Examples of TemplateDescriptor


Examples of org.apache.jetspeed.locator.TemplateDescriptor

        {

            descriptor.setName(path);
            descriptor.setType(templateType);

            TemplateDescriptor template = locator.locateTemplate(descriptor);
            // Check for defaults above the currently specified root
            if (template == null)
            {
                Path pathObject = new Path(path);
                if (pathObject.length() > 1)
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

                    }
                }
            }
          
            // load and/or verify decorator macros configuration
            TemplateDescriptor macrosDescriptor = null;
           
            // create reusable decoration base descriptor
            LocatorDescriptor descriptor = null;
            try
            {
                descriptor = decorationLocator.createLocatorDescriptor(null);
            }
            catch (TemplateLocatorException tle)
            {
                log.error("getVelocityEngine(): unable create base descriptor", tle);
            }
            descriptor.setMediaType(layoutMediaType);
            descriptor.setCountry(layoutCountry);
            descriptor.setLanguage(layoutLanguage);
            descriptor.setType(layoutType);
           
            // get decoration configuration properties descriptor
            descriptor.setName(layoutDecoration + "/" + JetspeedVelocityPowerTool.DECORATOR_TYPE + ".properties");
            TemplateDescriptor propertiesDescriptor = null;
            try
            {
                propertiesDescriptor = decorationLocator.locateTemplate(descriptor);
            }
            catch (TemplateLocatorException tle)
            {
                // fallback to generic template type
                try
                {
                    descriptor.setType(JetspeedVelocityPowerTool.GENERIC_TEMPLATE_TYPE);
                    propertiesDescriptor = decorationLocator.locateTemplate(descriptor);
                }
                catch (TemplateLocatorException tleFallback)
                {
                }
            }
            // load configuration properties
            Configuration configuration = null;
            if (propertiesDescriptor != null)
            {
                try
                {
                    configuration = new PropertiesConfiguration(propertiesDescriptor.getAbsolutePath());
                }
                catch (ConfigurationException ce)
                {
                    log.warn("getVelocityEngine(): unable read decorator properties from " + propertiesDescriptor.getAbsolutePath(), ce);
                }
            }
            if (configuration != null)
            {
                // get decoration template macros extension and suffix
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

            String templateKey = helpPage + "/" + JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE  + "-help";
            CachedTemplate ct = (CachedTemplate)layoutTemplatesCache.get(templateKey);
            if (ct == null)
            {
                TemplateDescriptor template = null;
                Configuration props = getConfiguration(request, helpPage);
                String ext = (String) props.getString(TEMPLATE_EXTENSION_KEY);
                String path = helpPage + "/" + JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE + "-help" + ext;                              
                template = jpt.getTemplate(path, JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE);
                if (template == null)
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

           
            String templateKey = viewPage + "/" + JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE;
            CachedTemplate ct = (CachedTemplate)layoutTemplatesCache.get(templateKey);
            if (ct == null)
            {
                TemplateDescriptor template = null;
                Configuration props = getConfiguration(request, viewPage);
                String ext = (String) props.getString(TEMPLATE_EXTENSION_KEY);
                String path = viewPage + "/" + JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE + ext;
               
                template = jpt.getTemplate(path, JetspeedPowerTool.LAYOUT_TEMPLATE_TYPE);
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

        {
            decorator = page.getEffectiveDefaultDecorator(fragmentType);
        }

        // get fragment properties for fragmentType or generic
        TemplateDescriptor propsTemp = getTemplate(decorator + "/" + DECORATOR_TYPE + ".properties", fragmentType,
                decorationLocator, decorationLocatorDescriptor);
        if (propsTemp == null)
        {
            fragmentType = GENERIC_TEMPLATE_TYPE;
            propsTemp = getTemplate(decorator + "/" + DECORATOR_TYPE + ".properties", fragmentType, decorationLocator,
                    decorationLocatorDescriptor);
        }

        // get decorator template
        Configuration decoConf = new PropertiesConfiguration(propsTemp.getAbsolutePath());
        String ext = decoConf.getString("template.extension");
        String decoratorPath = decorator + "/" + DECORATOR_TYPE + ext;
        TemplateDescriptor template = null;
        try
        {
            template = getDecoration(request, decoratorPath, fragmentType);
        }
        catch (TemplateLocatorException e)
        {
            String parent = decoConf.getString("extends");
            if (parent != null)
            {
                template = getDecoration(request, parent + "/" + DECORATOR_TYPE + ext, fragmentType);
            }
        }

        return  template.getAppRelativePath();
    }
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

        {

            descriptor.setName(path);
            descriptor.setType(templateType);

            TemplateDescriptor template = locator.locateTemplate(descriptor);
            return template;
        }
        catch (TemplateLocatorException e)
        {
            log.error("Unable to locate template: " + path, e);
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

            LocatorDescriptor locator = templateLocator.createLocatorDescriptor("email");
            locator.setName(templateName);
            locator.setMediaType(requestContext.getMediaType());
            locator.setLanguage(locale.getLanguage());
            locator.setCountry(locale.getCountry());
            TemplateDescriptor template = templateLocator.locateTemplate(locator);

            return template.getAppRelativePath();
        }
        catch (TemplateLocatorException e)
        {
            return templateLocation + PATH_SEPARATOR + templateName;
        }
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

            LocatorDescriptor locator = templateLocator.createLocatorDescriptor("email");
            locator.setName(templateName);
            locator.setMediaType(requestContext.getMediaType());
            locator.setLanguage(locale.getLanguage());
            locator.setCountry(locale.getCountry());
            TemplateDescriptor template = templateLocator.locateTemplate(locator);

            return template.getAppRelativePath();
        }
        catch (TemplateLocatorException e)
        {
            return templateLocation + PATH_SEPARATOR + templateName;
        }
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

    {
        ArgUtil.assertNotNull(String.class, type, this, "getTypeConfiguration(String type, String name)");
        ArgUtil.assertNotNull(String.class, name, this, "getTypeConfiguration(String type, String name)");
        try
        {
            TemplateDescriptor locator = null;
            if (location.equals("templates"))
            {
                locator = getTemplate(name + "/" + type + ".properties", type);
            }
            else if (location.equals("decorations"))
            {
                locator = getDecoration(name + "/decorator.properties", type);
            }
            else
            {
                throw new IllegalArgumentException("Location type " + location
                        + " is not supported by getTypeConfiguration().");
            }
            return new PropertiesConfiguration(locator.getAbsolutePath());
        }
        catch (TemplateLocatorException e)
        {
            log.warn(e.toString(), e);
            return null;
View Full Code Here

Examples of org.apache.jetspeed.locator.TemplateDescriptor

    public String includeTemplate(String template, String templateType) throws IOException
    {
        checkState();
        try
        {
            TemplateDescriptor useLocator = getTemplate(template, templateType);
            return useLocator.getAppRelativePath();
        }
        catch (Exception e)
        {
            PrintWriter directError = new PrintWriter(renderResponse.getWriter());
            directError.write("Error occured process includeTemplate(): " + e.toString() + "\n\n");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.