@Override public OrientDBDocumentCollectionManager get(String database) { requireNonNull(database, "database is required"); orient.createIfNotExists(database, storageType); ODatabasePool pool = new ODatabasePool(orient, database, user, password); return new DefaultOrientDBDocumentCollectionManager(pool); }
@Override public OrientDBDocumentCollectionManagerAsync getAsync(String database) throws UnsupportedOperationException, NullPointerException { requireNonNull(database, "database is required"); orient.createIfNotExists(database, storageType); ODatabasePool pool = new ODatabasePool(orient, database, user, password); return new DefaultOrientDBDocumentCollectionManagerAsync(pool); }
@Override public void start(final String database) { this.database = database; pool = new ODatabasePool(orientDB.get(), database, userManager.getUser(), userManager.getPassword()); // check database connection pool.acquire().close(); logger.debug("Pool {} started for database '{}'", getType(), this.database); }
@Override public Connection getConnection(String username, String password) throws SQLException { if (orientDB == null) { Properties info = new Properties(this.info); info.put("user", username); info.put("password", password); final String serverUsername = info.getProperty("serverUser", ""); final String serverPassword = info.getProperty("serverPassword", ""); String orientDbUrl = dbUrl.replace("jdbc:orient:", ""); OURLConnection connUrl = OURLHelper.parseNew(orientDbUrl); OrientDBConfig settings = OrientDBConfig.builder() .addConfig(OGlobalConfiguration.DB_POOL_MIN, Integer.valueOf(info.getProperty("db.pool.min", "1"))) .addConfig(OGlobalConfiguration.DB_POOL_MAX, Integer.valueOf(info.getProperty("db.pool.max", "10"))) .build(); orientDB = new OrientDB(connUrl.getType() + ":" + connUrl.getPath(), serverUsername, serverPassword, settings); if (!serverUsername.isEmpty() && !serverPassword.isEmpty()) orientDB.createIfNotExists(connUrl.getDbName(), connUrl.getDbType().orElse(ODatabaseType.MEMORY)); pool = new ODatabasePool(orientDB, connUrl.getDbName(), username, password); } return new OrientJdbcConnection(pool.acquire(), orientDB, info); }
pool = new ODatabasePool(orient, dbCtx, dbUser, dbPassword); } else if ("plocal".equalsIgnoreCase(kind)) { orient.create(dbName, ODatabaseType.PLOCAL); pool = new ODatabasePool(orient, dbName, dbUser, dbPassword); } else { orient = new OrientDB("remote:" + dbCtx, serverUser, serverPassword, null); orient.create(dbName, ODatabaseType.PLOCAL); pool = new ODatabasePool(orient, dbName, dbUser, dbPassword);
public void reCreatePool() { close(); OrientDBConfig config = OrientDBConfig.defaultConfig(); config.getConfigurations().setValue(OGlobalConfiguration.DB_POOL_MAX, this.maxSize); this.pool = new ODatabasePool(this.orientdb, this.dbName, this.userName, this.password, config); }