Package org.modeshape.jcr.cache.document

Examples of org.modeshape.jcr.cache.document.LocalDocumentStore


                    // the name of the fork stack is based on the name of the cache; this will allow multiple caches to share the
                    // same JG stack
                    String forkStackId = "modeshape-" + cacheName + "-fork-stack";
                    this.clusteringService = cacheChannel != null ? ClusteringService.startForked(forkStackId, cacheChannel) : null;

                    this.documentStore = connectors.hasConnectors() ? new FederatedDocumentStore(connectors, database) : new LocalDocumentStore(
                                                                                                                                                database);
                    this.txnMgr = this.documentStore.transactionManager();
                    this.transactions = createTransactions(cacheName, config.getTransactionMode(), this.txnMgr);

                    suspendExistingUserTransaction();
View Full Code Here


    Collection<Cache<?, ?>> caches() {
        RunningState running = runningState.get();
        if (running == null) return Collections.emptyList();

        List<Cache<?, ?>> caches = new ArrayList<Cache<?, ?>>();
        LocalDocumentStore localDocumentStore = running.documentStore().localStore();
        caches.add(localDocumentStore.localCache());
        // Add the binary store's cache, if there is one ...
        BinaryStore store = running.binaryStore();
        if (store instanceof InfinispanBinaryStore) {
            InfinispanBinaryStore ispnStore = (InfinispanBinaryStore)store;
            caches.addAll(ispnStore.getCaches());
View Full Code Here

     * @param localDb a {@code non-null} {@link SchematicDb} instance
     */
    public FederatedDocumentStore( Connectors connectors,
                                   SchematicDb localDb ) {
        this.connectors = connectors;
        this.localDocumentStore = new LocalDocumentStore(localDb);
    }
View Full Code Here

        // Set the Environment
        ReflectionUtil.setValue(connector, "environment", repository.environment());

        // Set the ExtraPropertiesStore instance, which is unique to this connector ...
        LocalDocumentStore store = repository.documentStore().localStore();
        String name = connector.getSourceName();
        String sourceKey = NodeKey.keyForSourceName(name);
        DocumentTranslator translator = getDocumentTranslator();
        ExtraPropertiesStore defaultExtraPropertiesStore = new LocalDocumentStoreExtraProperties(store, sourceKey, translator);
        ReflectionUtil.setValue(connector, "extraPropertiesStore", defaultExtraPropertiesStore);
View Full Code Here

                // cluster to do this, so we need to update the document store in an atomic fashion. So, first attempt to
                // lock the document ...
                this.upgradingRepository = runInTransaction(new Callable<Boolean>() {
                    @Override
                    public Boolean call() throws Exception {
                        LocalDocumentStore store = documentStore().localStore();
                        store.prepareDocumentsForUpdate(Collections.unmodifiableSet(REPOSITORY_INFO_KEY));
                        EditableDocument editor = store.edit(REPOSITORY_INFO_KEY, true);
                        if (editor.get(REPOSITORY_UPGRADER_FIELD_NAME) == null) {
                            // Make sure that some other process didn't sneak in and already upgrade ...
                            int lastUpgradeId = editor.getInteger(REPOSITORY_UPGRADE_ID_FIELD_NAME, 0);
                            if (upgrades.isUpgradeRequired(lastUpgradeId)) {
                                // An upgrade is still required, and we get to do it ...
View Full Code Here

            if (initializingRepository) {
                LOGGER.debug("Marking repository '{0}' as fully initialized", name);
                runInTransaction(new Callable<Void>() {
                    @Override
                    public Void call() throws Exception {
                        LocalDocumentStore store = documentStore().localStore();
                        store.prepareDocumentsForUpdate(Collections.unmodifiableSet(REPOSITORY_INFO_KEY));
                        EditableDocument editor = store.edit(REPOSITORY_INFO_KEY, true);
                        if (editor.get(REPOSITORY_INITIALIZED_AT_FIELD_NAME) == null) {
                            DateTime now = context().getValueFactories().getDateFactory().create();
                            editor.setDate(REPOSITORY_INITIALIZED_AT_FIELD_NAME, now.toDate());
                        }
                        return null;
View Full Code Here

                    public Void call() throws Exception {
                        LOGGER.debug("Upgrading repository '{0}'", name);
                        lastUpgradeId = upgrades.applyUpgradesSince(lastUpgradeId, resources);
                        LOGGER.debug("Recording upgrade completion in repository '{0}'", name);

                        LocalDocumentStore store = documentStore().localStore();
                        store.prepareDocumentsForUpdate(Collections.unmodifiableSet(REPOSITORY_INFO_KEY));
                        EditableDocument editor = store.edit(REPOSITORY_INFO_KEY, true);
                        DateTime now = context().getValueFactories().getDateFactory().create();
                        editor.setDate(REPOSITORY_UPGRADED_AT_FIELD_NAME, now.toDate());
                        editor.setNumber(REPOSITORY_UPGRADE_ID_FIELD_NAME, lastUpgradeId);
                        editor.remove(REPOSITORY_UPGRADER_FIELD_NAME);
                        return null;
View Full Code Here

    @Override
    protected NodeCache createCache() {
        executor = Executors.newCachedThreadPool();
        changeBus = new RepositoryChangeBus("repo", executor);
        ConcurrentMap<NodeKey, CachedNode> nodeCache = new ConcurrentHashMap<NodeKey, CachedNode>();
        DocumentStore documentStore = new LocalDocumentStore(schematicDb);
        DocumentTranslator translator = new DocumentTranslator(context, documentStore, 100L);
        WorkspaceCache workspaceCache = new WorkspaceCache(context, "repo", "ws", null, documentStore, translator, ROOT_KEY_WS1,
                                                           nodeCache, changeBus);
        loadJsonDocuments(resource(resourceNameForWorkspaceContentDocument()));
        return workspaceCache;
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.cache.document.LocalDocumentStore

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.