Examples of UriHandler


Examples of org.apache.slide.webdav.util.UriHandler

   
    /**
     * Factory method.
     */
    static public ResourceKind determineResourceKind( NamespaceAccessToken nsaToken, NodeRevisionDescriptors nrds, NodeRevisionDescriptor nrd ) {
        UriHandler uh = UriHandler.getUriHandler( nrds, nrd );
        return determineResourceKind( nsaToken, uh.toString(), nrd );
    }
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

   
    /**
     * 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();
        }
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

            slideToken = new SlideTokenWrapper(slideToken, false); // check only, no enlistment
        }
       
        // Added for DeltaV --start--
        if( Configuration.useVersionControl() ) {
            UriHandler uh = UriHandler.getUriHandler( path );
            if( uh.isWorkspaceUri() )
                return true;
            if( uh.isHistoryUri() )
                return true;
            if( uh.isVersionUri() )
                return false;
        }
        // Added for DeltaV --end--
       
        try {
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

       
        // Prevent dirty reads
        slideToken.setForceStoreEnlistment(true);
       
        // check destination URI
        UriHandler destUh = UriHandler.getUriHandler(resourcePath);
        if( VersionControlMethod.VERSIONCONTROL_EXCLUDEPATH != null && VersionControlMethod.VERSIONCONTROL_EXCLUDEPATH.length() > 0 ) {
            UriHandler exUh = UriHandler.getUriHandler( VersionControlMethod.VERSIONCONTROL_EXCLUDEPATH );
            if( exUh.isAncestorOf(destUh) )
                isInVersioncontrolExcludePath = true;
        }
       
        if (destUh.isRestrictedUri()) {
            boolean sendError = true;
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

                                                    WebdavStatus.SC_FORBIDDEN);
                }
            }
           
            // check precondition DAV:cannot-modify-version
            UriHandler uriHandler = UriHandler.getUriHandler(resourcePath);
            if (uriHandler.isVersionUri()) {
                return new ViolatedPrecondition(C_CANNOT_MODIFY_VERSION,
                                                WebdavStatus.SC_FORBIDDEN);
            }
        }
        return null;
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

       
        this.versionHistorySet =
            new XMLValue(versionHistorySetElm.getChildren(E_HREF, DNSP));
       
        // check DAV:must-be-version-history
        UriHandler uriHandler = null;
        String href = null;
        boolean isVersionHistory = false;
        Iterator iterator = versionHistorySet.getHrefStrings().iterator();
        while (iterator.hasNext()) {
            href = (String)iterator.next();
            uriHandler = UriHandler.getUriHandler(WebdavUtils.getSlidePath(href, contextPath));
            isVersionHistory = uriHandler.isHistoryUri();
            if (!isVersionHistory) {
                break;
            }
        }
        if (!isVersionHistory) {
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

            try {
                XMLValue xmlValue = new XMLValue(property.getValue().toString());
                Iterator iterator = xmlValue.iterator();
                if (iterator.hasNext()) {
                    String vrUri = ((Element)iterator.next()).getText();
                    UriHandler uriHandler = UriHandler.getUriHandler(vrUri);
                    if (uriHandler.isVersionUri()) {
                        historyUri = uriHandler.getAssociatedHistoryUri();
                    }
                }
            }
            catch (JDOMException e) {}
        }
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

            }
        }

        String associatedVrUri = versioningHelper.getUriOfAssociatedVR(resourcePath);
        String vcrHistoryUri = UriHandler.getUriHandler(associatedVrUri).getAssociatedHistoryUri();
        UriHandler vrUriHandler = UriHandler.getUriHandler(updateSourcePath);
        boolean isVersionOfVcrHistory = false;
        if (vrUriHandler.isVersionUri() &&
            vcrHistoryUri.equals(vrUriHandler.getAssociatedHistoryUri()) ) {

            NodeRevisionDescriptors vrDescriptors =
                content.retrieve(stoken, updateSourcePath);
            try {
                NodeRevisionDescriptor vrDescriptor =
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

     *
     * @param resourcePath the URI of the resource to version-control
     * @throws SlideException
     */
    public void versionControl( String resourcePath ) throws SlideException {
        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        Iterator i;
        Enumeration j;
       
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
        ResourceKind rRk = AbstractResourceKind.determineResourceKind( nsaToken, resourcePath, rNrd );
        if( !rRk.isSupportedMethod(req.getMethod()) ) {
            throw new MethodNotAllowedException( rRk );
        }
       
        // Check for rRk = K_VERSION_CONTROLLED*
        if( rRk instanceof VersionControlled ) {
            // nothing to do
            return;
        }
       
        // Set initial VR properties
        NodeRevisionDescriptor vrNrd =
            new NodeRevisionDescriptor(req.getContentLength());
        i = pHelp.createInitialProperties(VersionImpl.getInstance()).iterator();
        while( i.hasNext() )
            vrNrd.setProperty( (NodeProperty)i.next() );
       
        // Copy dead properties VCR -> VR
        j = rNrd.enumerateProperties();
        while( j.hasMoreElements() ) {
            NodeProperty p = (NodeProperty)j.nextElement();
            if( p.isLiveProperty() )
                continue;
            if( !vrNrd.exists(p.getName()) )
                vrNrd.setProperty( p );
        }
       
        // Copy properties VCR->VR
        NodeRevisionContent rNrc = content.retrieve( sToken, rNrds, rNrd );
        vrNrd.setContentType(rNrd.getContentType()); // P_GETCONTENTTYPE
        vrNrd.setContentLength(rNrd.getContentLength()); // P_GETCONTENTLENGTH
        vrNrd.setContentLanguage(rNrd.getContentLanguage()); // P_GETCONTENTLANGUAGE
        String comment = "INITIAL VERSION. ";
        if( rNrd.exists(P_COMMENT) )
            comment += (String)rNrd.getProperty(P_COMMENT).getValue();
        vrNrd.setProperty(
            new NodeProperty(P_COMMENT, comment) );
       
        // Set initial VHR properties
        Vector vhrLabels = new Vector();
        Hashtable vhrProps = new Hashtable();
        String vhrBranch = NodeRevisionDescriptors.MAIN_BRANCH;
        NodeRevisionDescriptor vhrNrd =
            new NodeRevisionDescriptor( NodeRevisionNumber.HIDDEN_0_0, vhrBranch, vhrLabels, vhrProps );
        i = pHelp.createInitialProperties(VersionHistoryImpl.getInstance()).iterator();
        while( i.hasNext() )
            vhrNrd.setProperty( (NodeProperty)i.next() );
       
        // Set initial VCR properties (do not overwrite existing!!)
        i = pHelp.createInitialProperties(VersionControlledImpl.getInstance()).iterator();
        while( i.hasNext() ) {
            NodeProperty p = (NodeProperty)i.next();
            if( !rNrd.exists(p.getName()) )
                rNrd.setProperty( p );
        }
       
        // Create VHR/VR
        UriHandler vhrUh = UriHandler.createNextHistoryUri( sToken, nsaToken, rUh );
        String vhrUri = String.valueOf( vhrUh );
        SubjectNode vhrNode = new SubjectNode();
        structure.create( sToken, vhrNode, String.valueOf(vhrUh) );
        content.create( sToken, vhrUri, true ); //isVersioned=true
        content.create( sToken, vhrUri, vrNrd, rNrc );
        NodeRevisionDescriptors vhrNrds =
            content.retrieve( sToken, vhrUri );
        content.create(
            sToken, vhrUri, null, vhrNrd, null ); //branch=null, revisionContent=null
       
        // Create VR node
        NodeRevisionNumber vrVersion = vrNrd.getRevisionNumber();
        SubjectNode vrNode = new SubjectNode();
        UriHandler vrUh =
            UriHandler.createVersionUri( vhrUh, String.valueOf(vrVersion) );
        String vrUri = String.valueOf( vrUh );
        structure.create( sToken, vrNode, String.valueOf(vrUh) );
       
        // Set specific properties
        vrNrd.setName(rUh.getName()); // P_DISPLAYNAME
        rNrd.setProperty(
            new NodeProperty(P_CHECKED_IN, pHelp.createHrefValue(vrUri)) );
        vhrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
        setCreationUser(vhrNrd);
        vhrNrd.setLastModified( new Date() ); // P_GETLASTMODIFIED
        vhrNrd.setContentLength( 0 ); // P_GETCONTENTLENGTH
        vhrNrd.setETag( PropertyHelper.computeEtag(vhrUri, vhrNrd) ); // P_GETETAG
        vhrNrd.setName( vhrUh.getHistoryName() ); // P_DISPLAYNAME
        vhrNrd.setProperty(
            new NodeProperty(P_VERSION_SET, pHelp.createHrefValue(vrUri)) );
        vrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
        setCreationUser(vrNrd);
        vrNrd.setLastModified( new Date() ); // P_GETLASTMODIFIED
        vrNrd.setETag( PropertyHelper.computeEtag(vrUri, vrNrd)); // P_GETETAG
        vrNrd.setProperty(
            new NodeProperty(P_VERSION_NAME, vrUh.getVersionName()) );
       
        // Store changes
        content.store( sToken, resourcePath, rNrd, null ); //revisionContent=null
        content.store( sToken, vhrUri, vhrNrd, null ); //revisionContent=null
        content.store( sToken, vhrUri, vrNrd, null ); //revisionContent=null
View Full Code Here

Examples of org.apache.slide.webdav.util.UriHandler

     * @throws SlideException
     */
    public void versionControl( String resourcePath, String existingVersionPath ) throws SlideException {
        Iterator i;
       
        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        UriHandler evUh = UriHandler.getUriHandler( existingVersionPath );
        if ( ! evUh.isVersionUri() ) {
            throw new PreconditionViolationException(
                new ViolatedPrecondition(C_MUST_BE_VERSION, WebdavStatus.SC_CONFLICT), resourcePath);
        }
        NodeRevisionNumber evNrn = new NodeRevisionNumber( evUh.getVersionName() );
        NodeRevisionDescriptors rNrds = null;
        NodeRevisionDescriptor rNrd = null;
        NodeRevisionDescriptors vcrNrds = null;
        NodeRevisionDescriptor vcrNrd = null;
        NodeRevisionDescriptors evNrds = null;
        NodeRevisionDescriptor evNrd = null;
       
        try {
            rNrds = content.retrieve( sToken, resourcePath );
            rNrd = content.retrieve( sToken, rNrds );
        }
        catch( ObjectNotFoundException e ) {}; // can be ignored here!
        try {
            evNrds = content.retrieve( sToken, existingVersionPath );
            evNrd = content.retrieve( sToken, evNrds /*, evNrn*/ ); //existingVersionPath
            //redirector should do the job
            //s.t. evNrn is not required
        }
        catch( ObjectNotFoundException e ) {}; // can be ignored here!
       
        ViolatedPrecondition violatedPrecondition =
            getVersionControlPreconditionViolation(resourcePath,
                                                   rNrd,
                                                   rUh,
                                                   existingVersionPath,
                                                   evNrd,
                                                   evUh);
        if (violatedPrecondition != null) {
            throw new PreconditionViolationException(violatedPrecondition,
                                                     resourcePath);
        }
       
        // create the VCR
        String vcrUri = String.valueOf(rUh);
        String evUri = String.valueOf(evUh);
        UriHandler vcrUh = UriHandler.getUriHandler( vcrUri );
        vcrNrd = new NodeRevisionDescriptor(0);
        i = pHelp.createInitialProperties(VersionControlledImpl.getInstance()).iterator();
        while( i.hasNext() )
            vcrNrd.setProperty( (NodeProperty)i.next() );
       
        // Set specific properties
        vcrNrd.setLastModified( new Date() ); //P_GETLASTMODIFIED
        vcrNrd.setContentLength( evNrd.getContentLength() ); // P_GETCONTENTLENGTH
        vcrNrd.setETag( PropertyHelper.computeEtag(vcrUri, vcrNrd))// P_GETETAG
        vcrNrd.setContentType( evNrd.getContentType() ); // P_GETCONTENTTYPE
        vcrNrd.setContentLanguage(evNrd.getContentLanguage()); // P_GETCONTENTLANGUAGE
       
        String[] utok = vcrUh.getUriTokens();
       
        if (!Configuration.useBinding(nsaToken.getUri(sToken, vcrUri).getStore())) {
            vcrNrd.setName( utok[utok.length - 1] ); // P_DISPLAYNAME
        }
        vcrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.