Browse Source

Provide more control over running Weblogic.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268092 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
a58b5083c4
1 changed files with 39 additions and 11 deletions
  1. +39
    -11
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java

+ 39
- 11
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java View File

@@ -75,12 +75,15 @@ public class WLRun extends Task {
* The classpath to be used in the weblogic ejbc calls. It must contain the weblogic * The classpath to be used in the weblogic ejbc calls. It must contain the weblogic
* classes <b>and</b> the implementation classes of the home and remote interfaces. * classes <b>and</b> the implementation classes of the home and remote interfaces.
*/ */
private String classpath;
private Path classpath;


/** /**
* The weblogic classpath to the be used when running weblogic. * The weblogic classpath to the be used when running weblogic.
*/ */
private String weblogicClasspath = "";
private Path weblogicClasspath;

private String weblogicMainClass = "weblogic.Server";
private String additionalArgs = "";
/** /**
* The security policy to use when running the weblogic server * The security policy to use when running the weblogic server
@@ -102,6 +105,11 @@ public class WLRun extends Task {
* The file containing the weblogic properties for this server. * The file containing the weblogic properties for this server.
*/ */
private String weblogicPropertiesFile = "weblogic.properties"; private String weblogicPropertiesFile = "weblogic.properties";

/**
* additional args to pass to the spawned jvm
*/
private String additionalJvmArgs = "";
/** /**
* Do the work. * Do the work.
@@ -143,23 +151,27 @@ public class WLRun extends Task {
" was not found."); " was not found.");
} }


String execClassPath = project.translatePath(classpath);
Java weblogicServer = (Java)project.createTask("java"); Java weblogicServer = (Java)project.createTask("java");
weblogicServer.setTaskName(getTaskName());
weblogicServer.setFork(true); weblogicServer.setFork(true);
weblogicServer.setClassname("weblogic.Server");
weblogicServer.setClassname(weblogicMainClass);

String jvmArgs = ""; String jvmArgs = "";
if (weblogicClasspath != null) { if (weblogicClasspath != null) {
jvmArgs += "-Dweblogic.class.path=" + project.translatePath(weblogicClasspath);
jvmArgs += " -Dweblogic.class.path=" + weblogicClasspath;
} }
jvmArgs += " -Djava.security.manager -Djava.security.policy==" + securityPolicyFile; jvmArgs += " -Djava.security.manager -Djava.security.policy==" + securityPolicyFile;
jvmArgs += " -Dweblogic.system.home=" + weblogicSystemHome; jvmArgs += " -Dweblogic.system.home=" + weblogicSystemHome;
jvmArgs += " -Dweblogic.system.name=" + weblogicSystemName; jvmArgs += " -Dweblogic.system.name=" + weblogicSystemName;
jvmArgs += " -Dweblogic.system.propertiesFile=" + weblogicPropertiesFile; jvmArgs += " -Dweblogic.system.propertiesFile=" + weblogicPropertiesFile;
jvmArgs += " " + additionalJvmArgs;


weblogicServer.setJvmargs(jvmArgs);
weblogicServer.setClasspath(new Path(project, execClassPath));
weblogicServer.createJvmarg().setLine(jvmArgs);
weblogicServer.createArg().setLine(additionalArgs);
weblogicServer.setClasspath(classpath);
if (weblogicServer.executeJava() != 0) { if (weblogicServer.executeJava() != 0) {
throw new BuildException("Execution of weblogic server failed"); throw new BuildException("Execution of weblogic server failed");
} }
@@ -171,8 +183,8 @@ public class WLRun extends Task {
* *
* @param s the classpath to use when executing the weblogic task. * @param s the classpath to use when executing the weblogic task.
*/ */
public void setClasspath(String s) {
this.classpath = project.translatePath(s);
public void setClasspath(Path classpath) {
this.classpath = classpath;
} }
/** /**
@@ -182,7 +194,7 @@ public class WLRun extends Task {
* *
* @param weblogicClasspath the weblogic classpath * @param weblogicClasspath the weblogic classpath
*/ */
public void setWlclasspath(String weblogicClasspath) {
public void setWlclasspath(Path weblogicClasspath) {
this.weblogicClasspath = weblogicClasspath; this.weblogicClasspath = weblogicClasspath;
} }
@@ -224,4 +236,20 @@ public class WLRun extends Task {
public void setProperties(String propertiesFilename) { public void setProperties(String propertiesFilename) {
this.weblogicPropertiesFile = propertiesFilename; this.weblogicPropertiesFile = propertiesFilename;
} }

/**
* Set the additional arguments to pass to the weblogic JVM
* @param args the arguments to be passed to the JVM
*/
public void setJvmargs(String args) {
this.additionalJvmArgs = args;
}
public void setArgs(String args)
{
additionalArgs = args;
}
public void setWeblogicMainClass(String c)
{
weblogicMainClass = c;
}
} }

Loading…
Cancel
Save