try {
this.dep = FileUtils.getRequestFromFile(
this.pr, this.args.depRequestFilePath);
} catch (Exception e) {
final String err = "Problem with deployment request file: ";
throw new ParameterProblem(err + e.getMessage(), e);
}
}
int deployDuration = 0;
if (this.args.deploy_DurationString != null) {
deployDuration = this._getDurationArg();
}
int memoryRequest = 0;
if (this.args.deploy_MemoryString != null) {
memoryRequest = this._getMemoryArg();
}
short numNodes = 0;
if (this.args.deploy_NumNodesString != null) {
numNodes = this._getNumNodesArg();
}
InitialState_Type requestState = null;
if (this.args.deploy_StateString != null) {
requestState = this._getDeployStateArg();
}
ShutdownMechanism_Type shutdownMechanism = null;
if (this.args.trashAtShutdown) {
shutdownMechanism = ShutdownMechanism_Type.Trash;
}
URI newPropagationTargetURI = null;
try {
if (this.args.saveTarget != null) {
newPropagationTargetURI = new URI(this.args.saveTarget);
}
} catch (Exception e) {
throw new ParameterProblem("Problem with save-target '" +
this.args.saveTarget + "': " + e.getMessage(), e);
}
if (this.dep == null) {
boolean end = false;
String err = name() + " requires a deployment request. This " +
"can be specified by file or by a number of arguments." +
" Problem encountered is that a file request is not " +
"configured and expected commandline arguments are " +
"missing: ";
if (deployDuration < 1 && memoryRequest < 1) {
end = true;
err += "duration and memory request.";
} else if (memoryRequest < 1) {
end = true;
err += "memory request.";
} else if (deployDuration < 1) {
end = true;
err += "duration.";
}
if (end) {
throw new ParameterProblem(err);
}
// default is 1
if (numNodes < 1) {
numNodes = 1;
}
// default is Running
if (requestState == null) {
requestState = InitialState_Type.Running;
}
// shutdownMechanism has no default except 'not set' which
// triggers 'normal'
this.dep = WSUtils.constructDeploymentType(deployDuration,
memoryRequest,
numNodes,
requestState,
shutdownMechanism,
newPropagationTargetURI);
if (this.pr.enabled()) {
final String msg =
"Created deployment request soley from arguments.";
if (this.pr.useThis()) {
this.pr.infoln(
PrCodes.DEPREQ__USING_ARGS, msg);
} else if (this.pr.useLogging()) {
logger.info(msg);
}
}
} else {
if (deployDuration > 0) {
if (this.pr.enabled()) {
final String msg =
"Duration argument provided: overriding duration " +
"found in deployment request file, it is now: " +
deployDuration + " minutes";
final String dbg;
try {
final int oldMins = CommonUtil.durationToMinutes(
this.dep.getDeploymentTime().getMinDuration());
dbg = "Old duration: " + oldMins + " minutes";
} catch (InvalidDurationException e) {
throw new ParameterProblem(e.getMessage(), e);
}
if (this.pr.useThis()) {
this.pr.infoln(
PrCodes.DEPREQ__FILE_OVERRIDE, msg);