Methods Summary |
---|
public org.apache.tools.ant.types.Path | createClasspath()Adds path to the classpath.
if (this.classpath == null) {
this.classpath = new Path(getProject());
}
return this.classpath.createPath();
|
public void | execute()Do the work.
The work is actually done by creating a separate JVM to run a java task.
if (ejbjarfile == null || ejbjarfile.isDirectory()) {
throw new BuildException("invalid ejb jar file.");
}
if (clientjarfile == null || clientjarfile.isDirectory()) {
log("invalid or missing client jar file.", Project.MSG_VERBOSE);
String ejbjarname = ejbjarfile.getAbsolutePath();
//clientname = ejbjarfile+client.jar
String clientname = ejbjarname.substring(0, ejbjarname.lastIndexOf("."));
clientname = clientname + "client.jar";
clientjarfile = new File(clientname);
}
if (mode == null) {
log("mode is null default mode is java");
setMode(JAVA_MODE);
}
if (!(version == BorlandDeploymentTool.BES
|| version == BorlandDeploymentTool.BAS)) {
throw new BuildException("version " + version
+ " is not supported");
}
log("client jar file is " + clientjarfile);
if (mode.equalsIgnoreCase(FORK_MODE)) {
executeFork();
} else {
executeJava();
} // end of else
|
protected void | executeFork()launch the generate client using system api.
if (version == BorlandDeploymentTool.BAS) {
executeForkV4();
}
if (version == BorlandDeploymentTool.BES) {
executeForkV5();
}
|
protected void | executeForkV4()launch the generate client using system api.
try {
log("mode : fork " + BorlandDeploymentTool.BAS, Project.MSG_DEBUG);
ExecTask execTask = new ExecTask(this);
execTask.setDir(new File("."));
execTask.setExecutable("iastool");
execTask.createArg().setValue("generateclient");
if (debug) {
execTask.createArg().setValue("-trace");
}
execTask.createArg().setValue("-short");
execTask.createArg().setValue("-jarfile");
// ejb jar file
execTask.createArg().setValue(ejbjarfile.getAbsolutePath());
//client jar file
execTask.createArg().setValue("-single");
execTask.createArg().setValue("-clientjarfile");
execTask.createArg().setValue(clientjarfile.getAbsolutePath());
log("Calling iastool", Project.MSG_VERBOSE);
execTask.execute();
} catch (Exception e) {
// Have to catch this because of the semantics of calling main()
String msg = "Exception while calling generateclient Details: "
+ e.toString();
throw new BuildException(msg, e);
}
|
protected void | executeForkV5()launch the generate client using system api.
try {
log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG);
ExecTask execTask = new ExecTask(this);
execTask.setDir(new File("."));
execTask.setExecutable("iastool");
if (debug) {
execTask.createArg().setValue("-debug");
}
execTask.createArg().setValue("-genclient");
execTask.createArg().setValue("-jars");
// ejb jar file
execTask.createArg().setValue(ejbjarfile.getAbsolutePath());
//client jar file
execTask.createArg().setValue("-target");
execTask.createArg().setValue(clientjarfile.getAbsolutePath());
//classpath
execTask.createArg().setValue("-cp");
execTask.createArg().setValue(classpath.toString());
log("Calling iastool", Project.MSG_VERBOSE);
execTask.execute();
} catch (Exception e) {
// Have to catch this because of the semantics of calling main()
String msg = "Exception while calling generateclient Details: "
+ e.toString();
throw new BuildException(msg, e);
}
|
protected void | executeJava()launch the generate client using java api.
try {
if (version == BorlandDeploymentTool.BES) {
throw new BuildException("java mode is supported only for "
+ "previous version <=" + BorlandDeploymentTool.BAS);
}
log("mode : java");
Java execTask = null;
execTask = new Java(this);
execTask.setDir(new File("."));
execTask.setClassname("com.inprise.server.commandline.EJBUtilities");
//classpath
//add at the end of the classpath
//the system classpath in order to find the tools.jar file
execTask.setClasspath(classpath.concatSystemClasspath());
execTask.setFork(true);
execTask.createArg().setValue("generateclient");
if (debug) {
execTask.createArg().setValue("-trace");
}
execTask.createArg().setValue("-short");
execTask.createArg().setValue("-jarfile");
// ejb jar file
execTask.createArg().setValue(ejbjarfile.getAbsolutePath());
//client jar file
execTask.createArg().setValue("-single");
execTask.createArg().setValue("-clientjarfile");
execTask.createArg().setValue(clientjarfile.getAbsolutePath());
log("Calling EJBUtilities", Project.MSG_VERBOSE);
execTask.execute();
} catch (Exception e) {
// Have to catch this because of the semantics of calling main()
String msg = "Exception while calling generateclient Details: " + e.toString();
throw new BuildException(msg, e);
}
|
public void | setClasspath(org.apache.tools.ant.types.Path classpath)Path to use for classpath.
if (this.classpath == null) {
this.classpath = classpath;
} else {
this.classpath.append(classpath);
}
|
public void | setClasspathRef(org.apache.tools.ant.types.Reference r)Reference to existing path, to use as a classpath.
createClasspath().setRefid(r);
|
public void | setClientjar(java.io.File clientjar)Client JAR file name.
clientjarfile = clientjar;
|
public void | setDebug(boolean debug)If true, turn on the debug mode for each of the Borland tools launched.
this.debug = debug;
|
public void | setEjbjar(java.io.File ejbfile)EJB JAR file.
ejbjarfile = ejbfile;
|
public void | setMode(java.lang.String s)Command launching mode: java or fork.
mode = s;
|
public void | setVersion(int version)Set the version attribute.
// CheckStyle:VisibilityModifier ON
this.version = version;
|