try {
final String agentName = getAgentName();
AgentConfig agentConfig = new AgentConfig(agentName,
getAgentPath());
AgentManager manager = getAgentManager(agentConfig);
//validate node agent before prompting
manager.validateNodeAgent(agentConfig, true);
if (!isNotRunning(manager,agentConfig)) {
CLILogger.getInstance().printDetailMessage(_strMgr.getString("TargetAlreadyRunning",
new Object[] {agentName}));
return;
}
//call getPortAndHost before getPassword()
getPortAndHost(agentConfig);
agentConfig.put(AgentConfig.K_DAS_USER, getUser());
agentConfig.put(AgentConfig.K_DAS_PASSWORD, getPassword());
agentConfig.put(AgentConfig.K_MASTER_PASSWORD,
getMasterPasswordWithDefaultPrompt(manager, agentConfig));
//Validation of admin password can only be done after synchronization, see 6304850
manager.validateMasterPassword(agentConfig, false);
if (getOption(S1ASCommand.PASSWORDFILE) != null ) {
final String adminPwdAlias =
RelativePathResolver.getAlias( (String)agentConfig.get(AgentConfig.K_DAS_PASSWORD));
if (adminPwdAlias!=null) {
final String masterPwd= (String)agentConfig.get(AgentConfig.K_MASTER_PASSWORD);
final String clearPwd = manager.getClearPasswordForAlias(agentConfig,masterPwd,adminPwdAlias);
agentConfig.put(AgentConfig.K_DAS_PASSWORD, clearPwd);
}
}
String[] extraPasswordOptions = manager.getExtraPasswordOptions(agentConfig);
if (extraPasswordOptions != null) {
java.util.HashMap extrapasswords = getExtraPasswords(extraPasswordOptions);
if (getOption(S1ASCommand.PASSWORDFILE) != null && extrapasswords.size()>0) {
final String masterPwd = (String)agentConfig.get( AgentConfig.K_MASTER_PASSWORD);
for (java.util.Iterator it = extrapasswords.entrySet().iterator(); it.hasNext(); ) {
java.util.Map.Entry entry = (java.util.Map.Entry)it.next();
String optionname = (String) entry.getKey();
String password = (String) entry.getValue();
String aliasname = RelativePathResolver.getAlias(password);
if (aliasname != null) {
final String clearpwd = manager.getClearPasswordForAlias(agentConfig, masterPwd, aliasname);
if (clearpwd != null)
entry.setValue(clearpwd);
}
}
}
agentConfig.put(AgentConfig.K_EXTRA_PASSWORDS, extrapasswords);
}
//System.out.println("adminUser=" + agentConfig.get(AgentConfig.K_DAS_USER) + " adminPassword=" +
// agentConfig.get(AgentConfig.K_DAS_PASSWORD) + " masterPassword=" +
// agentConfig.get(AgentConfig.K_MASTER_PASSWORD));
// get override for start managed start instances
String startInstancesOverride=getOption(START_INSTANCES_OVERRIDE);
String syncInstancesOverride = getOption(SYNC_INSTANCES_OVERRIDE);
String monitorInterval = getOption(MONITOR_INTERVAL_OVERRIDE);
String restartInstancesOverride = getOption(RESTART_INSTANCES_OVERRIDE);
CLILogger.getInstance().printDebugMessage("startInstanceOverride = "
+ startInstancesOverride);
CLILogger.getInstance().printDebugMessage("syncInstanceOverride = "
+ syncInstancesOverride);
CLILogger.getInstance().printDebugMessage("monitorIntervalOverride = "
+ monitorInterval);
// add map entries for --verbose start-node-agent
if ( getBooleanOption("verbose") ) {
// use domain constant, because that is where PEInstancesManager looks, for now
agentConfig.put("domain.verbose", Boolean.TRUE);
}
manager.startNodeAgent(startInstancesOverride, syncInstancesOverride, monitorInterval, restartInstancesOverride);
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
} catch (Exception e) {