Examples of MongoConnection


Examples of org.apache.jackrabbit.mongomk.util.MongoConnection

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

Examples of org.apache.jackrabbit.mongomk.util.MongoConnection

    private MongoConnection mongoConnection = null;

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

Examples of org.apache.jackrabbit.mongomk.util.MongoConnection

        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

Examples of org.apache.jackrabbit.mongomk.util.MongoConnection

        }
    }

    @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 MongoMK.Builder().
                    setMongoDB(db).setClusterId(i).open();
View Full Code Here

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

            ns.runBackgroundOperations();
        }
    }

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

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

        return OakMongoMKRepositoryStub.createConnection(
                ConcurrentAddNodesClusterIT.class.getSimpleName());
    }

    private static void dropDB() throws Exception {
        MongoConnection con = createConnection();
        try {
            con.getDB().dropDatabase();
        } finally {
            con.close();
        }
    }
View Full Code Here

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

            con.close();
        }
    }

    private static void initRepository() throws Exception {
        MongoConnection con = createConnection();
        DocumentMK mk = new DocumentMK.Builder()
                .setMongoDB(con.getDB())
                .setClusterId(1).open();
        Session session = new Jcr(mk.getNodeStore()).createRepository().login(
                new SimpleCredentials("admin", "admin".toCharArray()));
        session.logout();
        mk.dispose(); // closes connection as well
View Full Code Here

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

            @Override
            protected Repository[] internalSetUpCluster(int n) throws Exception {
                Repository[] cluster = new Repository[n];
                kernels = new DocumentMK[cluster.length];
                for (int i = 0; i < cluster.length; i++) {
                    MongoConnection mongo =
                            new MongoConnection(host, port, dbName);
                    BlobStore blobStore = getBlobStore();
                    DocumentMK.Builder mkBuilder = new DocumentMK.Builder().
                            setMongoDB(mongo.getDB()).
                            memoryCacheSize(cacheSize).
                            setClusterId(i).setLogging(false);
                    if (blobStore != null) {
                            mkBuilder.setBlobStore(blobStore);
                    }
                    kernels[i] = mkBuilder.open();
                    Oak oak;
                    if (useMK) {
                        oak = new Oak(new KernelNodeStore(kernels[i], cacheSize));
                    } else {
                        oak = new Oak(kernels[i].getNodeStore());
                    }
                    cluster[i] = new Jcr(oak).createRepository();
                }
                return cluster;
            }

            @Override
            public void tearDownCluster() {
                super.tearDownCluster();
                for (DocumentMK kernel : kernels) {
                    kernel.dispose();
                }
                if (dropDBAfterTest) {
                    try {
                        MongoConnection mongo =
                                new MongoConnection(host, port, dbName);
                        mongo.getDB().dropDatabase();
                        mongo.close();
                        if (blobStore instanceof CloudBlobStore) {
                            ((CloudBlobStore) blobStore).deleteBucket();
                        } else if (blobStore instanceof DataStoreBlobStore) {
                            ((DataStoreBlobStore) blobStore).clearInUse();
                            ((DataStoreBlobStore) blobStore).deleteAllOlderThan(
View Full Code Here

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

     */   
    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

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

    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
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.