Examples of FreeMarkerTemplate


Examples of org.milyn.util.FreeMarkerTemplate

            Map<String, Object> beans = Filter.getCurrentExecutionContext().getBeanContext().getBeanMap();
            Set<Map.Entry<QName, FreeMarkerTemplate>> attributeSet = attributes.entrySet();

            for(Map.Entry<QName, FreeMarkerTemplate> attributeConfig : attributeSet) {
                QName attribName = attributeConfig.getKey();
                FreeMarkerTemplate valueTemplate = attributeConfig.getValue();
                String namespaceURI = attribName.getNamespaceURI();

                if(namespaceURI != null) {
                    String prefix = attribName.getPrefix();
                    if(prefix != null && prefix.length() > 0) {
                        element.setAttributeNS(namespaceURI, prefix + ":" + attribName.getLocalPart(), valueTemplate.apply(beans));
                    } else {
                        element.setAttributeNS(namespaceURI, attribName.getLocalPart(), valueTemplate.apply(beans));
                    }
                } else {
                    element.setAttribute(attribName.getLocalPart(), valueTemplate.apply(beans));
                }
            }
        }
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

            if (message.startsWith("ftl:")) {
                // TODO: Is there a way to optimize this e.g. attach the compiled template
                // to the bundle as an object and then get back using ResourceBundle.getObject??
                // I timed it and it was able to create and apply 10000 templates in about 2500 ms
                // on an "average" spec machine, so it's not toooooo bad, and it's only done on demand :)
                FreeMarkerTemplate template = new FreeMarkerTemplate(message.substring("ftl:".length()));
                beanContext.put("ruleResult", ruleResult);
                beanContext.put("path", failFragmentPath);
                message = template.apply(beanContext);
            }

            return message;
        }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

    }

    public void generate() throws IOException {
        Map<String, List<ClassConfig>> templatingContextObject = new HashMap<String, List<ClassConfig>>();
        List<ClassConfig> classConfigs = new ArrayList<ClassConfig>();
        FreeMarkerTemplate template;

        addClassConfig(classConfigs, rootBeanClass, null);
        template = new FreeMarkerTemplate("templates/bindingConfig.ftl.xml", getClass());

        templatingContextObject.put("classConfigs", classConfigs);
        outputWriter.write(template.apply(templatingContextObject));
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

     * @param dataModel      - FreeMarker data model
     * @throws NamingStrategyException
     * @throws TemplateException
     */
    public String generateFileName(final String templateString, final Object dataModel) throws NamingStrategyException {
        FreeMarkerTemplate template = new FreeMarkerTemplate(templateString);
        return template.apply( dataModel );
  }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

        return this;
    }

    public ResultsetRowSelector setFailedSelectError(String failedSelectError) {
        AssertArgument.isNotNullAndNotEmpty(failedSelectError, "failedSelectError");
        this.failedSelectError = new FreeMarkerTemplate(failedSelectError);
        return this;
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

        }
        if(destinationDirectoryPattern == null) {
            throw new SmooksConfigurationException("Null 'destinationDirectoryPattern' configuration parameter.");
        }

        fileNameTemplate = new FreeMarkerTemplate(fileNamePattern);
        destinationDirectoryTemplate = new FreeMarkerTemplate(destinationDirectoryPattern);

        fileFilter = new SplitFilenameFilter(fileNamePattern);

        if(listFileNamePattern != null) {
          listFileNameTemplate = new FreeMarkerTemplate(listFileNamePattern);
            listFileNamePatternCtxKey = FileOutputStreamResource.class.getName() + "#" + listFileNamePattern;
        }
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

            }
        }
    }

    private void generateFactoryClass(Properties interchangeProperties) throws IOException {
        FreeMarkerTemplate factoryTemplate = new FreeMarkerTemplate("templates/" + interchangeProperties.getProperty(EdiSpecificationReader.INTERCHANGE_TYPE) + "-interchange-factoryClass.ftl.xml", EJCExecutor.class);
        Map<String, Object> contextObj = new HashMap<String, Object>();
        String packageTokens[] = packageName.split("\\.");
        String messageSetName = packageTokens[packageTokens.length - 1].toUpperCase();

        contextObj.put("mappingModel", ediMappingModel);
        contextObj.put("package", packageName);
        contextObj.put("messageSetName", messageSetName);
        contextObj.put("bindingConfig", "/" + packageName.replace('.', '/') + "/interchange-bindingconfig.xml");

        File interchangeFactoryFile = new File(destDir, packageName.replace('.', '/') + "/" + messageSetName + "InterchangeFactory.java");
        FileWriter interchangeBindingConfigWriter = new FileWriter(interchangeFactoryFile);
        try {
            factoryTemplate.apply(contextObj, interchangeBindingConfigWriter);
        } finally {
            try {
                interchangeBindingConfigWriter.flush();
            } finally {
                interchangeBindingConfigWriter.close();
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

                logger.debug("'template' configuration value '" + trimmedTemplateConfig + "' does not resolve to an external FreeMarker template.  Using configured value as the actual template.");
            }
        }

        // Create the template instance...
        template = new FreeMarkerTemplate(templateConfig);
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

    private volatile int classGenCount = 1;

    @Initialize
    public void initialize() throws IOException {
        String templateText = StreamUtils.readStreamAsString(getClass().getResourceAsStream("ScriptedGroovy.ftl"));
        classTemplate = new FreeMarkerTemplate(templateText);
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

     *
     * @param correlationIdPattern The pattern generator template.
     * @return This router instance.
     */
    public BeanRouter setCorrelationIdPattern(final String correlationIdPattern) {
        this.correlationIdPattern = new FreeMarkerTemplate(correlationIdPattern);
        return this;
    }
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.