conor 01/06/24 06:26:55
Modified: src/main/org/apache/tools/ant/taskdefs/optional/ejb
BorlandDeploymentTool.java DescriptorHandler.java
EjbJar.java GenericDeploymentTool.java
IPlanetDeploymentTool.java JbossDeploymentTool.java
WeblogicDeploymentTool.java
WeblogicTOPLinkDeploymentTool.java
Log:
First steps on reforming the ejbjar naming conventions. This installment
make the basejarname attribute actually do something useful
Revision Changes Path
1.4 +1 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
Index: BorlandDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BorlandDeploymentTool.java 2001/04/19 14:02:16 1.3
+++ BorlandDeploymentTool.java 2001/06/24 13:26:51 1.4
@@ -240,7 +240,7 @@
* Add any vendor specific files which should be included in the
* EJB Jar.
*/
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
File borlandDD = new File(getConfig().descriptorDir,META_DIR+BAS_DD);
if (borlandDD.exists()) {
1.8 +2 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
Index: DescriptorHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DescriptorHandler.java 2001/03/14 01:22:21 1.7
+++ DescriptorHandler.java 2001/06/24 13:26:52 1.8
@@ -131,6 +131,7 @@
if (fileDTD.exists()) {
if (publicId != null) {
fileDTDs.put(publicId, fileDTD);
+ owningTask.log("Mapped publicId " + publicId + " to file " +
fileDTD, Project.MSG_VERBOSE);
}
return;
}
@@ -138,6 +139,7 @@
if (getClass().getResource(location) != null) {
if (publicId != null) {
resourceDTDs.put(publicId, location);
+ owningTask.log("Mapped publicId " + publicId + " to resource
" + location, Project.MSG_VERBOSE);
}
}
}
1.19 +7 -0
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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- EjbJar.java 2001/05/17 11:05:47 1.18
+++ EjbJar.java 2001/06/24 13:26:52 1.19
@@ -469,6 +469,13 @@
throw new BuildException(msg, pce);
}
} // end of execute()
+
+ public static class NamignScheme extends EnumeratedAttribute {
+ public String[] getValues() {
+ return new String[] {"ejb-name", "directory", "descriptor"};
+ }
+ }
+
}
1.18 +187 -182
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
Index: GenericDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- GenericDeploymentTool.java 2001/05/01 10:31:47 1.17
+++ GenericDeploymentTool.java 2001/06/24 13:26:52 1.18
@@ -113,10 +113,10 @@
*/
private List addedfiles;
- /**
- * Handler used to parse the EJB XML descriptor
- */
- private DescriptorHandler handler;
+ /**
+ * Handler used to parse the EJB XML descriptor
+ */
+ private DescriptorHandler handler;
/**
* Setter used to store the value of destination directory prior to
execute()
@@ -210,9 +210,9 @@
getTask().log(message, level);
}
- protected Location getLocation() {
- return getTask().getLocation();
- }
+ protected Location getLocation() {
+ return getTask().getLocation();
+ }
/**
@@ -303,24 +303,24 @@
public void processDescriptor(String descriptorFileName, SAXParser
saxParser) {
- checkConfiguration(descriptorFileName, saxParser);
+ checkConfiguration(descriptorFileName, saxParser);
try {
- // Retrive the files to be added to JAR from EJB
descriptor
- Hashtable ejbFiles = parseEjbFiles(descriptorFileName,
saxParser);
+ // Retrive the files to be added to JAR from EJB descriptor
+ Hashtable ejbFiles = parseEjbFiles(descriptorFileName,
saxParser);
- // Add any support classes specified in the build file
- addSupportClasses(ejbFiles);
+ // Add any support classes specified in the build file
+ addSupportClasses(ejbFiles);
- // Determine the JAR filename (without filename
extension)
- String baseName = getJarBaseName(descriptorFileName);
+ // Determine the JAR filename (without filename extension)
+ String baseName = getJarBaseName(descriptorFileName);
// First the regular deployment descriptor
ejbFiles.put(META_DIR + EJB_DD,
new File(config.descriptorDir, descriptorFileName));
// now the vendor specific files, if any
- addVendorFiles(ejbFiles, baseName);
+ addVendorFiles(ejbFiles, baseName, descriptorFileName);
// add any inherited files
checkAndAddInherited(ejbFiles);
@@ -351,7 +351,7 @@
Project.MSG_INFO);
// Use helper method to write the jarfile
- String publicId = getPublicId();
+ String publicId = getPublicId();
writeJar(baseName, jarFile, ejbFiles, publicId);
}
@@ -380,60 +380,60 @@
}
}
- /**
- * This method is called as the first step in the processDescriptor
method
- * to allow vendor-specific subclasses to validate the task
configuration
- * prior to processing the descriptor. If the configuration is invalid,
- * a BuildException should be thrown.
- *
- * @param descriptorFileName String representing the file name of an EJB
- * descriptor to be processed
- * @param saxParser SAXParser which may be used to parse the
XML
- * descriptor
- * @thows BuildException Thrown if the configuration is invalid
- */
- protected void checkConfiguration(String descriptorFileName,
-
SAXParser saxParser) throws BuildException {
-
- /*
- * For the GenericDeploymentTool, do nothing. Vendor specific
- * subclasses should throw a BuildException if the
configuration is
- * invalid for their server.
- */
- }
-
- /**
- * This method returns a list of EJB files found when the specified EJB
- * descriptor is parsed and processed.
- *
- * @param descriptorFileName String representing the file name of an EJB
- * descriptor to be processed
- * @param saxParser SAXParser which may be used to parse the
XML
- * descriptor
- * @return Hashtable of EJB class (and other) files
to be
- * added to the completed JAR file
- * @throws SAXException Any SAX exception, possibly wrapping
another
- * exception
+ /**
+ * This method is called as the first step in the processDescriptor
method
+ * to allow vendor-specific subclasses to validate the task configuration
+ * prior to processing the descriptor. If the configuration is invalid,
+ * a BuildException should be thrown.
+ *
+ * @param descriptorFileName String representing the file name of an EJB
+ * descriptor to be processed
+ * @param saxParser SAXParser which may be used to parse the XML
+ * descriptor
+ * @thows BuildException Thrown if the configuration is invalid
+ */
+ protected void checkConfiguration(String descriptorFileName,
+ SAXParser saxParser) throws
BuildException {
+
+ /*
+ * For the GenericDeploymentTool, do nothing. Vendor specific
+ * subclasses should throw a BuildException if the configuration is
+ * invalid for their server.
+ */
+ }
+
+ /**
+ * This method returns a list of EJB files found when the specified EJB
+ * descriptor is parsed and processed.
+ *
+ * @param descriptorFileName String representing the file name of an EJB
+ * descriptor to be processed
+ * @param saxParser SAXParser which may be used to parse the XML
+ * descriptor
+ * @return Hashtable of EJB class (and other) files to
be
+ * added to the completed JAR file
+ * @throws SAXException Any SAX exception, possibly wrapping
another
+ * exception
* @throws IOException An IOException from the parser, possibly
from a
- * the byte stream or character stream
- */
- protected Hashtable parseEjbFiles(String descriptorFileName, SAXParser
saxParser)
- throws IOException,
SAXException {
- FileInputStream descriptorStream = null;
- Hashtable ejbFiles = null;
-
- try {
- handler = getDescriptorHandler(config.srcDir);
-
- /* Parse the ejb deployment descriptor. While it may
not
- * look like much, we use a SAXParser and an inner
class to
- * get hold of all the classfile names for the
descriptor.
- */
- descriptorStream = new FileInputStream(new
File(config.descriptorDir, descriptorFileName));
- saxParser.parse(new InputSource(descriptorStream),
handler);
-
- ejbFiles = handler.getFiles();
+ * the byte stream or character stream
+ */
+ protected Hashtable parseEjbFiles(String descriptorFileName, SAXParser
saxParser)
+ throws IOException, SAXException {
+ FileInputStream descriptorStream = null;
+ Hashtable ejbFiles = null;
+ try {
+ handler = getDescriptorHandler(config.srcDir);
+
+ /* Parse the ejb deployment descriptor. While it may not
+ * look like much, we use a SAXParser and an inner class to
+ * get hold of all the classfile names for the descriptor.
+ */
+ descriptorStream = new FileInputStream(new
File(config.descriptorDir, descriptorFileName));
+ saxParser.parse(new InputSource(descriptorStream), handler);
+
+ ejbFiles = handler.getFiles();
+
} finally {
if (descriptorStream != null) {
try {
@@ -443,74 +443,79 @@
}
}
- return ejbFiles;
- }
+ return ejbFiles;
+ }
- /**
- * Adds any classes the user specifies using <i>support</i> nested
elements
- * to the <code>ejbFiles</code> Hashtable.
- *
- * @param ejbFiles Hashtable of EJB classes (and other) files that will
be
- * added to the completed JAR file
- */
- protected void addSupportClasses(Hashtable ejbFiles) {
- // add in support classes if any
- Project project = task.getProject();
- for (Iterator i = config.supportFileSets.iterator();
i.hasNext();) {
- FileSet supportFileSet = (FileSet)i.next();
- File supportBaseDir = supportFileSet.getDir(project);
- DirectoryScanner supportScanner =
supportFileSet.getDirectoryScanner(project);
- supportScanner.scan();
- String[] supportFiles =
supportScanner.getIncludedFiles();
- for (int j = 0; j < supportFiles.length; ++j) {
- ejbFiles.put(supportFiles[j], new
File(supportBaseDir, supportFiles[j]));
- }
- }
- }
-
-
- /**
- * Using the EJB descriptor file name passed from the
<code>ejbjar</code>
- * task, this method returns the "basename" which will be used to name
the
- * completed JAR file.
- *
- * @param descriptorFileName String representing the file name of an EJB
- * descriptor to be processed
- * @return The "basename" which will be used to name
the
- * completed JAR file
- */
- protected String getJarBaseName(String descriptorFileName) {
-
- String baseName = "";
-
- // Work out what the base name is
- if (config.baseJarName != null) {
- baseName = config.baseJarName;
- } else {
- int lastSeparatorIndex =
descriptorFileName.lastIndexOf(File.separator);
- int endBaseName = -1;
- if (lastSeparatorIndex != -1) {
- endBaseName =
descriptorFileName.indexOf(config.baseNameTerminator,
-
lastSeparatorIndex);
- } else {
- endBaseName =
descriptorFileName.indexOf(config.baseNameTerminator);
- }
-
- if (endBaseName != -1) {
- baseName = descriptorFileName.substring(0,
endBaseName);
- }
- baseName = descriptorFileName.substring(0, endBaseName);
- }
+ /**
+ * Adds any classes the user specifies using <i>support</i> nested
elements
+ * to the <code>ejbFiles</code> Hashtable.
+ *
+ * @param ejbFiles Hashtable of EJB classes (and other) files that will
be
+ * added to the completed JAR file
+ */
+ protected void addSupportClasses(Hashtable ejbFiles) {
+ // add in support classes if any
+ Project project = task.getProject();
+ for (Iterator i = config.supportFileSets.iterator(); i.hasNext();) {
+ FileSet supportFileSet = (FileSet)i.next();
+ File supportBaseDir = supportFileSet.getDir(project);
+ DirectoryScanner supportScanner =
supportFileSet.getDirectoryScanner(project);
+ supportScanner.scan();
+ String[] supportFiles = supportScanner.getIncludedFiles();
+ for (int j = 0; j < supportFiles.length; ++j) {
+ ejbFiles.put(supportFiles[j], new File(supportBaseDir,
supportFiles[j]));
+ }
+ }
+ }
- return baseName;
- }
+ /**
+ * Using the EJB descriptor file name passed from the <code>ejbjar</code>
+ * task, this method returns the "basename" which will be used to name
the
+ * completed JAR file.
+ *
+ * @param descriptorFileName String representing the file name of an EJB
+ * descriptor to be processed
+ * @return The "basename" which will be used to name
the
+ * completed JAR file
+ */
+ protected String getJarBaseName(String descriptorFileName) {
+
+ String baseName = "";
+
+ // Work out what the base name is
+ if (config.baseJarName != null) {
+ String canonicalDescriptor = descriptorFileName.replace('\\',
'/');
+ int index = canonicalDescriptor.lastIndexOf('/');
+ if (index != -1) {
+ baseName = descriptorFileName.substring(0, index + 1);
+ }
+ baseName += config.baseJarName;
+ } else {
+ int lastSeparatorIndex =
descriptorFileName.lastIndexOf(File.separator);
+ int endBaseName = -1;
+ if (lastSeparatorIndex != -1) {
+ endBaseName =
descriptorFileName.indexOf(config.baseNameTerminator,
+
lastSeparatorIndex);
+ } else {
+ endBaseName =
descriptorFileName.indexOf(config.baseNameTerminator);
+ }
+
+ if (endBaseName != -1) {
+ baseName = descriptorFileName.substring(0, endBaseName);
+ }
+ baseName = descriptorFileName.substring(0, endBaseName);
+ }
+
+ return baseName;
+ }
+
/**
* Add any vendor specific files which should be included in the
* EJB Jar.
*/
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
// nothing to add for generic tool.
}
@@ -523,55 +528,55 @@
return new File(destDir, baseName + genericJarSuffix);
}
- /**
- * This method checks the timestamp on each file listed in the <code>
- * ejbFiles</code> and compares them to the timestamp on the
<code>jarFile
- * </code>. If the <code>jarFile</code>'s timestamp is more recent than
- * each EJB file, <code>false</code> is returned. Otherwise, <code>true
- * </code> is returned.
- *
- * @param ejbFiles Hashtable of EJB classes (and other) files that will
be
- * added to the completed JAR file
- * @param jarFile JAR file which will contain all of the EJB classes
(and
- * other) files
- * @return boolean indicating whether or not the
<code>jarFile</code>
- * is up to date
- */
- protected boolean needToRebuild(Hashtable ejbFiles, File jarFile) {
- // By default we assume we need to build.
- boolean needBuild = true;
-
- if (jarFile.exists()) {
- long lastBuild = jarFile.lastModified();
- Iterator fileIter = ejbFiles.values().iterator();
- // Set the need build to false until we find out
otherwise.
- needBuild = false;
-
- // Loop through the files seeing if any has been touched
- // more recently than the destination jar.
- while( (needBuild == false) && (fileIter.hasNext()) ) {
- File currentFile = (File) fileIter.next();
- needBuild = ( lastBuild <
currentFile.lastModified() );
- if (needBuild) {
- log("Build needed because " +
currentFile.getPath() + " is out of date",
- Project.MSG_VERBOSE);
- }
- }
- }
-
- return needBuild;
- }
-
- /**
- * Returns the Public ID of the DTD specified in the EJB descriptor.
Not
- * every vendor-specific <code>DeploymentTool</code> will need to
reference
- * this value or may want to determine this value in a vendor-specific
way.
- *
- * @return Public ID of the DTD specified in the EJB descriptor.
- */
- protected String getPublicId() {
- return handler.getPublicId();
- }
+ /**
+ * This method checks the timestamp on each file listed in the <code>
+ * ejbFiles</code> and compares them to the timestamp on the
<code>jarFile
+ * </code>. If the <code>jarFile</code>'s timestamp is more recent than
+ * each EJB file, <code>false</code> is returned. Otherwise, <code>true
+ * </code> is returned.
+ *
+ * @param ejbFiles Hashtable of EJB classes (and other) files that will
be
+ * added to the completed JAR file
+ * @param jarFile JAR file which will contain all of the EJB classes
(and
+ * other) files
+ * @return boolean indicating whether or not the
<code>jarFile</code>
+ * is up to date
+ */
+ protected boolean needToRebuild(Hashtable ejbFiles, File jarFile) {
+ // By default we assume we need to build.
+ boolean needBuild = true;
+
+ if (jarFile.exists()) {
+ long lastBuild = jarFile.lastModified();
+ Iterator fileIter = ejbFiles.values().iterator();
+ // Set the need build to false until we find out otherwise.
+ needBuild = false;
+
+ // Loop through the files seeing if any has been touched
+ // more recently than the destination jar.
+ while( (needBuild == false) && (fileIter.hasNext()) ) {
+ File currentFile = (File) fileIter.next();
+ needBuild = ( lastBuild < currentFile.lastModified() );
+ if (needBuild) {
+ log("Build needed because " + currentFile.getPath() + "
is out of date",
+ Project.MSG_VERBOSE);
+ }
+ }
+ }
+
+ return needBuild;
+ }
+
+ /**
+ * Returns the Public ID of the DTD specified in the EJB descriptor. Not
+ * every vendor-specific <code>DeploymentTool</code> will need to
reference
+ * this value or may want to determine this value in a vendor-specific
way.
+ *
+ * @return Public ID of the DTD specified in the EJB descriptor.
+ */
+ protected String getPublicId() {
+ return handler.getPublicId();
+ }
/**
* Method used to encapsulate the writing of the JAR file. Iterates over
the
@@ -785,14 +790,14 @@
/**
* Called to validate that the tool parameters have been configured.
*
- * @throws BuildException If the Deployment Tool's configuration isn't
- * valid
+ * @throws BuildException If the Deployment Tool's configuration isn't
+ * valid
*/
public void validateConfigured() throws BuildException {
if ((destDir == null) || (!destDir.isDirectory())) {
- String msg = "A valid destination directory must be
specified "
- + "using the
\"destdir\" attribute.";
- throw new BuildException(msg, getLocation());
+ String msg = "A valid destination directory must be specified "
+ + "using the \"destdir\" attribute.";
+ throw new BuildException(msg, getLocation());
}
}
}
1.2 +247 -248
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java
Index: IPlanetDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IPlanetDeploymentTool.java 2001/05/01 10:31:48 1.1
+++ IPlanetDeploymentTool.java 2001/06/24 13:26:53 1.2
@@ -122,302 +122,301 @@
*/
public class IPlanetDeploymentTool extends GenericDeploymentTool {
- /* Attributes set by the Ant build file */
- private File iashome;
- private String jarSuffix = ".jar";
- private boolean keepgenerated = false;
- private boolean debug = false;
-
- /*
- * Filenames of the standard EJB descriptor (which is passed to this
class
- * from the parent "ejbjar" task) and the iAS-specific EJB descriptor
- * (whose name is determined by this class). Both filenames are
relative
- * to the directory specified by the "srcdir" attribute in the ejbjar
task.
- */
- private String descriptorName;
- private String iasDescriptorName;
-
- /*
- * The displayName variable stores the value of the "display-name"
element
- * from the standard EJB descriptor. As a future enhancement to this
task,
- * we may determine the name of the EJB JAR file using this
display-name,
- * but this has not be implemented yet.
- */
- private String displayName;
-
- /*
- * Regardless of the name of the iAS-specific EJB descriptor file, it
will
- * written in the completed JAR file as "ias-ejb-jar.xml". This is the
- * naming convention implemented by iAS.
- */
+ /* Attributes set by the Ant build file */
+ private File iashome;
+ private String jarSuffix = ".jar";
+ private boolean keepgenerated = false;
+ private boolean debug = false;
+
+ /*
+ * Filenames of the standard EJB descriptor (which is passed to this
class
+ * from the parent "ejbjar" task) and the iAS-specific EJB descriptor
+ * (whose name is determined by this class). Both filenames are relative
+ * to the directory specified by the "srcdir" attribute in the ejbjar
task.
+ */
+ private String descriptorName;
+ private String iasDescriptorName;
+
+ /*
+ * The displayName variable stores the value of the "display-name"
element
+ * from the standard EJB descriptor. As a future enhancement to this
task,
+ * we may determine the name of the EJB JAR file using this display-name,
+ * but this has not be implemented yet.
+ */
+ private String displayName;
+
+ /*
+ * Regardless of the name of the iAS-specific EJB descriptor file, it
will
+ * written in the completed JAR file as "ias-ejb-jar.xml". This is the
+ * naming convention implemented by iAS.
+ */
private static final String IAS_DD = "ias-ejb-jar.xml";
/**
* Setter method used to store the "home" directory of the user's iAS
- * installation. The directory specified should typically be
- * <code>[install-location]/iplanet/ias6/ias</code>.
- *
+ * installation. The directory specified should typically be
+ * <code>[install-location]/iplanet/ias6/ias</code>.
+ *
* @param iashome The home directory for the user's iAS installation.
*/
- public void setIashome(File iashome) {
- this.iashome = iashome;
- }
+ public void setIashome(File iashome) {
+ this.iashome = iashome;
+ }
/**
* Setter method used to specify whether the Java source files generated
by
* the ejbc utility should be saved or automatically deleted.
- *
+ *
* @param keepgenerated boolean which, if <code>true</code>, indicates
that
- * Java source files generated by ejbc for the
stubs
- * and skeletons should be kept.
+ * Java source files generated by ejbc for the stubs
+ * and skeletons should be kept.
*/
- public void setKeepgenerated(boolean keepgenerated) {
- this.keepgenerated = keepgenerated;
- }
+ public void setKeepgenerated(boolean keepgenerated) {
+ this.keepgenerated = keepgenerated;
+ }
/**
* Sets whether or not debugging output will be generated when ejbc is
- * executed.
- *
- * @param debug A boolean indicating if debugging output should be
generated
- */
- public void setDebug(boolean debug) {
- this.debug = debug;
- }
+ * executed.
+ *
+ * @param debug A boolean indicating if debugging output should be
generated
+ */
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
/**
* Setter method used to specify the filename suffix (for example,
".jar")
- * for the JAR files to be created.
- *
+ * for the JAR files to be created.
+ *
* @param jarSuffix The string to use as the JAR filename suffix.
*/
public void setSuffix(String jarSuffix) {
this.jarSuffix = jarSuffix;
}
- /**
+ /**
* Since iAS doesn't generate a "generic" JAR as part of its processing,
- * this attribute is ignored and a warning message is displayed to the
user.
- *
+ * this attribute is ignored and a warning message is displayed to the
user.
+ *
* @param inString the string to use as the suffix. This parameter is
- * ignored.
+ * ignored.
*/
public void setGenericJarSuffix(String inString) {
log("Since a generic JAR file is not created during processing, the "
- + "iPlanet Deployment Tool does not support the
"
- + "\"genericjarsuffix\" attribute. It will be
ignored.",
- Project.MSG_WARN);
+ + "iPlanet Deployment Tool does not support the "
+ + "\"genericjarsuffix\" attribute. It will be ignored.",
+ Project.MSG_WARN);
}
- public void processDescriptor(String descriptorName, SAXParser
saxParser) {
- this.descriptorName = descriptorName;
+ public void processDescriptor(String descriptorName, SAXParser
saxParser) {
+ this.descriptorName = descriptorName;
- log("iPlanet Deployment Tool processing: " + descriptorName + "
(and "
- + getIasDescriptorName() + ")",
Project.MSG_VERBOSE);
+ log("iPlanet Deployment Tool processing: " + descriptorName + " (and
"
+ + getIasDescriptorName() + ")", Project.MSG_VERBOSE);
- super.processDescriptor(descriptorName, saxParser);
- }
+ super.processDescriptor(descriptorName, saxParser);
+ }
/**
* Verifies that the user selections are valid.
- *
- * @param descriptorFileName String representing the file name of an EJB
- * descriptor to be processed
- * @param saxParser SAXParser which may be used to parse the
XML
- * descriptor
- * @throws BuildException If the user selections are invalid.
- */
- protected void checkConfiguration(String descriptorFileName,
-
SAXParser saxParser) throws BuildException {
-
- int startOfName =
descriptorFileName.lastIndexOf(File.separatorChar) + 1;
- String stdXml = descriptorFileName.substring(startOfName);
- if (stdXml.equals(EJB_DD) && (getConfig().baseJarName == null))
{
- String msg = "No name specified for the completed JAR
file. The EJB"
- + " descriptor should
be prepended with the JAR "
- + "name or it should be
specified using the "
- + "attribute
\"basejarname\" in the \"ejbjar\" task.";
- throw new BuildException(msg, getLocation());
- }
-
- File iasDescriptor = new File(getConfig().descriptorDir,
-
getIasDescriptorName());
- if ((!iasDescriptor.exists()) || (!iasDescriptor.isFile())) {
- String msg = "The iAS-specific EJB descriptor ("
- + iasDescriptor + ")
was not found.";
- throw new BuildException(msg, getLocation());
- }
-
- if ((iashome != null) && (!iashome.isDirectory())) {
- String msg = "If \"iashome\" is specified, it must be a
valid "
- + "directory (it was
set to " + iashome + ").";
- throw new BuildException(msg, getLocation());
- }
- }
-
- /**
- * This method returns a list of EJB files found when the specified EJB
- * descriptor is parsed and processed.
- *
- * @param descriptorFileName String representing the file name of an EJB
- * descriptor to be processed
- * @param saxParser SAXParser which may be used to parse the
XML
- * descriptor
- * @return Hashtable of EJB class (and other) files
to be
- * added to the completed JAR file
+ *
+ * @param descriptorFileName String representing the file name of an EJB
+ * descriptor to be processed
+ * @param saxParser SAXParser which may be used to parse the XML
+ * descriptor
+ * @throws BuildException If the user selections are invalid.
+ */
+ protected void checkConfiguration(String descriptorFileName,
+ SAXParser saxParser) throws
BuildException {
+
+ int startOfName = descriptorFileName.lastIndexOf(File.separatorChar)
+ 1;
+ String stdXml = descriptorFileName.substring(startOfName);
+ if (stdXml.equals(EJB_DD) && (getConfig().baseJarName == null)) {
+ String msg = "No name specified for the completed JAR file. The
EJB"
+ + " descriptor should be prepended with the JAR "
+ + "name or it should be specified using the "
+ + "attribute \"basejarname\" in the \"ejbjar\"
task.";
+ throw new BuildException(msg, getLocation());
+ }
+
+ File iasDescriptor = new File(getConfig().descriptorDir,
+ getIasDescriptorName());
+ if ((!iasDescriptor.exists()) || (!iasDescriptor.isFile())) {
+ String msg = "The iAS-specific EJB descriptor ("
+ + iasDescriptor + ") was not found.";
+ throw new BuildException(msg, getLocation());
+ }
+
+ if ((iashome != null) && (!iashome.isDirectory())) {
+ String msg = "If \"iashome\" is specified, it must be a valid "
+ + "directory (it was set to " + iashome + ").";
+ throw new BuildException(msg, getLocation());
+ }
+ }
+
+ /**
+ * This method returns a list of EJB files found when the specified EJB
+ * descriptor is parsed and processed.
+ *
+ * @param descriptorFileName String representing the file name of an EJB
+ * descriptor to be processed
+ * @param saxParser SAXParser which may be used to parse the XML
+ * descriptor
+ * @return Hashtable of EJB class (and other) files to
be
+ * added to the completed JAR file
* @throws IOException An IOException from the parser, possibly
from
- * the byte stream or character stream
- * @throws SAXException Any SAX exception, possibly wrapping
another
- * exception
- */
- protected Hashtable parseEjbFiles(String descriptorFileName,
- SAXParser saxParser) throws
IOException, SAXException {
-
- Hashtable files;
-
- /* Build and populate an instance of the ejbc utility */
- IPlanetEjbc ejbc = new IPlanetEjbc(
- new
File(getConfig().descriptorDir,
-
descriptorFileName),
- new
File(getConfig().descriptorDir,
-
getIasDescriptorName()),
-
getConfig().srcDir,
-
getCombinedClasspath().toString(),
-
saxParser);
- ejbc.setRetainSource(keepgenerated);
- ejbc.setDebugOutput(debug);
- if (iashome != null) {
- ejbc.setIasHomeDir(iashome);
- }
-
- /* Execute the ejbc utility -- stubs/skeletons are rebuilt, if
needed */
- try {
- ejbc.execute();
- } catch (IPlanetEjbc.EjbcException e) {
- throw new BuildException("An error has occurred while
trying to "
- + "execute the iAS ejbc
utility", e, getLocation());
- }
-
- displayName = ejbc.getDisplayName();
- files = ejbc.getEjbFiles();
-
- /* Add CMP descriptors to the list of EJB files */
- String[] cmpDescriptors = ejbc.getCmpDescriptors();
- if (cmpDescriptors.length > 0) {
- File baseDir = getConfig().descriptorDir;
-
- int endOfPath =
descriptorFileName.lastIndexOf(File.separator);
- String relativePath = descriptorFileName.substring(0,
endOfPath + 1);
-
- for (int i = 0; i < cmpDescriptors.length; i++) {
- int endOfCmp =
cmpDescriptors[i].lastIndexOf('/');
- String cmpDescriptor =
cmpDescriptors[i].substring(endOfCmp + 1);
-
- File cmpFile = new File(baseDir, relativePath
+ cmpDescriptor);
- if (!cmpFile.exists()) {
- throw new BuildException("The CMP
descriptor file ("
- + cmpFile + ") could
not be found.", getLocation());
- }
- files.put(cmpDescriptors[i], cmpFile);
- }
- }
+ * the byte stream or character stream
+ * @throws SAXException Any SAX exception, possibly wrapping
another
+ * exception
+ */
+ protected Hashtable parseEjbFiles(String descriptorFileName,
+ SAXParser saxParser) throws IOException,
SAXException {
+
+ Hashtable files;
+
+ /* Build and populate an instance of the ejbc utility */
+ IPlanetEjbc ejbc = new IPlanetEjbc(
+ new File(getConfig().descriptorDir,
+ descriptorFileName),
+ new File(getConfig().descriptorDir,
+ getIasDescriptorName()),
+ getConfig().srcDir,
+ getCombinedClasspath().toString(),
+ saxParser);
+ ejbc.setRetainSource(keepgenerated);
+ ejbc.setDebugOutput(debug);
+ if (iashome != null) {
+ ejbc.setIasHomeDir(iashome);
+ }
+
+ /* Execute the ejbc utility -- stubs/skeletons are rebuilt, if
needed */
+ try {
+ ejbc.execute();
+ } catch (IPlanetEjbc.EjbcException e) {
+ throw new BuildException("An error has occurred while trying to "
+ + "execute the iAS ejbc utility", e, getLocation());
+ }
+
+ displayName = ejbc.getDisplayName();
+ files = ejbc.getEjbFiles();
+
+ /* Add CMP descriptors to the list of EJB files */
+ String[] cmpDescriptors = ejbc.getCmpDescriptors();
+ if (cmpDescriptors.length > 0) {
+ File baseDir = getConfig().descriptorDir;
+
+ int endOfPath = descriptorFileName.lastIndexOf(File.separator);
+ String relativePath = descriptorFileName.substring(0, endOfPath
+ 1);
+
+ for (int i = 0; i < cmpDescriptors.length; i++) {
+ int endOfCmp = cmpDescriptors[i].lastIndexOf('/');
+ String cmpDescriptor = cmpDescriptors[i].substring(endOfCmp
+ 1);
+
+ File cmpFile = new File(baseDir, relativePath +
cmpDescriptor);
+ if (!cmpFile.exists()) {
+ throw new BuildException("The CMP descriptor file ("
+ + cmpFile + ") could not be found.",
getLocation());
+ }
+ files.put(cmpDescriptors[i], cmpFile);
+ }
+ }
- return files;
- }
+ return files;
+ }
/**
* Add the iAS-specific EJB descriptor to the list of files which will be
- * written to the JAR file.
- *
- * @param ejbFiles Hashtable of EJB class (and other) files to be added
to
- * the completed JAR file.
- * @param baseName String name of the EJB JAR file to be written
(without
- * a filename extension).
- */
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
-
- ejbFiles.put(META_DIR + IAS_DD, new
File(getConfig().descriptorDir,
-
getIasDescriptorName()));
- }
+ * written to the JAR file.
+ *
+ * @param ejbFiles Hashtable of EJB class (and other) files to be added
to
+ * the completed JAR file.
+ * @param baseName String name of the EJB JAR file to be written (without
+ * a filename extension).
+ */
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
+ ejbFiles.put(META_DIR + IAS_DD, new File(getConfig().descriptorDir,
+ getIasDescriptorName()));
+ }
/**
* Get the name of the Jar that will be written. The modification date
* of this jar will be checked against the dependent bean classes.
- *
- * @param baseName String name of the EJB JAR file to be written
(without
- * a filename extension).
- *
- * @return File representing the JAR file which will be written.
+ *
+ * @param baseName String name of the EJB JAR file to be written (without
+ * a filename extension).
+ *
+ * @return File representing the JAR file which will be written.
*/
File getVendorOutputJarFile(String baseName) {
- File jarFile = new File(getDestDir(), baseName + jarSuffix);
- log("JAR file name: " + jarFile.toString(),
Project.MSG_VERBOSE);
+ File jarFile = new File(getDestDir(), baseName + jarSuffix);
+ log("JAR file name: " + jarFile.toString(), Project.MSG_VERBOSE);
return jarFile;
}
- /**
- * The iAS ejbc utility doesn't require the Public ID of the
descriptor's
- * DTD for it to process correctly--this method always returns
<code>null
- * </code>.
- *
- * @return <code>null</code>.
- */
- protected String getPublicId() {
- return null;
- }
-
- /**
- * Determines the name of the iAS-specific EJB descriptor using the
- * specified standard EJB descriptor name. In general, the standard
- * descriptor will be named "[basename]-ejb-jar.xml", and this method
will
- * return "[basename]-ias-ejb-jar.xml".
- *
- * @return The name of the iAS-specific EJB descriptor file.
- */
- private String getIasDescriptorName() {
-
- /* Only calculate the descriptor name once */
- if (iasDescriptorName != null) {
- return iasDescriptorName;
- }
-
- String path = ""; // Directory path of the EJB descriptor
- String basename; // Filename appearing before name
terminator
- String remainder; // Filename appearing after the name
terminator
-
- /* Find the end of the standard descriptor's relative path */
- int startOfFileName =
descriptorName.lastIndexOf(File.separatorChar);
- if (startOfFileName != -1) {
- path = descriptorName.substring(0, startOfFileName + 1);
- }
-
- /* Check to see if the standard name is used (there's no
basename) */
- if (descriptorName.substring(startOfFileName +
1).equals(EJB_DD)) {
- basename = "";
- remainder = EJB_DD;
-
- } else {
- int endOfBaseName = descriptorName.indexOf(
-
getConfig().baseNameTerminator,
-
startOfFileName);
- /*
- * Check for the odd case where the terminator and/or
filename
- * extension aren't found. These will ensure "ias-"
appears at the
- * end of the name and before the '.' (if present).
- */
- if (endOfBaseName < 0) {
- endOfBaseName = descriptorName.lastIndexOf('.')
- 1;
- if (endOfBaseName < 0) {
- endOfBaseName = descriptorName.length()
- 1;
- }
- }
-
- basename = descriptorName.substring(startOfFileName +
1,
-
endOfBaseName + 1);
- remainder = descriptorName.substring(endOfBaseName + 1);
- }
-
- iasDescriptorName = path + basename + "ias-" + remainder;
- return iasDescriptorName;
- }
+ /**
+ * The iAS ejbc utility doesn't require the Public ID of the descriptor's
+ * DTD for it to process correctly--this method always returns <code>null
+ * </code>.
+ *
+ * @return <code>null</code>.
+ */
+ protected String getPublicId() {
+ return null;
+ }
+
+ /**
+ * Determines the name of the iAS-specific EJB descriptor using the
+ * specified standard EJB descriptor name. In general, the standard
+ * descriptor will be named "[basename]-ejb-jar.xml", and this method
will
+ * return "[basename]-ias-ejb-jar.xml".
+ *
+ * @return The name of the iAS-specific EJB descriptor file.
+ */
+ private String getIasDescriptorName() {
+
+ /* Only calculate the descriptor name once */
+ if (iasDescriptorName != null) {
+ return iasDescriptorName;
+ }
+
+ String path = ""; // Directory path of the EJB descriptor
+ String basename; // Filename appearing before name terminator
+ String remainder; // Filename appearing after the name terminator
+
+ /* Find the end of the standard descriptor's relative path */
+ int startOfFileName = descriptorName.lastIndexOf(File.separatorChar);
+ if (startOfFileName != -1) {
+ path = descriptorName.substring(0, startOfFileName + 1);
+ }
+
+ /* Check to see if the standard name is used (there's no basename) */
+ if (descriptorName.substring(startOfFileName + 1).equals(EJB_DD)) {
+ basename = "";
+ remainder = EJB_DD;
+
+ } else {
+ int endOfBaseName = descriptorName.indexOf(
+
getConfig().baseNameTerminator,
+ startOfFileName);
+ /*
+ * Check for the odd case where the terminator and/or filename
+ * extension aren't found. These will ensure "ias-" appears at
the
+ * end of the name and before the '.' (if present).
+ */
+ if (endOfBaseName < 0) {
+ endOfBaseName = descriptorName.lastIndexOf('.') - 1;
+ if (endOfBaseName < 0) {
+ endOfBaseName = descriptorName.length() - 1;
+ }
+ }
+
+ basename = descriptorName.substring(startOfFileName + 1,
+ endOfBaseName + 1);
+ remainder = descriptorName.substring(endOfBaseName + 1);
+ }
+
+ iasDescriptorName = path + basename + "ias-" + remainder;
+ return iasDescriptorName;
+ }
}
1.2 +1 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java
Index: JbossDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JbossDeploymentTool.java 2001/05/17 11:05:46 1.1
+++ JbossDeploymentTool.java 2001/06/24 13:26:53 1.2
@@ -77,7 +77,7 @@
* Add any vendor specific files which should be included in the
* EJB Jar.
*/
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
String ddPrefix = (usingBaseJarName() ? "" : baseName +
getConfig().baseNameTerminator);
File jbossDD = new File(getConfig().descriptorDir, ddPrefix +
JBOSS_DD);
1.23 +15 -3
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
Index: WeblogicDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- WeblogicDeploymentTool.java 2001/04/19 14:36:11 1.22
+++ WeblogicDeploymentTool.java 2001/06/24 13:26:53 1.23
@@ -297,9 +297,21 @@
* Add any vendor specific files which should be included in the
* EJB Jar.
*/
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
- String ddPrefix = (usingBaseJarName() ? "" : baseName +
getConfig().baseNameTerminator);
-
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
+ String ddPrefix = null;
+ if (!usingBaseJarName()) {
+ ddPrefix = baseName + getConfig().baseNameTerminator;
+ }
+ else {
+ String canonicalDescriptor = descriptorFileName.replace('\\',
'/');
+ int index = canonicalDescriptor.lastIndexOf('/');
+ if (index == -1) {
+ ddPrefix = "";
+ }
+ else {
+ ddPrefix = descriptorFileName.substring(0, index + 1);
+ }
+ }
File weblogicDD = new File(getConfig().descriptorDir, ddPrefix +
WL_DD);
if (weblogicDD.exists()) {
1.6 +2 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java
Index: WeblogicTOPLinkDeploymentTool.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WeblogicTOPLinkDeploymentTool.java 2001/02/05 10:45:55 1.5
+++ WeblogicTOPLinkDeploymentTool.java 2001/06/24 13:26:53 1.6
@@ -102,8 +102,8 @@
* Add any vendor specific files which should be included in the
* EJB Jar.
*/
- protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
- super.addVendorFiles(ejbFiles, baseName);
+ protected void addVendorFiles(Hashtable ejbFiles, String baseName,
String descriptorFileName) {
+ super.addVendorFiles(ejbFiles, baseName, descriptorFileName);
// Then the toplink deployment descriptor
// Setup a naming standard here?.