ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb Ejbc.java EjbcHelper.java
Date Sun, 19 Nov 2000 08:59:24 GMT
conor       00/11/19 00:59:24

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        Ejbc.java EjbcHelper.java
  Log:
  Allow keepgenerated flag to be controlled from the ejbc task. It
  defaults to false.
  
  To keep genrated code, use the keepgenerated="true"
  
  Submitted by:	William Turnbull <William.Turnbull@trcinc.com>
  
  Revision  Changes    Path
  1.8       +17 -6     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  
  Index: Ejbc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Ejbc.java	2000/10/19 13:29:43	1.7
  +++ Ejbc.java	2000/11/19 08:59:23	1.8
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -53,7 +53,6 @@
    */
   package org.apache.tools.ant.taskdefs.optional.ejb;
   
  -
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
  @@ -99,6 +98,8 @@
        */
       private File sourceDirectory;
       
  +    public boolean keepgenerated;
  +    
       /**
        * Do the work.
        *
  @@ -144,6 +145,8 @@
           args += " " + generatedFilesDirectory;
           args += " " + sourceDirectory;
           args += " " + generatedManifestFile;
  +        args += " " + keepgenerated;
  +        
           for (int i = 0; i < files.length; ++i) {
               args += " " + files[i];
           }
  @@ -154,7 +157,11 @@
               throw new BuildException("Execution of ejbc helper failed");
           }
       }
  -
  +    
  +    public boolean getKeepgenerated() {
  +        return keepgenerated;
  +    }
  +    
       /**
        * Set the directory from where the serialised deployment descriptors are
        * to be read.
  @@ -173,7 +180,12 @@
       public void setDest(String dirName) {
           generatedFilesDirectory = new File(dirName);
       }
  -
  +    
  +    public void setKeepgenerated(String newKeepgenerated) {
  +        keepgenerated = Boolean.valueOf(newKeepgenerated.trim()).booleanValue();
  +        
  +    }
  +    
       /**
        * Set the generated manifest file. 
        *
  @@ -192,7 +204,7 @@
       public void setClasspath(String s) {
           this.classpath = project.translatePath(s);
       }
  -
  +    
       /**
        * Set the directory containing the source code for the home interface, remote interface
        * and public key class definitions.
  @@ -202,5 +214,4 @@
       public void setSrc(String dirName) {
           sourceDirectory = new File(dirName);
       }
  -                
   }
  
  
  
  1.5       +31 -18    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java
  
  Index: EjbcHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EjbcHelper.java	2000/10/19 13:29:44	1.4
  +++ EjbcHelper.java	2000/11/19 08:59:23	1.5
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -53,12 +53,8 @@
    */
   package org.apache.tools.ant.taskdefs.optional.ejb;
   
  -import java.io.File;
  -import java.io.FileInputStream;
  -import java.io.ObjectInputStream;
  -import java.io.IOException;
  -import java.io.PrintWriter;
  -import java.io.FileWriter;
  +import java.io.*;
  +import java.util.*;
   
   import javax.ejb.deployment.EntityDescriptor;
   import javax.ejb.deployment.DeploymentDescriptor;
  @@ -103,8 +99,10 @@
       /**
        * The names of the serialised deployment descriptors
        */
  -    String[] descriptors; 
  +    String[] descriptors;
   
  +    private boolean keepGenerated;
  +
       /**
        * Command line interface for the ejbc helper task.
        */    
  @@ -112,7 +110,7 @@
           EjbcHelper helper = new EjbcHelper(args);
           helper.process();
       }
  -
  +    
       /**
        * Initialise the EjbcHelper by reading the command arguments.
        */    
  @@ -122,12 +120,31 @@
           generatedFilesDirectory = new File(args[index++]);
           sourceDirectory = new File(args[index++]);
           manifestFile = new File(args[index++]);
  +        keepGenerated = Boolean.valueOf(args[index++]).booleanValue();
           
           descriptors = new String[args.length - index];
           for (int i = 0; index < args.length; ++i) {
               descriptors[i] = args[index++];
           }
       }
  +    
  +    private String[] getCommandLine(boolean debug, File descriptorFile) {
  +        Vector v = new Vector();
  +        if (!debug) {
  +            v.add("-noexit");
  +        }
  +        if (keepGenerated) {
  +            v.add("-keepgenerated");        
  +        }
  +        v.add("-d");
  +        v.add(generatedFilesDirectory.getPath());
  +        v.add(descriptorFile.getPath());
  +    
  +        String[] args = new String[v.size()];
  +        v.copyInto(args);
  +        System.out.println("args: "+args);
  +        return args;
  +    }
   
       /**
        * Determine if the weblogic EJB support classes need to be regenerated
  @@ -222,7 +239,7 @@
           
           return false;
       }
  -
  +    
       /**
        * Process the descriptors in turn generating support classes for each and a manifest
        * file for all of the beans.
  @@ -249,7 +266,7 @@
           fw.flush();
           fw.close();
       }
  -
  +    
       /**
        * Perform the weblogic.ejbc call to regenerate the support classes.
        *
  @@ -259,19 +276,15 @@
       private void regenerateSupportClasses(File descriptorFile) throws Exception {
           // create a Java task to do the rebuild
   
  -        String[] args = {"-noexit",
  -                         "-keepgenerated",
  -                         "-d", generatedFilesDirectory.getPath(),
  -                         descriptorFile.getPath()};
  +        
  +        String[] args = getCommandLine(false,descriptorFile);
           
           try {
               weblogic.ejbc.main(args);
           }
           catch (Exception e) {
               // run with no exit for better reporting
  -            String[] newArgs = {"-keepgenerated",
  -                         "-d", generatedFilesDirectory.getPath(),
  -                         descriptorFile.getPath()};
  +            String[] newArgs = getCommandLine(true, descriptorFile);
               weblogic.ejbc.main(newArgs);
           }
       }
  
  
  

Mime
View raw message