All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rebue.wheel.vertx.util.OracleUtils Maven / Gradle / Ivy

There is a newer version: 3.5.45
Show newest version
package rebue.wheel.vertx.util;

import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.oracleclient.OracleConnectOptions;
import io.vertx.oracleclient.OraclePool;
import io.vertx.sqlclient.Pool;
import io.vertx.sqlclient.PoolOptions;
import rebue.wheel.vertx.config.OracleConfig;

import java.util.Map.Entry;

public class OracleUtils {
    /**
     * 创建客户端
     */
    public static Pool createPool(final Vertx vertx, final JsonObject oracleConfig) {
        final JsonObject           config         = oracleConfig.getJsonObject(OracleConfig.CONNECT_PREFIX);
        final OracleConnectOptions connectOptions = config.mapTo(OracleConnectOptions.class);
        final JsonObject           properties     = config.getJsonObject("properties");
        if (properties != null && !properties.isEmpty()) {
            for (final Entry entry : properties) {
                connectOptions.addProperty(entry.getKey(), entry.getValue().toString());
            }
        }
        final PoolOptions poolOptions = oracleConfig.getJsonObject(OracleConfig.POOL_PREFIX).mapTo(PoolOptions.class);
        return OraclePool.pool(vertx, connectOptions, poolOptions.setShared(true));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy