• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OServerConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.orientechnologies.orient.server.config.OServerConfiguration的典型用法代码示例。如果您正苦于以下问题:Java OServerConfiguration类的具体用法?Java OServerConfiguration怎么用?Java OServerConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OServerConfiguration类属于com.orientechnologies.orient.server.config包,在下文中一共展示了OServerConfiguration类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startUp

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的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();
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:23,代码来源:EmbeddedOrientDBService.java


示例2: configureServer

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
private void configureServer() throws IOException {
  this.orientHome = Paths.get(managerOptions.getOrientHome()).toAbsolutePath();
  log.info(Orient.ORIENTDB_HOME + "=" + orientHome);
  this.orientServerConfig = orientHome.resolve(OServerConfiguration.DEFAULT_CONFIG_FILE);
  log.info("OrientDB server configuration: " + orientServerConfig);
  mayDefaultServer();

  System.setProperty("orient.home", orientHome.toString());
  System.setProperty(Orient.ORIENTDB_HOME, orientHome.toString());
}
 
开发者ID:cstamas,项目名称:vertx-orientdb,代码行数:11,代码来源:ManagerImpl.java


示例3: doStart

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
  // global startup
  Orient.instance().startup();

  // instance startup
  OServer server = new OServer();
  configureOrientMinimumLogLevel();
  server.setExtensionClassLoader(uberClassLoader);
  OServerConfiguration config = createConfiguration();
  server.startup(config);

  // remove Orient shutdown-hooks added during startup, we'll manage shutdown ourselves
  Orient.instance().removeShutdownHook();
  server.removeShutdownHook();

  // create default root user to avoid orientdb prompt on console
  server.addUser(OServerConfiguration.DEFAULT_ROOT_USER, null, "*");

  // Log global configuration
  if (log.isDebugEnabled()) {
    // dumpConfiguration() only accepts ancient stream api
    String encoding = StandardCharsets.UTF_8.name();
    ByteArrayOutputStream buff = new ByteArrayOutputStream();
    OGlobalConfiguration.dumpConfiguration(new PrintStream(buff, true, encoding));
    log.debug("Global configuration:\n{}", new String(buff.toByteArray(), encoding));
  }

  Orient.instance().addDbLifecycleListener(entityHook);

  server.activate();
  log.info("Activated");

  this.orientServer = server;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:36,代码来源:DatabaseServerImpl.java


示例4: createOServer

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的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


