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 BorlandGenerateClient.java BorlandDeploymentTool.java
Date Sat, 07 Apr 2001 03:51:32 GMT
conor       01/04/06 20:51:32

  Modified:    docs/manual/OptionalTasks ejb.html
               src/main/org/apache/tools/ant/taskdefs defaults.properties
               src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        BorlandDeploymentTool.java
  Added:       docs/manual/OptionalTasks BorlandEJBTasks.html
                        BorlandGenerateClient.html
               src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        BorlandGenerateClient.java
  Log:
  Borland ejbjar element documentation
  New blgenclient task to generate client jar for Borland EJBs
  
  Submitted by:	Benoît MOUSSAUD <benoit.moussaud@criltelecom.com>
  
  Revision  Changes    Path
  1.3       +11 -6     jakarta-ant/docs/manual/OptionalTasks/ejb.html
  
  Index: ejb.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/ejb.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ejb.html	2001/02/13 12:31:55	1.2
  +++ ejb.html	2001/04/07 03:51:30	1.3
  @@ -35,12 +35,16 @@
   <hr>
   <h2><a name="ejbtasks">EJB Tasks</a></h2>
   <table border="1" cellpadding="5">
  - <tr><td>Task</td><td>Application Servers</td></tr>
  - <tr><td><a href="#ddcreator">ddcreator</a></td><td>Weblogic
4.5.1</td></tr>
  - <tr><td><a href="#ejbc">ejbc</a></td><td>Weblogic
4.5.1</td></tr>
  - <tr><td><a href="#wlrun">wlrun</a></td><td>Weblogic
4.5.1, 5.1 &amp; 6.0</td></tr>
  - <tr><td><a href="#wlstop">wlstop</a></td><td>Weblogic
4.5.1, 5.1 &amp; 6.0</td></tr>
  - <tr><td><a href="#ejbjar">ejbjar</a></td><td>Weblogic
5.1 &amp; 6.0</td></tr>
  + <tr><td>Task</td><td colspan="2">Application Servers</td></tr>
  + <tr><td><a href="BorlandGenerateClient.html">blgenclient</a></td><td
colspan="2">Borland Application Server 4.5</td></tr>
  + <tr><td><a href="#ddcreator">ddcreator</a></td><td colspan="2">Weblogic
4.5.1</td></tr>
  + <tr><td><a href="#ejbc">ejbc</a></td><td colspan="2">Weblogic
4.5.1</td></tr>
  + <tr><td rowspan="3"><a href="#ejbjar">ejbjar</a></td><td
colspan="2" align="center">Nested Elements</td></tr>
  + <tr><td><a href="#ejbjar_weblogic">weblogic</a></td><td>Weblogic
5.1 &amp; 6.0</td></tr>
  + <tr><td><a href="BorlandEJBTasks.html">borland</a></td><td>Borland
Application Server 4.5</td></tr>
  + <tr><td><a href="#wlrun">wlrun</a></td><td colspan="2">Weblogic
4.5.1, 5.1 &amp; 6.0</td></tr>
  + <tr><td><a href="#wlstop">wlstop</a></td><td colspan="2">Weblogic
