Examples of MongoClientURI


Examples of com.mongodb.MongoClientURI

        int blobCacheSize = PropertiesUtil.toInteger(prop(PROP_BLOB_CACHE_SIZE), DEFAULT_BLOB_CACHE_SIZE);
        boolean useMK = PropertiesUtil.toBoolean(context.getProperties().get(PROP_USE_MK), false);


        MongoClientOptions.Builder builder = MongoConnection.getDefaultBuilder();
        MongoClientURI mongoURI = new MongoClientURI(uri, builder);

        if (log.isInfoEnabled()) {
            // Take care around not logging the uri directly as it
            // might contain passwords
            String type = useMK ? "MK" : "NodeStore";
            log.info("Starting Document{} with host={}, db={}, cache size (MB)={}, Off Heap Cache size (MB)={}, " +
                            "'changes' collection size (MB)={}, blobCacheSize (MB)={}, maxReplicationLagInSecs={}",
                    type, mongoURI.getHosts(), db, cacheSize, offHeapCache, changesSize, blobCacheSize, maxReplicationLagInSecs);
            log.info("Mongo Connection details {}", MongoConnection.toString(mongoURI.getOptions()));
        }

        MongoClient client = new MongoClient(mongoURI);
        DB mongoDB = client.getDB(db);
View Full Code Here

Examples of com.mongodb.MongoClientURI

        int cacheSize = PropertiesUtil.toInteger(config.get(PROP_CACHE), DEFAULT_CACHE);
        boolean useMK = PropertiesUtil.toBoolean(config.get(PROP_USE_MK), false);

        MongoClientOptions.Builder builder = MongoConnection.getDefaultBuilder();
        MongoClientURI mongoURI = new MongoClientURI(uri,builder);

        if(logger.isInfoEnabled()){
            //Take care around not logging the uri directly as it
            //might contain passwords
            String type = useMK ? "MicroKernel" : "NodeStore" ;
            logger.info("Starting MongoDB {} with host={}, db={}",
                    new Object[] {type,mongoURI.getHosts(), db});
            logger.info("Mongo Connection details {}",MongoConnection.toString(mongoURI.getOptions()));
        }

        MongoClient client = new MongoClient(mongoURI);
        DB mongoDB = client.getDB(db);
View Full Code Here

Examples of com.mongodb.MongoClientURI

        properties = new Properties();
        InputStream is = MongoDbConversionsTest.class.getResourceAsStream("/mongodb.test.properties");
        properties.load(is);
        // ping Mongo and populate db and collection
        try {
            mongo = new MongoClient(new MongoClientURI(properties.getProperty("mongodb.connectionURI")));
            mongo.getDatabaseNames();
            dbName = properties.getProperty("mongodb.testDb");
            db = mongo.getDB(dbName);
        } catch (Exception e) {
            Assume.assumeNoException(e);
View Full Code Here

Examples of com.mongodb.MongoClientURI

            new BlogController(args[0]);
        }
    }

    public BlogController(String mongoURIString) throws IOException {
        final MongoClient mongoClient = new MongoClient(new MongoClientURI(mongoURIString));
        final DB blogDatabase = mongoClient.getDB("blog");

        blogPostDAO = new BlogPostDAO(blogDatabase);
        userDAO = new UserDAO(blogDatabase);
        sessionDAO = new SessionDAO(blogDatabase);
View Full Code Here

Examples of com.mongodb.MongoClientURI

            new BlogController(args[0]);
        }
    }

    public BlogController(String mongoURIString) throws IOException {
        final MongoClient mongoClient = new MongoClient(new MongoClientURI(mongoURIString));
        final DB blogDatabase = mongoClient.getDB("blog");

        blogPostDAO = new BlogPostDAO(blogDatabase);
        userDAO = new UserDAO(blogDatabase);
        sessionDAO = new SessionDAO(blogDatabase);
View Full Code Here

Examples of com.mongodb.MongoClientURI

    if (mongoURIString == "") {
      uri = "mongodb://localhost";
    } else {
      uri = mongoURIString;
    }
    final MongoClient mongoClient = new MongoClient(new MongoClientURI(uri));
    chatDatabase = mongoClient.getDB("rilachatjava");

  }
View Full Code Here

Examples of com.mongodb.MongoClientURI

 
 
  public MessagesHistoryMongoTest(){
    MongoClient mongoClient;
    try {
      mongoClient = new MongoClient(new MongoClientURI(
          "mongodb://localhost"));
      chatDatabase = mongoClient.getDB("rilachatjavaTest");
     
    } catch (UnknownHostException e) {
      // TODO Auto-generated catch block
View Full Code Here

Examples of com.mongodb.MongoClientURI

  public MessagesHistoryMongo() {
    String uri = "mongodb://localhost";
    MongoClient mongoClient;
    try {
      mongoClient = new MongoClient(new MongoClientURI(uri));
      chatDatabase = mongoClient.getDB("chatTest");
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of com.mongodb.MongoClientURI

    if (mongoURIString == "") {
      uri = "mongodb://localhost";
    } else {
      uri = mongoURIString;
    }
    final MongoClient mongoClient = new MongoClient(new MongoClientURI(uri));
    chatDatabase = mongoClient.getDB("chat");

  }
View Full Code Here

Examples of com.mongodb.MongoClientURI

            }
        } else {
            if (dbUrl != null) {
                dbUrl = dbUrl.trim();
                try {
                    final MongoClientURI uri = new MongoClientURI(dbUrl);
                    mongoClient = (MongoClient) Mongo.Holder.singleton().connect(uri);
                    db = mongoClient.getDB(uri.getDatabase());
                } catch (final Exception e) {
                    throw BatchMessages.MESSAGES.invalidConfigProperty(e, JdbcRepository.DB_URL_KEY, dbUrl);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.