示例5: validateConfiguration

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
private OrientServerConfiguration validateConfiguration(final OrientServerConfiguration conf) {
    Preconditions.checkNotNull(conf, "Configuration object required");
    Preconditions.checkNotNull(conf.getConfig(), "Orient server configuration required");
    Preconditions.checkState(OrientConfigUtils.hasRootUser(conf.getConfig()),
            "User '%s' must be defined in configuration because otherwise orient will ask "
                    + "for user password on each application start.", OServerConfiguration.DEFAULT_ROOT_USER);
    return conf;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:9,代码来源:EmbeddedOrientServer.java


示例6: setConfig

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
/**
 * @param config configuration object defined in yaml configuration file
 */
public void setConfig(final OServerConfiguration config) {
    Preconditions.checkState(this.config == null,
            "Orient configuration already loaded from file '" + configFile
                    + "'. Use either xml file or direct yaml config, but not both.");
    this.config = config;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:10,代码来源:OrientServerConfiguration.java


示例7: parseXmlConfigFile

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
private OServerConfiguration parseXmlConfigFile(final String configFile) {
    logger.info("Loading orient configuration from file {}", configFile);
    final OServerConfigurationLoaderXml configurationLoader =
            new OServerConfigurationLoaderXml(OServerConfiguration.class, new File(configFile));
    try {
        return configurationLoader.load();
    } catch (IOException e) {
        throw new IllegalStateException("Failed to load configuration from file: " + configFile, e);
    }
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:11,代码来源:OrientServerConfiguration.java


示例8: embeddedServerProgrammatic

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
/**
 * Tests configuring the server w/o xml but configuring the JAXB objects directly.
 */
@Test
public void embeddedServerProgrammatic() throws Exception {
  File homeDir = util.createTempDir("orientdb-home").getCanonicalFile();
  System.setProperty("orient.home", homeDir.getPath());
  System.setProperty(Orient.ORIENTDB_HOME, homeDir.getPath());

  OServer server = new OServer();
  OServerConfiguration config = new OServerConfiguration();

  // Unsure what this is used for, its apparently assigned to xml location, but forcing it here
  config.location = "DYNAMIC-CONFIGURATION";

  File databaseDir = new File(homeDir, "db");
  config.properties = new OServerEntryConfiguration[] {
      new OServerEntryConfiguration("server.database.path", databaseDir.getPath())
  };

  config.handlers = Lists.newArrayList();

  config.hooks = Lists.newArrayList();

  config.network = new OServerNetworkConfiguration();
  config.network.protocols = Lists.newArrayList(
      new OServerNetworkProtocolConfiguration("binary", ONetworkProtocolBinary.class.getName())
  );

  OServerNetworkListenerConfiguration binaryListener = new OServerNetworkListenerConfiguration();
  binaryListener.ipAddress = "0.0.0.0";
  binaryListener.portRange = "2424-2430";
  binaryListener.protocol = "binary";
  binaryListener.socket = "default";

  config.network.listeners = Lists.newArrayList(
      binaryListener
  );

  config.storages = new OServerStorageConfiguration[] {};

  config.users = new OServerUserConfiguration[] {
      new OServerUserConfiguration("admin", "admin", "*")
  };

  config.security = new OServerSecurityConfiguration();
  config.security.users = Lists.newArrayList();
  config.security.resources = Lists.newArrayList();

  server.startup(config);

  // Dump config to log stream
  StringWriter buff = new StringWriter();
  OGlobalConfiguration.dumpConfiguration(new PrintStream(new WriterOutputStream(buff), true));
  log("Global configuration:\n{}", buff);

  server.activate();
  server.shutdown();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:60,代码来源:OrientDbEmbeddedTrial.java


示例9: createConfiguration

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
private OServerConfiguration createConfiguration() {
  File configDir = applicationDirectories.getConfigDirectory("fabric");

  // FIXME: Unsure what this directory is used for
  File orientDir = applicationDirectories.getWorkDirectory("orient");
  System.setProperty("orient.home", orientDir.getPath());
  System.setProperty(Orient.ORIENTDB_HOME, orientDir.getPath());

  OServerConfiguration config = new OServerConfiguration();

  // FIXME: Unsure what this is used for, its apparently assigned to xml location, but forcing it here
  config.location = "DYNAMIC-CONFIGURATION";

  File databaseDir = applicationDirectories.getWorkDirectory("db");
  File securityFile = new File(configDir, "orientdb-security.json");

  config.properties = new OServerEntryConfiguration[]{
      new OServerEntryConfiguration("server.database.path", databaseDir.getPath()),
      new OServerEntryConfiguration("server.security.file", securityFile.getPath()),
      new OServerEntryConfiguration("plugin.dynamic", String.valueOf(dynamicPlugins))
  };

  config.handlers = new ArrayList<>(injectedHandlers);
  config.hooks = new ArrayList<>();

  config.network = new OServerNetworkConfiguration();
  config.network.protocols = Lists.newArrayList(
      new OServerNetworkProtocolConfiguration("binary", ONetworkProtocolBinary.class.getName()),
      new OServerNetworkProtocolConfiguration("http", ONetworkProtocolHttpDb.class.getName())
  );

  config.network.listeners = new ArrayList<>();

  OServerNetworkListenerConfiguration binaryListener = null, httpListener = null;

  if (binaryListenerEnabled) {
    binaryListener = createBinaryListener(binaryPortRange);
    config.network.listeners.add(binaryListener);
  }

  if (httpListenerEnabled) {
    httpListener = createHttpListener(httpPortRange);
    config.network.listeners.add(httpListener);
  }

  config.storages = new OServerStorageConfiguration[]{};

  config.users = new OServerUserConfiguration[]{
      new OServerUserConfiguration("admin", "admin", "*")
  };

  config.security = new OServerSecurityConfiguration();
  config.security.users = new ArrayList<>();
  config.security.resources = new ArrayList<>();

  // latest advice is to disable DB compression as it doesn't buy much,
  // also snappy has issues with use of native lib (unpacked under tmp)
  OGlobalConfiguration.STORAGE_COMPRESSION_METHOD.setValue("nothing");
  
  // ensure we don't set a file lock, which can behave badly on NFS https://issues.sonatype.org/browse/NEXUS-11289
  OGlobalConfiguration.FILE_LOCK.setValue(false);

  // disable auto removal of servers, SharedHazelcastPlugin removes gracefully shutdown nodes but for crashes and
  // especially network partitions we don't want the write quorum getting lowered and endanger consistency 
  OGlobalConfiguration.DISTRIBUTED_AUTO_REMOVE_OFFLINE_SERVERS.setValue(-1);

  // Apply customizations to server configuration
  configCustomizers.forEach((it) -> it.apply(config));

  if (binaryListener != null) {
    log.info("Binary listener enabled: {}:[{}]", binaryListener.ipAddress, binaryListener.portRange);
  }

  if (httpListener != null) {
    log.info("HTTP listener enabled: {}:[{}]", httpListener.ipAddress, httpListener.portRange);
  }

  return config;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:80,代码来源:DatabaseServerImpl.java


示例10: registerHandlers

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
private void registerHandlers(final OServerConfiguration serverConfig) {
    if (CollectionUtils.isNotEmpty(config.getHandlers())) {
        serverConfig.handlers = config.getHandlers().stream().map(Supplier::get).collect(Collectors.toList());
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:6,代码来源:EmbeddedOrientDBService.java


示例11: EmbeddOrientDbApplicationListener

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
public EmbeddOrientDbApplicationListener(OServerConfiguration serverConfiguration)
{
	this.serverConfiguration = serverConfiguration;
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:5,代码来源:EmbeddOrientDbApplicationListener.java


示例12: AutoSslConfigurator

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
public AutoSslConfigurator(final ServerFactory dwServer, final OServerConfiguration conf) {
    this.dwServer = dwServer;
    this.conf = conf;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:5,代码来源:AutoSslConfigurator.java


示例13: getConfig

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
/**
 * @return orient server configuration object (from yaml config or external xml file)
 */
public OServerConfiguration getConfig() {
    return config;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:7,代码来源:OrientServerConfiguration.java


示例14: apply

import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
void apply(OServerConfiguration config); 
开发者ID:sonatype,项目名称:nexus-public,代码行数:2,代码来源:OrientConfigCustomizer.java



注:本文中的com.orientechnologies.orient.server.config.OServerConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VisibilityAnnotationTag类代码示例发布时间:2022-05-22
下一篇:
Java HTraceConfiguration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap