本文整理汇总了Java中com.orientechnologies.orient.core.Orient类的典型用法代码示例。如果您正苦于以下问题:Java Orient类的具体用法?Java Orient怎么用?Java Orient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Orient类属于com.orientechnologies.orient.core包,在下文中一共展示了Orient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
entityHook = new EntityHook(eventManager);
Orient.instance().addDbLifecycleListener(entityHook);
CapabilityStorageItemEntityAdapter entityAdapter = new CapabilityStorageItemEntityAdapter();
entityAdapter.enableObfuscation(new HexRecordIdObfuscator());
entityAdapter.enableEntityHook(entityHook);
this.underTest = new OrientCapabilityStorage(
database.getInstanceProvider(),
entityAdapter
);
underTest.start();
}
示例2: initDB
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Test(enabled = false)
public void initDB() {
try {
server = OServerMain.create();
server.startup(ClassLoader.getSystemResourceAsStream("orientdb-server-config.xml"));
server.activate();
} catch (Exception e) {
e.printStackTrace();
}
databaseDocumentTx = new ODatabaseDocumentTx(url);
if (!databaseDocumentTx.exists()) {
databaseDocumentTx = Orient.instance().getDatabaseFactory().createDatabase("graph", url);
databaseDocumentTx.create();
} else {
databaseDocumentTx.open("admin", "admin");
}
}
示例3: startupIfEnginesAreMissing
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
private void startupIfEnginesAreMissing() {
// If an instance of Orient was previously shutdown all engines are removed.
// We need to startup Orient again.
if ( Orient.instance().getEngines().size() == 0 ) {
Orient.instance().startup();
}
}
示例4: setup
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
protected void setup() throws MojoExecutionException {
if (oven != null) {
return;
}
try {
Orient.instance().startup();
this.oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), clearCache);
oven.setupPaths();
} catch (Throwable ex) {
destroy();
throw new MojoExecutionException("Failure when running: ", ex);
}
}
示例5: destroy
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
protected void destroy() {
oven = null;
try {
Orient.instance().shutdown();
} catch (Exception e) {
getLog().warn("Error on shutdown", e);
}
}
示例6: setOrientDbHome
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
private void setOrientDbHome()
{
if (ORIENTDB_HOME.length() == 0)
{
System.setProperty(Orient.ORIENTDB_HOME, createOrientDbHome());
logger.info("{} ORIENTDB_HOME : {}", Product.NAME.toUpperCase(), System.getProperty(Orient.ORIENTDB_HOME));
}
}
示例7: startup
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Override
public void startup() {
if (!enabled)
return;
Orient.instance().addDbLifecycleListener(this);
final OServerNetworkListener listener = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if (listener == null)
throw new OConfigurationException("HTTP listener not found");
listener.registerStatelessCommand(new OServerCommandESSync(this));
}
示例8: closeManager
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
private void closeManager() {
synchronized (databaseInfos) {
databaseInfos.values().forEach(DatabaseInfo::close);
databaseInfos.clear();
}
// global shutdown
Orient.instance().shutdown();
}
示例9: openManager
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
private void openManager() throws IOException {
if (orientServer != null) {
// server is running, obey server managerOptions
this.databasesDir = Paths.get(orientServer.getDatabaseDirectory());
}
else {
// just embedded, obey our managerOptions
Path orientHome = Paths.get(managerOptions.getOrientHome()).toAbsolutePath();
this.databasesDir = orientHome.resolve("databases");
}
// global startup
Orient.instance().startup();
Orient.instance().removeShutdownHook();
}
示例10: configureServer
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
private void configureServer() throws IOException {
this.orientHome = Paths.get(managerOptions.getOrientHome()).toAbsolutePath();
log.info(Orient.ORIENTDB_HOME + "=" + orientHome);
this.orientServerConfig = orientHome.resolve(OServerConfiguration.DEFAULT_CONFIG_FILE);
log.info("OrientDB server configuration: " + orientServerConfig);
mayDefaultServer();
System.setProperty("orient.home", orientHome.toString());
System.setProperty(Orient.ORIENTDB_HOME, orientHome.toString());
}
示例11: stop
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Override
public void stop() {
factory.close();
Orient.instance().shutdown();
if (server != null) {
server.shutdown();
}
Tx.setActive(null);
}
示例12: doStart
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
// global startup
Orient.instance().startup();
// instance startup
OServer server = new OServer();
configureOrientMinimumLogLevel();
server.setExtensionClassLoader(uberClassLoader);
OServerConfiguration config = createConfiguration();
server.startup(config);
// remove Orient shutdown-hooks added during startup, we'll manage shutdown ourselves
Orient.instance().removeShutdownHook();
server.removeShutdownHook();
// create default root user to avoid orientdb prompt on console
server.addUser(OServerConfiguration.DEFAULT_ROOT_USER, null, "*");
// Log global configuration
if (log.isDebugEnabled()) {
// dumpConfiguration() only accepts ancient stream api
String encoding = StandardCharsets.UTF_8.name();
ByteArrayOutputStream buff = new ByteArrayOutputStream();
OGlobalConfiguration.dumpConfiguration(new PrintStream(buff, true, encoding));
log.debug("Global configuration:\n{}", new String(buff.toByteArray(), encoding));
}
Orient.instance().addDbLifecycleListener(entityHook);
server.activate();
log.info("Activated");
this.orientServer = server;
}
示例13: doStop
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Override
protected void doStop() throws Exception {
// instance shutdown
orientServer.shutdown();
orientServer = null;
// global shutdown
Orient.instance().shutdown();
log.info("Shutdown");
}
示例14: testMemoryDBShouldDisapear
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
@Test(expected=OStorageException.class)
@Ignore
public void testMemoryDBShouldDisapear() throws Exception
{
try
{
testOrientDbLifeCycle(MEMORY_DB_NAME, true, false);
testOrientDbLifeCycle(MEMORY_DB_NAME, false, true);
} finally
{
OServer server = OServerMain.server();
if(server!=null) server.shutdown();
Orient.instance().shutdown();
}
}
示例15: testOrientDbLifeCycle
import com.orientechnologies.orient.core.Orient; //导入依赖的package包/类
public void testOrientDbLifeCycle(String dbURL, boolean createDb, boolean dropDb) throws Exception
{
Orient.instance().startup();
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
Orient.instance().removeShutdownHook();
OServer server = OServerMain.create();
server.startup(OrientDbTestWebApplication.class.getResource("db.config.xml").openStream());
server.activate();
if(createDb)
{
ODatabaseDocument dbToCreate = new ODatabaseDocumentTx(dbURL);
if(!dbToCreate.exists()) dbToCreate.create();
dbToCreate.close();
}
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
ODatabaseDocument db = new OPartitionedDatabasePoolFactory().get(dbURL, "admin", "admin").acquire();
db.close();
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
if(dropDb)
{
ODatabaseDocument dbToDrop = new ODatabaseDocumentTx(dbURL);
dbToDrop.open("admin", "admin");
dbToDrop.drop();
}
server.shutdown();
Orient.instance().shutdown();
// Thread.sleep(50);
}