本文整理汇总了Java中com.orientechnologies.orient.server.OServerMain类的典型用法代码示例。如果您正苦于以下问题:Java OServerMain类的具体用法?Java OServerMain怎么用?Java OServerMain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OServerMain类属于com.orientechnologies.orient.server包,在下文中一共展示了OServerMain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPreSetup
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
@Override
protected void doPreSetup() throws Exception {
server = OServerMain.create();
server.startup(getClass().getResourceAsStream("db.config.xml"));
server.activate();
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DB_URL,false);
db = db.create();
db.command(new OCommandSQL("CREATE CLASS "+TEST_CLASS)).execute();
db.command(new OCommandSQL("CREATE PROPERTY "+TEST_CLASS+"."+TEST_PROPERTY+" STRING")).execute();
db.command(new OCommandSQL("CREATE PROPERTY "+TEST_CLASS+"."+TEST_LINK_PROPERTY+" LINK")).execute();
db.command(new OCommandSQL("CREATE CLASS "+TEST_LINKED_CLASS)).execute();
db.command(new OCommandSQL("CREATE PROPERTY "+TEST_LINKED_CLASS+"."+TEST_PROPERTY+" STRING")).execute();
db.close();
Thread.sleep(1000);
super.doPreSetup();
}
示例2: startUp
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
@Override
protected void startUp() throws Exception {
registerLifecycleListeners();
server = OServerMain.create(true);
server.setServerRootDirectory(config.getOrientDBRootDir().toAbsolutePath().toString());
final OServerConfiguration serverConfig = new OServerConfiguration();
registerHandlers(serverConfig);
serverConfig.network = config.getNetworkConfig();
serverConfig.users = config.getUsers().stream().toArray(OServerUserConfiguration[]::new);
final ImmutableList.Builder<OServerEntryConfiguration> propertiesBuilder = ImmutableList.builder();
config.getProperties().entrySet().stream()
.map(entry -> new OServerEntryConfiguration(entry.getKey().getKey(), entry.getValue()))
.forEach(propertiesBuilder::add);
serverConfig.properties = propertiesBuilder.build().stream().toArray(OServerEntryConfiguration[]::new);
server.startup(serverConfig);
server.activate();
registerDatabaseLifeCycleListeners();
createDatabasePools();
}
示例3: initDB
import com.orientechnologies.orient.server.OServerMain; //导入依赖的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");
}
}
示例4: doGet
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
throws ServletException, IOException {
final String path = req.getContextPath() + req.getServletPath();
resp.setStatus(HttpServletResponse.SC_OK);
resp.setHeader("Cache-Control", "must-revalidate,no-cache,no-store");
resp.setContentType("text/html");
try (PrintWriter writer = resp.getWriter()) {
final OContextConfiguration config = OServerMain.server().getContextConfiguration();
writer.println(MessageFormat.format(TEMPLATE,
OConstants.ORIENT_VERSION,
renderPorts(info.binaryPorts),
renderPorts(info.httpPorts),
info.studioInstalled,
renderPlugins(config),
config.getValueAsString(CONF_DYNAMIC_PLUGIN, null),
config.getValueAsString(CONF_PLUGIN_RELOAD, null),
config.getValueAsString(CONF_PROFILER, null),
renderLinks(path)));
}
}
示例5: renderPlugins
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
private String renderPlugins(final OContextConfiguration config) {
final String pluginsEnabled = config.getValueAsString(CONF_DYNAMIC_PLUGIN, null);
final StringBuilder installedPlugins = new StringBuilder();
if (pluginsEnabled != null) {
final Collection<OServerPluginInfo> plugins = OServerMain.server().getPlugins();
if (!plugins.isEmpty()) {
installedPlugins.append("<ul>");
for (OServerPluginInfo plugin : plugins) {
installedPlugins.append(String.format("<li>%s</li>",
plugin.getName()));
}
installedPlugins.append("</ul>");
} else {
installedPlugins.append("none");
}
}
return installedPlugins.toString();
}
示例6: start
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void start() throws Exception {
System.setProperty("ORIENTDB_HOME", conf.getFilesPath());
System.setProperty("orientdb.www.path", "");
prepareSecurityConfig();
if (conf.isAutoSsl()) {
new AutoSslConfigurator(dwServer, conf.getConfig()).configure();
}
OrientConfigUtils.checkLocalFilesInSslSockets(conf.getConfig());
final OServer server = OServerMain.create();
server.startup(conf.getConfig()).activate();
installStudio(analyzeServerConfig(server));
logger.info("Orient server started");
}
示例7: init
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
public void init()
{
setOrientDbHome();
try
{
server = OServerMain.create();
}
catch (Exception exception)
{
logger.info(exception);
}
}
示例8: start
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
/**
* for the web studio to work you'll need:
* 1) set databaseBaseDir to point to the orientdb dir or to where the databases and www dirs are
* 2) unpack the ${databaseBaseDir}/plugins/studio-x.x.zip/www as ${databaseBaseDir}/www/studio
*/
public void start() throws Exception {
server = OServerMain.create();
FileTemplate template = new FileTemplate(new FileDocument(config.getConfigAsString(ConfigKey.databaseConfigFileName)));
server.startup(template.transform(config.asMap()));
server.activate();
}
示例9: contextInitialized
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent servletContextEvent)
{
try
{
server = OServerMain.create();
server = server.startup(OrientDBServletContextListener.class.getClassLoader().getResourceAsStream("db.config.xml"));
server.activate();
} catch (Exception e)
{
throw new RuntimeException(e);
}
}
示例10: startServer
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
/**
* Start the OrientDB studio server by extracting the studio plugin zipfile.
*
* @throws Exception
*/
@Override
public void startServer() throws Exception {
ClusterOptions clusterOptions = options.getClusterOptions();
boolean isClusteringEnabled = clusterOptions != null && clusterOptions.isEnabled();
String orientdbHome = new File("").getAbsolutePath();
System.setProperty("ORIENTDB_HOME", orientdbHome);
if (server == null) {
server = OServerMain.create();
updateOrientDBPlugin();
}
if (clusterOptions != null && clusterOptions.isEnabled()) {
// This setting will be referenced by the hazelcast configuration
System.setProperty("mesh.clusterName", clusterOptions.getClusterName() + "@" + Mesh.getPlainVersion());
}
log.info("Starting OrientDB Server");
server.startup(getOrientServerConfig());
OServerPluginManager manager = new OServerPluginManager();
manager.config(server);
server.activate();
if (isClusteringEnabled) {
ODistributedServerManager distributedManager = server.getDistributedManager();
topologyEventBridge = new TopologyEventBridge(this);
distributedManager.registerLifecycleListener(topologyEventBridge);
if (server.getDistributedManager() instanceof OHazelcastPlugin) {
hazelcastPlugin = (OHazelcastPlugin) distributedManager;
}
}
manager.startup();
if (isClusteringEnabled) {
// The registerLifecycleListener may not have been invoked. We need to redirect the online event manually.
postStartupDBEventHandling();
}
}
示例11: startOrientdb
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
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();
}
示例12: StorageEngine
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
public StorageEngine() throws Exception {
server = OServerMain.create();
server.startup(Thread.currentThread().getContextClassLoader().getResourceAsStream("orientconf.xml"));
server.activate();
attachmentStorage = new AttachmentStorage();
url = "plocal:./databases/rtc2jira";
}
示例13: createOServer
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
private static OServer createOServer() throws Exception {
registerLifeCycleListener();
server = OServerMain.create(true);
server.setServerRootDirectory(orientdbHome.getAbsolutePath());
final OServerConfiguration config = new OServerConfiguration();
config.handlers = ImmutableList.<OServerHandlerConfiguration>builder()
.add(oGraphServerHandler())
.add(oHazelcastPlugin())
.add(oServerSideScriptInterpreter())
.build();
config.network = new OServerNetworkConfiguration();
config.network.protocols = ImmutableList.<OServerNetworkProtocolConfiguration>builder()
.add(new OServerNetworkProtocolConfiguration("binary", ONetworkProtocolBinary.class.getName()))
.build();
final OServerNetworkListenerConfiguration binaryListener = new OServerNetworkListenerConfiguration();
binaryListener.ipAddress = "0.0.0.0";
binaryListener.protocol = "binary";
binaryListener.portRange = "2424-2430";
binaryListener.socket = "default";
config.network.listeners = ImmutableList.<OServerNetworkListenerConfiguration>builder()
.add(binaryListener)
.build();
config.users = new OServerUserConfiguration[]{
new OServerUserConfiguration(ROOT_USER, "root", "*")
};
config.properties = new OServerEntryConfiguration[]{
new OServerEntryConfiguration("db.pool.min", "1"),
new OServerEntryConfiguration("db.pool.max", "50")
};
server.startup(config);
return server;
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:38,代码来源:RunRightFastOrientDBLifeCycleListenerTest.java
示例14: onAfterInitialized
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
@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);
}
}
示例15: startServer
import com.orientechnologies.orient.server.OServerMain; //导入依赖的package包/类
private OServer startServer() throws Exception
{
OServer server = OServerMain.create();
// server.startup();
server.startup(OrientDbTestWebApplication.class.getResource("db.config.xml").openStream());
server.activate();
return server;
}