Package org.apache.slide.store

Examples of org.apache.slide.store.Store


                              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


     * 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

                    return permActionSet.contains(checkAction);
                }
            }
            else {
                Uri u = namespace.getUri(token, checkAction.getUri());
                Store s = u.getStore();
                throw new ServiceAccessException(s, "Actions cache not loaded");
            }
        }
    }
View Full Code Here

            return b.toString();
        }
    }
   
    private boolean sameStore(SlideToken token, String leftUri, String rightUri) {
        Store leftStore = namespace.getUri(token, leftUri).getStore();
        Store rightStore = namespace.getUri(token, rightUri).getStore();
        if (leftStore == null || rightStore == null) {
            throw new IllegalStateException("Got null store: leftStore="+leftStore+", rightStore="+rightStore);
        }
        return leftStore == rightStore;
    }
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

            return b.toString();
        }
    }
   
    private boolean sameStore(SlideToken token, String leftUri, String rightUri) {
        Store leftStore = namespace.getUri(token, leftUri).getStore();
        Store rightStore = namespace.getUri(token, rightUri).getStore();
        if (leftStore == null || rightStore == null) {
            throw new IllegalStateException("Got null store: leftStore="+leftStore+", rightStore="+rightStore);
        }
        return leftStore == rightStore;
    }
View Full Code Here

   
    public String generateUniqueUri(SlideToken token, String parentUri) throws ServiceAccessException {
        String sequenceName = parentUri.replace('/', '-');

        Uri uri = namespace.getUri(token, parentUri);
        Store store = uri.getStore();
        if (!store.isSequenceSupported()) {
            return null;
        } else {
            if (!store.sequenceExists(sequenceName)) {
                store.createSequence(sequenceName);
            }
            long next = store.nextSequenceValue(sequenceName);
            String uniqueUri = parentUri + "/" + next;
            return uniqueUri;
        }
    }
View Full Code Here

        //ObjectNode realObject = retrieve(token, object.getUri(), false);
        securityHelper
            .checkCredentials(token, object,
                              namespaceConfig.getCreateObjectAction());
        Uri uri = namespace.getUri(token, object.getUri());
        Store store = uri.getStore();
        store.storeObject(uri, object);
       
        if (setModificationDate) {
            try {
                NodeRevisionDescriptor revisionDescriptor = store.retrieveRevisionDescriptor(uri, new NodeRevisionNumber());
                revisionDescriptor.setModificationDate(new Date());
                revisionDescriptor.setModificationUser(
                    securityHelper.getPrincipal(token).getPath().lastSegment());
                store.storeRevisionDescriptor(uri, revisionDescriptor );
            }
            catch (RevisionDescriptorNotFoundException e) {
                // ignore silently
            }
        }
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.