4.5.1, 5.1 &amp; 6.0</td></tr>
  +
   </table>
   
   <hr>
  @@ -558,6 +562,7 @@
   specific to that vendor's EJB container. The parameters for each supported 
   deployment element are detailed here.
   
  +<a name="ejbjar_weblogic"></a>
   <h3>Weblogic element</h3>
   
   <p>The weblogic element is used to control the weblogic.ejbc compiler for 
  
  
  
  1.1                  jakarta-ant/docs/manual/OptionalTasks/BorlandEJBTasks.html
  
  Index: BorlandEJBTasks.html
  ===================================================================
  <html>
  
  <head>
  <meta http-equiv="Content-Language" content="en-us">
  <title>Ant User Manual</title>
  </head>
  
  <body>
  
  <h2><a name="log">BorlandDeploy</a>Tool</h2>
  <h3>Description</h3>
  <p>The BorlandDeployTool is a vendor specifc nested element for the Ejbjar optionaltask.
  <p>BorlandDeploymentTool is dedicated to the Borland Application Server 4.5. It 
    generates and compiles the stubs and skeletons for all ejb described into the 
    Deployement Descriptor, builds the jar file including the support files and 
    verify whether the produced jar is valid or not.
  <h3>Borland element</h3>
  <table border="1" cellpadding="2" cellspacing="0">
    <tr> 
      <td valign="top" width="63"><b>Attribute</b></td>
      <td valign="top" width="915"><b>Description</b></td>
      <td align="center" valign="top" width="62"><b>Required</b></td>
    </tr>
    <tr> 
      <td valign="top" width="63">destdir</td>
      <td valign="top" width="915">The base directory into which the generated borland

        ready jar files are deposited</td>
      <td align="center" valign="middle" width="62">yes</td>
    </tr>
    <tr> 
      <td valign="top" width="63">debug</td>
      <td valign="top" width="915">If true, turn on the debug mode for each borland

        tools (java2iiop, iastool ...) default = false</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">verify</td>
      <td valign="top" width="915">If true, turn on the verification at the end 
        of the jar production (default = false)</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">verifyargs</td>
      <td valign="top" width="915">extra parameter for verify command</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">suffix</td>
      <td valign="top" width="915">String value appended to the basename of the 
        deployment descriptor to create the filename of the Borland EJB jar file.</td>
      <td align="center" valign="middle" width="62">No, defaults to '-ejb.jar'.</td>
    </tr>
    <tr> 
      <td valign="top" width="63">basdtd</td>
      <td valign="top" width="915"><b>Deprecated</b>. Defines the location
of the 
        weblogic-ejb-jar DTD which covers the Borland specific deployment descriptors. 
        This should not be necessary if you have borland in your classpath. If you 
        do not, you should use a nested <dtd> element, described above</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">ejbdtd</td>
      <td valign="top" width="915"><b>Deprecated</b>. Defines the location
of the 
        ejb-jar DTD in the weblogic class hierarchy. This should not be necessary 
        if you have weblogic in your classpath. If you do not, you should use a 
        nested <dtd> element, described above. </td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">generateclient </td>
      <td valign="top" width="915">If true, turn on the generation of the corresponding

        ejbjar (default = false)</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
  </table>
  
  <h3>Examples</h3>
  <p>The following build.xml snippit is an example of how to use Borland element 
    into the ejbjar task
  <pre>    &lt;ejbjar srcdir=&quot;${build.classes}&quot;  basejarname=&quot;vsmp&quot;
 descriptordir=&quot;${rsc.dir}/hrmanager&quot;&gt;
          &lt;borland destdir=&quot;lib&quot; verify=&quot;on&quot; generateclient=&quot;on&quot;&gt;
            &lt;classpath refid=&quot;classpath&quot; /&gt;
          &lt;/borland&gt;      
          &lt;include name=&quot;**\ejb-jar.xml&quot;/&gt;
          &lt;support dir=&quot;${build.classes}&quot;&gt;
            &lt;include name=&quot;demo\*.class&quot;/&gt;
            &lt;include name=&quot;demo\helper\*.class&quot;/&gt;
           &lt;/support&gt;
       &lt;/ejbjar&gt;</pre>
  <pre>The borland element will generate into the lib dir an ejb jar file using the
deployment descriptor placed into the ${rsc.dir}/hrmanager directory.
  The verify phase is turned on and the generate client phase as well. 
  </pre>
  
  <h3>&nbsp;</h3>
  <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  Reserved.</p>
  
  </body>
  </html>
  
  
  
  
  1.1                  jakarta-ant/docs/manual/OptionalTasks/BorlandGenerateClient.html
  
  Index: BorlandGenerateClient.html
  ===================================================================
  <html>
  
  <head>
  <meta http-equiv="Content-Language" content="en-us">
  <title>Ant User Manual</title>
  </head>
  
  <body>
  
  <h2><a name="log">BorlandGenerateClient</a></h2>
  <h3>Description</h3>
  <p>The BorlandGenerateClient is a task dedicated to Borland Application Server 
    v 4.5. It offers to generate the client jar file corresponding to an ejb jar 
    file.
  <h3>Parameters</h3>
  <table border="1" cellpadding="2" cellspacing="0">
    <tr> 
      <td valign="top" width="63"><b>Attribute</b></td>
      <td valign="top" width="915"><b>Description</b></td>
      <td align="center" valign="top" width="62"><b>Required</b></td>
    </tr>
    <tr> 
      <td valign="top" width="63">ejbjar</td>
      <td valign="top" width="915">ejb jar file</td>
      <td align="center" valign="middle" width="62">yes</td>
    </tr>
    <tr> 
      <td valign="top" width="63">debug</td>
      <td valign="top" width="915">If true, turn on the debug mode for each borland

        tools (java2iiop, iastool ...) default = false</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
    <tr> 
      <td valign="top" width="63">clientjar</td>
      <td valign="top" width="915">client jar file name. If missing the client jar 
        file name is build using the ejbjar file name: ejbjar = hellobean-ejb.jar 
        =&gt; hellobean-ejbclient.jar</td>
      <td align="center" valign="middle" width="62">no</td>
    </tr>
  </table>
  
  <h3>Examples</h3>
  <p>The following build.xml snippit is an example of how to use Borland element 
    into the ejbjar task
  <pre>  ....
  &lt;generateclient ejbjar=&quot;lib/secutest-ejb.jar&quot; clientjar=&quot;lib/client.jar&quot;
