当前位置: 首页>>代码示例>>Java>>正文


Java ODatabaseDocumentTx.close方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.close方法的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentTx.close方法的具体用法?Java ODatabaseDocumentTx.close怎么用?Java ODatabaseDocumentTx.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx的用法示例。


在下文中一共展示了ODatabaseDocumentTx.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPreSetup

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
protected void doPreSetup() throws Exception {
       server = OServerMain.create();
       server.startup(getClass().getResourceAsStream("db.config.xml"));
       server.activate();

       ODatabaseDocumentTx db = new ODatabaseDocumentTx(DB_URL,false);
	db = db.create();
	db.command(new OCommandSQL("CREATE CLASS "+TEST_CLASS)).execute();
	db.command(new OCommandSQL("CREATE PROPERTY "+TEST_CLASS+"."+TEST_PROPERTY+" STRING")).execute();
	db.command(new OCommandSQL("CREATE PROPERTY "+TEST_CLASS+"."+TEST_LINK_PROPERTY+" LINK")).execute();
	db.command(new OCommandSQL("CREATE CLASS "+TEST_LINKED_CLASS)).execute();
	db.command(new OCommandSQL("CREATE PROPERTY "+TEST_LINKED_CLASS+"."+TEST_PROPERTY+" STRING")).execute();
	
	db.close();
       Thread.sleep(1000);
	super.doPreSetup();
}
 
开发者ID:OrienteerBAP,项目名称:camel-orientdb,代码行数:19,代码来源:OrientDBComponentTest.java

