本文整理汇总了Java中com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open方法的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentTx.open方法的具体用法?Java ODatabaseDocumentTx.open怎么用?Java ODatabaseDocumentTx.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
的用法示例。
在下文中一共展示了ODatabaseDocumentTx.open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeActive
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public void makeActive() {
makeActiveDb();
if (this.connectionFailed) {
this.connectionFailed = false;
try {
if (this.pool != null) {
this.pool.reCreatePool();
this.database = this.pool.acquire();
} else {
ODatabaseDocumentTx replaceDb = new ODatabaseDocumentTx(this.database.getURL());
replaceDb.open(user, password);
this.database = replaceDb;
}
makeActiveDb();
} catch (OException e) {
OLogManager.instance().info(this, "Recreation of connection resulted in exception", e);
}
}
}
示例2: connect
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public OrientConnection connect() throws Exception {
final OrientGraphFactory graphFactory = new OrientGraphFactory(url.toString(), userName, password);
final ODatabaseDocumentTx database = graphFactory.getDatabase(false, false);
if (database.exists()) {
database.open(userName, password);
database.drop();
}
graphFactory.setAutoStartTx(false);
graphFactory.declareIntent(new OIntentMassiveInsert().setEnableCache(false));
return new AbstractOrientConnection(graphFactory.getNoTx()) {
@Override
public void close() throws Exception {
graph.commit();
graph.getRawGraph().close();
}
};
}
示例3: getDatabase
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private ODatabaseDocumentTx getDatabase(String url, String userName, String password)
{
ODatabaseDocumentTx tx = new ODatabaseDocumentTx(url);
if (!tx.exists())
{
tx.create();
return tx;
}
return tx.open(userName, password);
}
示例4: connect
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public ODatabaseDocumentTx connect(final String name, final boolean create) {
checkNotNull(name);
ensureStarted();
String uri = connectionUri(name);
ODatabaseDocumentTx db = new ODatabaseDocumentTx(uri);
if (db.exists()) {
db.open(SYSTEM_USER, SYSTEM_PASSWORD);
log.debug("Opened database: {} -> {}", name, db);
}
else {
if (create) {
db.create();
log.debug("Created database: {} -> {}", name, db);
// invoke created callback
try {
created(db, name);
}
catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
else {
log.debug("Database does not exist: {}", name);
}
}
return db;
}
示例5: getDatabase
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
/**
* @param create
* if true automatically creates database if database with given
* URL does not exist
* @param open
* if true automatically opens the database
*/
protected ODatabaseDocumentTx getDatabase(boolean create, boolean open) {
final ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
if (!db.getURL().startsWith("remote:") && !db.exists()) {
if (create)
db.create();
else if (open) throw new ODatabaseException("Database '" + url + "' not found");
} else if (open) db.open(user, password);
return db;
}
示例6: create
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public ODatabaseDocumentTx create() throws Exception {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbURL);
if (exists(db)) {
db.open("admin", "admin");
}
db.declareIntent(currentMode == Mode.NO_TX_MODE ? new OIntentMassiveInsert() : new OIntentMassiveRead());
allConns.add(db);
return db;
}
示例7: TestOrientDBAppender
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public TestOrientDBAppender(){
PropertyConfigurator.configure(LOG4J_PROPS);
appender=(OrientDBAppender) log.getRootLogger().getAppender("OrientDB");
database = new ODatabaseDocumentTx("remote:" + DB_HOSTNAME + ":" + DB_PORT + "/" + DB_DATABASE_NAME);
database.open(DB_USER_NAME, DB_PASSWORD);
ODatabaseRecordThreadLocal.INSTANCE.set(database);
}