ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Chambery" <tchamb...@hotmail.com>
Subject [PATCH] change the way the GeneralDeploymentDescriptor (GDT) picks up a user-built manifest file
Date Fri, 11 Jan 2002 14:11:50 GMT
My first crack at this was less than impressive, but this one I think solves
the problem in a more intuitive way:

Old GDT:  Grabs a user-created manifest from

    descriptor_root/basejarname-manifest.mf

this is not intuitive, and in my case requires an extra mapping/copy step
before running <ejbjar>.

New GDT:  Grabs a user-created manifest from

    descriptor_root/dir_of_current_descriptor/manifest.mf


Todd

        ---  patch follows ---

--- GenericDeploymentTool.java.old Wed Jan  9 21:14:38 2002
+++ GenericDeploymentTool.java Thu Jan 10 21:11:41 2002
@@ -101,8 +101,9 @@
  */
 public class GenericDeploymentTool implements EJBDeploymentTool {
     /** Private constants that are used when constructing the standard
jarfile */
-    protected final static String META_DIR  = "META-INF/";
-    protected final static String EJB_DD    = "ejb-jar.xml";
+    protected final static String META_DIR   = "META-INF/";
+    protected final static String EJB_DD     = "ejb-jar.xml";
+    protected final static String MANIFEST_FILE = "manifest.mf";

     /**
      * The configuration from the containing task. This config combined
with the
@@ -353,6 +354,9 @@
             // add any dependent files
             checkAndAddDependants(ejbFiles);

+   // grab the directory of the current descriptor
+            String currDescriptorDir = descriptorFileName.substring(0,
descriptorFileName.lastIndexOf(File.separator));
+
             // Lastly create File object for the Jar files. If we are using
             // a flat destination dir, then we need to redefine baseName!
             if (config.flatDestDir && baseName.length() != 0) {
@@ -380,7 +384,7 @@

                 // Use helper method to write the jarfile
                 String publicId = getPublicId();
-                writeJar(baseName, jarFile, ejbFiles, publicId);
+                writeJar(currDescriptorDir, baseName, jarFile, ejbFiles,
publicId);

             }
             else {
@@ -651,7 +655,7 @@
      * filenames/java.io.Files in the Hashtable stored on the instance
variable
      * ejbFiles.
      */
-    protected void writeJar(String baseName, File jarfile, Hashtable files,
+    protected void writeJar(String currDescriptorDir, String baseName, File
jarfile, Hashtable files,
                             String publicId) throws BuildException{

         JarOutputStream jarStream = null;
@@ -673,8 +677,9 @@
             InputStream in = null;
             Manifest manifest = null;
             try {
-                File manifestFile = new File(getConfig().descriptorDir,
baseName + "-manifest.mf");
+                File manifestFile = new File(config.descriptorDir,
currDescriptorDir + File.separator + MANIFEST_FILE);
                 if (manifestFile.exists()) {
+     log("found manifest: " + manifestFile.getAbsolutePath(),
Project.MSG_VERBOSE);
                     in = new FileInputStream(manifestFile);
                 }
                 else if (config.manifest != null) {


Mime
View raw message