Search in sources :

Example 11 with OServer

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

the class OCommandExecutorSQLHASyncCluster method execute.

/**
   * Execute the SYNC CLUSTER.
   */
public Object execute(final Map<Object, Object> iArgs) {
    final ODatabaseDocumentInternal database = getDatabase();
    database.checkSecurity(ORule.ResourceGeneric.CLUSTER, "sync", ORole.PERMISSION_UPDATE);
    final String dbUrl = database.getURL();
    final String path = dbUrl.substring(dbUrl.indexOf(":") + 1);
    final OServer serverInstance = OServer.getInstanceByPath(path);
    final OHazelcastPlugin dManager = (OHazelcastPlugin) serverInstance.getDistributedManager();
    if (dManager == null || !dManager.isEnabled())
        throw new OCommandExecutionException("OrientDB is not started in distributed mode");
    final String databaseName = database.getName();
    try {
        if (this.parsedStatement.modeFull) {
            return replaceCluster(dManager, database, serverInstance, databaseName, this.parsedStatement.clusterName.getStringValue());
        }
    // else {
    // int merged = 0;
    // return String.format("Merged %d records", merged);
    // }
    } catch (Exception e) {
        throw OException.wrapException(new OCommandExecutionException("Cannot execute synchronization of cluster"), e);
    }
    return "Mode not supported";
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OCommandExecutionException(com.orientechnologies.orient.core.exception.OCommandExecutionException) OHazelcastPlugin(com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal) OException(com.orientechnologies.common.exception.OException) OCommandSQLParsingException(com.orientechnologies.orient.core.sql.OCommandSQLParsingException) OCommandExecutionException(com.orientechnologies.orient.core.exception.OCommandExecutionException) IOException(java.io.IOException)

Example 12 with OServer

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

the class GraphNonBlockingQueryRemote method before.

@Before
public void before() throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, NoSuchMethodException, InstantiationException, IOException, IllegalAccessException {
    server = new OServer(false);
    server.startup(OrientGraphRemoteTest.class.getResourceAsStream("/embedded-server-config-single-run.xml"));
    server.activate();
    OServerAdmin admin = new OServerAdmin("remote:localhost:3064");
    admin.connect("root", "root");
    admin.createDatabase(GraphNonBlockingQueryRemote.class.getSimpleName(), "graph", "memory");
    admin.close();
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OrientGraphRemoteTest(com.tinkerpop.blueprints.impls.orient.OrientGraphRemoteTest) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Example 13 with OServer

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

the class EdgeBug method run.

public void run() throws Exception {
    OServer server = setupDatabase();
    try {
        setupClasses();
        populateDatabase();
        tryLabelQuery();
        runEdgeTest();
    } finally {
        server.shutdown();
    }
}
Also used : OServer(com.orientechnologies.orient.server.OServer)

Example 14 with OServer

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

the class EdgeBug method setupDatabase.

private OServer setupDatabase() throws Exception {
    OServer ret = new OServer(false);
    ret.startup("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<orient-server>" + "<network>" + "<protocols>" + "<protocol name=\"binary\" implementation=\"com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary\"/>" + "<protocol name=\"http\" implementation=\"com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb\"/>" + "</protocols>" + "<listeners>" + "<listener ip-address=\"0.0.0.0\" port-range=\"2424-2430\" protocol=\"binary\"/>" + "<listener ip-address=\"0.0.0.0\" port-range=\"2480-2490\" protocol=\"http\"/>" + "</listeners>" + "</network>" + "<users>" + "<user name=\"root\" password=\"root\" resources=\"*\"/>" + "</users>" + "<storages>" + "<storage path=\"memory:temp\" name=\"temp\" userName=\"admin\" userPassword=\"admin\" loaded-at-startup=\"true\" />" + "</storages>" + "<properties>" + "<entry name=\"orientdb.www.path\" value=\"/Users/curtis/orientdb-graphed-1.3.0/www/\"/>" + "<entry name=\"orientdb.config.file\" value=\"/Users/curtis/orientdb-graphed-1.3.0/config/orientdb-server-config.xml\"/>" + "<entry name=\"server.cache.staticResources\" value=\"false\"/>" + "<entry name=\"log.console.level\" value=\"info\"/>" + "<entry name=\"log.file.level\" value=\"info\"/>" + "</properties>" + "<isAfterFirstTime>true</isAfterFirstTime></orient-server>");
    return ret;
}
Also used : OServer(com.orientechnologies.orient.server.OServer)

Example 15 with OServer

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

the class OrientGraphRemoteTest method startEmbeddedServer.

@BeforeClass
public static void startEmbeddedServer() throws Exception {
    final String buildDirectory = System.getProperty("buildDirectory", ".");
    serverHome = buildDirectory + "/" + OrientGraphRemoteTest.class.getSimpleName();
    File file = new File(serverHome);
    deleteDirectory(file);
    file = new File(serverHome);
    Assert.assertTrue(file.mkdir());
    oldOrientDBHome = System.getProperty("ORIENTDB_HOME");
    System.setProperty("ORIENTDB_HOME", serverHome);
    server = new OServer(false);
    server.startup(OrientGraphRemoteTest.class.getResourceAsStream("/embedded-server-config.xml"));
    server.activate();
}
Also used : OServer(com.orientechnologies.orient.server.OServer)

Aggregations

OServer (com.orientechnologies.orient.server.OServer)25 Before (org.junit.Before)9 OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)8 OHazelcastPlugin (com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin)4 File (java.io.File)4 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)3 OCommandExecutionException (com.orientechnologies.orient.core.exception.OCommandExecutionException)3 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 BeforeClass (org.junit.BeforeClass)2 OException (com.orientechnologies.common.exception.OException)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 OrientGraphRemoteTest (com.tinkerpop.blueprints.impls.orient.OrientGraphRemoteTest)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1