Package org.apache.slide.common

Examples of org.apache.slide.common.NamespaceConfig


           
            case LOCK_CREATION:
               
                try {
                   
                    NamespaceConfig namespaceConfig = token.getNamespaceConfig();
                   
                    try {
                        toLockSubject = (SubjectNode) structure
                            .retrieve(slideToken, lockInfo_lockSubject);
                    } catch (ObjectNotFoundException ex) {
                       
                        // Creating a lock null resource
                        toLockSubject = new SubjectNode();
                       
                        // Creating new subject
                        structure.create(slideToken, toLockSubject,
                                         lockInfo_lockSubject);
                       
                        NodeRevisionDescriptor revisionDescriptor =
                            new NodeRevisionDescriptor(0);
                       
                        // Resource type
                        XMLValue lockNull =
                            new XMLValue(new Element(E_LOCKNULL, DNSP));
                        revisionDescriptor.setResourceType(lockNull.toString());
                       
                        // Creating the revision descriptor
                        content.create(slideToken, lockInfo_lockSubject,
                                       revisionDescriptor, null);
                    }
                   
                    NodeLock lockToken = null;
                   
                    inheritance = (depth != 0);
                    boolean exclusive =
                        !(lockInfo_lockScope.equals(E_SHARED));
                   
                    if (lockDate == null)
                        lockDate = new Date((new Date()).getTime()
                                                + ((long)lockDuration * 1000L));
                   
                    lockToken =
                        new NodeLock(toLockSubject, (SubjectNode)security.getPrincipal(slideToken),
                                     namespaceConfig.getCreateObjectAction(),
                                     lockDate, inheritance, exclusive, lockInfo_lockOwner);
                    lock.lock(slideToken, lockToken);
                   
                    // Set the lock-token header
                    // [RFC 2518, 9.5] " The Lock-Token response header is used
View Full Code Here


    switch (lockType) {

    case LOCK_CREATION:
      if (lockInfo_lockType.equals(E_TRANSACTION)) {
        try {
          NamespaceConfig namespaceConfig = token
          .getNamespaceConfig();
                    toLockSubject = getToLockSubject();
                    if (lockDate == null)
                        lockDate = new Date((new Date()).getTime()
                                + ((long) lockDuration * 1000L));
          NodeLock lockToken = new NodeLock(toLockSubject.getUri(),((SubjectNode)security.getPrincipal(slideToken)).getUri(),
              namespaceConfig.getCreateObjectAction().getUri(), lockDate,
              inheritance, NodeLock.LOCAL, lockInfo_lockOwner);
                    token.setTransactionTimeout(lockDuration * 1000);
          Transaction transaction = token.getTransactionManager().suspend();
                    //String txId = lockToken.getLockId();
                    String fullTxId = "<" + S_LOCK_TOKEN + lockToken.getLockId() + ">";
                    ExternalTransactionContext.registerContext(fullTxId, transaction);
                    slideToken.setExternalTx();
                    resp.setHeader("Lock-Token", fullTxId);
                    showLockDiscoveryInfo(lockToken);
        } catch (Exception e) {
          int statusCode = getErrorCode(e);
          sendError(statusCode, e);
          throw new WebdavException(statusCode);
        }
      } else if (lockInfo_lockType.equals(E_WRITE)) {
        try {
                   
                if (!checkIfHeaders()) {
                    return;
                }
                     
          NamespaceConfig namespaceConfig = token
              .getNamespaceConfig();
                    toLockSubject = getToLockSubject();
          NodeLock lockToken = null;

          inheritance = (depth != 0);
          boolean exclusive = !(lockInfo_lockScope.equals(E_SHARED));

          if (lockDate == null)
            lockDate = new Date((new Date()).getTime()
                + ((long) lockDuration * 1000L));

          lockToken = new NodeLock(toLockSubject,
              (SubjectNode) security.getPrincipal(slideToken),
              namespaceConfig.getCreateObjectAction(), lockDate,
              inheritance, exclusive, lockInfo_lockOwner);
          lock.lock(slideToken, lockToken);

          // Set the lock-token header
          // [RFC 2518, 9.5] " The Lock-Token response header is used
View Full Code Here

                                         "This report is only defined for depth=0."),
                resourcePath
            );
        }
        UriPath resourcepath = new UriPath(resourcePath);
        NamespaceConfig namespaceConfig = token.getNamespaceConfig();
        UriPath userspath = namespaceConfig.getUsersPath() != null
            ? new UriPath(namespaceConfig.getUsersPath())
            : null;
        UriPath groupspath = namespaceConfig.getGroupsPath() != null
            ? new UriPath(namespaceConfig.getGroupsPath())
            : null;
        UriPath rolespath = namespaceConfig.getRolesPath() != null
            ? new UriPath(namespaceConfig.getRolesPath())
            : null;
        if (!resourcepath.equals(userspath) &&
            !resourcepath.equals(groupspath) &&
            !resourcepath.equals(rolespath)) {
            throw new PreconditionViolationException(
View Full Code Here

     */
    public XMLValue computeCurrentuserPrivilegeSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
       
        try {
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode object =  structure.retrieve(sToken, revisionDescriptors.getUri());

        // check read-own-permissions permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, object, config.getReadOwnPermissionsAction());
       
            String actionsPath = config.getActionsPath();
            Uri actionsPathUri = nsaToken.getUri(sToken, actionsPath);
            ObjectNode actionsPathNode = actionsPathUri.getStore().retrieveObject(actionsPathUri);
            Enumeration actions = actionsPathNode.enumerateChildren();
            addGrantedActionsToPrivilegeSet(xmlValue, object, actions);
        }
View Full Code Here

    //public XMLValue computeAcl(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String serverURL) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException, VetoException {
    public XMLValue computeAcl(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException, VetoException {
        // FIXME serverUrl?
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode objectNode =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-acl permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, objectNode, config.getReadPermissionsAction());
       
        String currentSubjectUri = "";
        boolean currentNegative = false;
        String currentInheritedFrom = "";
        Element currentAceElm = null;
View Full Code Here

     * @throws   ObjectNotFoundException
     * @throws   JDOMException
     */
    public XMLValue computePrincipalCollectionSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
        NamespaceConfig namespaceConfig = nsaToken.getNamespaceConfig();
       
        xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getUsersPath(),
                slideContextPath, sConf));
       
        if (namespaceConfig.getGroupsPath() != null) {
           
            xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getGroupsPath(),
                    slideContextPath, sConf));
        }
        if (namespaceConfig.getRolesPath() != null) {
            xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getRolesPath(),
                    slideContextPath, sConf));
        }
        return xmlValue;
    }
