Package org.apache.lenya.cms.publication

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


    public AccessController doResolveAccessController(String webappUrl)
        throws AccessControlException {
        getLogger().debug("Resolving controller for URL [" + webappUrl + "]");

        AccessController controller = null;
        Publication publication = getPublication(webappUrl);

        if (publication != null) {
            String publicationUrl = webappUrl.substring(("/" + publication.getId()).length());
            controller = resolveAccessController(publication, publicationUrl);
        }
        return controller;
    }
View Full Code Here


     * @param webappUrl The webapp URL.
     * @return A publication.
     * @throws AccessControlException when something went wrong.
     */
    protected Publication getPublication(String webappUrl) throws AccessControlException {
        Publication publication = null;

        assert webappUrl.startsWith("/");
        // remove leading slash
        String url = webappUrl.substring(1);

View Full Code Here

            DocumentTypeBuildException,
            WorkflowException,
            AccessControlException,
            PageEnvelopeException,
            DocumentBuildException {
        Publication publication = PublicationHelper.getPublication();
        String url = "/" + publication.getId() + URL;
        Document document = publication.getDocumentBuilder().buildDocument(publication, url);

        File configDir = new File(publication.getDirectory(), FileItemManager.PATH);
        assertTrue(configDir.exists());

        Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), url);

        DocumentType type = DocumentTypeBuilder.buildDocumentType(documentTypeName, publication);
View Full Code Here

            return null;
        }

        PageEnvelope envelope = null;
        Publication publication = null;

        try {
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            publication = envelope.getPublication();
            document = envelope.getDocument();
        } catch (Exception e) {
            getLogger().error("Resolving page envelope failed: ", e);
            throw e;
        }

        //get Parameters for RC
        String publicationPath = publication.getDirectory().getAbsolutePath();
        RCEnvironment rcEnvironment =
            RCEnvironment.getInstance(publication.getServletContext().getAbsolutePath());
        rcmlDirectory = rcEnvironment.getRCMLDirectory();
        rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
        backupDirectory = rcEnvironment.getBackupDirectory();
        backupDirectory = publicationPath + File.separator + backupDirectory;

        // Initialize Revision Controller
        rc = new RevisionController(rcmlDirectory, backupDirectory, publicationPath);
        getLogger().debug("revision controller" + rc);

        // /Initialize Revision Controller
        // Get session
        Session session = request.getSession(false);

        if (session == null) {
            getLogger().error(".act(): No session object");

            return null;
        }

        Identity identity = (Identity) session.getAttribute(Identity.class.getName());
        getLogger().debug(".act(): Identity: " + identity);

        //FIXME: hack because of the uri for the editor bitflux. The filename cannot be get from the page-envelope

        String documentid = document.getId();
        int bx = documentid.lastIndexOf("-bxeng");

        if (bx > 0) {
            String language = document.getLanguage();

            int l = documentid.length();
            int bxLength = "-bxeng".length();
            int lang = documentid.lastIndexOf("_", bx);
            int langLength = bx - lang;

            if (bx > 0 && bx + bxLength <= l) {
                documentid = documentid.substring(0, bx) + documentid.substring(bx + bxLength, l);

                if (lang > 0 && langLength + lang < l) {
                    language = documentid.substring(lang + 1, lang + langLength);
                    documentid =
                        documentid.substring(0, lang)
                            + documentid.substring(lang + langLength, l - bxLength);
                }
            }

            DocumentBuilder builder = publication.getDocumentBuilder();

            String srcUrl =
                builder.buildCanonicalUrl(publication, document.getArea(), documentid, language);
            Document srcDoc = builder.buildDocument(publication, srcUrl);
            File newFile = srcDoc.getFile();
View Full Code Here

            getLogger().debug("    Language:    [" + language + "]");
            getLogger().debug("    Event:       [" + eventName + "]");
        }

        PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
        Publication publication = envelope.getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();
        String url = builder.buildCanonicalUrl(publication, area, documentId, language);
        Document document = builder.buildDocument(publication, url);

        WorkflowFactory factory = WorkflowFactory.newInstance();
View Full Code Here

                String configurationUri;
                if (getConfigurationURI() != null) {
                    configurationUri = getConfigurationURI();
                } else {
                    Publication publication = PublicationFactory.getPublication(resolver, request);
                    configurationUri = getConfigurationURI(publication);
                }

                Role[] roles = PolicyAuthorizer.getRoles(request);
                authorized = authorizeUsecase(usecase, roles, configurationUri);
View Full Code Here

    if (event != null) {

      try {
        resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
        Publication publication = PublicationFactory.getPublication(resolver, request);

        DocumentBuilder builder = publication.getDocumentBuilder();
        if (builder.isDocument(publication, url)) {

          Document document = builder.buildDocument(publication, url);
          WorkflowFactory factory = WorkflowFactory.newInstance();
View Full Code Here

            } else if (action.equals(DELETE)) {
                String jobId = getJobId(schedulerParameters);
                getScheduler().deleteJob(jobId, publicationId);
            } else if (action.equals(DOCUMENT_DELETED)) {

                Publication publication =
                    PublicationFactory.getPublication(
                        publicationId,
                        getServletContextDirectory().getAbsolutePath());

                String documentUrl = (String) schedulerParameters.get(PARAMETER_DOCUMENT_URL);
                org.apache.lenya.cms.publication.Document document =
                    publication.getDocumentBuilder().buildDocument(publication, documentUrl);
                deleteDocumentJobs(document);
            }

            // handle the remainder of the request by simply returning all
            // scheduled jobs (for the given publication ID).
View Full Code Here

            throw new ExecutionException("Parameters missing: [" + keyString + "]");
        }

        TaskManager manager;

        Publication publication = getTaskParameters().getPublication();

        WorkflowInvoker workflowInvoker = new WorkflowInvoker(getParameters());
        workflowInvoker.setup(publication, getWrapperParameters().getWebappUrl());

        Task task;
        try {
            manager = new TaskManager(publication.getDirectory().getAbsolutePath());
            task = manager.getTask(taskId);

            Properties properties = new Properties();
            properties.putAll(getTaskParameters().getMap());
            Parameters parameters = Parameters.fromProperties(properties);

            task.parameterize(parameters);
        } catch (Exception e) {
            throw new ExecutionException(e);
        }

    log.debug("-----------------------------------");
    log.debug(" Triggering workflow");
    log.debug("-----------------------------------");
   
        //FIXME The new workflow is set before the end of the transition because the document id
        // and so the document are sometimes changing during the transition (ex archiving , ...)
        workflowInvoker.invokeTransition();

    log.debug("-----------------------------------");
    log.debug(" Triggering task");
    log.debug("-----------------------------------");
   
        task.execute(publication.getServletContext().getAbsolutePath());

    log.debug("-----------------------------------");
    log.debug(" Triggering notification");
    log.debug("-----------------------------------");
        Notifier notifier = new Notifier(manager, getParameters());
View Full Code Here

     */
    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
            throws ProcessingException, SAXException, IOException {
        log.debug("setup");
        try {
            Publication publication = PublicationFactory.getPublication(objectModel);
            area = par.getParameter(AREA_PARAMETER);
            sitetree = publication.getTree(area);
        } catch (PublicationException e) {
            throw new ProcessingException("Unable to get sitetree: publication exception.", e);
        } catch (ParameterException e) {
            throw new ProcessingException("Unable to get sitetree: parameter 'area' not found.", e);
        } catch (SiteTreeException e) {
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.