示例2: restoreGraph

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void restoreGraph(String backupFile) throws IOException {
	if (log.isDebugEnabled()) {
		log.debug("Running restore using {" + backupFile + "} backup file.");
	}
	ODatabaseDocumentTx db = factory.getDatabase();
	try {
		OCommandOutputListener listener = new OCommandOutputListener() {
			@Override
			public void onMessage(String iText) {
				System.out.println(iText);
			}
		};
		InputStream in = new FileInputStream(backupFile);
		db.restore(in, null, null, listener);
	} finally {
		db.close();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:20,代码来源:OrientDBDatabase.java

示例3: exportGraph

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void exportGraph(String outputDirectory) throws IOException {
	if (log.isDebugEnabled()) {
		log.debug("Running export to {" + outputDirectory + "} directory.");
	}
	ODatabaseDocumentTx db = factory.getDatabase();
	try {
		OCommandOutputListener listener = new OCommandOutputListener() {
			@Override
			public void onMessage(String iText) {
				System.out.println(iText);
			}
		};

		String dateString = formatter.format(new Date());
		String exportFile = "export_" + dateString;
		new File(outputDirectory).mkdirs();
		ODatabaseExport export = new ODatabaseExport(db, new File(outputDirectory, exportFile).getAbsolutePath(), listener);
		export.exportDatabase();
		export.close();
	} finally {
		db.close();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:25,代码来源:OrientDBDatabase.java

示例4: importGraph

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void importGraph(String importFile) throws IOException {
	ODatabaseDocumentTx db = factory.getDatabase();
	try {
		OCommandOutputListener listener = new OCommandOutputListener() {
			@Override
			public void onMessage(String iText) {
				System.out.println(iText);
			}
		};
		ODatabaseImport databaseImport = new ODatabaseImport(db, importFile, listener);
		databaseImport.importDatabase();
		databaseImport.close();
	} finally {
		db.close();
	}

}
 
开发者ID:gentics,项目名称:mesh,代码行数:19,代码来源:OrientDBDatabase.java

示例5: fix

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public static void fix(MeshOptions options) {
	File graphDir = new File(options.getStorageOptions().getDirectory(), "storage");
	if (graphDir.exists()) {
		log.info("Checking database {" + graphDir + "}");
		OrientGraphFactory factory = new OrientGraphFactory("plocal:" + graphDir.getAbsolutePath()).setupPool(5, 100);
		try {
			// Enable the patched security class
			factory.setProperty(ODatabase.OPTIONS.SECURITY.toString(), OSecuritySharedPatched.class);
			ODatabaseDocumentTx tx = factory.getDatabase();
			try {
				OClass userClass = tx.getMetadata().getSchema().getClass("OUser");
				if (userClass == null) {
					log.info("OrientDB user credentials not found. Recreating needed roles and users.");
					tx.getMetadata().getSecurity().create();
					tx.commit();
				} else {
					log.info("OrientDB user credentials found. Skipping fix.");
				}
			} finally {
				tx.close();
			}
		} finally {
			factory.close();
		}
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:27,代码来源:MissingOrientCredentialFixer.java

示例6: testOrientDBfinalize

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void testOrientDBfinalize() throws Exception {
    Thread.sleep(2000);
    
	ODatabaseDocumentTx db = new ODatabaseDocumentTx(DB_URL).open(DB_USERNAME, DB_PASSWORD);
	List<ODocument> dbResult = db.query(new OSQLSynchQuery<ODocument>("SELECT FROM "+TEST_CLASS));
	
	assertEquals((int)2, dbResult.size());
	assertNotNull(dbResult.get(1).field(TEST_LINK_PROPERTY));
	
    db.close();
    server.shutdown();
}
 
开发者ID:OrienteerBAP,项目名称:camel-orientdb,代码行数:14,代码来源:OrientDBComponentTest.java

示例7: run

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void run()
{
    ODatabaseDocumentTx tx = getDatabase("memory:Test", "admin", "admin");
    ODocument animal = tx.newInstance("Animal").field("name", "Gaudi").field("location", "Madrid");
    tx.save(animal);
    tx.close();
}
 
开发者ID:geekflow,项目名称:light,代码行数:9,代码来源:OtherTest.java

示例8: close

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
/**
 * close database
 *
 * @param database
 */
synchronized public void close(ODatabaseDocumentTx database) {
	if (logger.isDebugEnabled()) {
		logger.debug(String.format("close(database=%s) - start", database));
	}
    if (database != null && !database.isClosed()) {
        database.close();
    }
	if (logger.isDebugEnabled()) {
		logger.debug("close() - end");
	}
}
 
开发者ID:okinawaopenlabs,项目名称:of-patch-manager,代码行数:17,代码来源:ConnectionManager.java

示例9: destroyObject

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void destroyObject(PooledObject<ODatabaseDocumentTx> pooled) throws Exception {
	final ODatabaseDocumentTx db = pooled.getObject();
	allConns.remove(db);
	db.activateOnCurrentThread();
	db.close();
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:8,代码来源:OrientDatabase.java

示例10: shutdown

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private void shutdown(boolean delete) throws Exception {
	if (pool == null || pool.isClosed()) {
		return;
	}

	ODatabaseDocumentTx db = getGraphNoCreate();
	if (delete) {
		discardDirty();
	} else {
		saveDirty();
	}

	synchronized (allConns) {
		// Close all other connections
		for (ODatabaseDocumentTx conn : allConns) {
			if (conn != db) {
				pool.invalidateObject(conn);
			}
		}
		dbConn.get().activateOnCurrentThread();

		/*
		 * We want to completely close the database (e.g. so we can delete
		 * the directory later from the Hawk UI).
		 */
		final OStorage storage = db.getStorage();
		if (delete) {
			db.drop();
		} else {
			db.close();
		}
		storage.close(true, false);
		Orient.instance().unregisterStorage(storage);
		pool.invalidateObject(db);

		if (delete && storageFolder != null) {
			try {
				deleteRecursively(storageFolder);
			} catch (IOException e) {
				console.printerrln(e);
			}
		}

		pool.clear();
	}

	metamodelIndex = fileIndex = null;
	storageFolder = tempFolder = null;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:50,代码来源:OrientDatabase.java


注:本文中的com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。