conor 00/07/26 05:17:30
Modified: docs ejb.html
src/main/org/apache/tools/ant/taskdefs/optional/ejb
EjbJar.java
Log:
Add the ability to output all EJB jarfiles to a single directory.
Add a new attribute 'flatdestdir'. Attribute defaults to false, which
maintains the current behaviour. If it is set to true, all jars will
be created directly in the destination dir.
WARNING: If you use this attribute, and have multiple jars with the same
name, they will overwrite each other!
Submitted by: Tim Fennell <[EMAIL PROTECTED]>
Revision Changes Path
1.3 +1 -0 jakarta-ant/docs/ejb.html
Index: ejb.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/ejb.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ejb.html 2000/07/24 13:20:54 1.2
+++ ejb.html 2000/07/26 12:17:27 1.3
@@ -12,6 +12,7 @@
<p>by</p>
<!-- Names are in alphabetical order, on last name -->
<ul>
+ <li>Tim Fennell (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
<li>Conor MacNeill (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
</ul>
1.2 +32 -7
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
Index: EjbJar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EjbJar.java 2000/07/14 13:50:27 1.1
+++ EjbJar.java 2000/07/26 12:17:30 1.2
@@ -250,6 +250,12 @@
/** Stores a handle to the directory to put the Jar files in */
private File destdir = null;
+ /**
+ * Instance variable that determines whether to use a package structure
+ * of a flat directory as the destination for the jar files.
+ */
+ private boolean flatdestdir = false;
+
/** Instance variable that determines whether to generate weblogic jars.
*/
private boolean generateweblogic = false;
@@ -283,6 +289,14 @@
}
/**
+ * Setter used to store the value of flatdestdir.
+ * @param inValue a string, either 'true' or 'false'.
+ */
+ public void setFlatdestdir(String inValue) {
+ this.flatdestdir = Boolean.valueOf(inValue).booleanValue();
+ }
+
+ /**
* Setter used to store the suffix for the generated jar file.
* @param inString the string to use as the suffix.
*/
@@ -415,7 +429,12 @@
/**
- *
+ * Helper method invoked by execute() for each WebLogic jar to be built.
+ * Encapsulates the logic of constructing a java task for calling
+ * weblogic.ejbc and executing it.
+ * @param sourceJar java.io.File representing the source (EJB1.1)
jarfile.
+ * @param destJar java.io.File representing the destination, WebLogic
+ * jarfile.
*/
public void buildWeblogicJar(File sourceJar, File destJar) {
org.apache.tools.ant.taskdefs.Java javaTask = null;
@@ -505,8 +524,8 @@
baseName = files[index].substring(0, endBaseName);
/* Parse the ejb deployment descriptor. While it may not
- * look like much, passing 'this' in the above method allows
- * the parser to call us back when it finds interesting
things.
+ * look like much, we use a SAXParser and an inner class to
+ * get hold of all the classfile names for the descriptor.
*/
handler = new DescriptorHandler();
saxParser.parse(new InputSource
@@ -516,9 +535,8 @@
ejbFiles = handler.getFiles();
- /* Now that we've parsed the deployment descriptor we have
the
- * bean name, so we can figure out all the .xml filenames and
- * add them to the set of files for the jar.
+ /* Now try to locate all of the deployment descriptors for
the
+ * jar, and if they exist, add them to the list of files.
*/
// First the regular deployment descriptor
@@ -546,8 +564,15 @@
ejbFiles.put(EjbJar.META_DIR + EjbJar.WL_CMP_DD,
weblogicDD);
}
+
+ // Lastly create File object for the Jar files. If we are
using
+ // a flat destination dir, then we need to redefine baseName!
+ if (this.flatdestdir) {
+ int startName = baseName.lastIndexOf(File.separator);
+ int endName = baseName.length();
+ baseName = baseName.substring(startName, endName);
+ }
- // Lastly for the jarfiles
jarfile = new File(this.destdir,
baseName
+ this.genericjarsuffix);