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 BorlandDeploymentTool.java BorlandGenerateClient.java
Date Thu, 20 Jun 2002 12:47:34 GMT
conor       2002/06/20 05:47:34

  Modified:    docs/manual/OptionalTasks Tag: ANT_15_BRANCH
                        BorlandEJBTasks.html BorlandGenerateClient.html
               src/main/org/apache/tools/ant/taskdefs/optional/ejb Tag:
                        ANT_15_BRANCH BorlandDeploymentTool.java
                        BorlandGenerateClient.java
  Log:
  Update Borland EJB tasks to support Borland Enterprise Server
  
  Submitted by:	benoit.moussaud@criltelecom.com
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.3   +43 -30    jakarta-ant/docs/manual/OptionalTasks/BorlandEJBTasks.html
  
  Index: BorlandEJBTasks.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/BorlandEJBTasks.html,v
  retrieving revision 1.6.2.2
  retrieving revision 1.6.2.3
  diff -u -w -u -r1.6.2.2 -r1.6.2.3
  --- BorlandEJBTasks.html	3 May 2002 07:13:01 -0000	1.6.2.2
  +++ BorlandEJBTasks.html	20 Jun 2002 12:47:33 -0000	1.6.2.3
  @@ -8,10 +8,13 @@
   <body>
   
   <h2><a name="log">BorlandDeploy</a>Tool</h2>
  +<p>by Benoit Moussaud (<a href="mailto:benoit.moussaud@criltelecom.com">benoit.moussaud@criltelecom.com</a>)</p>
  +
  +
   <h3>Description</h3>
   <p>The BorlandDeployTool is a vendor specific nested element for the Ejbjar optional
task.</p>
  -<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 
  +<p>BorlandDeploymentTool is dedicated to the Borland Application Server 4.5.x and
Borland
  +  Enterprise Server 5.x. It  generates and compiles the stubs and skeletons for all ejb
described into the
     Deployment Descriptor, builds the jar file including the support files and 
     verify whether the produced jar is valid or not.</p>
   <h3>Borland element</h3>
  @@ -76,13 +79,23 @@
         ejbjar (default = false)</td>
       <td align="center" valign="middle" width="62">no</td>
     </tr>
  +  <tr>
  +    <td valign="top" width="63">version</td>
  +    <td valign="top" width="915">set the Borland Application Version.
  +            <ul>
  +              <li>4 means B.A.S (Borland Application Server) 4.x, target will add
ejb-inprise.xml file</li>
  +              <li>5 means B.E.S (Borland Application Server) 5.x, target will add
ejb-borland.xml file</li>
  +            </ul>
  +          </td>
  +    <td align="center" valign="middle" width="62">No, defaults to 4</td>
  +  </tr>
   </table>
   
   <h3>Examples</h3>
   <p>The following build.xml snippet is an example of how to use Borland element 
     into the ejbjar task</p>
   <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;borland destdir=&quot;lib&quot; verify=&quot;on&quot; generateclient=&quot;on&quot;
version=&quot;5&quot;&gt;
             &lt;classpath refid=&quot;classpath&quot; /&gt;
           &lt;/borland&gt;      
           &lt;include name=&quot;**\ejb-jar.xml&quot;/&gt;
  
  
  
  1.7.2.1   +24 -13    jakarta-ant/docs/manual/OptionalTasks/BorlandGenerateClient.html
  
  Index: BorlandGenerateClient.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/BorlandGenerateClient.html,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -w -u -r1.7 -r1.7.2.1
  --- BorlandGenerateClient.html	3 Feb 2002 22:09:08 -0000	1.7
  +++ BorlandGenerateClient.html	20 Jun 2002 12:47:33 -0000	1.7.2.1
  @@ -8,6 +8,7 @@
   <body>
   
   <h2><a name="log">BorlandGenerateClient</a></h2>
  +<p>by Benoit Moussaud (<a href="mailto:benoit.moussaud@criltelecom.com">benoit.moussaud@criltelecom.com</a>)</p>
   <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 
  @@ -40,16 +41,26 @@
     <tr>
       <td valign="top" width="63">mode</td>
       <td valign="top" width="915">choose the command launching mode. Two values: 
  -      java or fork. default = java. Possibility to specify a classpath.</td>
  +      java or fork. default = fork. java is not supported for version=5.Possibility to
