Package org.apache.slide.store

Examples of org.apache.slide.store.Store


                        Iterator keys = information.keySet().iterator();
                        while (keys.hasNext()) {
                            String key = keys.next().toString();
                            if ("uri".equals(key)) {
                                Uri theUri = nat.getUri(new SlideTokenImpl(new CredentialsToken("")), stripUri(information.get(key).toString()));
                                Store store = theUri.getStore();
                                if (store instanceof ExtendedStore) {
                                    Domain.log("Resetting cache for " + theUri, LOG_CHANNEL, Logger.INFO);
                                    ((ExtendedStore) store).removeObjectFromCache(theUri);
                                }
                            }
                        }
                        nat.commit();
                    } catch(Exception e) {
                      if (Domain.isEnabled(LOG_CHANNEL, Logger.ERROR)) {
                        Domain.log("Error clearing cache: " + e + ". See stderr for stacktrace.", LOG_CHANNEL, Logger.ERROR);
                        e.printStackTrace();
                      }
                    }
                }
            };

            final Subscriber structureSubscriber = new Subscriber() {
                public void notify(String uri, Map information) {
                    NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(this), Domain.getDefaultNamespace());
                    try {
                        nat.begin();
                      Iterator keys = information.keySet().iterator();
                      while (keys.hasNext()) {
                          String key = keys.next().toString();
                          if ("uri".equals(key)) {
                              Uri theUri = nat.getUri(new SlideTokenImpl(new CredentialsToken("")), stripUri(information.get(key).toString()));
                              Store store = theUri.getParentUri().getStore();
                              if (store instanceof ExtendedStore) {
                                  Domain.log("Resetting cache for " + theUri.getParentUri(), LOG_CHANNEL, Logger.INFO);
                                  ((ExtendedStore) store).removeObjectFromCache(theUri.getParentUri());
                              }
                          }
View Full Code Here


                              Hashtable childStores)
        throws ServiceRegistrationFailedException,
        ServiceParameterErrorException, ServiceParameterMissingException {
        if (!stores.containsKey(scope)) {
            try {
                Store store = (Store) storeClass.newInstance();
                store.setName(storeName);
                store.setParameters(parameters);
                stores.put(scope, store);
               
                // assign NodeStore
                NodeStore nodeStore =
                    (NodeStore) dereferenceStore (NODE_STORE, childStores);
               
                store.setNodeStore (nodeStore);
               
                // assign SecurityStore
                SecurityStore securityStore =
                    (SecurityStore) dereferenceStore (SECURITY_STORE, childStores);
               
                store.setSecurityStore (securityStore);
               
                // assign LockStore
                LockStore lockStore =
                    (LockStore) dereferenceStore (LOCK_STORE, childStores);
               
                store.setLockStore (lockStore);
               
                // assign RevisionDescriptorsStore
                RevisionDescriptorsStore revisionDescriptorsStore =
                    (RevisionDescriptorsStore) dereferenceStore
                    (REVISION_DESCRIPTORS_STORE, childStores);
               
                store.setRevisionDescriptorsStore (revisionDescriptorsStore);
               
                // assign RevisionDescriptorStore
                RevisionDescriptorStore revisionDescriptorStore =
                    (RevisionDescriptorStore) dereferenceStore
                    (REVISION_DESCRIPTOR_STORE, childStores);
               
                store.setRevisionDescriptorStore (revisionDescriptorStore);
               
                // assign ContentStore
                ContentStore contentStore =
                    (ContentStore) dereferenceStore (CONTENT_STORE, childStores);
               
                store.setContentStore (contentStore);
               
                // assign PropertiesIndexStore
                IndexStore propertiesIndexer =
                    (IndexStore) dereferenceStore (PROPERTIES_INDEX_STORE, childStores);
               
                // if not configured, take the default indexer
                if (propertiesIndexer == null) {
                    propertiesIndexer = new DefaultIndexer (revisionDescriptorStore);
                    childStores.put (PROPERTIES_INDEX_STORE, propertiesIndexer);
                }
               
                store.setPropertiesIndexer (propertiesIndexer);
               
                // assign ContentIndexStore
                IndexStore contentIndexer =
                    (IndexStore) dereferenceStore (CONTENT_INDEX_STORE, childStores);
               
                // if not configured, take the default indexer
                if (contentIndexer == null) {
                    contentIndexer = new DefaultIndexer (contentStore);
                    childStores.put (CONTENT_INDEX_STORE, contentIndexer);
                }
               
                store.setContentIndexer (contentIndexer);
               
                // assign SequenceStore
                SequenceStore sequenceStore =
                    (SequenceStore) dereferenceStore (SEQUENCE_STORE, childStores);
               
                store.setSequenceStore(sequenceStore);
               
                // set the scope in the father and child stores
                store.setScope(scope);
               
                // call the create_store_listener
                notifyStoreCreated( this.name, scope.toString(), storeName );
               
            } catch(InstantiationException e) {
View Full Code Here

     * service access
     */
    public void unregisterStore(Scope scope)
        throws ServiceDisconnectionFailedException, ServiceAccessException {
        if (stores.containsKey(scope)) {
            Store store = (Store) stores.get(scope);
            if (store.isConnected()) {
                store.disconnect();
                connectedServices.removeElement(store);
            }
            stores.remove(scope);
            store = null;
        }
View Full Code Here

     * perform a connection.
     *
     * @param scope Scope to match
     */
    public Store getStore(Scope scope) {
        Store store = null;
        if (stores.containsKey(scope)) {
            store = (Store) stores.get(scope);
        }
        return store;
    }
View Full Code Here

     * @exception ServiceConnectionFailedException Connection to Store failed
     * @exception ServiceAccessException Unspecified service access exception
     */
    public Store retrieveStore(Scope scope, CredentialsToken token)
        throws ServiceConnectionFailedException, ServiceAccessException {
        Store store = getStore(scope);
        if (store != null) {
            connectService(store, token);
        }
        return store;
    }
View Full Code Here

        if (!cache.hasBeenLoaded()) {
            loadActionsCache(security, token);
        }
        if (cache.hasLoadingFailed()) {
            Uri u = security.namespace.getUri(token, uri);
            Store s = u.getStore();
            throw new ServiceAccessException(s, "Actions cache not loaded");
        }
        return cache.aggregationClosure;
    }
View Full Code Here

  public UncacheModifiedUriListener() {
    Domain.log( "Creating UncacheModifiedUriListener.", LOG_CHANNEL, Logger.DEBUG );
  }

  public void modified(UriModifiedEvent event) {
    Store store = event.getUri().getStore();
    /*
     * TODO: Moving the cache methods on ExtendedStore into their own interface (say CachingStore)
     * would make this more portable.
     */
    if ( store instanceof ExtendedStore ) {
View Full Code Here

                              Hashtable childStores)
        throws ServiceRegistrationFailedException,
        ServiceParameterErrorException, ServiceParameterMissingException {
        if (!stores.containsKey(scope)) {
            try {
                Store store = (Store) storeClass.newInstance();
                store.setName(storeName);
                store.setParameters(parameters);
                stores.put(scope, store);
               
                // Now assigning the child stores
                Object nodeStore = childStores.get(NODE_STORE);
                if (nodeStore instanceof String) {
                    // Resolving reference
                    store.setNodeStore((NodeStore) childStores.get(nodeStore));
                } else {
                    store.setNodeStore((NodeStore) nodeStore);
                }
               
                Object securityStore = childStores.get(SECURITY_STORE);
                if (securityStore instanceof String) {
                    // Resolving reference
                    store.setSecurityStore
                        ((SecurityStore) childStores.get(securityStore));
                } else {
                    store.setSecurityStore
                        ((SecurityStore) securityStore);
                }
               
                Object lockStore = childStores.get(LOCK_STORE);
                if (lockStore instanceof String) {
                    store.setLockStore
                        ((LockStore) childStores.get(lockStore));
                } else {
                    store.setLockStore((LockStore) lockStore);
                }
               
                Object revisionDescriptorsStore = childStores
                    .get(REVISION_DESCRIPTORS_STORE);
                if (revisionDescriptorsStore instanceof String) {
                    store.setRevisionDescriptorsStore
                        ((RevisionDescriptorsStore) childStores
                             .get(revisionDescriptorsStore));
                } else {
                    store.setRevisionDescriptorsStore
                        ((RevisionDescriptorsStore) revisionDescriptorsStore);
                }
               
                Object revisionDescriptorStore = childStores
                    .get(REVISION_DESCRIPTOR_STORE);
                if (revisionDescriptorStore instanceof String) {
                    store.setRevisionDescriptorStore
                        ((RevisionDescriptorStore) childStores
                             .get(revisionDescriptorStore));
                } else {
                    store.setRevisionDescriptorStore
                        ((RevisionDescriptorStore) revisionDescriptorStore);
                }
               
                Object contentStore = childStores.get(CONTENT_STORE);
                if (contentStore instanceof String) {
                    // Resolving reference
                    store.setContentStore
                        ((ContentStore) childStores.get(contentStore));
                } else {
                    store.setContentStore((ContentStore) contentStore);
                }
               
                // set the scope in the father and child stores
                store.setScope(scope);
               
                // call the create_store_listener
                notifyStoreCreated( this.name, scope.toString(), storeName );
               
            } catch(InstantiationException e) {
View Full Code Here

        ObjectNode realObject = retrieve(token, object.getUri(), false);
        securityHelper
            .checkCredentials(token, realObject,
                              namespaceConfig.getCreateObjectAction());
        Uri realObjectUri = namespace.getUri(token, realObject.getUri());
        Store store = realObjectUri.getStore();
        store.storeObject(realObjectUri, object);
       
        if (setModificationDate) {
            try {
                NodeRevisionDescriptor revisionDescriptor = store.retrieveRevisionDescriptor(realObjectUri, new NodeRevisionNumber());
                revisionDescriptor.setModificationDate(new Date());
                revisionDescriptor.setModificationUser(
                    securityHelper.getPrincipal(token).getPath().lastSegment());
                store.storeRevisionDescriptor(realObjectUri, revisionDescriptor );
            }
            catch (RevisionDescriptorNotFoundException e) {
                // ignore silently
            }
        }
View Full Code Here

     * service access
     */
    public void unregisterStore(Scope scope)
        throws ServiceDisconnectionFailedException, ServiceAccessException {
        if (stores.containsKey(scope)) {
            Store store = (Store) stores.get(scope);
            if (store.isConnected()) {
                store.disconnect();
                connectedServices.removeElement(store);
            }
            stores.remove(scope);
            store = null;
        }
View Full Code Here

TOP

Related Classes of org.apache.slide.store.Store

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.