Package org.apache.slide.common

Examples of org.apache.slide.common.Uri


            (token, associatedObject,
             namespaceConfig.getRemoveRevisionContentAction());
        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getRemoveRevisionContentAction());
       
        Uri objectUri = namespace.getUri(token, revisionDescriptors.getUri());

        // Fire event
        if ( ContentEvent.REMOVE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(ContentEvent.REMOVE, new ContentEvent(this, token, namespace, objectUri.toString(), revisionDescriptors));

        objectUri.getStore().removeRevisionDescriptors(objectUri);
       
        // Invoke interceptors
        invokeInterceptors(token, revisionDescriptors, null, null,
                           POST_REMOVE);
    }
View Full Code Here


            (token, associatedObject,
             namespaceConfig.getRemoveRevisionContentAction());
        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getRemoveRevisionContentAction());
       
        Uri objectUri = namespace.getUri(token, strUri);
       
        NodeRevisionDescriptor revisionDescriptor =
            objectUri.getStore().retrieveRevisionDescriptor
            (objectUri, revisionNumber);

        // Fire event
        if ( revisionNumber != NodeRevisionNumber.HIDDEN_0_0 && ContentEvent.REMOVE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(ContentEvent.REMOVE, new ContentEvent(this, token, namespace, objectUri.toString(), revisionDescriptor));

        // Invoke interceptors
        invokeInterceptors(token, null, revisionDescriptor, null, PRE_REMOVE);
       
        objectUri.getStore().removeRevisionContent
            (objectUri, revisionDescriptor);
        objectUri.getStore()
            .removeRevisionDescriptor(objectUri, revisionNumber);
       
        // Invoke interceptors
        invokeInterceptors(token, null, revisionDescriptor, null, POST_REMOVE);
    }
