com.orientechnologies.orient.server.OServerMain Java Examples

The following examples show how to use com.orientechnologies.orient.server.OServerMain. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseRemoteLuceneTest.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@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");
  }
}
 
Example #2
Source File: OctopusMain.java    From bjoern with GNU General Public License v3.0 5 votes vote down vote up
public void startOrientdb() throws java.lang.Exception
{
    System.setProperty("ORIENTDB_HOME",octopusHome + "/orientdb");
    System.setProperty("orientdb.www.path",octopusHome +"/orientdb/www");
    System.setProperty("orientdb.config.file", octopusHome + "/conf/orientdb-server-config.xml");

    server = OServerMain.create();
    server.startup();
    server.activate();
}
 
Example #3
Source File: StorageEngine.java    From rtc2jira with GNU General Public License v2.0 5 votes vote down vote up
public StorageEngine() throws Exception {
  server = OServerMain.create();
  server.startup(Thread.currentThread().getContextClassLoader().getResourceAsStream("orientconf.xml"));
  server.activate();
  attachmentStorage = new AttachmentStorage();
  url = "plocal:./databases/rtc2jira";
}
 
Example #4
Source File: EmbeddOrientDbApplicationListener.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
public void onAfterInitialized(Application application) {
	try {
		OrientDbWebApplication app = (OrientDbWebApplication)application;
		OServer server = OServerMain.create(false);
		if(url!=null)
		{
			server.startup(url.openStream());
		}
		else if(configFile!=null)
		{
			server.startup(configFile);
		}
		else if(config!=null)
		{
			server.startup(config);
		}
		else if(serverConfiguration!=null)
		{
			server.startup(serverConfiguration);
		}
		else
		{
			server.startup();
		}
		server.activate();
		server.removeShutdownHook();
		app.setServer(server);
		app.getOrientDbSettings().setDatabasePoolFactory(server.getDatabasePoolFactory());
		onAfterServerStartupAndActivation(app);
	} catch (Exception e) {
		throw new WicketRuntimeException("Can't start OrientDB Embedded Server", e);
	}
}
 
Example #5
Source File: TestStandaloneOrientDBCompatibility.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@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();
	}
}
 
Example #6
Source File: TestStandaloneOrientDBCompatibility.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
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)
		{
			@SuppressWarnings("resource")
			ODatabaseDocument dbToDrop = new ODatabaseDocumentTx(dbURL);
			dbToDrop.open("admin", "admin");
			dbToDrop.drop();
		}
		server.shutdown();
		Orient.instance().shutdown();
//		Thread.sleep(50);
	}