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

Examples of org.apache.jackrabbit.oak.plugins.document.DocumentMK


    }

    @Test
    public void addNodes2() throws Exception {
        for (int i = 0; i < 3; i++) {
            DocumentMK mk = new DocumentMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setAsyncDelay(0)
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        final DocumentMK mk1 = mks.get(0);
        final DocumentMK mk2 = mks.get(1);
        final DocumentMK mk3 = mks.get(2);
        Repository r1 = new Jcr(mk1.getNodeStore()).createRepository();
        repos.add(r1);
        Repository r2 = new Jcr(mk2.getNodeStore()).createRepository();
        repos.add(r2);
        Repository r3 = new Jcr(mk3.getNodeStore()).createRepository();
        repos.add(r3);

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s3 = r3.login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here


    }

    @Test
    public void rebaseVisibility() throws Exception {
        for (int i = 0; i < 2; i++) {
            DocumentMK mk = new DocumentMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setAsyncDelay(0)
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        final DocumentMK mk1 = mks.get(0);
        final DocumentMK mk2 = mks.get(1);
        Repository r1 = new Jcr(mk1.getNodeStore()).createRepository();
        repos.add(r1);
        Repository r2 = new Jcr(mk2.getNodeStore()).createRepository();
        repos.add(r2);

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here

        }
    }

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

        }
    }

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

            "Adding a total of {} nodes evely spread across cluster. Loop: {}, Count: {}, Cluster nodes: {}",
            new Object[] { loop * count * clusters, loop, count, clusters });

        // creating instances
        for (int i = 1; i <= clusters; i++) {
            DocumentMK mk = new DocumentMK.Builder()
                    .memoryCacheSize(CACHE_SIZE)
                    .setMongoDB(createConnection().getDB())
                    .setClusterId(i).open();
            mks.add(mk);
        }

        Map<String, Exception> exceptions = Collections.synchronizedMap(
            new HashMap<String, Exception>());

        // initialising repositories and creating workers
        for (int i = 0; i < mks.size(); i++) {
            DocumentMK mk = mks.get(i);
            Repository repo = new Jcr(mk.getNodeStore()).createRepository();
            Session session = repo.login(ADMIN);
            ensureIndex(session);
            session.logout();
            repos.add(repo);
            workers.add(new Thread(new Worker(repo, exceptions), "Worker-" + (i + 1)));
        }

        // we know we have at least repos[0]
        Repository repo = repos.get(0);
        Session session = repo.login(ADMIN);
        ensureIndex(session);
       
        // initialising the repository sequentially to avoid any possible
        // concurrency errors during inserts
        for (Thread w : workers) {
            String nodeName = getNodeName(w);
            createNodes(session, nodeName, loop, count, exceptions);
        }
       
        // extra save for being sure.
        session.save();
       
        if (exceptions.isEmpty()) {
            // ensuring the cluster is aligned before triggering in order to avoid any
            // PathNotFoundException
            for (DocumentMK mk : mks) {
                mk.getNodeStore().runBackgroundOperations();
            }
            for (Thread t : workers) {
                t.start();
            }
            for (Thread t : workers) {
View Full Code Here

                DocumentMK.Builder mkBuilder = new DocumentMK.Builder().
                        setMongoDB(mongo.getDB()).
                        memoryCacheSize(cacheSize).
                        setClusterId(clusterId).setLogging(false);
                setupBlobStore(mkBuilder);
                DocumentMK dmk = mkBuilder.open();
                Oak oak;
                if (useMk) {
                    oak = new Oak(new KernelNodeStore(dmk, cacheSize));
                } else {
                    oak = new Oak(dmk.getNodeStore());
                }
                return oak;
            }

            @Override
View Full Code Here

                        .setClusterId(clusterId).setLogging(false);
                BlobStore blobStore = getBlobStore();
                if (blobStore != null) {
                    mkBuilder.setBlobStore(blobStore);
                }
                DocumentMK dmk = mkBuilder.open();
                Oak oak;
                if (useMk) {
                    oak = new Oak(new KernelNodeStore(dmk, cacheSize));
                } else {
                    oak = new Oak(dmk.getNodeStore());
                }
                return oak;
            }

            @Override
View Full Code Here

        }
    }

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

            "Adding a total of {} nodes evely spread across cluster. Loop: {}, Count: {}, Cluster nodes: {}",
            new Object[] { loop * count * clusters, loop, count, clusters });

        // creating instances
        for (int i = 1; i <= clusters; i++) {
            DocumentMK mk = new DocumentMK.Builder()
                    .memoryCacheSize(CACHE_SIZE)
                    .setMongoDB(createConnection().getDB())
                    .setClusterId(i).open();
            mks.add(mk);
        }

        Map<String, Exception> exceptions = Collections.synchronizedMap(
            new HashMap<String, Exception>());

        // initialising repositories and creating workers
        for (int i = 0; i < mks.size(); i++) {
            DocumentMK mk = mks.get(i);
            Repository repo = new Jcr(mk.getNodeStore()).createRepository();
            Session session = repo.login(ADMIN);
            ensureIndex(session);
            session.logout();
            repos.add(repo);
            workers.add(new Thread(new Worker(repo, exceptions), "Worker-" + (i + 1)));
        }

        // we know we have at least repos[0]
        Repository repo = repos.get(0);
        Session session = repo.login(ADMIN);
        ensureIndex(session);
       
        // initialising the repository sequentially to avoid any possible
        // concurrency errors during inserts
        for (Thread w : workers) {
            String nodeName = getNodeName(w);
            createNodes(session, nodeName, loop, count, exceptions);
        }
       
        // extra save for being sure.
        session.save();
       
        if (exceptions.isEmpty()) {
            // ensuring the cluster is aligned before triggering in order to avoid any
            // PathNotFoundException
            for (DocumentMK mk : mks) {
                mk.getNodeStore().runBackgroundOperations();
            }
            for (Thread t : workers) {
                t.start();
            }
            for (Thread t : workers) {
View Full Code Here

        Runtime.getRuntime().addShutdownHook(
                new Thread(new ShutdownHook(connection)));
    }

    protected Repository createRepository(MongoConnection connection) {
        DocumentMK m = new DocumentMK.Builder()
                .setClusterId(1)
                .memoryCacheSize(64 * 1024 * 1024)
                .setMongoDB(connection.getDB())
                .open();
        QueryEngineSettings qs = new QueryEngineSettings();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.document.DocumentMK

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.