specify a classpath.</td>
       <td align="center" valign="middle" width="62">no</td>
     </tr>
  +  <tr>
  +    <td valign="top" width="63">version</td>
  +    <td valign="top" width="915">set the Borland Application Version.
  +            <ul>
  +              <li>4 means B.A.S (Borland Application Server 4.x)</li>
  +              <li>5 means B.E.S (Borland Application Server 5.x)</li>
  +            </ul>
  +          </td>
  +    <td align="center" valign="middle" width="62">No, defaults to 4</td>
  +  </tr>
   </table>
   
   <h3>Examples</h3>
   <p>The following build.xml snippet is an example of how to use Borland element 
      into the ejbjar task using the java mode.</p>
   <pre>
  -&lt;blgenclient ejbjar=&quot;lib/secutest-ejb.jar&quot; clientjar=&quot;lib/client.jar&quot;
debug=&quot;true&quot; mode=&quot;java&quot;&gt;
  +&lt;blgenclient ejbjar=&quot;lib/secutest-ejb.jar&quot; clientjar=&quot;lib/client.jar&quot;
debug=&quot;true&quot; mode=&quot;fork&quot;&gt; version=&quot;5&quot;&gt;
       &lt;classpath&gt;
           &lt;pathelement locacation=&quot;mymodule.jar&quot;/&gt;
       &lt;/classpath&gt;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.17.2.1  +88 -6     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.17
  retrieving revision 1.17.2.1
  diff -u -w -u -r1.17 -r1.17.2.1
  --- BorlandDeploymentTool.java	30 Apr 2002 14:30:00 -0000	1.17
  +++ BorlandDeploymentTool.java	20 Jun 2002 12:47:34 -0000	1.17.2.1
  @@ -75,6 +75,7 @@
   import org.apache.tools.ant.taskdefs.Execute;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.taskdefs.ExecTask;
   
   
   /**
  @@ -89,6 +90,7 @@
    * <li>verifyargs (String) : add optional argument to verify command (see vbj com.inprise.ejb.util.Verify)</li>
    * <li>basdtd (String)     : location of the BAS DTD </li>
    * <li>generateclient (boolean) : turn on the client jar file generation </li>
  + * <li>version (int)       : tell what is the borland appserver version 4 or 5 </li>
    * </ul>
    *
    *<PRE>
  @@ -119,6 +121,8 @@
       = "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd";
   
       protected static final String BAS_DD = "ejb-inprise.xml";
  +    protected static final String BES_DD = "ejb-borland.xml";
  +
   
       /** Java2iiop executable **/
       protected static final String JAVA2IIOP = "java2iiop";
  @@ -137,6 +141,16 @@
   
       /** Instance variable that determines whetger the client jar file is generated */
       private boolean generateclient = false;
  +
  +    /** Borland Entreprise Server = version 5 */
  +    static final int    BES       = 5;
  +    /** Borland Application Server or Inprise Applcation Server  = version 4 */
  +    static final int    BAS       = 4;
  +
  +    /** borland appserver version 4 or 5 */
  +    private int version = BAS;
  +
  +
       /** Instance variable that determines whether it is necessary to verify the produced
jar */
       private boolean verify     = true;
       private String  verifyArgs = "";
  @@ -193,6 +207,13 @@
           this.generateclient = b;
       }
   
  +    /**
  +     * setter used to store the borland appserver version [4 or 5]
  +     * @param version app server version 4 or 5
  +     */
  +    public void setVersion(int version) {
  +        this.version = version;
  +    }
   
       protected DescriptorHandler getBorlandDescriptorHandler(final File srcDir) {
           DescriptorHandler handler =
  @@ -227,10 +248,19 @@
        */
       protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
   
  -        File borlandDD = new File(getConfig().descriptorDir, ddPrefix + BAS_DD);
  +        //choose the right vendor DD
  +        if ( !(version == BES || version == BAS)) {
  +            throw new BuildException("version "+version+" is not supported");
  +        }
  +
  +        String dd = ( version == BES ? BES_DD : BAS_DD);
  +
  +        log("vendor file : "+ddPrefix + dd,Project.MSG_DEBUG);
  +
  +        File borlandDD = new File(getConfig().descriptorDir, ddPrefix + dd);
           if (borlandDD.exists()) {
               log("Borland specific file found " + borlandDD,  Project.MSG_VERBOSE);
  -            ejbFiles.put(META_DIR + BAS_DD,  borlandDD);
  +            ejbFiles.put(META_DIR + dd ,  borlandDD);
           } else {
               log("Unable to locate borland deployment descriptor. It was expected to be
in " +
                   borlandDD.getPath(), Project.MSG_WARN);
  @@ -251,10 +281,59 @@
        * @param sourceJar java.io.File representing the produced jar file
        */
       private void verifyBorlandJar(File sourceJar) {
  -        org.apache.tools.ant.taskdefs.Java javaTask = null;
  -        log("verify " + sourceJar, Project.MSG_INFO);
  +        if ( version == BAS) {
  +            verifyBorlandJarV4(sourceJar);
  +            return ;
  +        }
  +        if ( version == BES ) {
  +            verifyBorlandJarV5(sourceJar);
  +            return;
  +        }
  +        log("verify jar skipped because the version is invalid ["+version+"]",Project.MSG_WARN);
  +    }
  +
  +    /**
  +     * Verify the produced jar file by invoking the Borland iastool tool
  +     * @param sourceJar java.io.File representing the produced jar file
  +     */
  +    private void verifyBorlandJarV5(File sourceJar) {
  +        log("verify BES " + sourceJar, Project.MSG_INFO);
           try {
  +            org.apache.tools.ant.taskdefs.ExecTask execTask = null;
  +            execTask = (ExecTask) getTask().getProject().createTask("exec");
  +            execTask.setDir(new File("."));
  +            execTask.setExecutable("iastool");
  +            //classpath
  +            if (getCombinedClasspath() != null)  {
  +                execTask.createArg().setValue("-VBJclasspath");
  +                execTask.createArg().setValue(getCombinedClasspath().toString());
  +            }
   
  +            if (java2iiopdebug) {
  +                execTask.createArg().setValue("-debug");
  +            }
  +            execTask.createArg().setValue("-verify");
  +            execTask.createArg().setValue("-src");
  +            // ejb jar file to verfiy
  +            execTask.createArg().setValue(sourceJar.getPath());
  +            log("Calling iastool", 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);
  +        }
  +    }
  +
  +    /**
  +     * Verify the produced jar file by invoking the Borland verify tool
  +     * @param sourceJar java.io.File representing the produced jar file
  +     */
  +    private void verifyBorlandJarV4(File sourceJar) {
  +        org.apache.tools.ant.taskdefs.Java javaTask = null;
  +        log("verify BAS " + sourceJar, Project.MSG_INFO);
  +        try  {
               String args = verifyArgs;
               args += " " + sourceJar.getPath();
   
  @@ -280,6 +359,7 @@
           }
       }
   
  +
       /**
        * Generate the client jar corresponding to the jar file passed as paremeter
        * the method uses the BorlandGenerateClient task.
  @@ -299,6 +379,7 @@
               if (classpath != null) {
                   gentask.setClasspath(classpath);
               }
  +            gentask.setVersion(version);
               gentask.setTaskName("generate client");
               gentask.execute();
           } catch (Exception e) {
  @@ -391,11 +472,11 @@
   
           if (verify) {
               verifyBorlandJar(jarFile);
  -        } // end of if ()
  +        }
   
           if (generateclient) {
               generateClient(jarFile);
  -        } // end of if ()
  +        }
       }
   
       /**
  @@ -460,3 +541,4 @@
           } // end of if ()
       }
   }
  +
  
  
  
  1.9.2.2   +84 -32    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  
  Index: BorlandGenerateClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -w -u -r1.9.2.1 -r1.9.2.2
  --- BorlandGenerateClient.java	19 Jun 2002 20:15:25 -0000	1.9.2.1
  +++ BorlandGenerateClient.java	20 Jun 2002 12:47:34 -0000	1.9.2.2
  @@ -57,19 +57,14 @@
   
   import java.io.File;
   
  -
  -
  -
  -import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.ExecTask;
   import org.apache.tools.ant.taskdefs.Java;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.types.Reference;
   
  -
  -
   /**
    * Generates a Borland Application Server 4.5 client JAR using as
    * input the EJB JAR file.
  @@ -98,7 +93,14 @@
       Path classpath;
   
       /** hold the mode (java|fork) */
  -    String mode = JAVA_MODE;
  +    String mode = FORK_MODE;
  +
  +    /** hold the version */
  +    int version = BorlandDeploymentTool.BAS;
  +
  +    public void setVersion(int version) {
  +        this.version = version;
  +    }
   
       /**
        * Command launching mode: java or fork.
  @@ -167,7 +169,7 @@
       public void execute() throws BuildException {
           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);
  @@ -176,13 +178,16 @@
               String clientname = ejbjarname.substring(0, ejbjarname.lastIndexOf("."));
               clientname = clientname + "client.jar";
               clientjarfile = new File(clientname);
  -
  -        } // end of if ()
  +        }
   
           if (mode == null) {
               log("mode is null default mode  is java");
               setMode(JAVA_MODE);
  -        } // end of if ()
  +        }
  +
  +        if ( !(version == BorlandDeploymentTool.BES || version == BorlandDeploymentTool.BAS))
{
  +            throw new BuildException("version "+version+" is not supported");
  +        }
   
           log("client jar file is " + clientjarfile);
   
  @@ -196,6 +201,10 @@
       /** launch the generate client using java api */
       protected void executeJava() throws BuildException {
           try {
  +            if ( version == BorlandDeploymentTool.BES)  {
  +                throw new BuildException("java mode is supported only for previous version
<="+BorlandDeploymentTool.BAS);
  +            }
  +
               log("mode : java");
   
               org.apache.tools.ant.taskdefs.Java execTask = null;                
  @@ -212,9 +221,8 @@
               execTask.createArg().setValue("generateclient");
               if (debug) {
                   execTask.createArg().setValue("-trace");                
  -            } // end of if ()
  +            }
   
  -            //
               execTask.createArg().setValue("-short");
               execTask.createArg().setValue("-jarfile");
               // ejb jar file
  @@ -236,8 +244,19 @@
   
       /** launch the generate client using system api */
       protected  void executeFork() throws BuildException {
  +        if ( version == BorlandDeploymentTool.BAS) {
  +            executeForkV4();
  +        }
  +        if ( version == BorlandDeploymentTool.BES ) {
  +            executeForkV5();
  +        }
  +    }
  +
  +    /** launch the generate client using system api */
  +    protected  void executeForkV4() throws BuildException {
           try {
  -            log("mode : fork");
  +
  +            log("mode : fork "+BorlandDeploymentTool.BAS,Project.MSG_DEBUG);
   
               org.apache.tools.ant.taskdefs.ExecTask execTask = null;                
               execTask = (ExecTask) getProject().createTask("exec");
  @@ -247,9 +266,8 @@
               execTask.createArg().setValue("generateclient");
               if (debug) {
                   execTask.createArg().setValue("-trace");                
  -            } // end of if ()
  +            }
   
  -            //
               execTask.createArg().setValue("-short");
               execTask.createArg().setValue("-jarfile");
               // ejb jar file
  @@ -259,7 +277,7 @@
               execTask.createArg().setValue("-clientjarfile");
               execTask.createArg().setValue(clientjarfile.getAbsolutePath());
   
  -            log("Calling java2iiop", Project.MSG_VERBOSE);
  +            log("Calling iastool", Project.MSG_VERBOSE);
               execTask.execute();        
           } catch (Exception e) {
               // Have to catch this because of the semantics of calling main()
  @@ -269,4 +287,38 @@
           }
   
       }
  +    /** launch the generate client using system api */
  +    protected  void executeForkV5() throws BuildException {
  +        try {
  +            log("mode : fork "+BorlandDeploymentTool.BES,Project.MSG_DEBUG);
  +            org.apache.tools.ant.taskdefs.ExecTask execTask = null;
  +            execTask = (ExecTask) getProject().createTask("exec");
  +
  +            execTask.setDir(new File("."));
  +
  +            execTask.setExecutable("iastool");
  +            if (debug) {
  +                execTask.createArg().setValue("-debug");
  +            }
  +            execTask.createArg().setValue("-genclient");
  +            execTask.createArg().setValue("-jars");
  +            // ejb jar file
  +            execTask.createArg().setValue(ejbjarfile.getAbsolutePath());
  +            //client jar file
  +            execTask.createArg().setValue("-target");
  +            execTask.createArg().setValue(clientjarfile.getAbsolutePath());
  +            //classpath
  +            execTask.createArg().setValue("-cp");
  +            execTask.createArg().setValue(classpath.toString());
  +            log("Calling iastool", 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);
  +        }
  +
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message