Package org.apache.jackrabbit.oak.plugins.document.util

Examples of org.apache.jackrabbit.oak.plugins.document.util.MongoConnection


    private MongoConnection mongoConnection = null;

    protected MongoConnection getMongoConnection() throws Exception {
        if (mongoConnection == null) {
            mongoConnection = new MongoConnection(HOST, PORT, DB);
        }
        return mongoConnection;
    }
View Full Code Here


        return mongoConnection;
    }

    @Override
    public boolean isAvailable() {
        MongoConnection connection = null;
        try {
            connection = new MongoConnection(HOST, PORT, DB);
            connection.getDB().command(new BasicDBObject("ping", 1));
            return true;
        } catch (Exception e) {
            return false;
        } finally {
            if (connection != null) {
                connection.close();
            }
        }
    }
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

     */   
    public static MongoConnection getConnection(String dbName) {
        if (exception != null) {
            return null;
        }
        MongoConnection mongoConnection = null;
        try {
            mongoConnection = new MongoConnection(HOST, PORT, dbName);
            mongoConnection.getDB().command(new BasicDBObject("ping", 1));
            // dropCollections(mongoConnection.getDB());
        } catch (Exception e) {
            exception = e;
            mongoConnection = null;
        }
View Full Code Here

        return blobStore;
    }

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

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

        return blobStore;
    }

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

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

     */
    public static MongoConnection getConnection(String dbName) {
        if (exception != null) {
            return null;
        }
        MongoConnection mongoConnection = null;
        try {
            mongoConnection = new MongoConnection(HOST, PORT, dbName);
            mongoConnection.getDB().command(new BasicDBObject("ping", 1));
            // dropCollections(mongoConnection.getDB());
        } catch (Exception e) {
            exception = e;
            mongoConnection = null;
        }
View Full Code Here

        public DocumentFixture() {
            this(DEFAULT_URI, false);
        }

        private static NodeStore createNodeStore(String uri) {
            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

    private static final int NB_THREADS = 16;

    private List<DocumentMK> mks = new ArrayList<DocumentMK>();

    private DocumentMK createMicroKernel() throws Exception {
        MongoConnection connection = MongoUtils.getConnection();
        DB mongoDB = connection.getDB();
        return new DocumentMK.Builder().memoryCacheSize(CACHE_SIZE).setMongoDB(mongoDB).open();
    }
View Full Code Here

            ns.runBackgroundOperations();
        }
    }

    private static DocumentNodeStore createNS(int clusterId) throws Exception {
        MongoConnection mc = MongoUtils.getConnection();
        return new DocumentMK.Builder()
                          .setMongoDB(mc.getDB())
                          .setClusterId(clusterId)
                          //Set delay to 0 so that effect of changes are immediately reflected
                          .setAsyncDelay(0)
                          .getNodeStore();
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.document.util.MongoConnection

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.