UndeployCommandpublic class UndeployCommand extends S1ASCommand
Fields Summary |
---|
private static final String | CASCADE_OPTION | private static final String | DROPTABLES_OPTION | private static final String | TARGET_OPTION |
Methods Summary |
---|
private java.util.Map | createDeploymentProperties()creates the DeployProperties which is used as a parameter to the
deploy operation.
Properties props = new Properties();
final String cascadeOption = getOption(CASCADE_OPTION);
final String dropTablesOption = getOption(DROPTABLES_OPTION);
final String target = getOption(TARGET_OPTION);
if (props != null)
props.put(DeploymentProperties.TARGET, target);
props.put(DeploymentProperties.NAME, getComponentName() );
if (cascadeOption != null)
props.put(DeploymentProperties.CASCADE, cascadeOption);
if (dropTablesOption != null)
props.put(Constants.CMP_DROP_TABLES, dropTablesOption);
return props;
| private java.lang.String | getComponentName()this method returns the componet_name operand
return (String) getOperands().get(0);
| public void | runCommand()An abstract method that Executes the command
validateOptions();
DeploymentFacility df = DeploymentFacilityFactory.getDeploymentFacility();
ServerConnectionIdentifier conn = createServerConnectionIdentifier(
getHost(), getPort(), getUser(), getPassword());
df.connect(conn);
//prepare data
//Target[] targets = new JESTarget[1];
final String targetName = getOption(TARGET_OPTION);
//targets[0] = new JESTarget(targetName, null);
Map deployOptions = createDeploymentProperties();
JESProgressObject progressObject = null;
try
{
if (df.isConnected())
{
CLILogger.getInstance().printDebugMessage("Calling the undeploy with DeployOptions");
Target[] targets = df.createTargets(new String[]{targetName});
if (targets == null)
{
//CLILogger.getInstance().printError(getLocalizedString("InvalidTarget"));
throw new CommandException(getLocalizedString("InvalidTarget", new Object[] {targetName}));
}
progressObject = df.undeploy(targets, getComponentName(), deployOptions);
} else
{
CLILogger.getInstance().printError(
getLocalizedString("CouldNotConnectToDAS"));
}
}
catch (Exception e)
{
if (e.getLocalizedMessage() != null)
CLILogger.getInstance().printDetailMessage(
e.getLocalizedMessage());
throw new CommandException(getLocalizedString(
"CommandUnSuccessful", new Object[] {name} ), e);
}
DeploymentStatus status = df.waitFor(progressObject);
final String statusString = status.getStageStatusMessage();
if (status != null &&
status.getStatus() == DeploymentStatus.FAILURE) {
throw new CommandException(getLocalizedString(
"CommandUnSuccessfulWithMsg", new Object[] {name,
statusString} ));
} else if (status != null &&
status.getStatus() == DeploymentStatus.WARNING) {
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessfulWithMsg",
new Object[] {name, statusString}));
} else {
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful", new Object[] {name} ));
}
| public boolean | validateOptions()An abstract method that validates the options
on the specification in the xml properties file
This method verifies for the correctness of number of
operands and if all the required options are supplied by the client.
return super.validateOptions();
|
|