Package org.apache.jackrabbit.mongomk.impl

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


    public ArrayList<MicroKernel> init(Configuration conf, int mksNumber)
            throws Exception {

        ArrayList<MicroKernel> mks = new ArrayList<MicroKernel>();

        MongoConnection mongoConnection;
        mongoConnection = new MongoConnection(conf.getHost(),
                conf.getMongoPort(), conf.getMongoDatabase());

        Thread.sleep(1000);
        MongoClearCollections.clearAllCollections(mongoConnection);
        mongoConnection.close();

        mongoConnection = new MongoConnection(conf.getHost(),
                conf.getMongoPort(), "admin");
        // set the shard key
        mongoConnection.getDB()
                .command(
                        BasicDBObjectBuilder
                                .start("shardCollection", "test.nodes")
                                .push("key").add("path", 1).add("revId", 1)
                                .pop().get());

        for (int i = 0; i < mksNumber; i++) {
            mongoConnection = new MongoConnection(conf.getHost(),
                    conf.getMongoPort(), conf.getMongoDatabase());
            MongoNodeStore nodeStore = new MongoNodeStore(
                    mongoConnection.getDB());
            // MongoAssert.setNodeStore(nodeStore);
            BlobStore blobStore = new MongoGridFSBlobStore(
                    mongoConnection.getDB());
            mks.add(new MongoMicroKernel(mongoConnection, nodeStore, blobStore));
        }

        return mks;
    }
View Full Code Here


        BlobStore blobStore = new BlobStoreFS(System.getProperty("java.io.tmpdir"));
        microKernel = new MongoMicroKernel(mongoConnection, nodeStore, blobStore);
    }

    private void initMongo() throws Exception {
        mongoConnection = new MongoConnection(config.getMongoHost(), config.getMongoPort(), config.getMongoDatabase());
    }
View Full Code Here

        LOG.info("Preparing environment");
        //mongoConnection.initializeDB(true);
    }

    private void initMongo() throws Exception {
        mongoConnection = new MongoConnection(config.getMongoHost(), config.getMongoPort(),
                config.getMongoDatabase());
    }
View Full Code Here

        BlobStore blobStore = new BlobStoreFS(System.getProperty("java.io.tmpdir"));
        microKernel = new MongoMicroKernel(mongoConnection, nodeStore, blobStore);
    }

    private void initMongo() throws Exception {
        this.mongoConnection = new MongoConnection(this.config.getMongoHost(), this.config.getMongoPort(),
                this.config.getMongoDatabase());
    }
View Full Code Here

        String db = PropertiesUtil.toString(config.get(PROP_DB), DEFAULT_DB);

        logger.info("Starting MongoDB MicroKernel with host={}, port={}, db={}",
                new Object[] {host, port, db});

        MongoConnection connection = new MongoConnection(host, port, db);
        DB mongoDB = connection.getDB();

        logger.info("Connected to database {}", mongoDB);

        MongoNodeStore nodeStore = new MongoNodeStore(mongoDB);
        MongoGridFSBlobStore blobStore = new MongoGridFSBlobStore(mongoDB);
View Full Code Here

    private static Exception mongoException = null;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        if (mongoConnection == null) {
            mongoConnection = new MongoConnection(HOST, PORT, DB);
            try {
                mongoConnection.getDB().command(new BasicDBObject("ping", 1));
            } catch (Exception e) {
                mongoException = e;
            }
View Full Code Here

    private static MicroKernel mk2;
    private static MicroKernel mk3;

    @BeforeClass
    public static void createMongoConnections() throws Exception {
        mongoConnection2 = new MongoConnection(HOST, PORT, DB2);
        mongoConnection3 = new MongoConnection(HOST, PORT, DB);
    }
View Full Code Here

    private static MongoConnection mongoConnection = null;

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

    }

    @Override
    public boolean isAvailable() {
        try {
            MongoConnection connection =
                    BaseMongoMicroKernelFixture.getMongoConnection();
            connection.getDB().command(new BasicDBObject("ping", 1));
            return true;
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

        }
    }

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

        MongoNodeStore nodeStore = new MongoNodeStore(db);
        BlobStore blobStore = getBlobStore(db);
        MicroKernel mk = new MongoMicroKernel(connection, nodeStore, blobStore);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mongomk.impl.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.