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/docs/manual/OptionalTasks ejb.html
Date Sat, 02 Feb 2002 11:04:44 GMT
conor       02/02/02 03:04:44

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        EjbJar.java
               docs/manual/OptionalTasks ejb.html
  Added:       src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        JonasDeploymentTool.java
  Log:
  Add Support for JOnAS EJB server
  
  Submitted by:	 Cyrille Morvan <cyrille_list@ingenosya.com>
  
  Revision  Changes    Path
  1.27      +15 -0     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.26
  retrieving revision 1.27
  diff -u -w -u -r1.26 -r1.27
  --- EjbJar.java	10 Jan 2002 13:59:35 -0000	1.26
  +++ EjbJar.java	2 Feb 2002 11:04:43 -0000	1.27
  @@ -275,6 +275,21 @@
       }
   
       /**
  +     * Create a jonas nested element used to configure a
  +     * deployment tool for JOnAS server.
  +     *
  +     * @return the deployment tool instance to be configured.
  +     */
  +    public JonasDeploymentTool createJonas() {
  +        log("JOnAS deployment tools",  Project.MSG_VERBOSE);
  +        
  +        JonasDeploymentTool tool = new JonasDeploymentTool();
  +        tool.setTask(this);
  +        deploymentTools.add(tool);
  +        return tool;
  +    }    
  +    
  +    /**
        * Create a nested element for weblogic when using the Toplink
        * Object- Relational mapping.
        *
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
  
  Index: JonasDeploymentTool.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.Path;
  import org.apache.tools.ant.taskdefs.Java;
  import org.apache.tools.ant.util.FileUtils;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.Hashtable;
  
  
  /**
   * The deployment tool to add the jonas specific deployment descriptors to 
   * the ejb jar file. JONAS only requires one additional file jonas-ejb-jar.xml.
   *
   * @author <a href="cmorvan@ingenosya.com">Cyrille Morvan</a>,
   *       <a href="http://www.ingenosya.com">Ingenosya France</a>
   * @version 1.0
   * @see EjbJar#createJonas
   */
  public class JonasDeploymentTool extends GenericDeploymentTool {
  
      protected static final String JONAS_DD = "jonas-ejb-jar.xml";
  
      protected static final String GENIC_CLASS =
                 "org.objectweb.jonas_ejb.tools.GenWholeIC";
  
      protected static final String OLD_GENIC_CLASS =
                 "org.objectweb.jonas_ejb.tools.GenIC";
  
      protected static final String DEFAULT_ORB = "RMI";
  
      /** Instance variable that stores the suffix for the jonas jarfile. */
      private String jarSuffix = ".jar";
  
      /**
       * Instance variable that stores the fully qualified classname
       * of the JOnAS GenIC compiler.
       **/
      private String genicClass;
  
      private String additionalArgs = "";
  
      /** Instance variable that determines do not delete intermediate generated source files
*/
      private boolean keepgenerated = false;
      
      /** as websphere and WebLogic taskes */
      private boolean keepGeneric = false;    
      
      /** Instance variable that determines the JOnAS Root directory */
      private File jonasroot;
  
      /** Instance variable that determines if we could -secpropag */
      private boolean secpropag = false;
      
      /** Instance variable that determines the ouput directory */
      private File ouputdirectory;
  
      /** Instance variable that determines the path to the compiler to use */
      private String compiler;
  
      /** Instance variable that determines if GenIC is verbose */
      private boolean verbose;
  
      /** Instance variable that determines the ORB to use (RMI, JEREMIE, DAVID)*/
      private String orb;
  
      /** clean the working directory after work **/
      private boolean cleanWorkDir = false;
  
      private boolean noGENIC = false;
  
      /**
       * set the name of the GenIC compiler class.
       **/
      public void setGenicClass(final String inGenicClass) {
         genicClass = inGenicClass;
      }
  
  
      /**
       * Set the ORB to construct classpath.
       * @param inValue RMI, JEREMIE, DAVID,...
       **/
      public void setOrb(final String inValue) {
         orb = inValue;
      }
  
      /**
       * The compiler (switch <code>-javac</code>) to use.
       **/
      public void setCompiler(final String inCompiler) {
          compiler = inCompiler;
      }  
      
      /**
       * Setter used to store the value of keepGeneric
       * @param inValue a string, either 'true' or 'false'.
       */
      public void setKeepgeneric(boolean inValue) {
          this.keepGeneric = inValue;
      }
      
      /**
       * GenIC verbose or not
       * @param inValue either 'true' or 'false'
       **/
      public void setVerbose(final boolean inValue) {
          verbose = inValue;
      }
  
      /**
       * GenIC run or not.
       * @param inValue run or not
       **/
      public void setNoGENIC(final boolean inValue) {
          noGENIC = inValue;
      }
  
      /**
       * Sets whether -keepgenerated is passed to GenIC (that is,
       * the .java source files are kept).
       * @param inValue either 'true' or 'false'
       **/
      public void setKeepgenerated(final boolean inValue) {
          keepgenerated = inValue;
      }
  
      /**
       * set the jonas root directory (-Dinstall.root=).
       * 
       * @throws BuildException if the file doesn't exist.
       **/
      public void setJonasroot(final File inValue) {
        jonasroot = inValue;
      }
  
      /**
       * Modify the RMI Skel. and Stub. to implement
       * the implicit propagation of the transactionnal
       * context and security context.
       * For JOnAS 2.4 and next.
       */
      public void setSecpropag(final boolean inValue) {
        secpropag = inValue;
      }
      
      /**
       * set the output directory (-d ...).
       * <br>
       *  
       * It's the GenIC working directory. It's not the
       * DestDir, which is the 'jar' destination directory. 
       * 
       * @param inValue a file 
       **/
      public void setOuputdir(final File inValue) {
          ouputdirectory = inValue;
      }
      
      
      /**
       * set the output directory (-d ...).
       * Same as setOuputdir().
       * <br>
       * But do not override setDestDir()
       **/
      public void setWorkdir(final File inValue) {
          setOuputdir(inValue);
      }
  
      /**
       * Clean the specified Work dir after work.
       * @param inValue true : clean ; false : not clean
       **/
      public void setCleanworkdir(final boolean inValue) {
          cleanWorkDir = inValue;
      }
      
      /**
       * Setter used to store the suffix for the generated JOnAS jar file.
       * @param inString the string to use as the suffix.
       **/
      public void setSuffix(String inString) {
          this.jarSuffix = inString;
      }
  
      /**
       * sets some additional args to send to GenIC.
       **/
      public void setArgs(final String inArgs) {
          additionalArgs = inArgs;
      }
  
      /**
       * Add any vendor specific files which should be included in the
       * EJB Jar.
       * @param aDdPrefix MyDirectories/MyEjb- or MyDirectories/ 
       **/
      protected void addVendorFiles(final Hashtable someEjbFiles,final String aDdPrefix) {
          // Use Ant Naming convention
          File aJonasDD = new File(getConfig().descriptorDir,aDdPrefix + JONAS_DD);
          if ( aJonasDD.exists() ) {
              someEjbFiles.put(META_DIR + JONAS_DD, aJonasDD);
          } else {
              // try with JOnAS Naming convention
              if( ! addJonasVendorFiles(someEjbFiles,aDdPrefix) ) {            
                 log("Unable to locate JOnAS deployment descriptor. It was expected to be
in "
                    + aJonasDD.getPath() + ". Or please use JOnAS naming convention.",
                    Project.MSG_WARN);
              }
          }
      }
  
      /**
       * try to add JOnAS specific file, using JOnAS naming convention.
       * For example : jonas-Account.xml or jonas-ejb-jar.xml
       * @param aDdPrefix MyDirectories/MyEjb- or MyDirectories/ 
       * @return true if Ok
       */
      private boolean addJonasVendorFiles(final Hashtable someEjbFiles,final String aDdPrefix)
{
        // replace \ by /, remove the last letter ( a dash - )
        final String aCanonicalDD = aDdPrefix.replace('\\', '/').substring(0,aDdPrefix.length()-1);
        final int index = aCanonicalDD.lastIndexOf('/') + 1;
        String anEjbJarName = aCanonicalDD.substring(index);
        if( "ejb".equals( anEjbJarName ) ) {
           anEjbJarName = "ejb-jar";
        } 
        final String aNewDdPrefix = 
              aDdPrefix.substring(0,index) + "jonas-" + anEjbJarName + ".xml";
        File aConventionNamingJonasDD = new File(getConfig().descriptorDir,aNewDdPrefix);
        
        log("look for jonas specific file using jonas naming convention " + aConventionNamingJonasDD,
                             Project.MSG_VERBOSE);
  
        if( aConventionNamingJonasDD.exists() ) {
           someEjbFiles.put(META_DIR + JONAS_DD,aConventionNamingJonasDD);
           return true;
        } else {
           return false;
        }
      }
      
      // include javadoc
      // Determine the JAR filename (without filename extension)
      protected String getJarBaseName(String aDescriptorFileName) {
        String aBaseName = null;
        EjbJar.Config aConfig = super.getConfig();
        if (aConfig.namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR)) {
           // try to find JOnAS specific convention name
           // ??/MyEJB.xml ( I will find later the ??/jonas-MyEJB.xml file )
           if( aDescriptorFileName.indexOf(aConfig.baseNameTerminator) == -1 ) {
              String aCanonicalDescriptor = aDescriptorFileName.replace('\\','/');
              int lastSeparatorIndex = aCanonicalDescriptor.lastIndexOf('/');
              int endBaseName;
              if (lastSeparatorIndex != -1) {
                  endBaseName = aDescriptorFileName.indexOf(".xml", lastSeparatorIndex);
              } else {
                  endBaseName = aDescriptorFileName.indexOf(".xml");
              }
  
              if (endBaseName != -1) {
                  aBaseName = aDescriptorFileName.substring(0, endBaseName);
              }
           }
        }
  
        if( aBaseName == null ) {
           // else get standard BaseName
           aBaseName = super.getJarBaseName(aDescriptorFileName);
        }
        return aBaseName;
      }
  
      /**
       * Method used to encapsulate the writing of the JAR file. Iterates over the
       * 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 {
          // need to create a generic jar first.
          File genericJarFile = super.getVendorOutputJarFile(baseName);
          super.writeJar(baseName, genericJarFile, files, publicId);
  
          // todo ? if (alwaysRebuild || isRebuildRequired(genericJarFile, jarFile))
          buildJOnASJar(baseName,genericJarFile, jarFile,files,publicId);
          
          if (!keepGeneric) {
               log("deleting generic jar " + genericJarFile.toString(),
                             Project.MSG_VERBOSE);
               genericJarFile.delete();
          }
      }
  
      /**
       * Helper method invoked by execute() for each JOnAS jar to be built.
       * Encapsulates the logic of constructing a java task for calling
       * GenIC and executing it.
       * @param inBaseName the base name of the jar
       * @param inSourceJar java.io.File representing the source (EJB1.1) jarfile.
       * @param someFiles list of files in the jar. Add all the new genererated
       *   files.
       * @param inPublicId the link to DTD (to rewrite JAR).
       **/
      private void buildJOnASJar(final String inBaseName,
                                 final File inSourceJar,final File inDestJar,
                                 final Hashtable someFiles,String inPublicId) {
        org.apache.tools.ant.taskdefs.Java aJavaTask = null;
        String aGenIcClassName = genicClass;
        boolean isOldGenIC = false;
        boolean isTempDirectory = false;
        File anOutputDirectoryFile = null;
  
        // do not call GenIC
        // only copy file
        if (noGENIC) {
           try {
              FileUtils.newFileUtils().copyFile(inSourceJar, inDestJar);
              return;
           } catch (IOException anIOException) {
              throw new BuildException("Unable to write EJB jar", anIOException);
           }
        }
           
        // call GenIC
        try {
           aJavaTask = (Java) getTask().getProject().createTask("java");
           aJavaTask.setTaskName("genic");
           if(aGenIcClassName == null) {
              aGenIcClassName = GENIC_CLASS;
           } else if( OLD_GENIC_CLASS.equals(aGenIcClassName) ){
              isOldGenIC = true;
           }
           // ClassName
           aJavaTask.setClassname(aGenIcClassName);
  
           // JVM Args
           if( jonasroot == null ) {
              throw new BuildException("Error : set the jonasroot parameter");
           } else if ( ! jonasroot.isDirectory() ) {
              log("jonasroot attribut '" + jonasroot + "' is not a valid directory",
                       Project.MSG_ERR);
           }
           aJavaTask.createJvmarg().setValue("-Dinstall.root=" + jonasroot);
           File aJavaPolicyFile = new File(jonasroot,"config/java.policy");
           if( aJavaPolicyFile.exists() ) {
              aJavaTask.createJvmarg().setValue("-Djava.security.policy=" 
                                          + aJavaPolicyFile.toString() );
           }
  
           // Find output directory
           if( ouputdirectory == null ) {
              anOutputDirectoryFile = createTempDir();
              isTempDirectory = true;
              log("Use temporary output directory : " +
                    anOutputDirectoryFile, Project.MSG_VERBOSE);
           } else {
              anOutputDirectoryFile = ouputdirectory;
              log("Use temporary specific output directory : " + 
                    anOutputDirectoryFile, Project.MSG_VERBOSE);
           }
           aJavaTask.createArg().setValue("-d");
           aJavaTask.createArg().setFile(anOutputDirectoryFile);
  
           // Additionnal args
           aJavaTask.createArg().setLine(additionalArgs);
           // KeepGenerated
           if (keepgenerated) {
               aJavaTask.createArg().setValue("-keepgenerated");
           }
  
           // Verbose
           if( verbose ) {
              aJavaTask.createArg().setValue("-verbose");
           }
           
           // -secpropag
           if( secpropag ) {
              aJavaTask.createArg().setValue("-secpropag");            
           }
           
           // The compiler
           if (compiler == null) {
               // try to use the compiler specified by build.compiler. Right now we are just
going
               // to allow Jikes
               String aBuildCompiler = getTask().getProject().getProperty("build.compiler");
               if ("jikes".equals(aBuildCompiler) ) {
                   aJavaTask.createArg().setValue("-javac");
                   aJavaTask.createArg().setValue("jikes");
               }
           } else {
              if( ! "default".equals( compiler ) ) {
                 aJavaTask.createArg().setValue("-javac");
                 aJavaTask.createArg().setLine(compiler);
              }
           }
  
           if( ! isOldGenIC ) {
              // the add in jar features is buggy...
              aJavaTask.createArg().setValue("-noaddinjar");
           }
  
           aJavaTask.createArg().setValue(inSourceJar.getPath());
  
           // try to create the classpath for the correct ORB
           Path aClasspath = getCombinedClasspath();
           if( aClasspath == null ) {
              aClasspath = new Path(getTask().getProject());
           }
           if( orb != null ) {
              String aOrbJar = new File(jonasroot,"lib/" + orb + "_jonas.jar").toString();
              String aConfigDir = new File(jonasroot,"config/").toString();
              Path aJOnASOrbPath = new Path(aClasspath.getProject(),
                                         aOrbJar + File.pathSeparator + aConfigDir );
              aClasspath.append( aJOnASOrbPath );
           } else {
              log("No ORB propertie setup (RMI, JEREMIE, DAVID).", Project.MSG_WARN);
           }
  
           // append the output directory
           aClasspath.append( new Path(aClasspath.getProject(), anOutputDirectoryFile.getPath()));
           aJavaTask.setClasspath(aClasspath);
  
  
           aJavaTask.setFork(true);
  
           log("Calling " + aGenIcClassName + " for " + inSourceJar.toString(),
                         Project.MSG_VERBOSE);
  
           if (aJavaTask.executeJava() != 0) {
               throw new BuildException("GenIC reported an error");
           }
           // Update the list of files.
           addAllFiles(anOutputDirectoryFile,"",someFiles);
  
           // rewrite the jar with the new files
           super.writeJar(inBaseName, inDestJar, someFiles, inPublicId);
       } catch(BuildException aBuildException) {
           throw aBuildException;
       } catch (Exception e) {
           // Have to catch this because of the semantics of calling main()
           String msg = "Exception while calling " + aGenIcClassName + ". Details: " + e.toString();
           throw new BuildException(msg, e);
       } finally {
          if( isTempDirectory && anOutputDirectoryFile != null) {
             dellAllFiles(anOutputDirectoryFile);
          } else if( cleanWorkDir && anOutputDirectoryFile != null) {
             dellAllFilesInside(anOutputDirectoryFile);
          }
       }
     }
  
      /**
       * 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(final String aBaseName) {
          return new File(getDestDir(), aBaseName + jarSuffix);
      }
  
     /**
      * Create a free tempory directory for GenIC output.
      * @return directory file
      * @throws BuildException if impossible to find a tempory directory
      **/
     private File createTempDir() {
        String theTempDir = System.getProperty("java.io.tmpdir");
        int anIndice = 0;
        File aFile = null;
        // try 50 times to find a free tempory directory
        while( anIndice < 50 && aFile == null) {
           aFile = new File(theTempDir,"GenicTemp" + anIndice);
           if(aFile.exists()) {
              anIndice++;
              aFile = null;
           }
        }
  
        if( aFile == null ) {
           // problem in temp directory
           throw new BuildException("Impossible to find a free temp directory for output.");
        } else {
           aFile.mkdirs();
           return(aFile);
        }
     }
  
  
     /**
      * add all files in anOutputDir + ' / ' + aRootDir to the HashTable someFiles.
      *
      * @param anOutputDir - start directory
      * @param aCurrentDirOrFile - a sub-directory to scan or a file to add.
      * @param someFiles - where to add the files
      **/
     private void addAllFiles(final File anOutputDir, String aCurrentDirOrFile, Hashtable
someFiles) {
        File aFile = new File(anOutputDir,aCurrentDirOrFile);
        if( aFile.isDirectory() ) {
           String aCurrentDir = "";
           if( aCurrentDirOrFile.length() > 0 ) {
              aCurrentDir = aCurrentDirOrFile + '/';
           }
           File theFiles[] = aFile.listFiles();
           for(int i=0;i<theFiles.length;i++) {
              addAllFiles(anOutputDir,aCurrentDir + theFiles[i].getName(),someFiles);
           }
        } else {
           // is a file
           someFiles.put(aCurrentDirOrFile,aFile);
        }
     }
  
     /**
      * Delete all the files in a directory
      * @param aFile file to delete recursivly
      **/
     private void dellAllFiles(File aFile) {
       if(aFile.isDirectory()) {
         File someFiles[] = aFile.listFiles();
         for(int i=0;i<someFiles.length;i++) {
            dellAllFiles(someFiles[i]);
         }
       }
       aFile.delete();
     }
     
     /**
      * Delete all the files in a directory, but don't delete
      * the directory
      * @param aFile file to delete recursivly
      **/   
     private void dellAllFilesInside(File aFile) {
       if(aFile.isDirectory()) {
         File someFiles[] = aFile.listFiles();
         for(int i=0;i<someFiles.length;i++) {
            dellAllFiles(someFiles[i]);
         }
       }      
     }
     
  }
  // eof.
  
  
  
  1.13      +224 -13   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.12
  retrieving revision 1.13
  diff -u -w -u -r1.12 -r1.13
  --- ejb.html	10 Jan 2002 08:48:31 -0000	1.12
  +++ ejb.html	2 Feb 2002 11:04:43 -0000	1.13
  @@ -16,11 +16,12 @@
     <li>Tim Fennell (<a href="mailto:tfenne@rcn.com">tfenne@rcn.com</a>)</li>
     <li>Martin Gee (<a href="mailto:martin.gee@icsynergy.com">martin.gee@icsynergy.com</a>)</li>
     <li>Conor MacNeill (<a href="mailto:conor@cortexebusiness.com.au">conor@cortexebusiness.com.au</a>)</li>
  -  <li>Greg Nelson (<a href="mailto:greg@netscape.com">greg@netscape.com</a>)</li>
  +  <li>Cyrille Morvan (<a href="mailto:cmorvan@ingenosya.com">cmorvan@ingenosya.com</a>)</li>
  +  <li>Greg Nelson (<a href="mailto:gn@sun.com">gn@sun.com</a>)</li>
   </ul>
   
   <p>Version @VERSION@<br>
  -$Id: ejb.html,v 1.12 2002/01/10 08:48:31 bodewig Exp $
  +$Id: ejb.html,v 1.13 2002/02/02 11:04:43 conor Exp $
   </p>
   <hr>
   <h2>Table of Contents</h2>
  @@ -32,11 +33,10 @@
   <hr>
   <h2><a name="introduction">Introduction</a></h2>
   <p>Ant provides a number of optional tasks for developing 
  -<a href="http://java.sun.com/products/ejb" target="_top">Enterprise Java Beans (EJBs)</a>
  -. In general these tasks are specific to the particular vendor's EJB Server.</p>
  +<a href="http://java.sun.com/products/ejb" target="_top">Enterprise Java Beans (EJBs)</a>.

  +In general these tasks are specific to the particular vendor's EJB Server.</p>
   
   <p> At present the tasks support:<br>
  -</p>
   
   <ul>
     <li><a href="http://www.borland.com">Borland </a>
  @@ -47,15 +47,12 @@
     jboss 2.1</a> and above EJB servers</li>
     <li><a href="http://www.bea.com" target="_top">Weblogic</a>
      4.5.1, 5.1, and 6.0 EJB servers</li>
  +  <li><a href="http://www.objectweb.com/jonas/" target="_top">JOnAS</a>
  +   2.4 Open Source EJB server</li>   
   </ul>
     Over time we expect further optional tasks  to support additional EJB Servers.
  -
  -<p>Ant provides a number of optional tasks for developing 
  -<a href="http://java.sun.com/products/ejb" target="_top">Enterprise Java Beans (EJBs)</a>.

  -In general these tasks are specific to the particular vendor's EJB Server. At present the
