Package org.rhq.core.template

Examples of org.rhq.core.template.TemplateEngine


    public String getTemplateEngineString() {
        return getValueExpression("").getExpressionString();
    }

    public TemplateEngine getTemplateEngine() {
        TemplateEngine templateEngine = FacesComponentUtility.getExpressionAttribute(this, TEMPLATE_ENGINE_ATTRIBUTE,
            TemplateEngine.class);
        return templateEngine;
    };
View Full Code Here


                    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

                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

        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

        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

    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

        // 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

            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

        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

TOP

Related Classes of org.rhq.core.template.TemplateEngine

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.