EmbeddedOServer.java revision cf3ded7a02a85e9a249254ba37c8bc82d31b831a
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright © 2011 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
//import com.orientechnologies.orient.core.config.OEntryConfiguration;
// TODO: Work with the OrientDB team so the workaround of extending is not necessary anymore
// and configuration can be provided externally
/**
* Embedded OrientDB Server Workaround
*/
public class EmbeddedOServer extends OServer {
private static Thread serverThread;
public EmbeddedOServer() throws ClassNotFoundException, MalformedObjectNameException, NullPointerException,
super();
}
protected void loadConfiguration() {
configuration = new OServerConfiguration();
handler.clazz = "com.orientechnologies.orient.server.handler.distributed.ODistributedServerManager";
};
protocol1.implementation = "com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary";
protocol2.implementation = "com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb";
protocol3.implementation = "com.orientechnologies.orient.server.network.protocol.distributed.ONetworkProtocolDistributed";
command1.implementation = "com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostAction";
};
storage1.loadOnStartup = true;
storage2.loadOnStartup = true;
};
new OServerUserConfiguration("root", "3358BE3413F53E0D3DDA03C95C0A3F8357D0D160F8186EDA0C191CE9A4FA271B", "*")
};
};
//loadStorages();
//loadUsers();
}
public static void startEmbedded() {
try {
serverThread = new Thread() {
public void run() {
try {
// TODO: work with OrientDB team to also address the following
// If embedded server affects logging configuration work with OrientDB team
// Server also needs this property, work with OrientDB team if they can remove this
server = new EmbeddedOServer();
// can't "just" start OServer as some code uses OServerMain.server()
// Hack until the OrientDB team fixes that.
serverField.setAccessible(true);
}
}
};
}
}
public static void stopEmbedded() {
}
}
}