Package org.apache.lenya.cms.publication

Examples of org.apache.lenya.cms.publication.DocumentBuilder


        Label[] labels = node.getLabels();
        for (int i = 0; i < labels.length; i++) {

            String language = labels[i].getLanguage();
            DocumentBuilder builder = publication.getDocumentBuilder();

            try {
                String url = builder.buildCanonicalUrl(publication, area, documentId, language);
                Document document = builder.buildDocument(publication, url);

                String servletContext = new File(servletContextPath).getCanonicalPath();
                log("Deleting scheduler entry for document [" + document + "]");
                log("Resolving servlet [" + servletContext + "]");
View Full Code Here


  /** (non-Javadoc)
   * @see org.apache.lenya.cms.publication.SiteTreeNodeVisitor#visitSiteTreeNode(org.apache.lenya.cms.publication.SiteTreeNode)
   */
  public void visitSiteTreeNode(SiteTreeNode node) {
    Publication publication = getPublication();
    DocumentBuilder builder = publication.getDocumentBuilder();

    String srcDocumentid = node.getAbsoluteId();
    String destDocumentid =
      srcDocumentid.replaceFirst(
        getFirstdocumentid(),
        getSecdocumentid());

    Label[] labels = node.getLabels();
    for (int i = 0; i < labels.length; i++) {
      String language = labels[i].getLanguage();
      String srcUrl =
        builder.buildCanonicalUrl(
          publication,
          getFirstarea(),
          srcDocumentid,
          language);
      Document srcDoc;
      try {
        srcDoc = builder.buildDocument(publication, srcUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      File srcFile = srcDoc.getFile();
      if (!srcFile.exists()) {
        log("There are no file " + srcFile.getAbsolutePath());
        return;
      }
      String destUrl =
        builder.buildCanonicalUrl(
          publication,
          getSecarea(),
          destDocumentid,
          language);
      Document destDoc;
      try {
        destDoc = builder.buildDocument(publication, destUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      File destFile = destDoc.getFile();

View Full Code Here

        String value = null;
        try {
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            Publication publication = envelope.getPublication();

            DocumentBuilder builder = publication.getDocumentBuilder();

            // Create canonical URL
            String canonicalUrl = builder
                    .buildCanonicalUrl(publication, area, documentId, language);

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Created canonicalURL: " + canonicalUrl);
            }

            // Get proxy for document
            serviceSelector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
                    + "Selector");
            acResolver = (AccessControllerResolver) serviceSelector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);

            AccessController accessController = acResolver.resolveAccessController(canonicalUrl);
            if (accessController instanceof DefaultAccessController) {
                DefaultAccessController defaultAccessController = (DefaultAccessController) accessController;
                accreditableManager = defaultAccessController.getAccreditableManager();
                Authorizer[] authorizers = defaultAccessController.getAuthorizers();
                for (int i = 0; i < authorizers.length; i++) {
                    if (authorizers[i] instanceof PolicyAuthorizer) {
                        PolicyAuthorizer policyAuthorizer = (PolicyAuthorizer) authorizers[i];
                        policyManager = policyAuthorizer.getPolicyManager();
                    }
                }
            }

            Policy policy = policyManager.getPolicy(accreditableManager, canonicalUrl);

            Document doc = builder.buildDocument(publication, canonicalUrl);

            Proxy proxy = doc.getPublication().getProxy(doc, policy.isSSLProtected());

            if (proxy != null) {
                value = proxy.getURL(doc);
View Full Code Here

        SiteTreeNode[] children = node.getChildren(language);
        if (children.length > 0) {

            String childNodeId = children[0].getId();
            String childId = id + "/" + childNodeId;
            DocumentBuilder builder = publication.getDocumentBuilder();
            String url = builder.buildCanonicalUrl(publication, area, childId, language);
            Document childDocument = builder.buildDocument(publication, url);

            if (!childDocument.existsInAnyLanguage()) {
                throw new NoChildDocumentExistException("The document " + childId + " does not exist. Check sitetree, it might need to be reloaded.");
            }
            List availableLanguages = Arrays.asList(childDocument.getLanguages());
View Full Code Here

   * @return the document with the given language
   *
   * @throws ProcessingException if the document for the given language could not be created.
   */
    protected Document getDocument(String language) throws ProcessingException {
        DocumentBuilder builder = pageEnvelope.getPublication().getDocumentBuilder();
        Document document = builder.buildLanguageVersion(pageEnvelope.getDocument(), language);
        return document;
    }
View Full Code Here

     */
    public Document[] getReferences(String area) throws ProcessingException {
       
        try {
            PublicationHelper pubHelper = new PublicationHelper(this.publication);
            DocumentBuilder builder = publication.getDocumentBuilder();
            Document[] documents = pubHelper.getAllDocuments(area);
            ArrayList targetDocuments = new ArrayList();

            for (int docIndex = 0; docIndex < documents.length; docIndex++) {
                String[] links = getInternalLinks(documents[docIndex].getFile());
               
                for (int linkIndex = 0; linkIndex < links.length; linkIndex++) {
                    if (builder.isDocument(publication, links[linkIndex])) {
                        Document targetDocument = builder.buildDocument(publication, links[linkIndex]);

                        if (targetDocument.equals(document)) {
                            if (log.isDebugEnabled()) {
                                log.debug("found link to " + document + " in " + documents[docIndex]);
                            }
View Full Code Here

     *
     * @throws ProcessingException if the current document cannot be opened.
     */
    public Document[] getInternalReferences() throws ProcessingException {
        ArrayList unpublishedReferences = new ArrayList();
        DocumentBuilder builder = publication.getDocumentBuilder();

        try {
            SiteTree sitetree = publication.getTree(Publication.LIVE_AREA);
            String[] links = getInternalLinks(this.document.getFile());
           
            for (int linkIndex = 0; linkIndex < links.length; linkIndex++) {
                if (builder.isDocument(publication, links[linkIndex])) {
                    Document targetDocument = builder.buildDocument(publication, links[linkIndex]);

                    SiteTreeNode documentNode = sitetree.getNode(targetDocument.getId());

                    if (documentNode == null || documentNode.getLabel(targetDocument.getLanguage()) == null) {
                        // the document has not been published for the given language
View Full Code Here

      // TODO: resources (fix the build file)
      // TODO: rcml (fix the build file)
      // TODO: rcbak (fix the build file)

      //move workflow
      DocumentBuilder builder = publication.getDocumentBuilder();
      String url = builder.buildCanonicalUrl(publication, firstarea, srcDocumentid, language);
      String newurl =
        builder.buildCanonicalUrl(publication, secarea, destDocumentid, language);

      Document document;
      Document newDocument;
      WorkflowFactory factory = WorkflowFactory.newInstance();

      log("move workflow history");
      try {
        document = builder.buildDocument(publication, url);
        newDocument = builder.buildDocument(publication, newurl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      try {
        if (factory.hasWorkflow(document)) {
View Full Code Here

      if (node != null) {
        labels = node.getLabels();
      }
      if (node == null || (labels != null && labels.length < 1)) {

        DocumentBuilder builder = publication.getDocumentBuilder();
        String url = builder.buildCanonicalUrl(publication, area, documentid, language);
        Document doc;
        try {
          doc = builder.buildDocument(publication, url);
        } catch (DocumentBuildException e) {
          throw new BuildException(e);
        }
        ResourcesManager resourcesMgr = new ResourcesManager(doc);
        File[] resources = resourcesMgr.getResources();
View Full Code Here

     * @see org.apache.tools.ant.Task#execute()
     */
    public void execute() throws BuildException {

        try {
            DocumentBuilder builder = getPublication().getDocumentBuilder();

            String authoringUrl =
                builder.buildCanonicalUrl(getPublication(), Publication.AUTHORING_AREA, documentId);
            Document authoringDocument = builder.buildDocument(getPublication(), authoringUrl);
            ResourcesManager authoringManager = new ResourcesManager(authoringDocument);

            String liveUrl =
                builder.buildCanonicalUrl(getPublication(), Publication.LIVE_AREA, documentId);
            Document liveDocument = builder.buildDocument(getPublication(), liveUrl);
            ResourcesManager liveManager = new ResourcesManager(liveDocument);
           
            // find all resource files and their associated meta files
            List resourcesList =
                new ArrayList(Arrays.asList(authoringManager.getResources()));
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.DocumentBuilder

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.