tasks support
  -<a href="http://www.bea.com" target="_top">Weblogic</a> 4.5.1 and 5.1 EJB servers.
Over time we expect further optional tasks 
  -to support additional EJB Servers. 
   </p>
  +
   <hr>
   <h2><a name="ejbtasks">EJB Tasks</a></h2>
   <table border="1" cellpadding="5">
  @@ -64,11 +61,12 @@
    <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><a href="#iplanet-ejbc">iplanet-ejbc</a></td><td
colspan="2">iPlanet Application Server 6.0</td></tr>
  - <tr><td rowspan="5"><a href="#ejbjar">ejbjar</a></td><td
colspan="2" align="center"><b>Nested Elements</b></td></tr>
  + <tr><td rowspan="6"><a href="#ejbjar">ejbjar</a></td><td
colspan="2" align="center"><b>Nested Elements</b></td></tr>
    <tr><td><a href="BorlandEJBTasks.html">borland</a></td><td>Borland
Application Server 4.5</td></tr>
    <tr><td><a href="#ejbjar_jboss">jBoss</a></td><td>jBoss</td></tr>
    <tr><td><a href="#ejbjar_iplanet">iPlanet</a></td><td>iPlanet
Application Server 6.0</td></tr>
    <tr><td><a href="#ejbjar_weblogic">weblogic</a></td><td>Weblogic
