Search in sources :

Example 1 with MongoDBIndexingConfigBuilder

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder in project incubator-rya by apache.

the class MongoRyaDirectExample method getConf.

private static Configuration getConf() throws IOException {
    MongoDBIndexingConfigBuilder builder = MongoIndexingConfiguration.builder().setUseMockMongo(USE_MOCK).setUseInference(USE_INFER).setAuths("U");
    if (USE_MOCK) {
        final EmbeddedMongoFactory factory = EmbeddedMongoFactory.newFactory();
        final IMongoConfig connectionConfig = factory.getMongoServerDetails();
        final Net net = connectionConfig.net();
        builder.setMongoHost(net.getBindIp() == null ? "127.0.0.1" : net.getBindIp()).setMongoPort(net.getPort() + "");
    } else {
        // User name and password must be filled in:
        builder = builder.setMongoUser(MONGO_USER).setMongoPassword(MONGO_PASSWORD).setMongoHost(MONGO_INSTANCE_URL).setMongoPort(MONGO_INSTANCE_PORT);
    }
    return builder.setMongoDBName(MONGO_DB).setMongoCollectionPrefix(MONGO_COLL_PREFIX).setUseMongoFreetextIndex(true).setMongoFreeTextPredicates(RDFS.LABEL.stringValue()).build();
}
Also used : MongoDBIndexingConfigBuilder(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder) EmbeddedMongoFactory(org.apache.rya.mongodb.EmbeddedMongoFactory) Net(de.flapdoodle.embed.mongo.config.Net) IMongoConfig(de.flapdoodle.embed.mongo.config.IMongoConfig)

Example 2 with MongoDBIndexingConfigBuilder

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder in project incubator-rya by apache.

the class InferenceExamples method getConf.

private static Configuration getConf() throws IOException {
    // MongoDBIndexingConfigBuilder builder = MongoIndexingConfiguration.builder()
    // .setUseMockMongo(USE_MOCK).setUseInference(USE_INFER).setAuths("U");
    MongoDBIndexingConfigBuilder builder = MongoIndexingConfiguration.builder().setUseMockMongo(USE_EMBEDDED_MONGO).setUseInference(true).setAuths("U");
    if (USE_EMBEDDED_MONGO) {
        final MongoClient c = EmbeddedMongoFactory.newFactory().newMongoClient();
        final ServerAddress address = c.getAddress();
        final String url = address.getHost();
        final String port = Integer.toString(address.getPort());
        c.close();
        builder.setMongoHost(url).setMongoPort(port);
    } else {
        // User name and password must be filled in:
        builder = builder.setMongoUser(MongoUserName).setMongoPassword(MongoUserPswd).setMongoHost(MONGO_INSTANCE_URL).setMongoPort(MONGO_INSTANCE_PORT);
    }
    return builder.setMongoDBName(MONGO_DB).setMongoCollectionPrefix(MONGO_COLL_PREFIX).setUseMongoFreetextIndex(true).setMongoFreeTextPredicates(RDFS.LABEL.stringValue()).build();
}
Also used : MongoDBIndexingConfigBuilder(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder) MongoClient(com.mongodb.MongoClient) ServerAddress(com.mongodb.ServerAddress)

Example 3 with MongoDBIndexingConfigBuilder

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder in project incubator-rya by apache.

the class RyaMongoGeoDirectExample method getConf.

private static Configuration getConf() throws IOException {
    MongoDBIndexingConfigBuilder builder = MongoIndexingConfiguration.builder().setUseMockMongo(USE_MOCK).setUseInference(USE_INFER).setAuths("U");
    if (USE_MOCK) {
        mock = EmbeddedMongoFactory.newFactory();
        MongoClient c = mock.newMongoClient();
        ServerAddress address = c.getAddress();
        String url = address.getHost();
        String port = Integer.toString(address.getPort());
        c.close();
        builder.setMongoHost(url).setMongoPort(port);
    } else {
        // User name and password must be filled in:
        builder = builder.setMongoUser("fill this in").setMongoPassword("fill this in").setMongoHost(MONGO_INSTANCE_URL).setMongoPort(MONGO_INSTANCE_PORT);
    }
    return builder.setMongoDBName(MONGO_DB).setMongoCollectionPrefix(MONGO_COLL_PREFIX).setUseMongoFreetextIndex(true).setMongoFreeTextPredicates(RDFS.LABEL.stringValue()).build();
}
Also used : MongoDBIndexingConfigBuilder(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder) MongoClient(com.mongodb.MongoClient) ServerAddress(com.mongodb.ServerAddress)

Example 4 with MongoDBIndexingConfigBuilder

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder in project incubator-rya by apache.

the class MongoSpinIT method getConf.

private static MongoDBRdfConfiguration getConf() throws Exception {
    MongoDBIndexingConfigBuilder builder = MongoIndexingConfiguration.builder().setUseMockMongo(true);
    final MongoClient c = EmbeddedMongoFactory.newFactory().newMongoClient();
    final ServerAddress address = c.getAddress();
    builder.setMongoHost(address.getHost());
    builder.setMongoPort(Integer.toString(address.getPort()));
    builder.setUseInference(false);
    c.close();
    return builder.build();
}
Also used : MongoDBIndexingConfigBuilder(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder) MongoClient(com.mongodb.MongoClient) ServerAddress(com.mongodb.ServerAddress)

Aggregations

MongoDBIndexingConfigBuilder (org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder)4 MongoClient (com.mongodb.MongoClient)3 ServerAddress (com.mongodb.ServerAddress)3 IMongoConfig (de.flapdoodle.embed.mongo.config.IMongoConfig)1 Net (de.flapdoodle.embed.mongo.config.Net)1 EmbeddedMongoFactory (org.apache.rya.mongodb.EmbeddedMongoFactory)1