Package org.apache.lenya.cms.publication

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


        String[] snippets = key.split(":");
        String publicationId = snippets[0];
        String areaName = snippets[1];
        SiteTree tree;
        try {
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            Publication publication = factory.getPublication(publicationId);
            Area  area = publication.getArea(areaName);
           
            if (session.isModifiable() || session instanceof SharedItemStore) {
                tree = new SiteTreeImpl(this.manager, area, getLogger());
            }
View Full Code Here


        super.setup(_resolver, _objectModel, _source, _parameters);

        Request _request = ObjectModelHelper.getRequest(_objectModel);
        try {
            Session session = RepositoryUtil.getSession(this.manager, _request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String url = ServletHelper.getWebappURI(_request);
            URLInformation info = new URLInformation(url);
            Publication pub = factory.getPublication(info.getPublicationId());
            Area area = pub.getArea(info.getArea());
            this.rewriter = new UrlToUuidRewriter(area);
        } catch (final Exception e1) {
            throw new ProcessingException(e1);
        }
View Full Code Here

        super.setup(_resolver, _objectModel, _source, _parameters);
        Request request = ObjectModelHelper.getRequest(_objectModel);

        try {
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            URLInformation info = new URLInformation(ServletHelper.getWebappURI(request));
            String pubId = info.getPublicationId();
            this.rewriter = new IncomingLinkRewriter(factory.getPublication(pubId));
        } catch (final Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        URLInformation info = new URLInformation(url);

        String pubId = params.getParameter("pubId", info.getPublicationId());
        String areaId = params.getParameter("area", info.getArea());

        DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
        try {
            Publication pub = factory.getPublication(pubId);
            Area area = pub.getArea(areaId);
            this.site = area.getSite();
        } catch (Exception e) {
            throw new ProcessingException(e);
        }
View Full Code Here

        String pubId = steps[0];
        String area = steps[2];

        try {

            DocumentFactory factory = DocumentUtil
                    .createDocumentFactory(manager, node.getSession());
            Publication pub = factory.getPublication(pubId);
            String docPath = path.substring((pubId + "/content/" + area).length());

            String uuid = docPath.substring(1, docPath.length() - "/en".length());
            String language = docPath.substring(docPath.length() - "en".length());

            doc = factory.get(pub, area, uuid, language);

            if (doc == null) {
                // this happens if the node was not a document node
                logger.info("No document found for node [" + sourceUri + "]");
            }
View Full Code Here

     * @see org.apache.lenya.cms.site.SiteManager#sortAscending(org.apache.lenya.cms.publication.util.DocumentSet)
     */
    public SiteNode[] sortAscending(SiteNode[] nodes) throws SiteException {
        if (nodes.length > 0) {

            DocumentFactory map = nodes[0].getStructure().getPublication().getFactory();
            if (!check(map, new NodeSet(this.manager, nodes))) {
                throw new SiteException("The dependence relation is not a strict partial order!");
            }

            SiteNode[] sortedNodes = (SiteNode[]) Arrays.asList(nodes).toArray(new SiteNode[nodes.length]);
View Full Code Here

            } else {
                throw new MalformedURLException("The path [" + absolutePath
                        + "] must start with at least one slash.");
            }

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            Publication pub = factory.getPublication(pubId);
            SiteStructure site = pub.getArea(areaName).getSite();

            String[] steps = relativePath.substring(1).split("/");

            String language = steps[0];
View Full Code Here

        try {
            String pubBase = Node.LENYA_PROTOCOL + Publication.PUBLICATION_PREFIX_URI + "/";
            String publicationsPath = sourceUri.substring(pubBase.length());
            int firstSlashIndex = publicationsPath.indexOf("/");
            publicationId = publicationsPath.substring(0, firstSlashIndex);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(manager, session);
            Publication pub = factory.getPublication(publicationId);
            contentDir = pub.getContentDir();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

                    + "]");
        }

        Map objectModel = ContextHelper.getObjectModel(this.context);
        Request request = ObjectModelHelper.getRequest(objectModel);
        DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);

        start = end + 1;
       
        // Absolute vs. relative
        if (location.startsWith("//", start)) {
            // Absolute: get publication id
            start += 2;
            end = location.indexOf('/', start);
            if (end == -1) {
                throw new MalformedURLException("Malformed lenyadoc: URI: publication part not found ["
                        + location + "]");
            }
            String publicationId = location.substring(start, end);
            try {
                pub = factory.getPublication(publicationId);
            } catch (PublicationException e) {
                throw new MalformedURLException("Malformed lenyadoc: Publication [" + publicationId
                        + "] does not exist or could not be initialized");
            }
            if (pub == null || !pub.exists()) {
                throw new SourceException("The publication [" + publicationId + "] does not exist!");
            }

            // Area
            start = end + 1;
            end = location.indexOf('/', start);
            if (end == -1) {
                throw new MalformedURLException("Malformed lenyadoc: URI: cannot find area ["
                        + location + "]");
            }
            area = location.substring(start, end);

        } else if (location.startsWith("/", start)) {
            end += 1;
            // Relative: get publication id and area from page envelope
            try {
                pub = PublicationUtil.getPublication(this.manager, objectModel);
            } catch (PublicationException e) {
                throw new SourceException("Error getting publication id / area from page envelope ["
                        + location + "]");
            }
            if (pub != null && pub.exists()) {
                String url = ServletHelper.getWebappURI(request);
                area = new URLInformation(url).getArea();
            } else {
                throw new SourceException("Error getting publication id / area from page envelope ["
                        + location + "]");
            }
        } else {
            throw new MalformedURLException("Malformed lenyadoc: URI [" + location + "]");
        }

        // Language
        start = end + 1;
        end = location.indexOf('/', start);
        if (end == -1) {
            throw new MalformedURLException("Malformed lenyadoc: URI: cannot find language ["
                    + location + "]");
        }
        language = location.substring(start, end);

        // UUID
        start = end + 1;
        uuid = location.substring(start);

        Session session;
        try {
            session = RepositoryUtil.getSession(this.manager, request);
        } catch (RepositoryException e1) {
            throw new RuntimeException(e1);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Creating repository source for URI [" + location + "]");
        }
        Document document;
        try {
            document = factory.get(pub, area, uuid, language);
        } catch (DocumentBuildException e) {
            throw new MalformedURLException("Malformed lenyadoc: Document [" + uuid + ":"
                    + language + "] could not be created.");
        }
View Full Code Here

                URLInformation info = new URLInformation(webappUrl);
                publicationId = info.getPublicationId();
            }

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            if (factory.existsPublication(publicationId)) {
                Publication pub = factory.getPublication(publicationId);
                VisitingSourceResolver resolver = getSourceVisitor();
                templateManager.visit(pub, path, resolver);
                source = resolver.getSource();
            }
View Full Code Here

TOP

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

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.