本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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());
}
}
示例11: EmbeddOrientDbApplicationListener
import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
public EmbeddOrientDbApplicationListener(OServerConfiguration serverConfiguration)
{
this.serverConfiguration = serverConfiguration;
}
示例12: AutoSslConfigurator
import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
public AutoSslConfigurator(final ServerFactory dwServer, final OServerConfiguration conf) {
this.dwServer = dwServer;
this.conf = conf;
}
示例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;
}
示例14: apply
import com.orientechnologies.orient.server.config.OServerConfiguration; //导入依赖的package包/类
void apply(OServerConfiguration config);