Package org.apache.lenya.cms.publication

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


        AntProperties properties;
        Request request = ObjectModelHelper.getRequest(objectModel);
        String webappUrl = ServletHelper.getWebappURI(request);
        URLInformation info = new URLInformation(webappUrl);
        String pubId = info.getPublicationId();
        DocumentFactory factory = DocumentUtil.getDocumentFactory(this.serviceManager, request);
        if (factory.existsPublication(pubId)) {
            try {
                Publication pub = factory.getPublication(pubId);
                properties = getPublicationProperties(pub);
            }
            catch (Exception e) {
                throw new ConfigurationException("Could not resolve properties for publication [" + pubId + "]: ", e);
            }
View Full Code Here


                    .select(AccessControllerResolver.DEFAULT_RESOLVER);
            accessController = acResolver.resolveAccessController(webappUrl);

            contextUtil = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = contextUtil.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            URLInformation info = new URLInformation(webappUrl);
            Publication pub = factory.getPublication(info.getPublicationId());
            Role[] roles = PolicyUtil.getRoles(request);

            Authorizer[] authorizers = accessController.getAuthorizers();
            for (int i = 0; i < authorizers.length; i++) {
                if (authorizers[i] instanceof UsecaseAuthorizer) {
View Full Code Here

            String area = params.getParameter(PARAM_AREA);
            this.language = params.getParameter(PARAM_LANG);
            this.path = params.getParameter(PARAM_PATH);
            this.selectorPath = params.getParameter(PARAM_SELECTOR_PATH, "");

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

            this.cacheKey = pubId + "/" + area;
            source = resolver.resolveURI(this.site.getRepositoryNode().getSourceURI());
            this.validity = source.getValidity();
View Full Code Here

            throw new AccessControlException(e);
        }
        org.apache.lenya.cms.repository.Session repoSession = RepositoryUtil.getSession(
                this.manager, request);

        DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, repoSession);
        Document document = null;

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

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

        // 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.getPath();
        int bx = documentid.lastIndexOf("-bxe");

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

            int l = documentid.length();
            int bxLength = "-bxe".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);
                }
            }

            Document srcDoc = factory.get(publication, document.getArea(), documentid, language);
            this.node = srcDoc.getRepositoryNode();

        } else {
            this.node = document.getRepositoryNode();
        }
View Full Code Here

        try {
            Request request = ObjectModelHelper.getRequest(objectModel);
            Identity identity = (Identity) request.getSession().getAttribute(Identity.class.getName());
            Session session = RepositoryUtil.createSession(this.manager, identity, true);
           
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String url = ServletHelper.getWebappURI(request);
            if (factory.isDocument(url)) {
                Node node = factory.getFromURL(url).getRepositoryNode();
                if (node.isCheckedOutBySession(session)) {
                    node.checkin();
                }
            }
            else {
View Full Code Here

     */
    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source,
            Parameters parameters) throws Exception {

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

        String url = ServletHelper.getWebappURI(request);
        if (factory.isDocument(url)) {
            return Collections.unmodifiableMap(Collections.EMPTY_MAP);
        }
        else {
            return null;
        }
View Full Code Here

        String webappUri = ServletHelper.getWebappURI(request);
        URLInformation info = new URLInformation(webappUri);
        String pubId = null;
        try {
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String pubIdCandidate = info.getPublicationId();
            if (pubIdCandidate != null && factory.existsPublication(pubIdCandidate)) {
                pubId = pubIdCandidate;
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

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

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

        try {
            selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(node.getStructure().getPublication()
                    .getSiteManagerHint());

            DocumentFactory map = node.getStructure().getPublication().getFactory();
            Set nodes = new HashSet();
            nodes.add(node);

            SiteNode[] requiringNodes = siteManager.getRequiringResources(map, node);
            for (int i = 0; i < requiringNodes.length; i++) {
View Full Code Here

    }

    protected List getNodes() throws DocumentBuildException, DocumentException, PublicationException {
        List preOrder;
        String sourceUrl = getSourceURL();
        DocumentFactory factory = getDocumentFactory();
        if (getDocumentFactory().isDocument(sourceUrl)) {
            Document doc = factory.getFromURL(sourceUrl);
            preOrder = getPreOrder(doc.getLink().getNode());
        } else {
            preOrder = new ArrayList();
            URLInformation info = new URLInformation(getSourceURL());
            Publication pub = factory.getPublication(info.getPublicationId());
            Area area = pub.getArea(info.getArea());
            SiteStructure site = area.getSite();
            SiteNode[] topLevelNodes = site.getTopLevelNodes();
            for (int i = 0; i < topLevelNodes.length; i++) {
                preOrder.addAll(getPreOrder(topLevelNodes[i]));
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.