Package org.apache.lenya.cms.publication

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


        String publicationId = getParameterAsString(PUBLICATION_ID);

        if (publicationId.trim().equals("")) {
            addErrorMessage("Please enter a publication ID!");
        } else {
            PublicationFactory factory = PublicationFactory.getInstance(getLogger());
            Publication publication = factory.getPublication(this.manager, publicationId);
            if (publication.exists()) {
                addErrorMessage("A publication with this ID already exists.");
            }
        }
    }
View Full Code Here


        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            Source context = resolver.resolveURI("context://");
            String contextPath = SourceUtil.getFile(context).getAbsolutePath();
            PublicationFactory factory = PublicationFactory.getInstance(getLogger());

            Publication template = factory.getPublication(templateId, contextPath);
            String name = getParameterAsString(PUBLICATION_NAME);

            selector = (ServiceSelector) this.manager.lookup(Instantiator.ROLE + "Selector");
            instantiator = (Instantiator) selector.select(template.getInstantiatorHint());
View Full Code Here

        PublicationTemplateManager templateManager = null;

        try {
            templateManager = (PublicationTemplateManager) this.manager
                    .lookup(PublicationTemplateManager.ROLE);
            PublicationFactory factory = PublicationFactory.getInstance(getLogger());
            Publication publication;
            String targetUri = null;

            // check if publication ID is provided in attribute name
            if (name.indexOf(":") > -1) {
                String[] parts = name.split(":");
                if (parts.length > 2) {
                    throw new RuntimeException(
                            "The attribute may not contain more than one colons!");
                }
                String publicationId = parts[0];
                targetUri = parts[1];

                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Publication ID provided explicitely: [" + publicationId
                            + "]");
                }

                SourceResolver resolver = null;
                Source source = null;
                try {
                    resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                    source = resolver.resolveURI("context://");
                    String contextPath = SourceUtil.getFile(source).getAbsolutePath();
                    publication = factory.getPublication(publicationId, contextPath);
                } finally {
                    if (resolver != null) {
                        if (source != null) {
                            resolver.release(source);
                        }
                        this.manager.release(resolver);
                    }
                }
            } else {
                publication = factory.getPublication(objectModel);
                targetUri = name;
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Publication resolved from request: [" + publication.getId()
                            + "]");
                }
View Full Code Here

        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI("context://");
            File servletContext = SourceUtil.getFile(source);

            PublicationFactory factory = PublicationFactory.getInstance(getLogger());
            Publication publication = factory.getPublication(publicationId, servletContext
                    .getAbsolutePath());

            store = new DocumentStore(this.manager, (DocumentIdentityMap) map, publication, area,
                    getLogger());
View Full Code Here

     * @throws ExecutionException when something went wrong.
     */
    public Publication getPublication() throws ExecutionException {
        Publication publication;
        try {
            PublicationFactory factory = PublicationFactory.getInstance(new ConsoleLogger());
            publication = factory.getPublication(get(Task.PARAMETER_PUBLICATION_ID),
                    get(Task.PARAMETER_SERVLET_CONTEXT));
        } catch (PublicationException e) {
            throw new ExecutionException(e);
        }
        return publication;
View Full Code Here

     *
     * @return the publication in which the use-case is being executed
     */
    protected Publication getPublication() {
        if (this.publication == null) {
            PublicationFactory factory = PublicationFactory.getInstance(getLogger());
            try {
                this.publication = factory.getPublication(this.manager, getSourceURL());
            } catch (PublicationException e) {
                throw new RuntimeException(e);
            }
        }
        return this.publication;
View Full Code Here

        try {
            URLInformation info = new URLInformation(webappUrl);
            String publicationId = info.getPublicationId();

            if (publicationId != null) {
                PublicationFactory factory = PublicationFactory.getInstance(getLogger());
                Publication pub = factory.getPublication(this.manager, webappUrl);
                if (pub.exists()) {
                    publication = pub;
                }
            }
        } catch (Exception e) {
View Full Code Here

                SourceResolver resolver = null;
                try {
                    resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                    contextSource = resolver.resolveURI("context://");
                    File context = org.apache.excalibur.source.SourceUtil.getFile(contextSource);
                    PublicationFactory factory = PublicationFactory.getInstance(getLogger());
                    Publication pub = factory.getPublication(publicationId, context
                            .getAbsolutePath());

                    String publicationPath = pub.getDirectory().getCanonicalPath();
                    RCEnvironment rcEnvironment = RCEnvironment.getInstance(pub.getServletContext()
                            .getCanonicalPath());
View Full Code Here

TOP

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

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.