use of com.sun.enterprise.admin.util.TokenValue in project Payara by payara.
the class CLICommand method expandManPage.
/**
* Return a man page for this command that has the tokens substituted
* @param r
* @return
*/
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.TokenValue 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.TokenValue in project Payara by payara.
the class TokenReplacementTester method getTokensFromFile.
private TokenValueSet getTokensFromFile(String fileName) {
final TokenValueSet tokens = new TokenValueSet();
try (BufferedReader 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();
}
return tokens;
}
use of com.sun.enterprise.admin.util.TokenValue 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);
}
use of com.sun.enterprise.admin.util.TokenValue in project Payara by payara.
the class RepositoryManager method createJBIInstance.
/**
* Create JBI instance.
* @param instanceName the name of the instance to create
* @param config the {@link RepositoryConfig} to create the JBI instance within
* @throws RepositoryException if an error occured creating the JBI instance
*/
protected void createJBIInstance(String instanceName, RepositoryConfig config) throws RepositoryException {
final PEFileLayout layout = getFileLayout(config);
layout.createJBIDirectories();
final TokenValueSet tvSet = new TokenValueSet();
final String tvDelimiter = "@";
final String tJbiInstanceName = "JBI_INSTANCE_NAME";
final String tJbiInstanceRoot = "JBI_INSTANCE_ROOT";
try {
final TokenValue tvJbiInstanceName = new TokenValue(tJbiInstanceName, instanceName, tvDelimiter);
final TokenValue tvJbiInstanceRoot = new TokenValue(tJbiInstanceRoot, layout.getRepositoryDir().getCanonicalPath(), tvDelimiter);
tvSet.add(tvJbiInstanceName);
tvSet.add(tvJbiInstanceRoot);
final File src = layout.getJbiTemplateFile();
final File dest = layout.getJbiRegistryFile();
generateFromTemplate(tvSet, src, dest);
final File httpConfigSrc = layout.getHttpBcConfigTemplate();
final File httpConfigDest = layout.getHttpBcConfigFile();
// tokens will be added in a follow-up integration
final TokenValueSet httpTvSet = new TokenValueSet();
generateFromTemplate(httpTvSet, httpConfigSrc, httpConfigDest);
createHttpBCInstallRoot(layout);
createJavaEESEInstallRoot(layout);
createWSDLSLInstallRoot(layout);
} catch (Exception ioe) {
throw new RepositoryException(STRING_MANAGER.getString("jbiRegistryFileNotCreated"), ioe);
}
}
Aggregations