A method that Executes the command
String result = "";
String successKey = "";
String errorKey = "";
boolean installFromDomain = false;
try {
// Retrieve the upload boolean option value
boolean isUpload = getBooleanOption(UPLOAD_OPTION);
// Perform the pre run initialization
if (preRunInit(isUpload))
{
// Retrieve the options
String targetName = getOption(TARGET_OPTION);
// Retrieve the operand
String operand = (String) getOperands().get(0);
// Make sure the file specified is valid. If it is not a valid file, then
// we should try to install/deploy the component/assembly from the domain.
// If that should fail, then we will throw the original commandException,
// saying that the filePath specified was not valid.
try {
if (name.equals(DEPLOY_SERVICE_ASSEMBLY))
{
errorKey = "JBIDeloymentFileNotFound";
}
else
{
errorKey = "JBIInstallationFileNotFound";
}
operand = validateFilePath (errorKey,operand);
}
catch (CommandException ce) {
installFromDomain = true;
if (name.equals(INSTALL_COMPONENT)) {
result = ((JBIAdminCommands) mJbiAdminCommands).installComponentFromDomain(
operand,
targetName);
successKey = "JBISuccessInstallDomainComponent";
}
else if (name.equals(INSTALL_SHARED_LIBRARY)) {
result = ((JBIAdminCommands) mJbiAdminCommands).installSharedLibraryFromDomain(
operand,
targetName);
successKey = "JBISuccessInstallDomainSharedLibrary";
}
else if (name.equals(DEPLOY_SERVICE_ASSEMBLY)) {
result = ((JBIAdminCommands) mJbiAdminCommands).deployServiceAssemblyFromDomain(
operand,
targetName);
successKey = "JBISuccessDeployServiceAssembly";
}
processJBIAdminResult (result, successKey);
}
if (!(installFromDomain))
{
// Using the command name, we'll determine how to process the command
if (name.equals(INSTALL_COMPONENT)) {
// When installing a component, two api's exist, one when installing
// a component with no associated properties, and one when installing
// a component with associated properties.
Properties properties = checkForProperties();
result = ((JBIAdminCommands) mJbiAdminCommands).installComponent(
operand,
properties,
targetName);
successKey = "JBISuccessInstallComponent";
}
else if (name.equals(INSTALL_SHARED_LIBRARY)) {
result = ((JBIAdminCommands) mJbiAdminCommands).installSharedLibrary(
operand,
targetName);
successKey = "JBISuccessInstallSharedLibrary";
}
else if (name.equals(DEPLOY_SERVICE_ASSEMBLY)) {
result = ((JBIAdminCommands) mJbiAdminCommands).deployServiceAssembly(
operand,
targetName);
successKey = "JBISuccessDeployServiceAssembly";
}
processJBIAdminResult (result, successKey);
}
}
}
catch (Exception e) {
processTaskException(e);
}