You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2001/01/25 15:39:19 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb DescriptorHandler.java EJBDeploymentTool.java EjbJar.java GenericDeploymentTool.java WeblogicDeploymentTool.java WeblogicTOPLinkDeploymentTool.java

conor       01/01/25 06:39:19

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        DescriptorHandler.java EJBDeploymentTool.java
                        EjbJar.java GenericDeploymentTool.java
                        WeblogicDeploymentTool.java
                        WeblogicTOPLinkDeploymentTool.java
  Log:
  Reworking of ejbjar to support Weblogic 6. You can now specify
  the location of arbitrary DTDs in the ejbjar task
  
  <ejbjar ...>
     <dtd publicId="foo"
          location="file or resource"/>
  </ejbjar>
  
  This is not necessary for weblogic as the task "knows" the locations of the
  ejb1.1 and ejb2.0 DTD within the weblogic classes for both 5.1 and 6.0
  
  To avoid warnings under WL6, about classes in the system classpath,
  the classpath is now split into two using a second nested classpath element
  wlclasspath. Current build files will continue to function
  
  Revision  Changes    Path
  1.5       +15 -8     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DescriptorHandler.java	2001/01/03 14:18:39	1.4
  +++ DescriptorHandler.java	2001/01/25 14:39:15	1.5
  @@ -115,13 +115,20 @@
           this.srcDir = srcDir;
       }
       
  -
  -    public void registerFileDTD(String publicId, File dtdFile) {
  -        fileDTDs.put(publicId, dtdFile);
  -    }
  -    
  -    public void registerResourceDTD(String publicId, String resourceName) {
  -        resourceDTDs.put(publicId, resourceName);
  +    public void registerDTD(String publicId, String location) {
  +        if (location == null) {
  +            return;
  +        }
  +        
  +        File fileDTD = new File(location);
  +        if (fileDTD.exists()) {
  +            fileDTDs.put(publicId, fileDTD);
  +            return;
  +        }
  +        
  +        if (getClass().getResource(location) != null) {
  +            resourceDTDs.put(publicId, location);
  +        }
       }
   
       public InputSource resolveEntity(String publicId, String systemId)
  @@ -129,7 +136,7 @@
       {
           
           File dtdFile = (File) fileDTDs.get(publicId);
  -        if (dtdFile != null && dtdFile.exists()) {
  +        if (dtdFile != null) {
               try {
                   return new InputSource(new FileInputStream(dtdFile));
               } catch( FileNotFoundException ex ) {
  
  
  
  1.7       +2 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java
  
  Index: EJBDeploymentTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EJBDeploymentTool.java	2001/01/20 12:41:51	1.6
  +++ EJBDeploymentTool.java	2001/01/25 14:39:16	1.7
  @@ -72,8 +72,7 @@
        * @param supportFileSet a fileset containing all the files to be included in the 
        * `                     generated jarfile as support classes.
        */
  -    public void processDescriptor(String descriptorFilename, SAXParser saxParser,
  -                                  FileSet supportFileSet) 
  +    public void processDescriptor(String descriptorFilename, SAXParser saxParser) 
           throws BuildException;
       
       /**
  @@ -90,6 +89,5 @@
       /**
        * Configure this tool for use in the ejbjar task.
        */
  -    public void configure(File srcDir, File descriptorDir, String basenameTerminator, 
  -                          String baseJarName, boolean flatDestDir, Path classpath);     
  +    public void configure(EjbJar.Config config);     
   }
  
  
  
  1.13      +103 -51   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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EjbJar.java	2001/01/20 13:50:36	1.12
  +++ EjbJar.java	2001/01/25 14:39:16	1.13
  @@ -102,33 +102,76 @@
    * @author <a href="mailto:tfennell@sapient.com">Tim Fennell</a>
    */
   public class EjbJar extends MatchingTask {
  -
  -    /** Stores a handle to the directory under which to search for class files */
  -    private File srcDir;
  +    
  +    static class DTDLocation {
  +        private String publicId;
  +        private String location;
  +        
  +        public void setPublicId(String publicId) {
  +            this.publicId = publicId;
  +        }
  +        
  +        public void setLocation(String location) {
  +            this.location = location;
  +        }
  +        
  +        public String getPublicId() {
  +            return publicId;
  +        }
  +        
  +        public String getLocation() {
  +            return location;
  +        }
  +    }
   
  -    /** Stores a handle to the directory under which to search for deployment descriptors */
  -    private File descriptorDir;
  +    /**
  +     * A class which contains the configuration state of the ejbjar task.
  +     * This state is passed to the deployment tools for configuration
  +     */
  +    static class Config {
  +        /** Stores a handle to the directory under which to search for class files */
  +        public File srcDir;
   
  -    /** Stores a handle to the directory to put the Jar files in */
  -    private File destDir;
  +        /** Stores a handle to the directory under which to search for deployment descriptors */
  +        public File descriptorDir;
  +        
  +        /** Instance variable that marks the end of the 'basename' */
  +        public String baseNameTerminator = "-";
   
  -    /** Stores a handle to the destination EJB Jar file */
  -    private String baseJarName;
  +        /** Stores a handle to the destination EJB Jar file */
  +        public String baseJarName;
   
  -    /**
  -     * The classpath to use when loading classes
  -     */
  -    private Path classpath;
  - 
  -    /**
  -     * 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 use a package structure
  +         * of a flat directory as the destination for the jar files.
  +         */
  +        public boolean flatDestDir = false;
  +        
  +        /**
  +         * The classpath to use when loading classes
  +         */
  +        public Path classpath;
       
  -    /** Instance variable that marks the end of the 'basename' */
  -    private String baseNameTerminator = "-";
  +        /**
  +         * A Fileset of support classes
  +         */
  +        public FileSet supportFileSet = null;
  +        
  +        /**
  +         * The list of configured DTD locations
  +         */
  +        public ArrayList dtdLocations = new ArrayList();
  +    };
  +
  +    private Config config = new Config();
  +
   
  +    /** Stores a handle to the directory to put the Jar files in. This is only used
  +        by the generic deployment descriptor tool which is created if no other
  +        deployment descriptor tools are provided. Normally each deployment tool
  +        will specify the desitination dir itself. */
  +    private File destDir;
  + 
       /** Instance variable that stores the suffix for the generated jarfile. */
       private String genericJarSuffix = "-generic.jar";
   
  @@ -138,11 +181,6 @@
       private ArrayList deploymentTools = new ArrayList();
   
       /**
  -     * A Fileset of support classes
  -     */
  -    private FileSet supportClasses = null;
  -
  -    /**
        * Create a weblogic nested element used to configure a
        * deployment tool for Weblogic server.
        *
  @@ -177,10 +215,21 @@
        * @return the path to be configured.
        */
       public Path createClasspath() {
  -        if (classpath == null) {
  -            classpath = new Path(project);
  +        if (config.classpath == null) {
  +            config.classpath = new Path(project);
           }
  -        return classpath.createPath();
  +        return config.classpath.createPath();
  +    }
  +
  +    /**
  +     * Create a DTD location record. This stores the location of a DTD. The DTD is identified
  +     * by its public Id. The location may either be a file location or a resource location.
  +     */
  +    public DTDLocation createDTD() {
  +        DTDLocation dtdLocation = new DTDLocation();
  +        config.dtdLocations.add(dtdLocation);
  +        
  +        return dtdLocation;
       }
   
       /**
  @@ -189,8 +238,8 @@
        * @return a fileset which can be populated with support files.
        */
       public FileSet createSupport() {
  -        supportClasses = new FileSet();
  -        return supportClasses;
  +        config.supportFileSet = new FileSet();
  +        return config.supportFileSet;
       }
       
   
  @@ -202,7 +251,7 @@
        * @param inDir the source directory.
        */
       public void setSrcdir(File inDir) {
  -        this.srcDir = inDir;
  +        config.srcDir = inDir;
       }
   
       /**
  @@ -216,7 +265,7 @@
        * @param inDir the directory containing the deployment descriptors.
        */
       public void setDescriptordir(File inDir) {
  -        this.descriptorDir = inDir;
  +        config.descriptorDir = inDir;
       }
   
       /**
  @@ -227,7 +276,7 @@
        * the EJB
        */
       public void setBasejarname(String inValue) {
  -        this.baseJarName = inValue;
  +        config.baseJarName = inValue;
       }
   
       /**
  @@ -252,7 +301,7 @@
        * @param classpath the classpath to use.
        */
       public void setClasspath(Path classpath) {
  -        this.classpath = classpath;
  +        config.classpath = classpath;
       }
   
       /**
  @@ -268,7 +317,7 @@
        * @param inValue the new value of the flatdestdir flag.
        */
       public void setFlatdestdir(boolean inValue) {
  -        this.flatDestDir = inValue;
  +        config.flatDestDir = inValue;
       }
        
       /**
  @@ -295,9 +344,19 @@
        * @param inValue a string which marks the end of the basename.
        */
       public void setBasenameterminator(String inValue) {
  -        this.baseNameTerminator = inValue;
  +        config.baseNameTerminator = inValue;
       }
   
  +    private void validateConfig() {
  +        if (config.srcDir == null) {
  +            throw new BuildException("The srcDir attribute must be specified");
  +        }
  +
  +        if (config.descriptorDir == null) {
  +            config.descriptorDir = config.srcDir;
  +        }
  +    }        
  +
       /**
        * Invoked by Ant after the task is prepared, when it is ready to execute
        * this task.  
  @@ -314,26 +373,19 @@
        *            that a major problem occurred within this task.
        */
       public void execute() throws BuildException {
  -        if (srcDir == null) {
  -            throw new BuildException("The srcDir attribute must be specified");
  -        }
  -
  +        validateConfig();
  +        
           if (deploymentTools.size() == 0) {
               GenericDeploymentTool genericTool = new GenericDeploymentTool();
  -            genericTool.setDestdir(destDir);
               genericTool.setTask(this);
  +            genericTool.setDestdir(destDir);
               genericTool.setGenericJarSuffix(genericJarSuffix);
               deploymentTools.add(genericTool);
           }
           
  -        File scanDir = descriptorDir;
  -        if (scanDir == null) {
  -            scanDir = srcDir;
  -        }
  -        
           for (Iterator i = deploymentTools.iterator(); i.hasNext(); ) {
               EJBDeploymentTool tool = (EJBDeploymentTool)i.next();
  -            tool.configure(srcDir, scanDir, baseNameTerminator, baseJarName, flatDestDir, classpath);
  +            tool.configure(config);
               tool.validateConfigured();
           }
           
  @@ -343,8 +395,8 @@
               saxParserFactory.setValidating(true);
               SAXParser saxParser = saxParserFactory.newSAXParser();
       
  -            
  -            DirectoryScanner ds = getDirectoryScanner(scanDir);
  +                        
  +            DirectoryScanner ds = getDirectoryScanner(config.descriptorDir);
               ds.scan();
               String[] files = ds.getIncludedFiles();
       
  @@ -357,7 +409,7 @@
                   // process the deployment descriptor in each tool
                   for (Iterator i = deploymentTools.iterator(); i.hasNext(); ) {
                       EJBDeploymentTool tool = (EJBDeploymentTool)i.next();
  -                    tool.processDescriptor(files[index], saxParser, supportClasses);
  +                    tool.processDescriptor(files[index], saxParser);
                   }
               }    
           }
  
  
  
  1.13      +51 -79    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GenericDeploymentTool.java	2001/01/20 12:41:51	1.12
  +++ GenericDeploymentTool.java	2001/01/25 14:39:16	1.13
  @@ -79,30 +79,20 @@
       protected static final String META_DIR  = "META-INF/";
       protected static final String EJB_DD    = "ejb-jar.xml";
   
  -    /** Stores a handle to the directory of the source tree */
  -    private File srcDir;
  -
  -    /** Stores a handle to the directory of the deployment descriptors */
  -    private File descriptorDir;
  +    /**
  +     * The configuration from the containing task. This config combined with the 
  +     * settings of the individual attributes here constitues the complete config for
  +     * this deployment tool.
  +     */
  +    private EjbJar.Config config;
   
       /** Stores a handle to the directory to put the Jar files in */
       private File destDir;
       
  -    /** Instance variable that stores the jar file name when not using the naming standard */
  -    private String baseJarName;
  -
  -    /** The classpath to use with this deployment tool. */
  +    /** The classpath to use with this deployment tool. This is appended to 
  +        any paths from the ejbjar task itself.*/
       private Path classpath;
   
  -    /**
  -     * 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 marks the end of the 'basename' */
  -    private String baseNameTerminator = "-";
  -
       /** Instance variable that stores the suffix for the generated jarfile. */
       private String genericJarSuffix = "-generic.jar";
   
  @@ -157,37 +147,15 @@
       /**
        * Get the basename terminator.
        */
  -    protected String getBaseNameTerminator() {
  -        return baseNameTerminator;
  +    protected EjbJar.Config getConfig() {
  +        return config;
       }
       
       /**
  -     * Get the base jar name.
  -     */
  -    protected String getBaseJarName() {
  -        return baseJarName;
  -    }
  -    
  -    /**
  -     * Get the source dir.
  -     */
  -    protected File getSrcDir() {
  -        return srcDir;
  -    }
  -    
  -    /**
  -     * Get the meta-inf dir.
  -     * 
  -     */
  -    protected File getDescriptorDir() {
  -        return descriptorDir;
  -    }
  -
  -    /**
        * Returns true, if the meta-inf dir is being explicitly set, false otherwise.
        */
       protected boolean usingBaseJarName() {
  -        return baseJarName != null;
  +        return config.baseJarName != null;
       }
       
       /**
  @@ -199,7 +167,7 @@
       }
   
       /**
  -     * creates a nested classpath element.
  +     * Add the classpath for the user classes
        */
       public Path createClasspath() {
           if (classpath == null) {
  @@ -215,8 +183,22 @@
           this.classpath = classpath;
       }
   
  -    protected Path getClasspath() {
  -        return classpath;
  +    /**
  +     * Get the classpath by combining the one from the surrounding task, if any
  +     * and the one from tis tool.
  +     */
  +    protected Path getCombinedClasspath() {
  +        Path combinedPath = classpath;
  +        if (config.classpath != null) {
  +            if (combinedPath == null) {
  +                combinedPath = config.classpath;
  +            }
  +            else {
  +                combinedPath.append(config.classpath);
  +            }
  +        }
  +        
  +        return combinedPath;
       }
       
       protected void log(String message, int level) {
  @@ -227,19 +209,9 @@
       /**
        * Configure this tool for use in the ejbjar task.
        */
  -    public void configure(File srcDir, File descriptorDir, String baseNameTerminator, 
  -                          String baseJarName, boolean flatDestDir, Path classpath) {
  -        this.srcDir = srcDir;
  -        this.descriptorDir = descriptorDir;
  -        this.baseJarName = baseJarName;
  -        this.baseNameTerminator = baseNameTerminator;
  -        this.flatDestDir = flatDestDir;
  -        if (this.classpath != null) {
  -            this.classpath.append(classpath);
  -        }
  -        else {
  -            this.classpath = classpath;
  -        }
  +    public void configure(EjbJar.Config config) {
  +        this.config = config;
  +        
           classpathLoader = null;
       }
   
  @@ -301,28 +273,26 @@
           return new DescriptorHandler(srcDir);
       }
       
  -    public void processDescriptor(String descriptorFileName, SAXParser saxParser,
  -                                  FileSet supportFileSet) {
  +    public void processDescriptor(String descriptorFileName, SAXParser saxParser) {
           FileInputStream descriptorStream = null;
   
           try {
  -            DescriptorHandler handler = getDescriptorHandler(srcDir);
  +            DescriptorHandler 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(getDescriptorDir(), descriptorFileName));
  +            descriptorStream = new FileInputStream(new File(config.descriptorDir, descriptorFileName));
               saxParser.parse(new InputSource(descriptorStream), handler);
                               
               Hashtable ejbFiles = handler.getFiles();
                       
               // add in support classes if any
  -            if (supportFileSet != null) {
  +            if (config.supportFileSet != null) {
                   Project project = task.getProject();
  -                File supportBaseDir = supportFileSet.getDir(project);
  -                
  -                DirectoryScanner supportScanner = supportFileSet.getDirectoryScanner(project);
  +                File supportBaseDir = config.supportFileSet.getDir(project);
  +                DirectoryScanner supportScanner = config.supportFileSet.getDirectoryScanner(project);
                   supportScanner.scan();
                   String[] supportFiles = supportScanner.getIncludedFiles();
                   for (int i = 0; i < supportFiles.length; ++i) {
  @@ -333,17 +303,17 @@
               String baseName = "";
               
               // Work out what the base name is
  -            if (baseJarName != null) {
  -                baseName = baseJarName;
  +            if (config.baseJarName != null) {
  +                baseName = config.baseJarName;
               } else {
                   int lastSeparatorIndex = descriptorFileName.lastIndexOf(File.separator);
                   int endBaseName = -1;
                   if (lastSeparatorIndex != -1) {
  -                    endBaseName = descriptorFileName.indexOf(baseNameTerminator, 
  +                    endBaseName = descriptorFileName.indexOf(config.baseNameTerminator, 
                                                                lastSeparatorIndex);
                   }
                   else {
  -                    endBaseName = descriptorFileName.indexOf(baseNameTerminator);
  +                    endBaseName = descriptorFileName.indexOf(config.baseNameTerminator);
                   }
   
                   if (endBaseName != -1) {
  @@ -354,7 +324,7 @@
   
               // First the regular deployment descriptor
               ejbFiles.put(META_DIR + EJB_DD,
  -                         new File(getDescriptorDir(), descriptorFileName));
  +                         new File(config.descriptorDir, descriptorFileName));
               
               // now the vendor specific files, if any             
               addVendorFiles(ejbFiles, baseName);
  @@ -364,7 +334,7 @@
   
               // Lastly create File object for the Jar files. If we are using
               // a flat destination dir, then we need to redefine baseName!
  -            if (flatDestDir && baseName.length() != 0) {
  +            if (config.flatDestDir && baseName.length() != 0) {
                   int startName = baseName.lastIndexOf(File.separator);
                   if (startName == -1) {
                       startName = 0;
  @@ -510,7 +480,7 @@
                       entryName = entryName.substring(0, entryName.lastIndexOf(entryFile.getName())-1) + File.separatorChar + innerfiles[i];
           
                       // link the file
  -                    entryFile = new File(srcDir, entryName);
  +                    entryFile = new File(config.srcDir, entryName);
           
                       log("adding innerclass file '" + entryName + "'", 
                               Project.MSG_VERBOSE);
  @@ -597,7 +567,7 @@
       private void addInterface(Class theInterface, Hashtable checkEntries) {
           if (!theInterface.getName().startsWith("java")) // do not add system interfaces
           { 
  -            File interfaceFile = new File(srcDir.getAbsolutePath() 
  +            File interfaceFile = new File(config.srcDir.getAbsolutePath() 
                                           + File.separatorChar 
                                           + theInterface.getName().replace('.',File.separatorChar)
                                           + ".class"
  @@ -618,7 +588,7 @@
       
           if (!superClass.getName().startsWith("java"))
           {
  -            File superClassFile = new File(srcDir.getAbsolutePath() 
  +            File superClassFile = new File(config.srcDir.getAbsolutePath() 
                                               + File.separatorChar 
                                               + superClass.getName().replace('.',File.separatorChar)
                                               + ".class");
  @@ -650,12 +620,14 @@
               return classpathLoader;
           }
           
  -        // only generate a URLClassLoader if we have a classpath
  -        if (classpath == null) {
  +        Path combinedClasspath = getCombinedClasspath();
  +        
  +        // only generate a new ClassLoader if we have a classpath
  +        if (combinedClasspath == null) {
               classpathLoader = getClass().getClassLoader();
           }
           else {
  -            classpathLoader = new AntClassLoader(getTask().getProject(), classpath);
  +            classpathLoader = new AntClassLoader(getTask().getProject(), combinedClasspath);
           }
           
           return classpathLoader;
  
  
  
  1.15      +59 -36    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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WeblogicDeploymentTool.java	2001/01/20 13:07:29	1.14
  +++ WeblogicDeploymentTool.java	2001/01/25 14:39:17	1.15
  @@ -67,28 +67,36 @@
   import org.apache.tools.ant.taskdefs.Java;
   
   public class WeblogicDeploymentTool extends GenericDeploymentTool {
  -    public static final String PUBLICID_EJB
  +    public static final String PUBLICID_EJB11
           = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
  -    public static final String PUBLICID_WEBLOGIC
  +    public static final String PUBLICID_EJB20
  +        = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";
  +
  +    public static final String PUBLICID_WEBLOGIC_EJB
           = "-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN";
       
  -    protected static final String WL_DD = "weblogic-ejb-jar.xml";
  -    protected static final String WL_CMP_DD = "weblogic-cmp-rdbms-jar.xml";
  -
  -    protected static final String DEFAULT_EJB_DTD_LOCATION 
  +    protected static final String DEFAULT_WL51_EJB11_DTD_LOCATION 
           = "/weblogic/ejb/deployment/xml/ejb-jar.dtd";
  +    protected static final String DEFAULT_WL60_EJB11_DTD_LOCATION 
  +        = "/weblogic/ejb20/dd/xml/ejb11-jar.dtd";
  +    protected static final String DEFAULT_WL60_EJB20_DTD_LOCATION 
  +        = "/weblogic/ejb20/dd/xml/ejb20-jar.dtd";
  +
       protected static final String DEFAULT_WL_DTD_LOCATION 
           = "/weblogic/ejb/deployment/xml/weblogic-ejb-jar.dtd";
   
  +    protected static final String WL_DD = "weblogic-ejb-jar.xml";
  +    protected static final String WL_CMP_DD = "weblogic-cmp-rdbms-jar.xml";
  +
       /** Instance variable that stores the suffix for the weblogic jarfile. */
       private String jarSuffix = ".jar";
   
       /** Instance variable that stores the location of the weblogic DTD file. */
       private String weblogicDTD;
   
  -    /** Instance variable that stores the location of the generic EJB DTD file. */
  -    private String ejbDTD;
  -    
  +    /** Instance variable that stores the location of the ejb 1.1 DTD file. */
  +    private String ejb11DTD;
  +        
       /** Instance variable that determines whether generic ejb jars are kept. */
   
       private boolean keepgenerated = false;
  @@ -105,7 +113,20 @@
        * Indicates if the old CMP location convention is to be used.
        */
       private boolean oldCMP = true;
  -    
  +
  +    /** The classpath to the weblogic classes. */
  +    private Path wlClasspath;
  +
  +    /**
  +     * Get the classpath to the weblogic classpaths
  +     */
  +    public Path createWLClasspath() {
  +        if (wlClasspath == null) {
  +            wlClasspath = new Path(getTask().getProject());
  +        }
  +        return wlClasspath.createPath();
  +    }
  +
       /**
        * The compiler (switch <code>-compiler</code>) to use
        */
  @@ -161,7 +182,7 @@
        * @param inString the string to use as the DTD location.
        */
       public void setWeblogicdtd(String inString) {
  -        this.ejbDTD = inString;
  +        setEJBdtd(inString);
       }
   
       /**
  @@ -179,7 +200,7 @@
        * @param inString the string to use as the DTD location.
        */
       public void setEJBdtd(String inString) {
  -        this.ejbDTD = inString;
  +        this.ejb11DTD = inString;
       }
   
       /**
  @@ -198,24 +219,21 @@
       }
       
   
  -    /**
  -     * Register the location of the local resource copy of a DTD in a given
  -     * handler.
  -     */
  -    private void registerDTD(DescriptorHandler handler, 
  -                             String publicId, String dtdLocation) {
  -        File dtdFile = new File(dtdLocation);
  -        if (dtdFile.exists()) {
  -            handler.registerFileDTD(publicId, dtdFile);
  -        } else {
  -            handler.registerResourceDTD(publicId, dtdLocation);
  -        }                                            
  -    }
  -    
       protected DescriptorHandler getDescriptorHandler(File srcDir) {
           DescriptorHandler handler = new DescriptorHandler(srcDir);
  -        registerDTD(handler, PUBLICID_EJB, 
  -                    ejbDTD == null ? DEFAULT_EJB_DTD_LOCATION : ejbDTD);
  +        // register all the DTDs, both the ones that are known and
  +        // any supplied by the user
  +        handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL51_EJB11_DTD_LOCATION);
  +        handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL60_EJB11_DTD_LOCATION);
  +        handler.registerDTD(PUBLICID_EJB11, ejb11DTD);
  +        handler.registerDTD(PUBLICID_EJB20, DEFAULT_WL60_EJB20_DTD_LOCATION);
  +        
  +        
  +        for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) {
  +            EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation)i.next();
  +            handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation());
  +        }
  +        
           return handler;                                    
       }
   
  @@ -229,14 +247,14 @@
                           //trim the META_INF\ off of the file name
                           String fileName = fileNameWithMETA.substring(META_DIR.length(), 
                                                                        fileNameWithMETA.length() );
  -                        File descriptorFile = new File(getDescriptorDir(), fileName);
  +                        File descriptorFile = new File(getConfig().descriptorDir, fileName);
                           ejbFiles.put(fileNameWithMETA, descriptorFile);
                       }
                   }
               };
   
  -        registerDTD(handler, PUBLICID_WEBLOGIC, 
  -                    weblogicDTD == null ? DEFAULT_WL_DTD_LOCATION : weblogicDTD);
  +        handler.registerDTD(PUBLICID_WEBLOGIC_EJB, 
  +                            weblogicDTD == null ? DEFAULT_WL_DTD_LOCATION : weblogicDTD);
           return handler;                                    
       }
   
  @@ -245,9 +263,9 @@
        * EJB Jar.
        */
       protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
  -        String ddPrefix = (usingBaseJarName() ? "" : baseName + getBaseNameTerminator());
  +        String ddPrefix = (usingBaseJarName() ? "" : baseName + getConfig().baseNameTerminator);
   
  -        File weblogicDD = new File(getDescriptorDir(), ddPrefix + WL_DD);
  +        File weblogicDD = new File(getConfig().descriptorDir, ddPrefix + WL_DD);
   
           if (weblogicDD.exists()) {
               ejbFiles.put(META_DIR + WL_DD,
  @@ -264,7 +282,7 @@
               log("Please adjust your weblogic descriptor and set oldCMP=\"false\" " +
                   "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE);
               // The the weblogic cmp deployment descriptor
  -            File weblogicCMPDD = new File(getDescriptorDir(), ddPrefix + WL_CMP_DD);
  +            File weblogicCMPDD = new File(getConfig().descriptorDir, ddPrefix + WL_CMP_DD);
                   
               if (weblogicCMPDD.exists()) {
                   ejbFiles.put(META_DIR + WL_CMP_DD,
  @@ -335,10 +353,15 @@
               args += " -noexit " + sourceJar.getPath() + " " + destJar.getPath();
               
               javaTask = (Java) getTask().getProject().createTask("java");
  +            javaTask.setTaskName("ejbc");
               javaTask.setClassname("weblogic.ejbc");
               Commandline.Argument arguments = javaTask.createArg();
               arguments.setLine(args);
  -            Path classpath = getClasspath();
  +            Path classpath = wlClasspath;
  +            if (classpath == null) {
  +                classpath = getCombinedClasspath();
  +            }
  +            
               if (classpath != null) {
                   javaTask.setClasspath(classpath);
                   javaTask.setFork(true);
  @@ -603,7 +626,7 @@
           Path lookupPath = new Path(getTask().getProject());
           lookupPath.setLocation(classjar);
           
  -        Path classpath = getClasspath();
  +        Path classpath = getCombinedClasspath();
           if (classpath != null) {
               lookupPath.append(classpath);
           }
  
  
  
  1.3       +1 -1      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WeblogicTOPLinkDeploymentTool.java	2001/01/03 14:18:39	1.2
  +++ WeblogicTOPLinkDeploymentTool.java	2001/01/25 14:39:17	1.3
  @@ -108,7 +108,7 @@
   
           // Setup a naming standard here?.
   
  -        File toplinkDD = new File(getDescriptorDir(), toplinkDescriptor);
  +        File toplinkDD = new File(getConfig().descriptorDir, toplinkDescriptor);
   
           if (toplinkDD.exists()) {
               ejbFiles.put(META_DIR + toplinkDescriptor,