Package org.apache.lenya.cms.publication.templating

Examples of org.apache.lenya.cms.publication.templating.PublicationTemplateManager


        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Location:     [" + location + "]");
            getLogger().debug("Path:         [" + path + "]");
        }

        PublicationTemplateManager templateManager = null;
        SourceResolver sourceResolver = null;
        Source source = null;
        try {
            sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);

            templateManager = (PublicationTemplateManager) this.manager.lookup(PublicationTemplateManager.ROLE);

            Request request = ContextHelper.getRequest(this.context);
           
            if (publicationId == null) {
                String webappUrl = request.getRequestURI().substring(request.getContextPath().length());

                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();
            }

            if (source == null) {
                if (path.startsWith("lenya/modules/")) {
View Full Code Here


        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Location:     [" + location + "]");
            getLogger().debug("Path:         [" + path + "]");
        }

        PublicationTemplateManager templateManager = null;
        try {
            templateManager = (PublicationTemplateManager) this.manager
                    .lookup(PublicationTemplateManager.ROLE);

            Request request = ContextHelper.getRequest(this.context);

            if (publicationId == null) {
                String webappUrl = request.getRequestURI().substring(
                        request.getContextPath().length());

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

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);

            String[] uris;

            if (factory.existsPublication(publicationId)) {
                Publication pub = factory.getPublication(publicationId);
                AllExistingSourceResolver resolver = new AllExistingSourceResolver();
                templateManager.visit(pub, path, resolver);
                uris = resolver.getUris();
            } else {
                uris = new String[0];
            }
           
View Full Code Here

       
        FallbackUri uri = new FallbackUri(location);
        String pubId = uri.getPubId();
        String path = uri.getPath();

        PublicationTemplateManager templateManager = null;
        try {
            templateManager = (PublicationTemplateManager) this.manager
                    .lookup(PublicationTemplateManager.ROLE);

            Request request = ContextHelper.getRequest(this.context);

            if (pubId == null) {
                String webappUrl = ServletHelper.getWebappURI(request);
                URLInformation info = new URLInformation(webappUrl);
                pubId = info.getPublicationId();
            }

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);

            String[] uris;

            if (factory.existsPublication(pubId)) {
                Publication pub = factory.getPublication(pubId);
                AllExistingSourceResolver resolver = new AllExistingSourceResolver();
                templateManager.visit(pub, path, resolver);
                uris = resolver.getUris();
            } else {
                uris = new String[0];
            }
           
View Full Code Here

    protected String getUsecaseName(String webappUrl, final String name) throws ServiceException {
        String newName = null;

        Publication publication = getPublication(webappUrl);
        if (publication != null) {
            PublicationTemplateManager templateManager = null;
            try {
                templateManager = (PublicationTemplateManager) this.manager
                        .lookup(PublicationTemplateManager.ROLE);
                newName = (String) templateManager.getSelectableHint(publication, getSelector(),
                        name);
            } finally {
                if (templateManager != null) {
                    this.manager.release(templateManager);
                }
View Full Code Here

        FallbackUri uri = new FallbackUri(location);

        String pubId = uri.getPubId();
        String path = uri.getPath();

        PublicationTemplateManager templateManager = null;
        SourceResolver sourceResolver = null;
        Source source = null;
        try {
            sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);

            templateManager = (PublicationTemplateManager) this.manager
                    .lookup(PublicationTemplateManager.ROLE);

            Request request = ContextHelper.getRequest(this.context);

            if (pubId == null) {
                String webappUrl = request.getRequestURI().substring(
                        request.getContextPath().length());

                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();
            }

            if (source == null) {
                if (path.startsWith("lenya/modules/")) {
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Resolving publication template for file [" + name + "]");
        }

        String resolvedUri = null;
        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()
                            + "]");
                }
            }
            ExistingSourceResolver resolver = new ExistingSourceResolver();
            templateManager.visit(publication, targetUri, resolver);
            resolvedUri = resolver.getURI();

        } catch (final Exception e) {
            String message = "Resolving path [" + name + "] failed: ";
            getLogger().error(message, e);
View Full Code Here

            throws ConfigurationException {

        String resolvedSitemapUri = null;

        try {
            PublicationTemplateManager templateManager = (PublicationTemplateManager) this._manager
                    .lookup(PublicationTemplateManager.ROLE);
            PageEnvelope envelope = getEnvelope(objectModel, name);

            ExistingUsecaseResolver resolver = new ExistingUsecaseResolver(name);
            templateManager.visit(envelope.getPublication(), resolver);

            Publication publication = resolver.getPublication();
            if (publication != null) {
                resolvedSitemapUri = PublicationTemplateManagerImpl.getBaseURI(publication) + "/"
                        + USECASE_SITEMAP;
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Location:     [" + location + "]");
            getLogger().debug("Path:         [" + path + "]");
        }

        PublicationTemplateManager templateManager = null;
        SourceResolver sourceResolver = null;
        Source contextSource = null;
        Source source;
        try {
            sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
           
            templateManager = (PublicationTemplateManager) this.manager
                    .lookup(PublicationTemplateManager.ROLE);

            contextSource = sourceResolver.resolveURI("context://");
            Request request = ContextHelper.getRequest(this.context);
            String webappUrl = request.getRequestURI().substring(request.getContextPath().length());

            PublicationFactory factory = PublicationFactory.getInstance(getLogger());
           
            String contextPath = SourceUtil.getFile(contextSource).getAbsolutePath();
            URLInformation info = new URLInformation(webappUrl);
            String publicationId = info.getPublicationId();
           
            Publication pub = factory.getPublication(publicationId, contextPath);
            if (pub.exists()) {
                ExistingSourceResolver resolver = new ExistingSourceResolver();
                templateManager.visit(pub, path, resolver);
                resolvedUri = resolver.getURI();
            }

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Resolved URI:  [" + resolvedUri + "]");
View Full Code Here

    protected String getUsecaseName(String webappUrl, final String name) throws ServiceException {
        String newName = null;

        Publication publication = getPublication(webappUrl);
        if (publication != null) {
            PublicationTemplateManager templateManager = null;
            try {
                templateManager = (PublicationTemplateManager) this.manager
                        .lookup(PublicationTemplateManager.ROLE);
                newName = (String) templateManager.getSelectableHint(publication,
                        this.selector,
                        name);
            } finally {
                if (templateManager != null) {
                    this.manager.release(templateManager);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.templating.PublicationTemplateManager

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.