use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class ConfigurePropertiesTask method getRollBackMessage.
public LocalizedMessage getRollBackMessage(IStateAccess stateAccess, Map properties) {
String productConfigFileName = (String) properties.get(STR_PRODUCT_CONFIG_FILENAME_AGENT_BOOTSTRAP_KEY);
Object[] args = { productConfigFileName, stateAccess.getInstanceName() };
LocalizedMessage message = LocalizedMessage.get(LOC_TSK_MSG_CONFIGURE_PRODUCT_PROPS_ROLLBACK, args);
return message;
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class ConfigurePropertiesTask method getExecutionMessage.
public LocalizedMessage getExecutionMessage(IStateAccess stateAccess, Map properties) {
String productConfigFileName = (String) properties.get(STR_PRODUCT_CONFIG_FILENAME_AGENT_BOOTSTRAP_KEY);
Object[] args = { productConfigFileName, stateAccess.getInstanceName() };
LocalizedMessage message = LocalizedMessage.get(LOC_TSK_MSG_CONFIGURE_PRODUCT_PROPS_EXECUTE, args);
return message;
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class AdminTool method showUsage.
private void showUsage() {
LocalizedMessage usageMessage = LocalizedMessage.get(MSG_USAGE);
LocalizedMessage availableOpts = LocalizedMessage.get(MSG_AVAIL_OPTS);
Console.println();
Console.println(usageMessage);
Console.println();
Console.println(availableOpts);
BaseToolsResolver resolver = ToolsConfiguration.getToolsResolver();
ArrayList options = resolver.getAllSupportedOptions();
Iterator it = options.iterator();
while (it.hasNext()) {
ToolsOptionsInfo info = (ToolsOptionsInfo) it.next();
Console.println(info.getDescription());
}
Console.println(LocalizedMessage.get(MSG_OPTION_DESC_USAGE));
Console.println(LocalizedMessage.get(MSG_OPTION_DESC_HELP));
Console.println();
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class AdminTool method dispatch.
private int dispatch(List filteredArgs) {
int returnCode = INT_CODE_SUCCESS;
String optionArg = (String) filteredArgs.remove(0);
Debug.log("Trying to dispatch to option handler for: " + optionArg);
BaseToolsResolver resolver = ToolsConfiguration.getToolsResolver();
ArrayList options = resolver.getAllSupportedOptions();
if (optionArg.equals(STR_USAGE_OPTION)) {
showUsage();
} else if (optionArg.equals(STR_HELP_OPTION)) {
Iterator it = options.iterator();
while (it.hasNext()) {
Console.println();
ToolsOptionsInfo info = (ToolsOptionsInfo) it.next();
Console.println(info.getDescription());
String handlerClass = info.getHandlerClass();
try {
IToolsOptionHandler handler = (IToolsOptionHandler) Class.forName(handlerClass).newInstance();
handler.displayHelp();
} catch (Exception ex) {
returnCode += INT_CODE_ERROR_UNKNOWN;
Debug.log("Exception caught during help dispatch:", ex);
LocalizedMessage unknownError = LocalizedMessage.get(MSG_UNKNOWN_ERROR);
Console.println();
Console.println(unknownError, new Object[] { ex.getMessage() });
Console.println();
break;
}
}
} else {
String handlerClass = null;
Iterator it = options.iterator();
boolean optionValid = false;
while (it.hasNext()) {
ToolsOptionsInfo info = (ToolsOptionsInfo) it.next();
if (info.getOption().equals(optionArg)) {
handlerClass = info.getHandlerClass();
optionValid = true;
break;
}
}
if (!optionValid) {
returnCode += INT_CODE_ERROR_INVALID_OPTS;
Debug.log("No handler found for option: " + optionArg);
LocalizedMessage errorInvalidOption = LocalizedMessage.get(MSG_INVALID_OPTION);
Console.println();
Console.println(errorInvalidOption, new Object[] { optionArg });
Console.println();
} else {
try {
IToolsOptionHandler handler = (IToolsOptionHandler) Class.forName(handlerClass).newInstance();
if (handler.checkArguments(filteredArgs)) {
handler.handleRequest(filteredArgs);
} else {
// Invalid arguments specified. Display help!
handler.displayHelp();
}
} catch (Exception ex) {
returnCode += INT_CODE_ERROR_UNKNOWN;
Debug.log("Exception caught during option dispatch", ex);
LocalizedMessage unknownError = LocalizedMessage.get(MSG_UNKNOWN_ERROR);
Console.println();
Console.println(unknownError, new Object[] { ex.getMessage() });
Console.println();
}
}
}
return returnCode;
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class BackupFileTask method getRollBackMessage.
public LocalizedMessage getRollBackMessage(IStateAccess stateAccess, Map properties) {
String fileName = getFileName(stateAccess, properties);
Object[] args = { fileName };
LocalizedMessage message = LocalizedMessage.get(LOC_TSK_MSG_BACKUP_FILE_ROLLBACK, args);
return message;
}
Aggregations