Package org.apache.lenya.cms.publication

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


      log("document-id for the source :" + this.getFirstdocumentid());
      log("area for the source :" + this.getFirstarea());
      log("document-id for the destination :" + this.getSecdocumentid());
      log("area for the destination :" + this.getSecarea());

      Publication publication = getPublication();
      SiteTree tree = publication.getTree(this.getSecarea());
      SiteTreeNode node = tree.getNode(this.getSecdocumentid());
      node.acceptReverseSubtree(this);
    } catch (Exception e) {
      throw new BuildException(e);
    }
View Full Code Here


      log("rcml dir" + this.getRcmldir());
      log("rcbak dir" + this.getRcbakdir());
      log("src area dir" + this.getSrcareadir());

      //visit the destination tree
      Publication publication = getPublication();
      SiteTree tree = publication.getTree(this.getSecarea());
      SiteTreeNode node = tree.getNode(this.getSecdocumentid());
      node.acceptReverseSubtree(this);

    } catch (Exception e) {
      throw new BuildException(e);
View Full Code Here

     * @throws ConfigurationException if an error occurs
     */
    protected void doTest(String target) throws ExecutionException, ParameterException, ConfigurationException, SAXException, IOException {
        System.out.println("Testing target [" + target + "]:");

        Publication publication = PublicationHelper.getPublication();

        TaskManager manager = new TaskManager(publication.getDirectory().getCanonicalPath());
        AntTask task = (AntTask) manager.getTask(TaskManager.ANT_TASK);

        Parameters parameters = getTaskParameters();
        parameters.setParameter(Task.PARAMETER_PUBLICATION_ID, publication.getId());
        parameters.setParameter(Task.PARAMETER_CONTEXT_PREFIX, "/lenya");
        parameters.setParameter(Task.PARAMETER_SERVLET_CONTEXT,
            publication.getServletContext().getCanonicalPath());
        parameters.setParameter(AntTask.TARGET, getTarget());
        task.parameterize(parameters);

        final GregorianCalendar beforeExecution = new GregorianCalendar();

        task.execute(publication.getServletContext().getCanonicalPath());

        File logDirectory = new File(publication.getDirectory(), AntTask.LOG_PATH);
        File[] logFiles = logDirectory.listFiles(new FileFilter() {
                    public boolean accept(File file) {
                        return file.lastModified() > beforeExecution.getTimeInMillis();
                    }
                });
View Full Code Here

  /**
   *  (non-Javadoc)
   * @see org.apache.lenya.cms.task.AntTaskTest#evaluateTest()
   */
    protected void evaluateTest() throws IOException {
        Publication pub = PublicationHelper.getPublication();
        DocumentIdToPathMapper mapper = pub.getPathMapper();
        File publishedFile = mapper.getFile(pub, Publication.LIVE_AREA, DOCUMENT_ID, DOCUMENT_LANGUAGE);
        System.out.println("Path of file to publish: " + publishedFile);
        assertTrue(publishedFile.exists());
        System.out.println("Published file exists: " + publishedFile.getCanonicalPath());
    }
View Full Code Here

   */
    protected Parameters getTaskParameters() {
        Parameters parameters = super.getTaskParameters();
        parameters.setParameter("properties.publish.documentid", DOCUMENT_ID);
        parameters.setParameter("properties.publish.language", DOCUMENT_LANGUAGE);
        Publication pub = PublicationHelper.getPublication();
        DocumentIdToPathMapper mapper = pub.getPathMapper();
        parameters.setParameter("properties.publish.sources", mapper.getPath(DOCUMENT_ID, DOCUMENT_LANGUAGE));

        return parameters;
    }
View Full Code Here

     * @throws CreatorException when something went wrong.
     * @throws SiteTreeException when something went wrong.
     */
    public void testCreator()
        throws CreatorException, SiteTreeException {
        Publication publication = PublicationHelper.getPublication();
        DocumentCreator creator = new DocumentCreator();
        File authoringDirectory = new File(publication.getDirectory(), AUTHORING_DIR);

        creator.create(publication, authoringDirectory, AREA, PARENT_ID, CHILD_ID, CHILD_NAME,
            CHILD_TYPE, DOCUMENT_TYPE, DOCUMENT_LANGUAGE, VISIBLEINNAV);

        File documentFile = new File(authoringDirectory, CREATED_FILE);
        assertTrue(documentFile.exists());
        System.out.println("File was created: " + documentFile.getAbsolutePath());

        SiteTree sitetree = publication.getTree(AREA);
        SiteTreeNode node = sitetree.getNode(PARENT_ID + "/" + CHILD_ID);
        assertNotNull(node);
        System.out.println("Sitetree node was created: " + node.getId() + " (label: " +
            node.getLabel(DOCUMENT_LANGUAGE) + ")");
    }
View Full Code Here

        System.out.println("    Source language:         [" + sourceLanguage + "]");
        System.out.println("    Destination area:        [" + destinationArea + "]");
        System.out.println("    Destination document ID: [" + destinationDocumentId + "]");
        System.out.println("    Destination language:    [" + destinationLanguage + "]");
           
        Publication publication = PublicationHelper.getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();
       
        String sourceUrl =
            builder.buildCanonicalUrl(publication, sourceArea, sourceDocumentId, sourceLanguage);
        Document sourceDocument = builder.buildDocument(publication, sourceUrl);
        String destinationUrl =
            builder.buildCanonicalUrl(
                publication,
                destinationArea,
                destinationDocumentId,
                destinationLanguage);
        Document destinationDocument = builder.buildDocument(publication, destinationUrl);
       
        publication.copyDocument(sourceDocument, destinationDocument);
       
        assertTrue(destinationDocument.exists());
       
        SiteTree destinationTree = publication.getTree(destinationArea);
        SiteTreeNode destinationNode = destinationTree.getNode(destinationDocumentId);
        assertNotNull(destinationNode);
        Label destinationLabel = destinationNode.getLabel(destinationLanguage);
        assertNotNull(destinationLabel);
       
View Full Code Here

     * @see PageEnvelope
     * @see RevisionController
     */
    public RevisionController getRevisionController(FOM_Cocoon cocoon)
    throws PageEnvelopeException, IOException {       
        final Publication publication = getPageEnvelope(cocoon).getPublication();
        final String publicationPath = publication.getDirectory().getAbsolutePath();
        final RCEnvironment rcEnvironment = RCEnvironment.getInstance(publication.getServletContext().getAbsolutePath());
        String rcmlDirectory = rcEnvironment.getRCMLDirectory();
        rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
        String backupDirectory = rcEnvironment.getBackupDirectory();
        backupDirectory = publicationPath + File.separator + backupDirectory;

View Full Code Here

   */
  public CocoonTaskWrapper(Map objectModel, Parameters parameters) throws ExecutionException {

    log.debug("Creating CocoonTaskWrapper");

    Publication publication;
    try {
      publication = PublicationFactory.getPublication(objectModel);
    } catch (PublicationException e) {
      throw new ExecutionException(e);
    }
View Full Code Here

    public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
    throws FileReservedCheckInException, Exception
    {
        final Identity identity = (Identity) ObjectModelHelper.getRequest(cocoon.getObjectModel()).getSession().getAttribute(Identity.class.getName());
        final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
        final Publication publication = getPageEnvelope(cocoon).getPublication();
        final String filename = pageEnvelope.getDocument().getFile().getAbsolutePath().substring(publication.getDirectory().getAbsolutePath().length());  
        getRevisionController(cocoon).reservedCheckIn(filename, identity.getUser().getId(), backup);
    }
View Full Code Here

TOP

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

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.