本文整理汇总了Java中com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.exists方法的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentTx.exists方法的具体用法?Java ODatabaseDocumentTx.exists怎么用?Java ODatabaseDocumentTx.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
的用法示例。
在下文中一共展示了ODatabaseDocumentTx.exists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
};
}
示例2: ContentStore
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public ContentStore(final String type, String name) {
startupIfEnginesAreMissing();
db = new ODatabaseDocumentTx(type + ":" + name);
boolean exists = db.exists();
if (!exists) {
db.create();
}
db = ODatabaseDocumentPool.global().acquire(type + ":" + name, "admin", "admin");
ODatabaseRecordThreadLocal.INSTANCE.set(db);
if (!exists) {
updateSchema();
}
}
示例3: initDatabaseDocumentTx
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private void initDatabaseDocumentTx(String database)
{
ODatabaseDocumentTx documentTx = new ODatabaseDocumentTx(dbUrl + database);
if (!documentTx.exists())
{
documentTx.create();
}
}
示例4: 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);
}
示例5: init
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private static void init(String database)
{
ODatabaseDocumentTx documentTx = new ODatabaseDocumentTx(path + database);
if (!documentTx.exists())
{
documentTx.create();
//database.open(OrientBaseGraph.ADMIN, OrientBaseGraph.ADMIN);
}
// else
// {
// database.create();
// }
}
示例6: 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;
}
示例7: createEventLogRepository
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public boolean createEventLogRepository() {
final ODatabaseDocumentTx db = new ODatabaseDocumentTx(eventLogRepoDBUrl);
if (!db.exists()) {
db.create();
log.logp(INFO, getClass().getName(), "createEventLogRepository", String.format("created db = %s", eventLogRepoDBUrl));
return true;
} else {
return false;
}
}
示例8: 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;
}
示例9: exists
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
/**
* Returns <code>true</code> if the database exists, <code>false</code>
* otherwise.
*/
protected boolean exists(ODatabaseDocumentTx db) {
return db.exists();
}