ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb EJBDeploymentTool.java EjbJar.java GenericDeploymentTool.java
Date Sat, 20 Jan 2001 12:41:51 GMT
conor       01/01/20 04:41:51

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        EJBDeploymentTool.java EjbJar.java
                        GenericDeploymentTool.java
  Log:
  Allow ejbjar to specify support classes.
  
  You can add support classes to all the generated jar fils by including a
  <support-classes> nested element. This is effectively a fileset and
  includes the ability to reference another fileset by refid
  
  So
  <ejbjar ...>
         <support-classes dir="${build.classes.server}">
              <include name="**/*.class"/>
         </support-classes>
  ...
  </ejbjar>
  
  or
  
  <ejbjar ...>
         <support-classes refid="support.fileset"/>
  ...
  </ejbjar>
  
  Please note the following.
  ==========================
  If your ejbjar task generates multiple jar files, the support classes will be
  added to each one.
  
  The nested element name may change. I am using it to test a facility I added
  to the core. If it does change, it will change to <support>
  
  Revision  Changes    Path
  1.6       +4 -1      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EJBDeploymentTool.java	2001/01/03 14:18:39	1.5
  +++ EJBDeploymentTool.java	2001/01/20 12:41:51	1.6
  @@ -69,8 +69,11 @@
        *
        * @param descriptorFilename the name of the deployment descriptor
        * @param saxParser a SAX parser which can be used to parse the deployment descriptor.

  +     * @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) 
  +    public void processDescriptor(String descriptorFilename, SAXParser saxParser,
  +                                  FileSet supportFileSet) 
           throws BuildException;
       
       /**
  
  
  
  1.11      +17 -3     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EjbJar.java	2001/01/03 14:18:39	1.10
  +++ EjbJar.java	2001/01/20 12:41:51	1.11
  @@ -138,6 +138,11 @@
       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.
        *
  @@ -178,6 +183,16 @@
           return classpath.createPath();
       }
   
  +    public Object createElement(String elementName) {
  +        if (elementName.equals("support-classes")) {
  +            supportClasses = new FileSet();
  +            return supportClasses;
  +        }
  +        
  +        return null;
  +    }
  +    
  +
       /**
        * Set the srcdir attribute. The source directory is the directory that contains
        * the classes that will be added to the EJB jar. Typically this will include the 
  @@ -301,7 +316,7 @@
           if (srcDir == null) {
               throw new BuildException("The srcDir attribute must be specified");
           }
  -        
  +
           if (deploymentTools.size() == 0) {
               GenericDeploymentTool genericTool = new GenericDeploymentTool();
               genericTool.setDestdir(destDir);
  @@ -335,14 +350,13 @@
               log(files.length + " deployment descriptors located.",
                   Project.MSG_VERBOSE);
               
  -                            
               // Loop through the files. Each file represents one deployment
               // descriptor, and hence one bean in our model.
               for (int index = 0; index < files.length; ++index) {
                   // process the deployment descriptor in each tool
                   for (Iterator i = deploymentTools.iterator(); i.hasNext(); ) {
                       EJBDeploymentTool tool = (EJBDeploymentTool)i.next();
  -                    tool.processDescriptor(files[index], saxParser);
  +                    tool.processDescriptor(files[index], saxParser, supportClasses);
                   }
               }    
           }
  
  
  
  1.12      +17 -3     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- GenericDeploymentTool.java	2001/01/20 10:43:34	1.11
  +++ GenericDeploymentTool.java	2001/01/20 12:41:51	1.12
  @@ -264,7 +264,7 @@
               if (!addedfiles.contains(logicalFilename)) {
                   iStream = new FileInputStream(inputFile);
                   // Create the zip entry and add it to the jar file
  -                ZipEntry zipEntry = new ZipEntry(logicalFilename);
  +                ZipEntry zipEntry = new ZipEntry(logicalFilename.replace('\\','/'));
                   jStream.putNextEntry(zipEntry);
                      
                   // Create the file input stream, and buffer everything over
  @@ -301,7 +301,8 @@
           return new DescriptorHandler(srcDir);
       }
       
  -    public void processDescriptor(String descriptorFileName, SAXParser saxParser) {
  +    public void processDescriptor(String descriptorFileName, SAXParser saxParser,
  +                                  FileSet supportFileSet) {
           FileInputStream descriptorStream = null;
   
           try {
  @@ -315,7 +316,20 @@
               saxParser.parse(new InputSource(descriptorStream), handler);
                               
               Hashtable ejbFiles = handler.getFiles();
  -            
  +                    
  +            // add in support classes if any
  +            if (supportFileSet != null) {
  +                Project project = task.getProject();
  +                File supportBaseDir = supportFileSet.getDir(project);
  +                
  +                DirectoryScanner supportScanner = supportFileSet.getDirectoryScanner(project);
  +                supportScanner.scan();
  +                String[] supportFiles = supportScanner.getIncludedFiles();
  +                for (int i = 0; i < supportFiles.length; ++i) {
  +                    ejbFiles.put(supportFiles[i], new File(supportBaseDir, supportFiles[i]));
  +                }
  +            }            
  +
               String baseName = "";
               
               // Work out what the base name is
  
  
  

Mime
View raw message