Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 84824 invoked from network); 29 May 2002 15:59:41 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 29 May 2002 15:59:41 -0000 Received: (qmail 23202 invoked by uid 97); 29 May 2002 15:59:08 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 23126 invoked by uid 97); 29 May 2002 15:59:07 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 22996 invoked by uid 98); 29 May 2002 15:59:05 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <37B2E6BFD50BD411970000B0D021D9C09B9229@intranet.tel.cril.net> From: =?iso-8859-1?Q?MOUSSAUD_Beno=EEt?= To: "'ant-dev@jakarta.apache.org'" Subject: [PATCH] EJB Optionnal task : Borland. Date: Wed, 29 May 2002 17:56:32 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C20729.670CF070" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_000_01C20729.670CF070 Content-Type: text/plain; charset="iso-8859-1" Hi, I made the migration of the EJB optional tasks for Borland Entreprise Server. I have kept the compatibility with the previous version (4.5.x) by adding a new attribute named version. Following the version i launch the right command to the server because Borland has modified the api :-( the version attributes takes the following values 4 (BAS) or 5 (BES). I join the .diff files corresponding to the two java classes and the 2 corresponding doc files. could you integrate them before the ANT1.5Beta2 ? Go on ant lovers ! it is a good tools Kind regards, Benoit --- Benoit Moussaud benoit.moussaud@criltelecom.com Cril Telecom Software http://www.criltelecom.com 8 rue danjou 92510 Boulogne Billancourt (33) 1 58 17 04 78 ------_=_NextPart_000_01C20729.670CF070 Content-Type: application/octet-stream; name="BorlandGenerateClient.html.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="BorlandGenerateClient.html.diff" --- BorlandGenerateClient.html.orig Wed May 29 12:58:35 2002 +++ BorlandGenerateClient.html Wed May 29 15:07:10 2002 @@ -8,6 +8,7 @@ =20

BorlandGenerateClient

+

by Benoit Moussaud (benoit.moussaud@criltele= com.com)

Description

The BorlandGenerateClient is a task dedicated to Borland = Application Server=20 v 4.5. It offers to generate the client jar file corresponding to an = ejb jar=20 @@ -40,16 +41,26 @@ mode choose the command launching = mode. Two values:=20 - java or fork. default =3D java. Possibility to specify a = classpath. + java or fork. default =3D fork. java is not supported for = version=3D5.Possibility to specify a classpath. no + + version + set the Borland Application = Version. +

    +
  • 4 means B.A.S (Borland Application Server 4.x)
  • +
  • 5 means B.E.S (Borland Application Server 5.x)
  • +
+ + yes + =20

Examples

The following build.xml snippet is an example of how to use Borland = element=20 into the ejbjar task using the java mode.

-<blgenclient ejbjar=3D"lib/secutest-ejb.jar" =
clientjar=3D"lib/client.jar" debug=3D"true" =
mode=3D"java">
+<blgenclient ejbjar=3D"lib/secutest-ejb.jar" =
clientjar=3D"lib/client.jar" debug=3D"true" =
mode=3D"fork"> version=3D"5">
     <classpath>
         <pathelement locacation=3D"mymodule.jar"/>
     </classpath>

------_=_NextPart_000_01C20729.670CF070
Content-Type: application/octet-stream;
	name="BorlandEjbTasks.html.diff"
Content-Disposition: attachment;
	filename="BorlandEjbTasks.html.diff"

--- BorlandEjbTask.html.orig	Wed May 29 12:59:03 2002
+++ BorlandEJBTasks.html	Wed May 29 15:10:40 2002
@@ -8,10 +8,13 @@
 
 
 

BorlandDeployTool

+

by Benoit Moussaud (benoit.moussaud@criltelecom.com)

+ +

Description

The BorlandDeployTool is a vendor specific nested element for the Ejbjar optional task.

-

BorlandDeploymentTool is dedicated to the Borland Application Server 4.5. It - generates and compiles the stubs and skeletons for all ejb described into the +

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.

Borland element

