Examples of MongoClientURI


Examples of com.massivecraft.mcore.xlib.mongodb.MongoClientURI

    return (DBCollection) coll.getCollDriverObject();
  }
 
  protected DB getDbInner(String uri)
  {
    MongoClientURI muri = new MongoClientURI(uri);
   
    try
    {
      // TODO: Create one of these per collection? Really? Perhaps I should cache.
      MongoClient mongoClient = new MongoClient(muri);
     
      DB db = mongoClient.getDB(muri.getDatabase());
     
      if (muri.getUsername() == null) return db;
     
      if ( ! db.authenticate(muri.getUsername(), muri.getPassword()))
      {
        //log(Level.SEVERE, "... db authentication failed.");
        return null;
      }
      return db;
View Full Code Here

Examples of com.mongodb.MongoClientURI

    if (uri == null)
    {
      throw new ConfigurationException("Please define a MongoDB URI for property: " + URI_PROPERTY);
    }

    MongoClientURI mongoUri = new MongoClientURI(uri);
    dbName = mongoUri.getDatabase();
    try
        {
          client = new MongoClient(mongoUri);
        }
        catch (UnknownHostException e)
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

        boolean useMK = PropertiesUtil.toBoolean(config.get(PROP_USE_MK), false);
        String blobStoreType = PropertiesUtil.toString(config.get(BlobStoreConfiguration.PROP_BLOB_STORE_PROVIDER),
                BlobStoreConfiguration.DEFAULT_BLOB_STORE_PROVIDER);

        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 ? "MK" : "NodeStore";
            logger.info("Starting Document{} with host={}, db={}, cache size (MB)={}, Off Heap Cache size (MB)={}",
                    new Object[] {type, mongoURI.getHosts(), db, cacheSize, offHeapCache});
            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

     * @param uri the MongoDB URI
     * @throws UnknownHostException
     */
    public MongoConnection(String uri) throws UnknownHostException  {
        MongoClientOptions.Builder builder = MongoConnection.getDefaultBuilder();
        MongoClientURI mongoURI = new MongoClientURI(uri, builder);
        mongo = new MongoClient(mongoURI);
        db = mongo.getDB(mongoURI.getDatabase());
    }
View Full Code Here

Examples of com.mongodb.MongoClientURI

            RepositoryContext source =
                    RepositoryContext.create(RepositoryConfig.create(dir, xml));
            try {
                if (dst.startsWith("mongodb://")) {
                    MongoClientURI uri = new MongoClientURI(dst);
                    MongoClient client = new MongoClient(uri);
                    try {
                        DocumentNodeStore target = new DocumentMK.Builder()
                            .setMongoDB(client.getDB(uri.getDatabase()))
                            .getNodeStore();
                        try {
                            RepositoryUpgrade upgrade =
                                    new RepositoryUpgrade(source, target);
                            upgrade.setCopyBinariesByReference(
View Full Code Here

Examples of com.mongodb.MongoClientURI

        int changesSize = PropertiesUtil.toInteger(prop(PROP_CHANGES_SIZE), DEFAULT_CHANGES_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)={}",
                    type, mongoURI.getHosts(), db, cacheSize, offHeapCache, changesSize);
            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

            RepositoryContext source =
                    RepositoryContext.create(RepositoryConfig.create(dir, xml));
            try {
                if (dst.startsWith("mongodb://")) {
                    MongoClientURI uri = new MongoClientURI(dst);
                    MongoClient client = new MongoClient(uri);
                    try {
                        DocumentNodeStore target = new DocumentMK.Builder()
                            .setMongoDB(client.getDB(uri.getDatabase()))
                            .getNodeStore();
                        try {
                            RepositoryUpgrade upgrade =
                                    new RepositoryUpgrade(source, target);
                            upgrade.setCopyBinariesByReference(
View Full Code Here

Examples of com.mongodb.MongoClientURI

        int offHeapCache = PropertiesUtil.toInteger(prop(config, PROP_OFF_HEAP_CACHE), DEFAULT_OFF_HEAP_CACHE);
        int cacheSize = PropertiesUtil.toInteger(prop(config, 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 ? "MK" : "NodeStore" ;
            logger.info("Starting Document{} with host={}, db={}, cache size (MB)={}, Off Heap Cache size (MB)={}",
                    new Object[] {type, mongoURI.getHosts(), db, cacheSize, offHeapCache});
            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

            RepositoryContext source =
                    RepositoryContext.create(RepositoryConfig.create(dir, xml));
            try {
                if (dst.startsWith("mongodb://")) {
                    MongoClientURI uri = new MongoClientURI(dst);
                    MongoClient client = new MongoClient(uri);
                    try {
                        DocumentNodeStore target = new DocumentMK.Builder()
                            .setMongoDB(client.getDB(uri.getDatabase()))
                            .getNodeStore();
                        try {
                            RepositoryUpgrade upgrade =
                                    new RepositoryUpgrade(source, target);
                            upgrade.setCopyBinariesByReference(
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.