Examples of TemplateEngine


Examples of org.rhq.core.template.TemplateEngine

                    tokens.put(TOKEN_PREFIX + "interfaces.java.address", InetAddress.getLocalHost().getHostAddress());
                }
            } catch (Exception e2) {
            }

            TemplateEngine templateEngine = new TemplateEngine(tokens);
            return templateEngine;
        } catch (Exception e) {
            // some rare exception occurred that we didn't expect, rather than blow up entirely, just don't provide any values
            return new TemplateEngine(new HashMap<String, String>());
        }
    }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

                for (MeasurementData data : traits) {
                    String name = data.getName().toLowerCase().replace(' ', '_');
                    tokens.put("rhq.system." + name, data.getValue().toString());
                }

                templateEngine = new TemplateEngine(tokens);
            }
        } catch (Throwable t) {
            //No clean way to recover.  This is probably indicative of a problem elsewhere
            log.error("Cannot fetch data for template engine", t);
        }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

        Map<String, String> tokens = new HashMap<String, String>();
        tokens.put("rhq.system.hostname", "localhost");
        tokens.put("rhq.system.sysprop.java.version", javaVersion);

        templateEngine = new TemplateEngine(tokens);
    }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

        Map<String, String> tokens = new HashMap<String, String>();
        tokens.put("rhq.system.hostname", "localhost");
        tokens.put("rhq.system.sysprop.java.version", javaVersion);

        templateEngine = new TemplateEngine(tokens);
    }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

    public void beforeClass() {
        Map<String, String> tokens = new HashMap<String, String>();
        tokens.put("rhq.system.hostname", "localhost");
        tokens.put("rhq.system.sysprop.java.version", System.getProperty("java.version"));

        templateEngine = new TemplateEngine(tokens);
    }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

        // since our replacement strings may include \ and $ characters avoid the use of
        // matcher.appendReplacement and like methods when doing this work.

        String result = input;
        Configuration replacementValues = context.getReplacementVariableValues();
        TemplateEngine templateEngine = null;

        Matcher matcher = this.replacementVariableDeclarationPattern.matcher(input);
        while (matcher.find()) {
            String next = matcher.group();
            Matcher nameMatcher = this.replacementVariableNamePattern.matcher(next);
            if (nameMatcher.find()) {
                String key = nameMatcher.group();
                String value = (replacementValues != null) ? replacementValues.getSimpleValue(key, null) : null;
                if (value == null) {
                    // our replacement values don't know how to replace the key, see if our system info template engine can
                    if (templateEngine == null) {
                        templateEngine = SystemInfoFactory.fetchTemplateEngine();
                    }
                    value = templateEngine.replaceTokens(next);
                }
                if (value != null) {
                    result = result.replace(next, value);
                }
            }
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

            boolean dryRun = getProject().isDryRun();

            DestinationComplianceMode complianceToUse = DestinationComplianceMode.instanceOrDefault(this.compliance);

            File deployDir = getProject().getDeployDir();
            @SuppressWarnings("unchecked")
            TemplateEngine templateEngine = createTemplateEngine(getProject().getProperties());
            int deploymentId = getProject().getDeploymentId();
            DeploymentProperties deploymentProps = new DeploymentProperties(deploymentId, getProject().getBundleName(),
                getProject().getBundleVersion(), getProject().getBundleDescription(), complianceToUse);
View Full Code Here

Examples of org.rhq.core.template.TemplateEngine

        List<FileSet> fileSets = ignore.getFileSets();
        this.ignorePattern = getPattern(fileSets);
    }

    private TemplateEngine createTemplateEngine(Hashtable<String, String> properties) {
        TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();

        // add properties to Template Engine tokens
        if (properties != null) {
            for (Map.Entry<String, String> e : properties.entrySet()) {
                templateEngine.getTokens().put(e.getKey(), e.getValue());
            }
        }

        // Add the deployment props to the template engine's tokens.
        Configuration config = getProject().getConfiguration();
        for (PropertySimple prop : config.getSimpleProperties().values()) {
            templateEngine.getTokens().put(prop.getName(), prop.getStringValue());
        }
        // And add the special rhq.deploy.dir prop.
        templateEngine.getTokens().put(DeployPropertyNames.DEPLOY_DIR,
            getProject().getProperty(DeployPropertyNames.DEPLOY_DIR));
        return templateEngine;
    }
View Full Code Here

Examples of org.thymeleaf.TemplateEngine

    templateResolver.setPrefix("/WEB-INF/templates/");
    templateResolver.setSuffix(".html");
    templateResolver.setCacheTTLMs(3600000L);
    templateResolver.setCacheable(false);

    templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(templateResolver);

    templateEngine.addDialect(new DataTablesDialect());
  }
View Full Code Here

Examples of org.thymeleaf.TemplateEngine

    // the configuration of the Thymeleaf TemplateEngine is static and we need to recreate on modification
    private synchronized void configureTemplateEngine() {
        logger.info("configure template engine");
        if (templateEngine == null || templateEngine.isInitialized()) {
            templateEngine = new TemplateEngine();
        }
        if (templateResolvers.size() > 0) {
            templateEngine.setTemplateResolvers(templateResolvers);
        }
        if (messageResolvers.size() > 0) {
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.