Methods Summary |
---|
protected java.lang.StringBuffer | buildArgsPrefix()Builds the prefix arguments to pass to weblogic.deploy.
These arguments are generic across all actions.
ServerDeploy task = getTask();
// constructs the "-url <url> -debug <action> <password>" portion
// of the commmand line
return new StringBuffer(1024)
.append((getServer() != null)
? "-url " + getServer()
: "")
.append(" ")
.append(debug ? "-debug " : "")
.append((getUserName() != null)
? "-username " + getUserName()
: "")
.append(" ")
.append(task.getAction()).append(" ")
.append(getPassword()).append(" ");
|
protected java.lang.String | buildDeployArgs()Builds the arguments to pass to weblogic.deploy for deployment actions
("deploy" and "update").
String args = buildArgsPrefix()
.append(application).append(" ")
.append(getTask().getSource())
.toString();
if (component != null) {
args = "-component " + component + " " + args;
}
return args;
|
protected java.lang.String | buildListArgs()Builds the arguments to pass to weblogic.deploy for the list action
return buildArgsPrefix()
.toString();
|
protected java.lang.String | buildUndeployArgs()Builds the arguments to pass to weblogic.deploy for undeployment actions
("undeploy" and "delete").
return buildArgsPrefix()
.append(application).append(" ")
.toString();
|
public void | deploy()Perform the actual deployment.
For this implementation, a JVM is spawned and the weblogic.deploy
tools is executed.
Java java = new Java(getTask());
java.setFork(true);
java.setFailonerror(true);
java.setClasspath(getClasspath());
java.setClassname(WEBLOGIC_DEPLOY_CLASS_NAME);
java.createArg().setLine(getArguments());
java.execute();
|
public java.lang.String | getArguments()Builds the arguments to pass to weblogic.deploy according to the
supplied action.
String action = getTask().getAction();
String args = null;
if (action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) {
args = buildDeployArgs();
} else if (action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) {
args = buildUndeployArgs();
} else if (action.equals(ACTION_LIST)) {
args = buildListArgs();
}
return args;
|
protected boolean | isActionValid()Determines if the action supplied is valid.
Valid actions are contained in the static array VALID_ACTIONS
boolean valid = false;
String action = getTask().getAction();
for (int i = 0; i < VALID_ACTIONS.length; i++) {
if (action.equals(VALID_ACTIONS[i])) {
valid = true;
break;
}
}
return valid;
|
public void | setApplication(java.lang.String application)The name of the application being deployed; required.
this.application = application;
|
public void | setComponent(java.lang.String component)the component string for the deployment targets; optional.
It is in the form <component>:<target1>,<target2>...
Where component is the archive name (minus the .jar, .ear, .war
extension). Targets are the servers where the components will be deployed
this.component = component;
|
public void | setDebug(boolean debug)If set to true, additional information will be
printed during the deployment process; optional.
this.debug = debug;
|
public void | validateAttributes()Validates the passed in attributes.
The rules are:
- If action is "deploy" or "update" the "application" and "source"
attributes must be supplied.
- If action is "delete" or "undeploy" the "application" attribute must
be supplied.
super.validateAttributes();
String action = getTask().getAction();
// check that the password has been set
if ((getPassword() == null)) {
throw new BuildException("The password attribute must be set.");
}
// check for missing application on deploy & update
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
&& application == null) {
throw new BuildException("The application attribute must be set "
+ "if action = " + action);
}
// check for missing source on deploy & update
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
&& getTask().getSource() == null) {
throw new BuildException("The source attribute must be set if "
+ "action = " + action);
}
// check for missing application on delete & undeploy
if ((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY))
&& application == null) {
throw new BuildException("The application attribute must be set if "
+ "action = " + action);
}
|