Search in sources :

Example 1 with OServer

use of com.orientechnologies.orient.server.OServer in project wicket-orientdb by OrienteerBAP.

the class TestStandaloneOrientDBCompatibility method testOrientDbLifeCycle.

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);
}
Also used : OServer(com.orientechnologies.orient.server.OServer) ODatabaseDocument(com.orientechnologies.orient.core.db.document.ODatabaseDocument) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OPartitionedDatabasePoolFactory(com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory)

Example 2 with OServer

use of com.orientechnologies.orient.server.OServer in project wicket-orientdb by OrienteerBAP.

the class EmbeddOrientDbApplicationListener method onBeforeDestroyed.

@Override
public void onBeforeDestroyed(Application application) {
    OrientDbWebApplication app = (OrientDbWebApplication) application;
    OServer server = app.getServer();
    if (server != null)
        server.shutdown();
}
Also used : OServer(com.orientechnologies.orient.server.OServer)

Example 3 with OServer

use of com.orientechnologies.orient.server.OServer in project wicket-orientdb by OrienteerBAP.

the class EmbeddOrientDbApplicationListener method onAfterInitialized.

@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);
    }
}
Also used : OServer(com.orientechnologies.orient.server.OServer) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) WicketRuntimeException(org.apache.wicket.WicketRuntimeException)

Example 4 with OServer

use of com.orientechnologies.orient.server.OServer in project serverless by bluenimble.

the class PlaygroundPlugin method main.

public static void main(String[] args) throws Exception {
    OServer oServer = OServerMain.create();
    oServer.startup(new File("/repos/bluenimble/serverless/plugins/bluenimble-plugin-dev.playground/src/main/resources/orientdb-server-config.xml"));
    oServer.activate();
}
Also used : OServer(com.orientechnologies.orient.server.OServer) File(java.io.File)

Example 5 with OServer

use of com.orientechnologies.orient.server.OServer in project orientdb by orientechnologies.

the class BareBonesServer method start.

public void start(String configFileDir, String configFileName) {
    OLogManager.instance().info(this, "starting the database based on: " + configFileName);
    try {
        server = new OServer(false);
        server.startup(new File(configFileDir, configFileName));
        server.activate();
        if (server.getPluginByClass(OHazelcastPlugin.class) != null)
            server.getPluginByClass(OHazelcastPlugin.class).waitUntilNodeOnline();
    } catch (Exception e) {
        OLogManager.instance().error(this, "start", e);
    }
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OHazelcastPlugin(com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin) File(java.io.File)

Aggregations

OServer (com.orientechnologies.orient.server.OServer)34 OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)10 Before (org.junit.Before)10 File (java.io.File)5 OHazelcastPlugin (com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin)4 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)3 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)3 OCommandExecutionException (com.orientechnologies.orient.core.exception.OCommandExecutionException)3 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 BeforeClass (org.junit.BeforeClass)2 Test (org.junit.Test)2 OException (com.orientechnologies.common.exception.OException)1 OPartitionedDatabasePoolFactory (com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory)1 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)1 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)1 OCommandSQLParsingException (com.orientechnologies.orient.core.sql.OCommandSQLParsingException)1 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)1 OObjectDatabaseTx (com.orientechnologies.orient.object.db.OObjectDatabaseTx)1 ODistributedConfiguration (com.orientechnologies.orient.server.distributed.ODistributedConfiguration)1 OServerNetworkListener (com.orientechnologies.orient.server.network.OServerNetworkListener)1