5.1 &amp; 6.0</td></tr>
  + <tr><td><a href="#ejbjar_jonas">jonas</a></td><td>JOnAS
2.4</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>
   
  @@ -531,6 +529,7 @@
     <li>Jboss 2.1 and above</li>
     <li>Weblogic 5.1/6.0 session/entity beans using the weblogic.ejbc tool</li>
     <li>TOPLink for WebLogic 2.5.1-enabled entity beans</li>
  +  <li><a href="http://www.objectweb.org/jonas/">JOnAS</a> 2.4 Open Source
EJB server</li>
   </ul>
   
   
  @@ -1282,12 +1281,224 @@
               &lt;dtd publicId="-//Sun Microsystems, Inc.//DTD iAS Enterprise JavaBeans
1.0//EN"
                    location="${ias.home}/APPS/IASEjb_jar_1_0.dtd"/>
       &lt;/ejbjar></pre>
  +<h3><a name="ejbjar_jonas">
  +<h3>JOnAS (Java Open Application Server) element</h3>
  +</a>
  +</h3>
  +<p>The &lt;jonas&gt; nested element is used to build JOnAS-specific stubs

  +and skeletons thanks to the GenIC specific tool, and construct a JAR file 
  +which may be deployed to the JOnAS Application Server. The build process 
  +will always determine if the EJB stubs/skeletons and the EJB-JAR file are 
  +up to date, and it will do the minimum amount of work required. </p>
  +
  +<p>Like the WebLogic element, a naming convention for the EJB descriptors
  + is most commonly used to specify the name for the completed JAR file.  For
  + example, if the EJB descriptor ejb/Account.xml (or ejb/Account-ejb-jar.xml ) 
  + is found in the descriptor directory, the jonas element will search for a
  + JOnAS-specific EJB descriptor file named ejb/Account-jonas-ejb-jar.xml 
  + (if it isn't found, the task will fail) and a JAR file named ejb/Account.jar 
  + will be written in the destination directory. Note that when the EJB 
  + descriptors are added to the JAR file, they are automatically  renamed 
  + META-INF/ejb-jar.xml and META-INF/jonas-ejb-jar.xml.<br><br>
  + But if you prefer, you can use JOnAS convention naming and keep your 
  + XML file name : ejb/Account.xml and ejb/jonas-Account.xml, a JAR file named 
  + ejb/Account.jar will be written in the destination directory. 
  +  
  + </p>
  +<p>Of course, this naming behavior can be modified by specifying attributes
  + in the ejbjar task (for example, basejarname, basenameterminator, and flatdestdir)
  + as well as the iplanet element (for example, suffix).  Refer to the appropriate
  + documentation for more details.</p>
  +<h3> Parameters:</h3>
  +<table border="1" cellspacing="0" cellpadding="2">
  +  <tbody>
  +    <tr>
  +      <td valign="Top"><b>Attribute</b></td>
  +      <td valign="Top"><b>Description</b></td>
  +      <td align="Center" valign="Top"><b>Required</b></td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">destdir</td>
  +      <td valign="Top">The base directory into which the generated JAR files
  + will be written. Each JAR file is written in directories which correspond
  + to their location within the "descriptordir" namespace.</td>
  +      <td align="Center" valign="Top">Yes</td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">jonasroot<br>
  +      </td>
  +      <td valign="Top">The root directory for JOnAS. <br>
  +      </td>
  +      <td valign="Top">
  +      <div align="Center">Yes<br>
  +      </div>
  +      </td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">workdir<br>
  +      </td>
  +      <td valign="Top">The work directory to use. Specify where to place
  +the generated files, before to add to the jar. The directory should be empty.
  +If omitted, it defaults to a temporary directory.<br>
  +      </td>
  +      <td valign="Top">
  +      <div align="Center">No<br>
  +      </div>
  +      </td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">cleanworkdir<br>
  +      </td>
  +      <td valign="Top">Clean the working directory after work.
  +         If omitted, it defaults to false, but your jar will contain
  +         wrong files if you don't clean the workdir yourself.<br>
  +         Temporary working directory is always cleaned.<br>
  +      </td>
  +      <td valign="Top">
  +      <div align="Center">No<br>
  +      </div>
  +      </td>
  +    </tr>    
  +    <tr>
  +      <td valign="Top">classpath</td>
  +      <td valign="Top">The classpath used when generating EJB stubs and skeletons.

  +      If omitted, the classpath specified in the "ejbjar" parent task will 
  +      be used. If specified, the classpath elements will be prepended to the 
  +      classpath specified in the parent "ejbjar" task (see also the ORB 
  +      attribute documentation below). Note that nested "classpath" elements 
  +      may also be used.</td>
  +      <td align="Center" valign="Top">No</td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">keepgenerated</td>
  +      <td valign="Top">Indicates whether or not the Java source files which
  + are generated by GenIC will be saved or automatically deleted. If "yes", the
  +source files will be retained.  If omitted, it defaults to "no". </td>
  +      <td align="Center" valign="Top">No</td>
  +    </tr>
  +  <tr>
  +    <td valign="top">keepgeneric</td>
  +    <td valign="top">This controls whether the generic file used as input to
  +                     GenIC is retained.</td>
  +    <td valign="top" align="center">No, defaults to false</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">secpropag</td>
  +    <td valign="top">Modify the RMI Skel. and Stub. to implement the 
  +                     implicit propagation of the security context (note that 
  +                     the transactionnal context is always provided).
  +                     </td>
  +    <td valign="top" align="center">No, defaults to false.</td>
  +  </tr>
  +    <tr>
  +      <td valign="Top">orb<br>
  +      </td>
  +      <td>Choose your ORB : RMI, JEREMIE, DAVID, ... If omitted, it defaults
  +to the one present in classpath. If specified, the corresponding JOnAS JAR is
  +automatically added to the classpath. <br>
  +      </td>
  +      <td align="Center" valign="Top">No</td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">noGENIC<br>
  +      </td>
  +      <td valign="Top">If this attribute is set to true, JOnAS's GenIC will
  + not be run on the EJB jar. Use this if you prefer to
  + run GenIC at deployment time.</td>
  +      <td>
  +      <div align="Center">No</div>
  +      </td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">suffix</td>
  +      <td>String value appended to the JAR filename when creating each JAR.
  +  If omitted, it defaults to ".jar". </td>
  +      <td align="Center" valign="Top">No</td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">verbose<br>
  +      </td>
  +      <td valign="Top">Indicates whether or not to use -verbose switch. If
  +omitted, it defaults to "no".</td>
  +      <td valign="Top">
  +      <div align="Center">No<br>
  +      </div>
  +      </td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">compiler<br>
  +      </td>
  +      <td valign="Top">This allows for the selection of a different compiler
  +                      to be used for the compilation of the generated Java
  +                      files. This could be set, for example, to Jikes to
  +                     compile with the Jikes compiler. If this is not set
  +                    and the <code>build.compiler</code> property is set
  +                    to jikes, the Jikes compiler will be used. If this
  +                   is not desired, the value "<code>default</code>"
  +                 may be given to use the default compiler<br>
  +      </td>
  +      <td valign="Top">
  +      <div align="Center">No<br>
  +      </div>
  +      </td>
  +    </tr>
  +    <tr>
  +      <td valign="Top">args<br>
  +      </td>
  +      <td valign="Top">Add additional args to GenIC.<br>
  +      </td>
  +      <td valign="Top">
  +      <div align="Center">No<br>
  +      </div>
  +      </td>
  +    </tr>
  +  </tbody>
  +</table>
  +<p>As noted above, the jonas element supports additional &lt;classpath&gt;
  + nested elements. </p>
  +<h3>Examples</h3>
  +<p>This example shows ejbjar being used to generate deployment jars using
  + a  JOnAS EJB container. This example requires the naming standard to be
  + used for  the deployment descriptors. Using this format will create a ejb
  + jar file for each variation of &nbsp;'*-jar.xml' that is found in the
  +deployment  descriptor  directory.&nbsp;</p>
  +<pre>
  +      &lt;ejbjar srcdir="${build.classes}"
  +              descriptordir="${descriptor.dir}"&gt;
  +        &lt;jonas destdir="${deploymentjars.dir}"
  +             jonasroot="${jonas.root}"
  +             orb="RMI" /&gt;
  +        &lt;include name="**/*.xml"/&gt;
  +        &lt;exclude name="**/jonas-*.xml"/&gt;
  +        &lt;support dir="${build.classes}"&gt;
  +             &lt;include name="**/*.class"/&gt;
  +        &lt;/support&gt;
  +      &lt;/ejbjar&gt;
  +</pre>
  +<p></p>
  +<p>This example shows ejbjar being used to generate a single deployment jar
  +  using a JOnAS EJB container. This example does require the deployment
  +  descriptors to use the naming standard. This will create only one ejb jar
  + file - 'TheEJBJar.jar'.</p>
  +<pre>
  +      &lt;ejbjar srcdir="${build.classes}"
  +              descriptordir="${descriptor.dir}"
  +              basejarname="TheEJBJar"&gt;
  +        &lt;jonas destdir="${deploymentjars.dir}" 
  +                  jonasroot="${jonas.root}"
  +                  suffix=".jar"
  +                  classpath="${descriptorbuild.classpath}" /&gt;
  +        &lt;include name="**/ejb-jar.xml"/&gt;
  +        &lt;exclude name="**/jonas-ejb-jar.xml"/&gt;
  +      &lt;/ejbjar&gt;
  +</pre>
   
   <hr>
   <p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
   Reserved.</p>
  +
  +
   </body>
   
   </html>
  -
   
  
  
  

--
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