Package org.apache.slide.content

Examples of org.apache.slide.content.NodeRevisionContent


            revisionDescriptor.getRevisionNumber());
      debug("retrieveRevisionContent {0}", key);
     
      byte[] content = (byte[])get(key);
      if (content != null) {
         NodeRevisionContent revisionContent = new NodeRevisionContent();
         revisionContent.setContent(content);
         return revisionContent;
      } else {
         throw new RevisionNotFoundException(uri.toString(),
               revisionDescriptor.getRevisionNumber());
      }
View Full Code Here


            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) )
View Full Code Here

        setWorkspaceProperty( vcrUri, vcrNrd );
       
        // store
        SubjectNode vcrNode = new SubjectNode();
        structure.create( sToken, vcrNode, vcrUri );
        NodeRevisionContent evContent =
            content.retrieve( sToken, evNrds, evNrd );
        content.create( sToken, vcrUri, vcrNrd, evContent );
       
        // Set status created
        resp.setStatus( WebdavStatus.SC_CREATED );
View Full Code Here

        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
       
        if( rUh.isVersionUri() ) {
            NodeRevisionContent rNrc = content.retrieve( sToken, rNrds, rNrd );
            return checkout( rNrds, rNrd, rNrc, forkOk, null ); // autoUpdateUri=null
        }
        else {
            return checkout( rNrds, rNrd, forkOk, applyToVersion, isAutoVersionCheckout);
        }
View Full Code Here

            NodeRevisionDescriptors cinNrds = content.retrieve(sToken, cinhUri);
            NodeRevisionDescriptor cinNrd = content.retrieve(sToken, cinNrds, cinNrn);
           
            // working resource feature
            if( applyToVersion ) {
                NodeRevisionContent cinNrc = content.retrieve( sToken, cinNrds, cinNrd );
                return checkout( cinNrds, cinNrd, cinNrc, forkOk, rUri ); // autoUpdateUri=rUri
            }
           
            ViolatedPrecondition violatedPrecondition = getCheckoutPreconditionViolation(cinNrds, cinNrd, forkOk);
            if (violatedPrecondition != null) {
View Full Code Here

                new NodeProperty(P_COMMENT, comment) );
           
            vrNrdNew.setProperty( rNrd.getProperty(P_CHECKOUT_FORK) );
            vrNrdNew.setProperty( rNrd.getProperty(P_CHECKIN_FORK) );
           
            NodeRevisionContent rNrc = content.retrieve( sToken, rNrds, rNrd );
           
            if (forkBranch != null) {
                content.store(sToken, vhrUri, vrNrdNew, rNrc);
            }
            else {
View Full Code Here

       
        // set workspace
        setWorkspaceProperty( vcrUri, vcrRevisionDescriptor );
       
        // get the VR content
        NodeRevisionContent vrContent = content.retrieve(sToken, vrRevisionDescriptors, vrRevisionDescriptor);
       
        // store the content
        content.store( sToken, vcrUri, vcrRevisionDescriptor, vrContent );
    }
View Full Code Here

            super.close();

            byte[] bytes = new byte[0]; // must be initialized

            try {
                NodeRevisionContent content = new NodeRevisionContent();
                bytes = toByteArray();
                content.setContent(bytes);

                if (m_descriptor == null) {
                    m_descriptor = new NodeRevisionDescriptor(0);
                    m_descriptor.setName(getName());
                }

                m_descriptor.setContentLength(bytes.length);
                m_descriptor.setLastModified(new Date());

                m_nat.begin();
                if (m_version == null) {
                    m_content.create(m_slideToken,m_uri,m_descriptor,null);
                }
                m_content.store(m_slideToken,m_uri,m_descriptor,content);
                try {
                    m_nat.commit();
                } catch (Exception cme) {
                    throw new CascadingIOException("Could not commit the transaction",cme);
                }

            } catch (ObjectNotFoundException e) {
               
                // Todo : Check to see if parent exists
                SubjectNode subject = new SubjectNode();

                try {
                    // Creating an object
                    m_structure.create(m_slideToken,subject,m_uri);
                } catch (SlideException se) {
                    throw new CascadingIOException(se);
                }

                NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor(bytes.length);
                descriptor.setResourceType("");
                descriptor.setSource("");
                descriptor.setContentLanguage("en");
                descriptor.setContentLength(bytes.length);
                String contentType = null;

                try {
                    contentType = ((org.apache.cocoon.environment.Context)
                        m_context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getMimeType(m_path);
                } catch (ContextException ce) {
                    this.logger.warn("Could not get context to determine the mime type.");
                }
                if (contentType == null) {
                    contentType = "application/octet-stream";
                }
                descriptor.setContentType(contentType);
                descriptor.setLastModified(new Date());
                descriptor.setOwner(m_slideToken.getCredentialsToken().getPublicCredentials());
                NodeRevisionContent content = new NodeRevisionContent();
               
                content.setContent(bytes);
                try {
                    m_content.create(m_slideToken,m_uri,descriptor,content);
                    try {
                        m_nat.commit();
                    } catch (Exception cme) {
View Full Code Here

                if (result != null) {
                    getLogger().log("Retrieving content at '" + key + "' from cache", LOG_CHANNEL, Logger.DEBUG);
                    // FIXME make a copy?! how?
                    return (NodeRevisionContent) result;
                } else {
                    NodeRevisionContent revisionContent = super.retrieveRevisionContent(uri, revisionDescriptor);
                    long size = revisionDescriptor.getContentLength();
                    // Do not add content to global cache, as this might violate repeatable read.
                    // When we reread the entry later and another thread has committed its stuff
                    // into the global cache we might get a different version on the second read.
                    contentCache.put(key, revisionContent, size);
View Full Code Here

     * @param revisionDescriptor Node revision descriptor
     */
    public NodeRevisionContent retrieveRevisionContent
        (Uri uri, NodeRevisionDescriptor revisionDescriptor)
        throws ServiceAccessException, RevisionNotFoundException {
        NodeRevisionContent revisionContent = null;
        if (isForceStoreEnlistment(uri)) {
            enlist(contentStore);
            try {
                revisionContent =
                    contentStore.retrieveRevisionContent
                    (uri, revisionDescriptor);
               
            } catch (ServiceAccessException e) {
                delist(contentStore, false);
                throw e;
            } catch (RevisionNotFoundException e) {
                // Normal read failures aren't considered fatal
                delist(contentStore);
                throw e;
            } catch (Throwable t) {
                delist(contentStore, false);
                // Wrap everything else in a ServiceAccessException
                throw new ServiceAccessException
                    (contentStore, t);
            }
            delist(contentStore);
        } else {
            try {
                revisionContent =
                    contentStore.retrieveRevisionContent
                    (uri, revisionDescriptor);
            } catch (ServiceAccessException e) {
                throw e;
            } catch (RevisionNotFoundException e) {
                throw e;
            } catch (Throwable t) {
                // Wrap everything else in a ServiceAccessException
                throw new ServiceAccessException
                    (contentStore, t);
            }
        }
        revisionContent.validate();
        return revisionContent;
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.content.NodeRevisionContent

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.