View Full Code Here

        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getCreateRevisionContentAction());
       
        setDefaultProperties(associatedObject, newRevisionDescriptor);
       
        Uri objectUri = namespace.getUri(token, strUri);
       
        // Retrieve the revision table
        NodeRevisionDescriptors revisionDescriptors =
            objectUri.getStore()
            .retrieveRevisionDescriptors(objectUri);
       
        if (!revisionDescriptors.isVersioned()) {
            // Invalid function call : we try to create a revision, but the
            // descriptors won't allow it
            throw new NodeNotVersionedException(strUri);
        }
       
        // Retrieve the old revision descriptor, just to make sure that the old
        //  revision we base the new one upon really exists
        NodeRevisionDescriptor realOldRevisionDescriptor =
            objectUri.getStore().retrieveRevisionDescriptor
            (objectUri, basedOnRevisionNumber);
       
        // We check that the old revision doesn't have successors, that is we :
        // - check to see if it's the latest revision in a branch
        // - store that information for later use
        NodeRevisionNumber latestNumberInBranch =
            revisionDescriptors.getLatestRevision
            (realOldRevisionDescriptor.getBranchName());
        if (!realOldRevisionDescriptor.getRevisionNumber()
            .equals(latestNumberInBranch)) {
            throw new RevisionAlreadyExistException
                (objectUri.toString(), new NodeRevisionNumber
                     (basedOnRevisionNumber));
        }
       
        // Next, generate the new revision's number
        newRevisionDescriptor.setRevisionNumber
            (new NodeRevisionNumber(basedOnRevisionNumber));
        // Set the creation date
        newRevisionDescriptor.setCreationDate(new Date());
       
        // Set the creation user
        setCreationUser(token, newRevisionDescriptor);
       
        // Initialize the branch name in the new descriptor
        newRevisionDescriptor.setBranchName
            (realOldRevisionDescriptor.getBranchName());

        // Fire event
        if ( ContentEvent.CREATE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(ContentEvent.CREATE, new ContentEvent(this, token, namespace, objectUri.toString(), revisionDescriptors, newRevisionDescriptor, revisionContent));

        // Invoke interceptors
        invokeInterceptors(token, revisionDescriptors, newRevisionDescriptor,
                           revisionContent, PRE_STORE);
       
        // Update the revision graph in the revision descriptors
        revisionDescriptors
            .addSuccessor(revisionDescriptors.getLatestRevision(newRevisionDescriptor.getBranchName()),
                          newRevisionDescriptor.getRevisionNumber());
        revisionDescriptors
            .setSuccessors(newRevisionDescriptor.getRevisionNumber(), new Vector());
        revisionDescriptors
            .setLatestRevision(newRevisionDescriptor.getBranchName(),
                               newRevisionDescriptor.getRevisionNumber());
        if (revisionContent != null) {
            // Storing the new revision contents
            objectUri.getStore()
                .createRevisionContent(objectUri, newRevisionDescriptor,
                                       revisionContent);
        }
        // Now creating the revision desriptor in the store
        newRevisionDescriptor.setModificationDate(newRevisionDescriptor.getCreationDate());
        newRevisionDescriptor.setModificationUser(
            securityHelper.getPrincipal(token).getPath().lastSegment());
        objectUri.getStore()
            .createRevisionDescriptor(objectUri, newRevisionDescriptor);
       
        // We now store the updated revision descriptors
        try {
            objectUri.getStore()
                .storeRevisionDescriptors(objectUri, revisionDescriptors);
        } catch (RevisionDescriptorNotFoundException e) {
            // Problem ...
            e.printStackTrace();
        }
View Full Code Here

        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getCreateRevisionContentAction());
       
        setDefaultProperties(associatedObject, revisionDescriptor);
       
        Uri objectUri = namespace.getUri(token, strUri);
       
        // Retrieve the revision table
        NodeRevisionDescriptors revisionDescriptors =
            objectUri.getStore()
            .retrieveRevisionDescriptors(objectUri);
       
        // Set the creation date
        revisionDescriptor.setCreationDate(new Date());
       
        // Set the creation user
        setCreationUser(token, revisionDescriptor);
       
        // Initialize the branch name in the new descriptor
        String branchName = "backup";
        NodeProperty rootVersionProperty = revisionDescriptor.getProperty("version-set");
        if (rootVersionProperty != null) {
            branchName = "version-history";
        }
        revisionDescriptor.setBranchName(branchName);

        // Fire event
        if ( revisionDescriptor.getRevisionNumber() != NodeRevisionNumber.HIDDEN_0_0 && ContentEvent.CREATE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(ContentEvent.CREATE, new ContentEvent(this, token, namespace, objectUri.toString(), revisionDescriptors, revisionDescriptor));

        // Invoke interceptors
        invokeInterceptors(token, revisionDescriptors, revisionDescriptor,
                           null, PRE_STORE);
       
        // Now creating the revision desriptor in the store
        revisionDescriptor.setModificationDate(revisionDescriptor.getCreationDate());
        revisionDescriptor.setModificationUser(
            securityHelper.getPrincipal(token).getPath().lastSegment());
        objectUri.getStore()
            .createRevisionDescriptor(objectUri, revisionDescriptor);
       
        // We now store the updated revision descriptors
        try {
            objectUri.getStore()
                .storeRevisionDescriptors(objectUri, revisionDescriptors);
        } catch (RevisionDescriptorNotFoundException e) {
            // Problem ...
            e.printStackTrace();
        }
View Full Code Here

    public void setPermissions(SlideToken token, String object,
                               Enumeration permissions)
        throws ServiceAccessException, ObjectNotFoundException,
        AccessDeniedException {
       
        Uri objectUri = namespace.getUri(token, object);
        ObjectNode objectNode = objectUri.getStore().retrieveObject(objectUri);
       
        checkCredentials(token, objectNode,
                         namespaceConfig.getGrantPermissionAction());
        checkCredentials(token, objectNode,
                         namespaceConfig.getRevokePermissionAction());
       
        objectUri.getStore().revokePermissions(objectUri);
       
        while (permissions.hasMoreElements()) {
            NodePermission permission =
                (NodePermission) permissions.nextElement();
            objectUri.getStore().grantPermission(objectUri, permission);
        }
       
    }
View Full Code Here

     */
    public void grantPermission(SlideToken token,
                                NodePermission permission)
        throws ServiceAccessException, ObjectNotFoundException,
        AccessDeniedException, VetoException {
        Uri objectUri = namespace.getUri(token, permission.getObjectUri());
        ObjectNode object = objectUri.getStore()
            .retrieveObject(objectUri);
       
        // Checking if the permission is already present
        Enumeration permissions = enumeratePermissions(token, object);
        boolean alreadyPresent = false;
        while (permissions.hasMoreElements() && !alreadyPresent) {
            if (permission.equals(permissions.nextElement())) {
                alreadyPresent = true;
            }
        }
       
        if (!alreadyPresent) {
            checkCredentials(token, object,
                             namespaceConfig.getGrantPermissionAction());
            objectUri.getStore().grantPermission(objectUri, permission);
        }

        // Fire event
        if ( permission.isNegative() ) {
            if ( SecurityEvent.DENY_PERMISSION.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(SecurityEvent.DENY_PERMISSION, new SecurityEvent(this, token, namespace, objectUri, permission));
View Full Code Here

     * Maybe this should be subclassed to allow different messaging implementations?
     */
    Domain.log( "Called ContentModifiedNotifier.notify for " + event.getUri(), LOG_CHANNEL, Logger.DEBUG );
    if ( UriModifiedEvent.URIMODIFIED.isEnabled() ) {
        EventDispatcher.getInstance().fireEvent(
          UriModifiedEvent.URIMODIFIED, new UriModifiedEvent(this, new Uri( event.getNamespace(), event.getUri() )));
    } else {
      Domain.log( "Can't notify, UriModifiedEvent is disabled.", LOG_CHANNEL, Logger.DEBUG );
    }
  }
View Full Code Here

            (token, associatedObject,
             namespaceConfig.getReadRevisionMetadataAction());
        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getReadRevisionMetadataAction());
       
        Uri objectUri = namespace.getUri(token, strUri);
        NodeRevisionDescriptors revisionDescriptors = null;
        try {
            revisionDescriptors = objectUri.getStore()
                .retrieveRevisionDescriptors(objectUri);
        } catch (RevisionDescriptorNotFoundException e) {
            // No revision descriptors. We have to create some.
            revisionDescriptors = new NodeRevisionDescriptors();
            revisionDescriptors.setUri(objectUri.toString());
            // FIXME: createRevisionDescriptors shouldn't be done in this read-only method
            objectUri.getStore()
                .createRevisionDescriptors(objectUri, revisionDescriptors);
        }
       
        revisionDescriptors.setOriginalUri( originalUri );
View Full Code Here

        LinkedObjectNotFoundException, ServiceAccessException,
        RevisionDescriptorNotFoundException, ObjectLockedException,
        BranchNotFoundException, NodeNotVersionedException, VetoException {
       
        NodeRevisionDescriptor result;
        Uri objectUri = namespace.getUri(token, revisionDescriptors.getUri());
        NodeRevisionNumber latestNrn =
            redirectLatestRevisionNumber( revisionDescriptors.getOriginalUri() );
       
        NodeRevisionDescriptors realRevisionDescriptors = objectUri.getStore()
            .retrieveRevisionDescriptors(objectUri);
       
        if (!realRevisionDescriptors.isVersioned()) {
            // Invalid function call : we try to create a revision, but the
            // descriptors won't allow it
View Full Code Here

            (token, associatedObject,
             namespaceConfig.getReadRevisionMetadataAction());
        lockHelper.checkLock(token, associatedObject,
                             namespaceConfig.getReadRevisionMetadataAction());
       
        Uri objectUri = namespace.getUri(token, revisionDescriptors.getUri());
       
        NodeRevisionDescriptor revisionDescriptor =
            objectUri.getStore().retrieveRevisionDescriptor
            (objectUri, revisionNumber);
       
        // Invoke interceptors
        invokeInterceptors(token, revisionDescriptors, revisionDescriptor,
                           null, POST_RETRIEVE);
       
        // Fire event
        if ( ContentEvent.RETRIEVE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(ContentEvent.RETRIEVE, new ContentEvent(this, token, namespace,  objectUri.toString(), revisionDescriptors, revisionDescriptor));

        return revisionDescriptor;
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.common.Uri

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.