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

Java OServerAdmin类代码示例

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

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



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

示例1: createDatabase

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
static void createDatabase(final OServerAdmin serverAdmin, final String database) {
    final Logger log = Logger.getLogger(OrientDBUtils.class.getName());
    try {
        if (!databaseExists(serverAdmin, database)) {
            serverAdmin.createDatabase(database, "document", "plocal");
            log.logp(INFO, OrientDBUtils.class.getName(), "createDatabase", String.format("created db : %s", database));
            serverAdmin.listDatabases().entrySet().forEach(entry -> log.info(String.format("%s -> %s", entry.getKey(), entry.getValue())));
        } else {
            log.logp(INFO, OrientDBUtils.class.getName(), "createDatabase", String.format("db already exists: %s", database));
        }
    } catch (final IOException e) {
        throw new RuntimeException(e);
    } finally {
        if (serverAdmin != null) {
            serverAdmin.close();
        }
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:19,代码来源:OrientDBUtils.java


示例2: getServerAdmin

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
@Override
public OServerAdmin getServerAdmin() {
    final String ipAddress = config.getNetworkConfig().listeners.stream()
            .filter(l -> l.protocol.equals(NETWORK_BINARY_PROTOCOL))
            .findFirst()
            .map(l -> l.ipAddress.equals("0.0.0.0") ? JvmProcess.HOST : l.ipAddress)
            .orElse(JvmProcess.HOST);

    try {
        final OServerAdmin serverAdmin = new OServerAdmin(String.format("remote:%s", ipAddress));
        final OServerUserConfiguration userConfig = server.getUser(ROOT_USER);
        serverAdmin.connect(userConfig.name, userConfig.password);
        return serverAdmin;
    } catch (final IOException ex) {
        throw new ApplicationException(ex);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:18,代码来源:EmbeddedOrientDBService.java


示例3: initDatabase

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private static void initDatabase() {
    Optional<OrientDBService> orientDBService = TypeSafeObjectRegistry.GLOBAL_OBJECT_REGISTRY.get(OrientDBService.ORIENTDB_SERVICE);
    while (!orientDBService.isPresent()) {
        log.log(Level.WARNING, "Waiting for OrientDBService ...");
        sleep(Duration.ofSeconds(2));
        orientDBService = TypeSafeObjectRegistry.GLOBAL_OBJECT_REGISTRY.get(OrientDBService.ORIENTDB_SERVICE);
    }

    final OServerAdmin admin = orientDBService.get().getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, EventLogRepository.DB);
    } catch (final Exception e) {
        e.printStackTrace();
    } finally {
        admin.close();
    }

    EventLogRepository.initDatabase(orientDBService.get().getODatabaseDocumentTxSupplier(EventLogRepository.DB).get().get());
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:20,代码来源:OrientDBVerticleTest.java


示例4: initDatabase

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }

    final Optional<ODatabaseDocumentTxSupplier> dbSupplier = service.getODatabaseDocumentTxSupplier(CLASS_NAME);
    assertThat(dbSupplier.isPresent(), is(true));

    try (final ODatabase db = dbSupplier.get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:21,代码来源:EmbeddedOrientDBServiceWithSSLTest.java


示例5: initDatabase

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }
    try (final ODatabase db = service.getODatabaseDocumentTxSupplier(CLASS_NAME).get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:17,代码来源:OrientDBHazelcastPluginTest.java


示例6: connect

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
@Override
public OrientConnection connect() throws IOException {
    final OServerAdmin oServerAdmin = new OServerAdmin(url.toString());

    oServerAdmin.connect(userName, password);
    try {
        if (oServerAdmin.existsDatabase())
            oServerAdmin.dropDatabase("plocal");

        oServerAdmin.createDatabase(url.getDbName(), "graph", "plocal");
    } finally {
        oServerAdmin.close();
    }

    final OrientGraphFactory graphFactory = new OrientGraphFactory(url.toString(), userName, password);
    graphFactory.setAutoStartTx(false);
    graphFactory.declareIntent(new OIntentMassiveInsert().setEnableCache(false));

    return new AbstractOrientConnection(graphFactory.getNoTx()) {
        @Override
        public void close() throws Exception {
            graph.commit();
            graph.getRawGraph().close();
        }
    };
}
 
开发者ID:gsson,项目名称:dependency-grapher,代码行数:27,代码来源:OrientDB.java


示例7: initObjectDatabaseTx

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private void initObjectDatabaseTx(String database)
{
    //        OPartitionedDatabasePoolFactory poolFactory = new OPartitionedDatabasePoolFactory(30);
    //        OPartitionedDatabasePool pool = poolFactory.get(dbUrl,  "admin", "admin");

    logger.info("db url : {}{}", dbUrl, database);

    if (dbUrl.startsWith("remote"))
    {
        OServerAdmin serverAdmin;

        try
        {
            serverAdmin = new OServerAdmin(dbUrl + database).connect("admin", "admin");
            if (!serverAdmin.existsDatabase())
            {
                serverAdmin.createDatabase(database, "object", "plocal");
            }
        }
        catch (IOException e)
        {
            logger.info(e);
        }
    }

    partitionedDatabasePool = new OPartitionedDatabasePool(dbUrl + database, "admin", "admin", 32, 10);
    partitionedDatabasePool.setAutoCreate(true);
}
 
开发者ID:geekflow,项目名称:light,代码行数:29,代码来源:RepositorySource.java


示例8: removeDatabaseIfExists

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private static void removeDatabaseIfExists(String dbName) throws IOException
{
	OServerAdmin admin;
	admin = new OServerAdmin("localhost/" + dbName).connect(
			Constants.DB_USERNAME, Constants.DB_PASSWORD);
	if (admin.existsDatabase())
	{
		admin.dropDatabase("plocal");
	}
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:11,代码来源:ProjectManager.java


示例9: doesDatabaseExist

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private boolean doesDatabaseExist(String dbName)
{
	try
	{
		return new OServerAdmin("localhost/" + dbName).connect(
				Constants.DB_USERNAME, Constants.DB_PASSWORD).existsDatabase();

	} catch (IOException e)
	{
		throw new RuntimeException("Error determining whether database exists");
	}
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:13,代码来源:OctopusProjectPlugin.java


示例10: databaseExists

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
static boolean databaseExists(final OServerAdmin serverAdmin, final String database) {
    try {
        return serverAdmin.listDatabases().containsKey(database);
    } catch (final IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:8,代码来源:OrientDBUtils.java


示例11: run

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
@Override
public void run(String iURL, File parentfolder, IConsole c) throws Exception {
	this.dbURL = iURL;

	final OServerAdmin admin = getServerAdmin();
	if (!admin.existsDatabase(storageType)) {
		admin.createDatabase(DBTYPE_DOC, storageType);
	}
	admin.close();

	super.run(iURL, parentfolder, c);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:13,代码来源:RemoteOrientDatabase.java


示例12: delete

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
@Override
public void delete() throws Exception {
	shutdown();

	final OServerAdmin admin = getServerAdmin();
	admin.dropDatabase(storageType);
	admin.close();
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:9,代码来源:RemoteOrientDatabase.java


示例13: getServerAdmin

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
protected OServerAdmin getServerAdmin() throws Exception {
	OServerAdmin admin = new OServerAdmin(dbURL);

	// TODO: add options for dbUsername/pw (and a specific remote: URL)
	admin.connect(rootUsername, rootPassword);

	return admin;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:9,代码来源:RemoteOrientDatabase.java


示例14: initialize

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * Initialize the OrientDB dataStore by {@link Properties} parameters.
 *
 * @param keyClass key class type for dataStore.
 * @param persistentClass persistent class type for dataStore.
 * @param properties OrientDB dataStore properties EG:- OrientDB client credentials.
 */
@Override
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) {
  super.initialize(keyClass, persistentClass, properties);
  try {
    orientDbStoreParams = OrientDBStoreParameters.load(properties);
    ROOT_URL = "remote:".concat(orientDbStoreParams.getServerHost()).concat(":")
            .concat(orientDbStoreParams.getServerPort());
    ROOT_DATABASE_URL = ROOT_URL.concat("/").concat(orientDbStoreParams.getDatabaseName());
    remoteServerAdmin = new OServerAdmin(ROOT_URL).connect(orientDbStoreParams.getUserName(),
            orientDbStoreParams.getUserPassword());
    if (!remoteServerAdmin.existsDatabase(orientDbStoreParams.getDatabaseName(), "memory")) {
      remoteServerAdmin.createDatabase(orientDbStoreParams.getDatabaseName(), "document", "memory");
    }

    if (orientDbStoreParams.getConnectionPoolSize() != null) {
      int connPoolSize = Integer.valueOf(orientDbStoreParams.getConnectionPoolSize());
      connectionPool = new OPartitionedDatabasePoolFactory(connPoolSize)
              .get(ROOT_DATABASE_URL, orientDbStoreParams.getUserName(),
                      orientDbStoreParams.getUserPassword());
    } else {
      connectionPool = new OPartitionedDatabasePoolFactory().get(ROOT_DATABASE_URL,
              orientDbStoreParams.getUserName(), orientDbStoreParams.getUserPassword());
    }

    OrientDBMappingBuilder<K, T> builder = new OrientDBMappingBuilder<>(this);
    orientDBMapping = builder.fromFile(orientDbStoreParams.getMappingFile()).build();

    if (!schemaExists()) {
      createSchema();
    }
  } catch (Exception e) {
    LOG.error("Error while initializing OrientDB dataStore: {}",
            new Object[]{e.getMessage()});
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:45,代码来源:OrientDBStore.java


示例15: databaseExists

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
private boolean databaseExists(String dbName) throws IOException
{
	return new OServerAdmin("localhost/" + dbName).connect(
			Constants.DB_USERNAME, Constants.DB_PASSWORD).existsDatabase();
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:6,代码来源:CSVBatchImporter.java


示例16: getServerAdmin

import com.orientechnologies.orient.client.remote.OServerAdmin; //导入依赖的package包/类
/**
 *
 * @return new instance is returned - it is the responsibility of the client to close the connection, i.e., via OServerAdmin.close(), when they are done
 * with it.
 */
OServerAdmin getServerAdmin();
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:7,代码来源:OrientDBService.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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