Package org.apache.slide.structure

Examples of org.apache.slide.structure.ObjectNode


     * @param privilegeNamespace The name space of the action.
     * @return The action having the simple name and namespace.
     * @throws SlideException There was a problem accessing the actions in the repository.
     */
    private ObjectNode findAction(Iterator actionsIterator, String privilegeName, String privilegeNamespace) throws SlideException {
        ObjectNode result = null;
        while (result == null && actionsIterator.hasNext()) {
            String aUriAsString = (String) actionsIterator.next();
            ObjectNode aNode = structure.retrieve(slideToken, aUriAsString);
            if (aNode.hasChildren()) {
                result = findAction(aNode.getChildren().iterator(), privilegeName, privilegeNamespace);
            }
            else {
                Uri aUri = token.getUri(slideToken, aUriAsString);
                NodeRevisionDescriptors nrds = aUri.getStore().retrieveRevisionDescriptors(aUri);
                NodeRevisionDescriptor latestNrd = aUri.getStore().retrieveRevisionDescriptor(aUri, nrds.getLatestRevision());
View Full Code Here


          }
        }

        // Checking if the resource at the URI isn't a lock-null
        // resource, in which case we must attempt to delete it
        ObjectNode node = structure.retrieve(slideToken, requestUri);

        if (isLockNull(revisionDescriptor)) {
          content.remove(slideToken, requestUri, revisionDescriptor);
          content.remove(slideToken, revisionDescriptors);
          structure.remove(slideToken, node);
View Full Code Here

    }
   
    protected void recursiveAccessCheck(Uri uri, ActionNode action) throws SlideException,
    AccessDeniedException {
        try {
            ObjectNode node = uri.getStore().retrieveObject(uri);
            securityHelper.checkCredentials(uri.getToken(), node, action);
            Iterator i = node.getChildren().iterator();
            while (i.hasNext()) {
                String child = (String) i.next();
                Uri childUri = namespace.getUri(uri.getToken(), child);
                recursiveAccessCheck(childUri, action);
            }
View Full Code Here

    protected void recursiveLockCheck(Uri uri) throws SlideException,
            ObjectLockedException
    {
        try {
            ObjectNode node = uri.getStore().retrieveObject(uri);
            ActionNode action = namespaceConfig.getCreateObjectAction();
            lockHelper.checkLock(uri.getToken(), node, action);
            Iterator i = node.getChildren().iterator();
            while (i.hasNext()) {
                String child = (String) i.next();
                Uri childUri = namespace.getUri(uri.getToken(), child);
                recursiveLockCheck(childUri);
            }
View Full Code Here

        }
        //----------------
       
        UriHandler destinationUh = new UriHandler(destinationUri);
        UriHandler destinationParentUh = destinationUh.getParent();
        ObjectNode destinationParentNode = null;
        String destinationSegment = destinationUh.getLastSegment();
        UriHandler sourceUh = new UriHandler(sourceUri);
        UriHandler sourceParentUh = sourceUh.getParent();
        ObjectNode sourceParentNode = null;
        String sourceSegment = sourceUh.getLastSegment();
        ObjectNode sourceNode = null;
       
        try {
            try {
                destinationParentNode =
                    structureHelper.retrieve(token, destinationParentUh.toString(), false );
View Full Code Here

                // skip
                return;
            }
           
            // Remember children of orginal source
            ObjectNode sourceNode =
                structureHelper.retrieve(token, sourceUri, false);
            Enumeration sourceNodeChildren = sourceNode.enumerateChildren();
            ObjectNode destinationNode = null;
           
            // now let the client redirect
            if (copyRedirector != null) {  // TODO: dump re-directing
                CopyRoute copyRoute = new CopyRoute(sourceUri, destinationUri);
                copyRoute = copyRedirector.getRedirectedCopyRoute(copyRoute);
                sourceUri = copyRoute.getSourceUri();
                destinationUri = copyRoute.getDestinationUri();
                sourceNode = structureHelper.retrieve(token, sourceUri, false);
                // note that childrenList is *not* re-assigned. This might be a bug ...
            }
           
            // notify CopyListener
            if (copyListener != null) {
                copyListener.beforeCopy(sourceUri, destinationUri, isRootOfCopy );
            }
           
            // delete target if it is the root of the copied tree
            if (isRootOfCopy && parameters.isDeleteCreate()) {
                try {
                    // We make sure the object we want to overwrite exists
                    structureHelper.retrieve(token, destinationUri);
                    if (parameters.getParameter(PARENT_BINDINGS) != null) {
                        Map parentBindings = (Map)parameters.getParameter(PARENT_BINDINGS);
                        Iterator i = parentBindings.entrySet().iterator();
                        while (i.hasNext()) {
                            Map.Entry me = (Map.Entry)i.next();
                            String uriToDelete = (String)me.getKey()+"/"+(String)me.getValue();
                            delete(token, uriToDelete, deleteRedirector, deleteListener);
                        }
                    }
                    else {
                        delete(token, destinationUri, deleteRedirector, deleteListener);
                    }
                } catch(ObjectNotFoundException onf) {
                    // Silent catch, the target doesn't exist
                } catch(DeleteMacroException s) {
                    Enumeration en = s.enumerateExceptions();
                    if (en.hasMoreElements()) {
                        throw (SlideException)en.nextElement();
                    }
                }
            }
           
            boolean destinationExists = destinationExists(token, destinationUri);
           
            // Creating the copy
            if (parameters.isDeleteCreate() || !destinationExists) {
                try {
                    Map alreadyCopied = (Map)parameters.getParameter( ALREADY_COPIED );
                   
                    if (alreadyCopied.containsKey(sourceNode.getUuri())) {
                        // If a COPY request would cause a new resource to be created
                        // as a copy of an existing resource, and that COPY request
                        // has already created a copy of that existing resource,
                        // the COPY request instead creates another binding to the
                        // previous copy, instead of creating a new resource.
                        UriHandler destinationUh = new UriHandler(destinationUri);
                        UriHandler destinationParentUh = destinationUh.getParent();
                        String segment = destinationUh.getLastSegment();
                        destinationNode = structureHelper.retrieve( token, (String)alreadyCopied.get(sourceNode.getUuri()) );
                        ObjectNode destinationParentNode = structureHelper.retrieve( token, destinationParentUh.toString() );
                        structureHelper.addBinding( token, destinationParentNode, segment, destinationNode );
                    }
                    else {
                        structureHelper.create(token, sourceNode.copyObject(),
                                               destinationUri);
View Full Code Here

                              DeleteTargetRedirector deleteRedirector, DeleteListener deleteListener) {
       
        Domain.debug("Delete object : " + targetUri);
       
        try {
            ObjectNode currentObject =
                structureHelper.retrieve(token, targetUri, false);
           
            if (!Configuration.useBinding(namespace.getUri(token, targetUri).getStore()) || currentObject.numberOfParentBindings() < 2) {
                // Removing children objects
                if (currentObject.hasChildren()) {
                    Enumeration children = currentObject.enumerateChildren();
                    while (children.hasMoreElements()) {
                        String childUri = (String)children.nextElement();
                        deleteObject(token, childUri, e, deleteRedirector, deleteListener);
                    }
                }

                // Removing links objects
                if (currentObject.hasLinks()) {
                    Enumeration links = currentObject.enumerateLinks();
                    while (links.hasMoreElements()) {
                        String linkUri = (String)links.nextElement();
                        deleteObject(token, linkUri, e, deleteRedirector, deleteListener);
                    }
                }
               
               
                // now let the client redirect
                if (deleteRedirector != null) {
                    targetUri = deleteRedirector.getRedirectedTargetUri(targetUri);
                    currentObject =  structureHelper.retrieve(token, targetUri, false);
                }
               
                // notify DeleteListener
                if (deleteListener != null) {
                    deleteListener.beforeDelete(targetUri);
                }
               
                NodeRevisionDescriptors revisionDescriptors =
                    contentHelper.retrieve(token, currentObject.getUri());
              
                // remove the associated locks
                Enumeration locks = lockHelper.enumerateLocks
                    (token, currentObject.getUri(), false);
                while (locks.hasMoreElements()) {
                    lockHelper.unlock(token, (NodeLock) locks.nextElement());
                }
                // remove the associated security
                Enumeration permissions = securityHelper.enumeratePermissions
                    (token, currentObject);
                while (permissions.hasMoreElements()) {
                    NodePermission permission =
                        (NodePermission) permissions.nextElement();
                    securityHelper.revokePermission(token, permission);
                }
               
                // remove all revisions
                if( !revisionDescriptors.isRedirected() ) {
                    Enumeration revisionNumberEnum =
                        revisionDescriptors.enumerateRevisionNumbers();
                    if (revisionNumberEnum != null) {
                        while (revisionNumberEnum.hasMoreElements()) {
                            contentHelper.remove
                                (token, currentObject.getUri(),
                                     (NodeRevisionNumber)revisionNumberEnum.nextElement());
                        }
                    }
                    removeHiddenRevisions( token, targetUri );
                   
View Full Code Here

        return  result;
    }
   
    private RequestedResource createResource(String uri) throws SearchException
    {
        ObjectNode node = new SubjectNode(uri); // this will return the root folder
        RequestedResource resource = null;
        IBasicQuery query = factory.getQuery();
       
        try
        {
View Full Code Here

        return  result;
    }

    private RequestedResource createResource(String uri) throws SearchException
    {
        ObjectNode node = new SubjectNode(uri); // this will return the root folder
        RequestedResource resource = null;
        IBasicQuery query = factory.getQuery();

        try
        {
View Full Code Here

       
        try {
           
            nat.begin();
           
            ObjectNode user = new SubjectNode();
            structure.create(slideToken,user,userUri);
           
            // create the user descriptor
            NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor();
            descriptor.setCreationDate(new Date());
View Full Code Here

TOP

Related Classes of org.apache.slide.structure.ObjectNode

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.