View Full Code Here

    }
   
   
    public XMLValue computePrivilegeCollectionSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
        NamespaceConfig namespaceConfig = nsaToken.getNamespaceConfig();
       
        String absUri = WebdavUtils.getAbsolutePath (namespaceConfig.getActionsPath(),
                slideContextPath, sConf);
       
        xmlValue.addHref(absUri);
        return xmlValue;
    }
View Full Code Here

    private XMLValue createUserPath(NodeProperty userProperty, String slideContextPath)
       throws IllegalArgumentException
    {
        XMLValue xmlValue = new XMLValue();
        String userHref = "";
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        if ((userProperty != null) && (userProperty.getValue()!=null) &&
                (!"".equals(userProperty.getValue().toString()))) {
           
            userHref = slideContextPath + config.getUsersPath()
                       + "/" + userProperty.getValue().toString();
            xmlValue.addHref(userHref);
        }
        else {
            xmlValue.add(new Element(E_UNAUTHENTICATED, DNSP));
View Full Code Here

    /**
     * Factory method.
     */
    static public ResourceKind determineResourceKind( NamespaceAccessToken nsaToken, String resourcePath, NodeRevisionDescriptor nrd ) {
        UriHandler uh = UriHandler.getUriHandler( resourcePath );
        NamespaceConfig config = nsaToken.getNamespaceConfig();
       
        if( nrd == null ) {
            return DeltavCompliantUnmappedUrlImpl.getInstance();
        }
        else if( uh.isHistoryUri() ) {
            return VersionHistoryImpl.getInstance();
        }
        else if( uh.isVersionUri() ) {
            return VersionImpl.getInstance();
        }
        else if( uh.isWorkspaceUri() ) {
            return WorkspaceImpl.getInstance();
        }
        else if( uh.isWorkingresourceUri() ) {
            return WorkingImpl.getInstance();
        }
        else if( nrd.exists(P_CHECKED_IN) ) {
            return CheckedInVersionControlledImpl.getInstance();
        }
        else if( nrd.exists(P_CHECKED_OUT) ) {
            return CheckedOutVersionControlledImpl.getInstance();
        }
        else if( config.isPrincipal(resourcePath) ) {
            return PrincipalImpl.getInstance();
        }
        else if( nrd.propertyValueContains(P_RESOURCETYPE, E_COLLECTION) ) {
            return DeltavCompliantCollectionImpl.getInstance();
        }
View Full Code Here

     * @throws   JDOMException
     */
    public XMLValue computeCurrentuserPrivilegeSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode object =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-own-permissions permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, object, config.getReadOwnPermissionsAction());
       
        try {
            String actionsPath = config.getActionsPath();
            Uri actionsPathUri = nsaToken.getUri(sToken, actionsPath);
            ObjectNode actionsPathNode = actionsPathUri.getStore().retrieveObject(actionsPathUri);
            Enumeration actions = actionsPathNode.enumerateChildren();
            while (actions.hasMoreElements()) {
                ActionNode aNode = ActionNode.getActionNode((String)actions.nextElement());
View Full Code Here

TOP

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

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.