debug=&quot;true&quot;/&gt;
  ....
     </pre>
  <pre>&nbsp;</pre>
  
  <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  Reserved.</p>
  
  </body>
  </html>
  
  
  
  
  1.68      +1 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties
  
  Index: defaults.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- defaults.properties	2001/04/04 12:03:46	1.67
  +++ defaults.properties	2001/04/07 03:51:31	1.68
  @@ -94,6 +94,7 @@
   junitreport=org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator
   vsslabel=org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL
   vsshistory=org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY
  +blgenclient=org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient
   
   # deprecated ant tasks (kept for back compatibility)
   javadoc2=org.apache.tools.ant.taskdefs.Javadoc
  
  
  
  1.2       +92 -62    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BorlandDeploymentTool.java	2001/03/27 10:40:17	1.1
  +++ BorlandDeploymentTool.java	2001/04/07 03:51:32	1.2
  @@ -52,6 +52,7 @@
    * <http://www.apache.org/>.
    */
   
  +
   package org.apache.tools.ant.taskdefs.optional.ejb;
   
   import java.io.*;
  @@ -73,7 +74,7 @@
   
   /**
    * BorlandDeploymentTool is dedicated to the Borland Application Server 4.5
  - * This task generates and compilesthe stubs and skeletons for all ejb described into the
  + * This task generates and compiles the stubs and skeletons for all ejb described into
the
    * Deployement Descriptor, builds the jar file including the support files and verify
    * whether the produced jar is valid or not.
    * The supported options are:
  @@ -83,6 +84,7 @@
    * <li>verifyargs (String) : add optional argument to verify command (see vbj com.inprise.ejb.util.Verify)</li>
    * <li>ejbdtd (String)  : location of the SUN DTD </li>
    * <li>basdtd (String)  : location of the BAS DTD </li>
  + * <li>generatelclient  (boolean) : turn on the client jar file generation </li>
    * </ul>
    *
    *<PRE>
  @@ -98,6 +100,7 @@
    *         &lt;/support&gt;
    *     &lt;/ejbjar&gt;
    *</PRE>
  + * @author     <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a>
    *
    */
   public class BorlandDeploymentTool extends GenericDeploymentTool 
  @@ -125,7 +128,7 @@
       protected static final String VERIFY = "com.inprise.ejb.util.Verify";
   
       /** Instance variable that stores the suffix for the borland jarfile. */
  -    private String jarSuffix = ".jar";
  +    private String jarSuffix = "-ejb.jar";
   
       /** Instance variable that stores the location of the borland DTD file. */
       private String borlandDTD;
  @@ -137,6 +140,8 @@
       /** Instance variable that determines whether the debug mode is on */
       private boolean java2iiopdebug = false;
   
  +    /** Instance variable that determines whetger the client jar file is generated */
  +    private boolean generateclient = false;
       /** Instance variable that determines whether it is necessary to verify the produced
jar */
       private boolean verify     = true;
       private String  verifyArgs = "";
  @@ -156,7 +161,6 @@
       }
   
      
  -
       /**
        * Setter used to store the suffix for the generated borland jar file.
        * @param inString the string to use as the suffix.
  @@ -168,9 +172,9 @@
   
       /**
        * sets some additional args to send to verify command
  +     * @param args addtions command line parameters
        */
  -    public void setVerifyArgs(String args) 
  -    {
  +    public void setVerifyArgs(String args) {
           this.verifyArgs = args;
       }
       
  @@ -193,28 +197,35 @@
           this.ejb11DTD = inString;
       }
           
  +    /**
  +     * setter used to store whether the task will include the generate client task.
  +     * (see : BorlandGenerateClient task)
  +     */
  +    public void setGenerateclient(boolean b) {
  +        this.generateclient = b;
  +    }
   
  +
       protected void registerKnownDTDs(DescriptorHandler handler) {
           handler.registerDTD(PUBLICID_EJB11, DEFAULT_BAS45_EJB11_DTD_LOCATION);
       }
   
       protected DescriptorHandler getBorlandDescriptorHandler(final File srcDir) {
  -        DescriptorHandler handler = 
  -            new DescriptorHandler(getTask(), srcDir) {        
  -                    protected void processElement() {
  -                        if (currentElement.equals("type-storage")) {
  -                            // Get the filename of vendor specific descriptor
  -                            String fileNameWithMETA = currentText;
  -                            //trim the META_INF\ off of the file name
  -                            String fileName = fileNameWithMETA.substring(META_DIR.length(),

  -                                                                         fileNameWithMETA.length()
);
  -                            File descriptorFile = new File(srcDir, fileName);
  -                        
  -                            ejbFiles.put(fileNameWithMETA, descriptorFile);
  -                        }
  -                    }
  +        DescriptorHandler handler =
  +           new DescriptorHandler(getTask(), srcDir) {
  +                   protected void processElement() {
  +                       if (currentElement.equals("type-storage")) {
  +                           // Get the filename of vendor specific descriptor
  +                           String fileNameWithMETA = currentText;
  +                           //trim the META_INF\ off of the file name
  +                           String fileName = fileNameWithMETA.substring(META_DIR.length(),

  +                                                                        fileNameWithMETA.length()
);
  +                           File descriptorFile = new File(srcDir, fileName);
  +                       
  +                           ejbFiles.put(fileNameWithMETA, descriptorFile);
  +                       }
  +                   }
                   };
  -
           handler.registerDTD(PUBLICID_BORLAND_EJB, 
                               borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD);
                               
  @@ -232,35 +243,30 @@
       protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
   
           File borlandDD = new File(getConfig().descriptorDir,META_DIR+BAS_DD);
  -        if (borlandDD.exists()) 
  -        {
  +        if (borlandDD.exists()) {
               log("Borland specific file found "+ borlandDD,  Project.MSG_VERBOSE);
               ejbFiles.put(META_DIR + BAS_DD, borlandDD);
           }
  -        else 
  -        {
  +        else {
               log("Unable to locate borland deployment descriptor. It was expected to be
in " + 
                   borlandDD.getPath(), Project.MSG_WARN);
               return;
           }
  -
       }
       
       /**
        * Get the vendor specific name of the Jar that will be output. The modification date
        * of this jar will be checked against the dependent bean classes.
        */
  -    File getVendorOutputJarFile(String baseName) 
  -    {   
  -        return new File(getDestDir(), baseName + jarSuffix);
  +    File getVendorOutputJarFile(String baseName) {   
  +        return new File(getDestDir(), baseName +  jarSuffix);
       }
   
       /**
        * Verify the produced jar file by invoking the Borland verify tool
        * @param sourceJar java.io.File representing the produced jar file
        */
  -    private void verifyBorlandJar(File sourceJar)
  -    {
  +    private void verifyBorlandJar(File sourceJar) {
           org.apache.tools.ant.taskdefs.Java javaTask = null;
           log("verify "+sourceJar,Project.MSG_INFO);
           try {
  @@ -283,14 +289,39 @@
               log("Calling "+VERIFY+" for " + sourceJar.toString(), Project.MSG_VERBOSE);
               javaTask.execute();
           }
  -        catch (Exception e) 
  -        {
  +        catch (Exception e) {
               //TO DO : delete the file if it is not a valid file.
               String msg = "Exception while calling "+VERIFY+" Details: " + e.toString();
               throw new BuildException(msg, e);
           }
  +    }
   
  +    /**
  +     * Generate the client jar corresponding to the jar file passed as paremeter
  +     * the method uses the BorlandGenerateClient task.
  +     * @param sourceJar java.io.File representing the produced jar file
  +     */
  +    private void generateClient(File sourceJar) {
  +        getTask().getProject().addTaskDefinition("internal_bas_generateclient",
  +                                                 org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class);
   
  +        org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null;
  +        log("generate client for "+sourceJar,Project.MSG_INFO);
  +        try {
  +            String args = verifyArgs;            
  +            args += " "+sourceJar.getPath();
  +            
  +            gentask = (BorlandGenerateClient) getTask().getProject().createTask("internal_bas_generateclient");
  +            gentask.setEjbjar(sourceJar);
  +            gentask.setDebug(java2iiopdebug);            
  +            gentask.setTaskName("generate client");
  +            gentask.execute();
  +        }
  +        catch (Exception e) {
  +            //TO DO : delete the file if it is not a valid file.
  +            String msg = "Exception while calling "+VERIFY+" Details: " + e.toString();
  +            throw new BuildException(msg, e);
  +        }
       }
   
       /**
  @@ -299,16 +330,17 @@
        * @param ithomes : iterator on home class
        * @param files   : file list , updated by the adding generated files
        */
  -    private void buildBorlandStubs(Iterator ithomes,Hashtable files )
  -    {
  +    private void buildBorlandStubs(Iterator ithomes,Hashtable files ) {
           org.apache.tools.ant.taskdefs.ExecTask execTask = null;
  -        File java2iiopOut = new File("java2iiop.log");
  -        try 
  -        {
  +        //File java2iiopOut = new File("java2iiop.log");
  +        File java2iiopOut = null;
  +        try {
  +            java2iiopOut = File.createTempFile("java2iiop","log");
  +            log(" iiop log file : "+ java2iiopOut ,Project.MSG_DEBUG);
  +
               execTask = (ExecTask) getTask().getProject().createTask("exec");
               execTask.setOutput(java2iiopOut);
  -            if ( java2iiopdebug ) 
  -            {
  +            if ( java2iiopdebug ) {
                   execTask.createArg().setValue("-VBJdebug");                
               } // end of if ()
                          
  @@ -319,14 +351,15 @@
               execTask.createArg().setPath(getCombinedClasspath());
               //list file
               execTask.createArg().setValue("-list_files");
  +            //no TIE classes
  +            execTask.createArg().setValue("-no_tie");
               //root dir
               execTask.createArg().setValue("-root_dir");
               execTask.createArg().setValue(getConfig().srcDir.getAbsolutePath());
               //compiling order
               execTask.createArg().setValue("-compile");
               //add the home class
  -            while ( ithomes.hasNext()) 
  -            {
  +            while ( ithomes.hasNext()) {
                   execTask.createArg().setValue(ithomes.next().toString());             
  
               } // end of while ()
               log("Calling java2iiop",Project.MSG_VERBOSE);                       
  @@ -338,15 +371,12 @@
               throw new BuildException(msg, e);
           }
   
  -        try
  -        {
  +        try {
               FileReader fr = new FileReader(java2iiopOut);
               LineNumberReader lnr = new LineNumberReader(fr);
               String javafile;
  -            while ( ( javafile = lnr.readLine()) != null) 
  -            {
  -                if ( javafile.endsWith(".java") )
  -                {
  +            while ( ( javafile = lnr.readLine()) != null) {
  +                if ( javafile.endsWith(".java") ) {
                       String classfile = toClassFile(javafile);
                       
                       String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length()+1);
  @@ -357,11 +387,13 @@
               } // end of while ()
               lnr.close();            
           }
  -        catch(Exception e)
  -        {
  +        catch(Exception e) {
               String msg = "Exception while parsing  java2iiop output. Details: " + e.toString();
               throw new BuildException(msg, e);
           }
  +
  +        //delete the output , only if all is succesfull
  +        java2iiopOut.delete();
       }
   
       /**
  @@ -369,16 +401,14 @@
        * filenames/java.io.Files in the Hashtable stored on the instance variable
        * ejbFiles.
        */
  -    protected void writeJar(String baseName, File jarFile, Hashtable files, 
  -                            String publicId) throws BuildException {
  +    protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId)

  +        throws BuildException {
           //build the home classes list.
           Vector homes = new Vector();
           Iterator it = files.keySet().iterator();
  -        while ( it.hasNext()) 
  -        {
  +        while ( it.hasNext()) {
               String clazz = (String) it.next();
  -            if ( clazz.endsWith("Home.class") ) 
  -            {
  +            if ( clazz.endsWith("Home.class") ) {
                   //remove .class extension
                   String home = toClass(clazz);
                   homes.add(home);
  @@ -390,19 +420,20 @@
           
           super.writeJar(baseName, jarFile, files, publicId);
   
  -        if ( verify ) 
  -        {
  +        if ( verify ) {
               verifyBorlandJar(jarFile);
           } // end of if ()
  -                
  +
  +        if ( generateclient) {
  +            generateClient(jarFile);
  +        } // end of if ()                       
       }
   
       /**
        * convert a class file name : A/B/C/toto.class
        * into    a class name: A.B.C.toto
        */
  -    protected String toClass(String filename)
  -    {
  +    private String toClass(String filename) {
           //remove the .class
           String classname = filename.substring(0,filename.lastIndexOf(".class"));
           classname = classname.replace('\\','.');
  @@ -413,8 +444,7 @@
        * convert a file name : A/B/C/toto.java
        * into    a class name: A/B/C/toto.class
        */
  -    protected String toClassFile(String filename)
  -    {
  +    private  String toClassFile(String filename) {
           //remove the .class
           String classfile = filename.substring(0,filename.lastIndexOf(".java"));
           classfile = classfile+".class";
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  
  Index: BorlandGenerateClient.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  package org.apache.tools.ant.taskdefs.optional.ejb;
  
  import java.io.*;
  import java.io.FileReader;
  import java.io.LineNumberReader;
  import java.io.StringReader;
  import java.net.*;
  import java.util.*;
  import java.util.Iterator;
  import java.util.jar.*;
  import javax.xml.parsers.*;
  
  import org.apache.tools.ant.*;
  import org.apache.tools.ant.taskdefs.ExecTask;
  import org.apache.tools.ant.taskdefs.Java;
  import org.apache.tools.ant.types.*;
  import org.apache.tools.ant.types.Commandline.Argument;
  import org.xml.sax.*;
  
  /**
   * BorlandGenerateClient is dedicated to the Borland Application Server 4.5
   * This task generates the client jar using as input the ejb jar file.
   * 
   * @author     <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a>
   *
   */
  public class BorlandGenerateClient extends Task
  {
  
      /** debug the generateclient task */
      boolean debug = false;
  
      /** hold the ejbjar file name */
      File ejbjarfile = null;
  
      /** hold the client jar file name */
      File clientjarfile = null;
  
      public void setDebug(boolean debug)
      {
          this.debug = debug;
      }
  
      public void setEjbjar(File ejbfile)
      {
          ejbjarfile = ejbfile;
      }
      public void setClientjar(File clientjar)
      {
          clientjarfile = clientjar;
      }
  
      /**
       * Do the work.
       *
       * The work is actually done by creating a separate JVM to run a java task. 
       *
       * @exception BuildException if someting goes wrong with the build
       */
      public void execute() throws BuildException 
      {
          try
          {
              if ( ejbjarfile == null ||
                   ejbjarfile.isDirectory()) 
              {
                  throw new BuildException("invalid ejb jar file.");
              } // end of if ()
  
              if ( clientjarfile == null ||
                   clientjarfile.isDirectory()) 
              {
                  log("invalid or missing client jar file.",Project.MSG_VERBOSE);
                  String ejbjarname = ejbjarfile.getAbsolutePath();
                  //clientname = ejbjarfile+client.jar
                  String clientname = ejbjarname.substring(0,ejbjarname.lastIndexOf("."));
                  clientname = clientname + "client.jar";
                  clientjarfile = new File(clientname);
  
              } // end of if ()
  
              log("client jar file is " + clientjarfile);
  
              org.apache.tools.ant.taskdefs.ExecTask execTask = null;                
              execTask = (ExecTask) getProject().createTask("exec");
                         
              execTask.setDir(new File("."));
              execTask.setExecutable("iastool");
              execTask.createArg().setValue("generateclient");
              if ( debug ) 
              {
                  execTask.createArg().setValue("-trace");                
              } // end of if ()
  
              //
              execTask.createArg().setValue("-short");
              execTask.createArg().setValue("-jarfile");
              // ejb jar file
              execTask.createArg().setValue(ejbjarfile.getAbsolutePath());
              //client jar file
              execTask.createArg().setValue("-single");
              execTask.createArg().setValue("-clientjarfile");
              execTask.createArg().setValue(clientjarfile.getAbsolutePath());
  
              log("Calling java2iiop",Project.MSG_VERBOSE);                       
              execTask.execute();        
          }
          catch (Exception e) 
          {
              // Have to catch this because of the semantics of calling main()
              String msg = "Exception while calling generateclient Details: " + e.toString();
              throw new BuildException(msg, e);
          }
  
      }
      
  }
  
  
  

Mime
View raw message