@@ -72,13 +75,23 @@ ejbjar (default = false) no + + version + set the Borland Application Version. +
    +
  • 4 means B.A.S (Borland Application Server) 4.x, target will add ejb-inprise.xml file
  • +
  • 5 means B.E.S (Borland Application Server) 5.x, target will add ejb-borland.xml file
  • +
+ + yes +

Examples

The following build.xml snippet is an example of how to use Borland element into the ejbjar task

    <ejbjar srcdir="${build.classes}"  basejarname="vsmp"  descriptordir="${rsc.dir}/hrmanager">
-        <borland destdir="lib" verify="on" generateclient="on">
+        <borland destdir="lib" verify="on" generateclient="on" version="5">
           <classpath refid="classpath" />
         </borland>      
         <include name="**\ejb-jar.xml"/>

------_=_NextPart_000_01C20729.670CF070
Content-Type: application/octet-stream;
	name="BorlandDeploymentTool.java.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="BorlandDeploymentTool.java.diff"

--- BorlandDeploymentTool.java.orig	Wed May 29 14:58:25 2002
+++ BorlandDeploymentTool.java	Mon May 27 09:53:55 2002
@@ -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;
=20
=20
 /**
@@ -89,6 +90,7 @@
  * 
  • verifyargs (String) : add optional argument to verify command = (see vbj com.inprise.ejb.util.Verify)
  • *
  • basdtd (String) : location of the BAS DTD
  • *
  • generateclient (boolean) : turn on the client jar file = generation
  • + *
  • version (int) : tell what is the borland appserver = version 4 or 5
  • * * *
    @@ -119,6 +121,8 @@
         =3D "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd";
    =20
         protected static final String BAS_DD =3D "ejb-inprise.xml";
    +    protected static final String BES_DD =3D "ejb-borland.xml";
    +
    =20
         /** Java2iiop executable **/
         protected static final String JAVA2IIOP =3D "java2iiop";
    @@ -137,6 +141,16 @@
    =20
         /** Instance variable that determines whetger the client jar file =
    is generated */
         private boolean generateclient =3D false;
    +
    +    /** borland appserver version 4 or 5 */
    +    private int version =3D 0;
    +
    +    /** Borland Entreprise Server =3D version 5 */
    +    static final int    BES       =3D 5;
    +    /** Borland Application Server or Inprise Applcation Server  =3D =
    version 4 */
    +    static final int    BAS       =3D 4;
    +
    +   =20
         /** Instance variable that determines whether it is necessary to =
    verify the produced jar */
         private boolean verify     =3D true;
         private String  verifyArgs =3D "";
    @@ -193,6 +207,13 @@
             this.generateclient =3D b;
         }
    =20
    +    /**
    +     * 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 =3D version;
    +    }
    =20
         protected DescriptorHandler getBorlandDescriptorHandler(final File =
    srcDir) {
             DescriptorHandler handler =3D
    @@ -227,10 +248,19 @@
          */
         protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) =
    {
    =20
    -        File borlandDD =3D new File(getConfig().descriptorDir, =
    ddPrefix + BAS_DD);
    +        //choose the right vendor DD
    +        if ( !(version =3D=3D BES || version =3D=3D BAS)) {
    +            throw new BuildException("version "+version+" is not =
    supported");
    +        }       =20
    +
    +        String dd =3D ( version =3D=3D BES ? BES_DD : BAS_DD);
    +
    +        log("vendor file : "+ddPrefix + dd,Project.MSG_DEBUG);
    +       =20
    +        File borlandDD =3D 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 =3D null;
    -        log("verify " + sourceJar, Project.MSG_INFO);
    +        if ( version =3D=3D BAS) {
    +            verifyBorlandJarV4(sourceJar);
    +            return ;
    +        }
    +        if ( version =3D=3D 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 =3D null;  =
                 =20
    +            execTask =3D (ExecTask) =
    getTask().getProject().createTask("exec");                      =20
    +            execTask.setDir(new File("."));
    +            execTask.setExecutable("iastool");
    +            //classpath
    +            if (getCombinedClasspath() !=3D null)  {
    +                execTask.createArg().setValue("-VBJclasspath");
    +                =
    execTask.createArg().setValue(getCombinedClasspath().toString());
    +            }
    =20
    +            if (java2iiopdebug) {
    +                execTask.createArg().setValue("-debug");               =
    =20
    +            }
    +            execTask.createArg().setValue("-verify");           =20
    +            execTask.createArg().setValue("-src");
    +            // ejb jar file to verfiy
    +            execTask.createArg().setValue(sourceJar.getPath());
    +            log("Calling iastool", Project.MSG_VERBOSE);
    +            execTask.execute();       =20
    +        } catch (Exception e) {
    +            // Have to catch this because of the semantics of calling =
    main()
    +            String msg =3D "Exception while calling generateclient =
    Details: "=20
    +                + 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 =3D null;
    +        log("verify BAS " + sourceJar, Project.MSG_INFO);
    +        try  {
                 String args =3D verifyArgs;
                 args +=3D " " + sourceJar.getPath();
    =20
    @@ -280,6 +359,7 @@
             }
         }
    =20
    +
         /**
          * Generate the client jar corresponding to the jar file passed as =
    paremeter
          * the method uses the BorlandGenerateClient task.
    @@ -299,6 +379,7 @@
                 if (classpath !=3D null) {
                     gentask.setClasspath(classpath);
                 }
    +            gentask.setVersion(version);
                 gentask.setTaskName("generate client");
                 gentask.execute();
             } catch (Exception e) {
    @@ -391,11 +472,11 @@
    =20
             if (verify) {
                 verifyBorlandJar(jarFile);
    -        } // end of if ()
    +        }=20
    =20
             if (generateclient) {
                 generateClient(jarFile);
    -        } // end of if ()
    +        }=20
         }
    =20
         /**
    @@ -460,3 +541,4 @@
             } // end of if ()
         }
     }
    +
    
    ------_=_NextPart_000_01C20729.670CF070
    Content-Type: application/octet-stream;
    	name="BorlandGenerateClient.java.diff"
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: attachment;
    	filename="BorlandGenerateClient.java.diff"
    
    --- BorlandGenerateClient.java.orig	Wed May 29 14:57:59 2002
    +++ BorlandGenerateClient.java	Mon May 27 09:47:12 2002
    @@ -57,19 +57,14 @@
    =20
     import java.io.File;
    =20
    -
    -
    -
    -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;
    =20
    -
    -
     /**
      * BorlandGenerateClient is dedicated to the Borland Application =
    Server 4.5
      * This task generates the client jar using as input the ejb jar file.
    @@ -83,7 +78,7 @@
     public class BorlandGenerateClient extends Task {
         static final String JAVA_MODE =3D "java";
         static final String FORK_MODE =3D "fork";
    -
    +   =20
         /** debug the generateclient task */
         boolean debug =3D false;
    =20
    @@ -97,7 +92,14 @@
         Path classpath;
    =20
         /** hold the mode (java|fork) */
    -    String mode =3D JAVA_MODE;
    +    String mode =3D FORK_MODE;
    +
    +    /** hold the version */
    +    int version =3D 0;
    +
    +    public void setVersion(int version) {
    +        this.version =3D version;
    +    }
    =20
         public void setMode(String s) {
             mode =3D s;
    @@ -144,7 +146,7 @@
         public void execute() throws BuildException {
             if (ejbjarfile =3D=3D null || ejbjarfile.isDirectory()) {
                 throw new BuildException("invalid ejb jar file.");
    -        } // end of if ()
    +        }=20
    =20
             if (clientjarfile =3D=3D null || clientjarfile.isDirectory()) =
    {
                 log("invalid or missing client jar file.", =
    Project.MSG_VERBOSE);
    @@ -153,13 +155,16 @@
                 String clientname =3D ejbjarname.substring(0, =
    ejbjarname.lastIndexOf("."));
                 clientname =3D clientname + "client.jar";
                 clientjarfile =3D new File(clientname);
    -
    -        } // end of if ()
    +        }=20
    =20
             if (mode =3D=3D null) {
                 log("mode is null default mode  is java");
                 setMode(JAVA_MODE);
    -        } // end of if ()
    +        }=20
    +
    +        if ( !(version =3D=3D BorlandDeploymentTool.BES || version =
    =3D=3D BorlandDeploymentTool.BAS)) {
    +            throw new BuildException("version "+version+" is not =
    supported");
    +        }       =20
    =20
             log("client jar file is " + clientjarfile);
    =20
    @@ -173,6 +178,10 @@
         /** launch the generate client using java api */
         protected void executeJava() throws BuildException {
             try {
    +            if ( version =3D=3D BorlandDeploymentTool.BES)  {
    +                throw new BuildException("java mode is supported only =
    for previous version <=3D"+BorlandDeploymentTool.BAS);
    +            }
    +           =20
                 log("mode : java");
    =20
                 org.apache.tools.ant.taskdefs.Java execTask =3D null;      =
             =20
    @@ -189,9 +198,8 @@
                 execTask.createArg().setValue("generateclient");
                 if (debug) {
                     execTask.createArg().setValue("-trace");               =
    =20
    -            } // end of if ()
    +            }=20
    =20
    -            //
                 execTask.createArg().setValue("-short");
                 execTask.createArg().setValue("-jarfile");
                 // ejb jar file
    @@ -213,8 +221,19 @@
    =20
         /** launch the generate client using system api */
         protected  void executeFork() throws BuildException {
    -        try {
    -            log("mode : fork");
    +            if ( version =3D=3D BorlandDeploymentTool.BAS) {
    +                executeForkV4();
    +            }
    +            if ( version =3D=3D BorlandDeploymentTool.BES ) {
    +                executeForkV5();
    +            }
    +    }
    +
    +    /** launch the generate client using system api */
    +    protected  void executeForkV4() throws BuildException {
    +        try {           =20
    +           =20
    +            log("mode : fork =
    "+BorlandDeploymentTool.BAS,Project.MSG_DEBUG);
    =20
                 org.apache.tools.ant.taskdefs.ExecTask execTask =3D null;  =
                 =20
                 execTask =3D (ExecTask) getProject().createTask("exec");
    @@ -224,9 +243,8 @@
                 execTask.createArg().setValue("generateclient");
                 if (debug) {
                     execTask.createArg().setValue("-trace");               =
    =20
    -            } // end of if ()
    +            }=20
    =20
    -            //
                 execTask.createArg().setValue("-short");
                 execTask.createArg().setValue("-jarfile");
                 // ejb jar file
    @@ -236,7 +254,40 @@
                 execTask.createArg().setValue("-clientjarfile");
                 =
    execTask.createArg().setValue(clientjarfile.getAbsolutePath());
    =20
    -            log("Calling java2iiop", Project.MSG_VERBOSE);
    +            log("Calling iastool", Project.MSG_VERBOSE);
    +            execTask.execute();       =20
    +        } catch (Exception e) {
    +            // Have to catch this because of the semantics of calling =
    main()
    +            String msg =3D "Exception while calling generateclient =
    Details: "=20
    +                + e.toString();
    +            throw new BuildException(msg, e);
    +        }
    +
    +    }
    +    /** 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 =3D null;  =
                 =20
    +            execTask =3D (ExecTask) getProject().createTask("exec");
    +                      =20
    +            execTask.setDir(new File("."));
    +
    +            execTask.setExecutable("iastool");
    +            if (debug) {
    +                execTask.createArg().setValue("-debug");               =
    =20
    +            }
    +            execTask.createArg().setValue("-genclient");           =20
    +            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();       =20
             } catch (Exception e) {
                 // Have to catch this because of the semantics of calling =
    main()
    @@ -246,5 +297,6 @@
             }
    =20
         }
    +
     }
    =20
    
    
    ------_=_NextPart_000_01C20729.670CF070
    Content-Type: text/plain; charset=us-ascii
    
    --
    To unsubscribe, e-mail:   
    For additional commands, e-mail: 
    ------_=_NextPart_000_01C20729.670CF070--