}
// log agentname for debug
CLILogger.getInstance().printDebugMessage("agentName = " + agentName);
AgentConfig agentConfig = new AgentConfig(agentName,
getAgentPath());
AgentManager manager = getAgentManager(agentConfig);
manager.validateNodeAgent(agentConfig, false);
} catch (Exception e) {
if (e.getLocalizedMessage() != null)
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
throw new CommandException(getLocalizedString(
"CommandUnSuccessful", new Object[] {name} ), e);
}
try {
Properties agentProperties = getAgentProperties(getOption(AGENT_PROPERTIES));
final String adminUser = getUser();
final String adminPassword = getPassword();
//need to call setOption before calling getMasterPassword() since
//getMasterPassword() needs to get ADMIN_PASSWORD first.
setOption(ADMIN_PASSWORD, adminPassword);
boolean saveMasterPasswordSpecified = getBooleanOption(SAVE_MASTER_PASSWORD);
String masterPassword = null;
if (saveMasterPasswordSpecified)
{
masterPassword = getMasterPasswordWithDefaultPrompt(null, null);
}
final String adminPort = String.valueOf(getPort());
final String adminHost = getHost();
Boolean saveMasterPassword = getSaveMasterPassword(masterPassword);
//The --secure option is a synonymn for --agentproperties agent.das.isSecure=false
if (!getBooleanOption(SECURE)) {
agentProperties.setProperty(AgentConfig.AGENT_DAS_IS_SECURE, "false");
}
//System.out.println("adminPassword=" + adminPassword + " masterPassword=" + masterPassword +
// " saveMasterPassword=" + saveMasterPassword);
if (adminHost == null || adminPort == null || adminUser == null || adminPassword == null) {
throw new CommandValidationException(_strMgr.getString("InvalidDASConfiguration"));
}
// defaulted protocol and clientHostName until moved to cli if deemed appropriate ???
// temporary fix to remove agent user & password, for now map them to das user & password???
AgentConfig agentConfig = new AgentConfig(agentName, getAgentPath(), adminUser,
adminPassword, new Integer(getAdminPort()),
adminHost, adminPort, adminUser, adminPassword,
masterPassword,
saveMasterPassword, agentProperties);