Package com.mongodb

Examples of com.mongodb.DB


    }

    private MongoMK createMK(int clusterId) {
        MongoMK.Builder builder = new MongoMK.Builder();
        if (MONGO_DB) {
            DB db = MongoUtils.getConnection().getDB();
            builder.setMongoDB(db);
        } else {
            if (ds == null) {
                ds = new MemoryDocumentStore();
            }
View Full Code Here


        @Override
        public DocumentStore createDocumentStore() {
            try {
                MongoConnection connection = new MongoConnection(uri);
                DB db = connection.getDB();
                MongoUtils.dropCollections(db);
                return new MongoDocumentStore(db, new DocumentMK.Builder());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here

                    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);

        DocumentMK.Builder mkBuilder =
                new DocumentMK.Builder().
                memoryCacheSize(cacheSize * MB).
                offHeapCacheSize(offHeapCache * MB);
 
View Full Code Here

    }

    @Override
    public void setUpCluster(MicroKernel[] cluster) throws Exception {
        MongoConnection connection = getMongoConnection();
        DB db = connection.getDB();
        dropCollections(db);

        for (int i = 0; i < cluster.length; i++) {
            cluster[i] = new DocumentMK.Builder().
                    setMongoDB(db).setClusterId(i).open();
View Full Code Here

    }

    @Override
    public void tearDownCluster(MicroKernel[] cluster) {
        try {
            DB db = getMongoConnection().getDB();
            dropCollections(db);
            mongoConnection.close();
            mongoConnection = null;
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            @Override
            public NodeStore createNodeStore(int clusterNodeId) {
                MongoConnection connection;
                try {
                    connection = new MongoConnection(uri);
                    DB mongoDB = connection.getDB();
                    return new DocumentMK.Builder()
                                    .setMongoDB(mongoDB).getNodeStore();
                } catch (Exception e) {
                    return null;
                }
View Full Code Here

                    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);

        mk = new DocumentMK.Builder()
                .memoryCacheSize(cacheSize * MB)
                .offHeapCacheSize(offHeapCache * MB)
                .setMongoDB(mongoDB)
View Full Code Here

  public static class Factory {
    public static MongoDao newTestMongoDao() throws UnknownHostException,
        MongoException {
      Mongo mongo = new Mongo("localhost");
      DB database = mongo.getDB("test");
      MongoDao mongoDao = new MongoDao();
      mongoDao.setDbCollection(database.getCollection("entities"));
      mongoDao.setDbCollection_History(database
          .getCollection("entities_history"));
      mongoDao.setSourceCollection(database.getCollection("sources"));
      return mongoDao;
    }
View Full Code Here

    userIsObject = false;
    itemIsObject = false;
    idCounter = 0;
    preferenceIsString = true;
    Mongo mongoDDBB = new Mongo(mongoHost, mongoPort);
    DB db = mongoDDBB.getDB(mongoDB);
    mongoTimestamp = new Date(0);
    FastByIDMap<Collection<Preference>> userIDPrefMap = new FastByIDMap<Collection<Preference>>();
    if (!mongoAuth || (mongoAuth && db.authenticate(mongoUsername, mongoPassword.toCharArray()))) {
      collection = db.getCollection(mongoCollection);
      collectionMap = db.getCollection(MONGO_MAP_COLLECTION);
      DBObject indexObj = new BasicDBObject();
      indexObj.put("element_id", 1);
      collectionMap.ensureIndex(indexObj);
      indexObj = new BasicDBObject();
      indexObj.put("long_value", 1);
View Full Code Here

                    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);

        DocumentMK.Builder mkBuilder =
                new DocumentMK.Builder().
                memoryCacheSize(cacheSize * MB).
                offHeapCacheSize(offHeapCache * MB);
 
View Full Code Here

TOP

Related Classes of com.mongodb.DB

Copyright © 2018 www.massapicom. 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.