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));
}
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);
}
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;
}
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);
}
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);
}
Aggregations