Search in sources :

Example 1 with TokenValueSet

use of com.sun.enterprise.admin.util.TokenValueSet in project Payara by payara.

the class CLICommand method expandManPage.

/**
 * Return a man page for this command that has the tokens substituted
 */
public BufferedReader expandManPage(Reader r) {
    manpageTokenValues[0] = programOpts.getCommandName();
    manpageTokenValues[1] = Environment.getPrefix();
    manpageTokenValues[2] = Version.getBriefProductName();
    TokenValueSet tvs = new TokenValueSet();
    for (int i = 0; i < manpageTokens.length; i++) {
        tvs.add(new TokenValue(manpageTokens[i], manpageTokenValues[i], "{", "}"));
    }
    return new BufferedReader(new LineTokenReplacer(tvs).getReader(r));
}
Also used : TokenValueSet(com.sun.enterprise.admin.util.TokenValueSet) LineTokenReplacer(com.sun.enterprise.admin.util.LineTokenReplacer) TokenValue(com.sun.enterprise.admin.util.TokenValue)

Example 2 with TokenValueSet

use of com.sun.enterprise.admin.util.TokenValueSet in project Payara by payara.

the class PEScriptsTokens method getTokenValueSet.

/**
 * @return Returns the TokenValueSet that has the (token, value) pairs for
 * startserv & stopserv scripts.
 * @param domainConfig
 */
public static TokenValueSet getTokenValueSet(DomainConfig domainConfig) {
    final PEFileLayout layout = new PEFileLayout(domainConfig);
    final TokenValueSet tokens = new TokenValueSet();
    final String configRootDir = domainConfig.getConfigRoot();
    TokenValue tv = new TokenValue(CONFIG_HOME, configRootDir);
    tokens.add(tv);
    final String instanceRoot = layout.getRepositoryDir().getAbsolutePath();
    tv = new TokenValue(INSTANCE_ROOT, instanceRoot);
    tokens.add(tv);
    final String instanceName = (String) domainConfig.get(DomainConfig.K_SERVERID);
    if ((instanceName == null) || (instanceName.equals("")))
        tv = new TokenValue(SERVER_NAME, PEFileLayout.DEFAULT_INSTANCE_NAME);
    else
        tv = new TokenValue(SERVER_NAME, instanceName);
    tokens.add(tv);
    tv = new TokenValue(DOMAIN_NAME, domainConfig.getDomainName());
    tokens.add(tv);
    return (tokens);
}
Also used : TokenValueSet(com.sun.enterprise.admin.util.TokenValueSet) PEFileLayout(com.sun.enterprise.admin.servermgmt.pe.PEFileLayout) TokenValue(com.sun.enterprise.admin.util.TokenValue)

Example 3 with TokenValueSet

use of com.sun.enterprise.admin.util.TokenValueSet in project Payara by payara.

the class TokenReplacementTester method getTokensFromFile.

private TokenValueSet getTokensFromFile(String fileName) {
    final TokenValueSet tokens = new TokenValueSet();
    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new FileReader(fileName));
        String line = null;
        while ((line = reader.readLine()) != null) {
            final TokenValue tv = getTokenValue(line);
            tokens.add(tv);
        }
        reader.close();
    } catch (Exception e) {
        e.printStackTrace();
        if (reader != null) {
            try {
                reader.close();
            } catch (Exception ex) {
            }
        }
    }
    return tokens;
}
Also used : TokenValueSet(com.sun.enterprise.admin.util.TokenValueSet) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) TokenValue(com.sun.enterprise.admin.util.TokenValue)

Example 4 with TokenValueSet

use of com.sun.enterprise.admin.util.TokenValueSet in project Payara by payara.

the class PEDomainsManager method createScripts.

protected void createScripts(DomainConfig domainConfig) throws DomainException {
    final TokenValueSet tokens = PEScriptsTokens.getTokenValueSet(domainConfig);
    createStartServ(domainConfig, tokens);
    createStopServ(domainConfig, tokens);
}
Also used : TokenValueSet(com.sun.enterprise.admin.util.TokenValueSet)

Example 5 with TokenValueSet

use of com.sun.enterprise.admin.util.TokenValueSet in project Payara by payara.

the class ServicesUtils method map2Set.

static TokenValueSet map2Set(final Map<String, String> map) {
    final Set<TokenValue> set = new HashSet<TokenValue>();
    for (final Map.Entry<String, String> e : map.entrySet()) {
        final String key = e.getKey();
        final String value = e.getValue();
        final TokenValue tv = new TokenValue(key, value);
        set.add(tv);
    }
    final TokenValueSet tvset = new TokenValueSet(set);
    return (tvset);
}
Also used : TokenValueSet(com.sun.enterprise.admin.util.TokenValueSet) TokenValue(com.sun.enterprise.admin.util.TokenValue)

Aggregations

TokenValueSet (com.sun.enterprise.admin.util.TokenValueSet)6 TokenValue (com.sun.enterprise.admin.util.TokenValue)5 PEFileLayout (com.sun.enterprise.admin.servermgmt.pe.PEFileLayout)2 LineTokenReplacer (com.sun.enterprise.admin.util.LineTokenReplacer)1 ZipFile (com.sun.enterprise.util.zip.ZipFile)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1