jskeet      2002/07/23 08:13:38

  Modified:    src/main/org/apache/tools/ant/taskdefs Rmic.java
                        Definer.java SQLExec.java Concat.java
                        PathConvert.java XSLTProcess.java Replace.java
                        TempFile.java
               src/main/org/apache/tools/ant/taskdefs/optional/jsp
                        JspC.java
               src/main/org/apache/tools/ant/taskdefs/optional/vss
                        MSVSSCHECKIN.java MSVSSADD.java
               src/main/org/apache/tools/ant Main.java
               src/main/org/apache/tools/ant/taskdefs/optional/net
                        SetProxy.java TelnetTask.java
               src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        JonasDeploymentTool.java
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        WsdlToDotnet.java
               src/main/org/apache/tools/ant/taskdefs/optional/starteam
                        StarTeamCheckout.java
               src/main/org/apache/tools/ant/taskdefs/optional
                        XMLValidateTask.java
               src/main/org/apache/tools/ant/filters StripJavaComments.java
               src/main/org/apache/tools/ant/taskdefs/optional/sos SOS.java
               src/main/org/apache/tools/ant/util JavaEnvUtils.java
                        CollectionUtils.java
  Log:
  Fixed up JavaDocs (where possible) to remove warnings (mostly about 
breakiterator).
  
  Revision  Changes    Path
  1.41      +4 -4      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java
  
  Index: Rmic.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Rmic.java 23 Jul 2002 08:39:53 -0000      1.40
  +++ Rmic.java 23 Jul 2002 15:13:36 -0000      1.41
  @@ -102,7 +102,7 @@
    * <ul>
    *   <li>sun (the standard compiler of the JDK)</li>
    *   <li>kaffe (the standard compiler of 
  - *       {@ link <a href="http://www.kaffe.org";>Kaffe</a>})</li>
  + *       [EMAIL PROTECTED] <a href="http://www.kaffe.org";>Kaffe</a>})</li>
    *   <li>weblogic</li>
    * </ul>
    * 
  @@ -363,9 +363,9 @@
       }
   
       /**
  -     * Include ant's own classpath in this task's classpath?
  -     * sets whether to include the Ant run-time libraries;
  -     * optional defaults to true.
  +     * Sets whether or not to include ant's own classpath in this task's 
  +     * classpath.
  +     * Optional; default is <code>true</code>.
        */
       public void setIncludeantruntime(boolean include) {
           includeAntRuntime = include;
  
  
  
  1.20      +5 -4      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
  
  Index: Definer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Definer.java      23 Jul 2002 08:39:52 -0000      1.19
  +++ Definer.java      23 Jul 2002 15:13:36 -0000      1.20
  @@ -319,14 +319,15 @@
       }
   
       /**
  -     * what is the classname we are definining? Can be null
  +     * Returns the classname of the object we are defining. 
  +     * May be <code>null</code>.
        */
       public String getClassname() {
           return value;
       }
   
       /**
  -     * the full class name of the object being defined.
  +     * The full class name of the object being defined.
        * Required, unless file or resource have
        * been specified.
        */
  @@ -335,8 +336,8 @@
       }
   
       /**
  -     * this must be implemented by subclasses; it is the callback
  -     * they will get to add a new definition of their type
  +     * This must be implemented by subclasses; it is the callback
  +     * they will get to add a new definition of their type.
        */
       protected abstract void addDefinition(String name, Class c);
   }
  
  
  
  1.47      +2 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  
  Index: SQLExec.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- SQLExec.java      23 Jul 2002 08:39:53 -0000      1.46
  +++ SQLExec.java      23 Jul 2002 15:13:36 -0000      1.47
  @@ -247,8 +247,8 @@
       }
   
       /**
  -     * Set the delimiter that separates SQL statements;
  -     * optional, default &quot;;&quot;
  +     * Sets the delimiter that separates SQL statements.
  +     * Optional, defaults to &quot;;&quot;.
        *
        * <p>For example, set this to "go" and delimitertype to "ROW" for
        * Sybase ASE or MS SQL Server.</p>
  
  
  
  1.8       +2 -1      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Concat.java
  
  Index: Concat.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Concat.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Concat.java       23 Jul 2002 07:54:47 -0000      1.7
  +++ Concat.java       23 Jul 2002 15:13:36 -0000      1.8
  @@ -109,7 +109,8 @@
       private File destinationFile = null;
   
       /**
  -     * If the destination file exists, should the stream be appended? 
  +     * Whether or not the stream should be appended if the destination file 
  +     * exists.
        * Defaults to <code>false</code>.
        */
       private boolean append = false;
  
  
  
  1.21      +4 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  
  Index: PathConvert.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PathConvert.java  9 Jul 2002 21:05:59 -0000       1.20
  +++ PathConvert.java  23 Jul 2002 15:13:37 -0000      1.21
  @@ -237,11 +237,12 @@
   
       /**
        * Set targetos to a platform to one of
  -     * "windows", "unix", "netware", or "os/2"; required unless
  -     * unless pathsep and/or dirsep are specified.
  +     * "windows", "unix", "netware", or "os/2".
  +     * 
  +     * Required unless unless pathsep and/or dirsep are specified.
        *
        * @deprecated use the method taking a TargetOs argument instead
  -     * @see #setTargetos(TargetOs)
  +     * @see #setTargetos(PathConvert.TargetOs)
        */
       public void setTargetos(String target) {
           TargetOs to = new TargetOs();
  
  
  
  1.51      +3 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  
  Index: XSLTProcess.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- XSLTProcess.java  23 Jul 2002 08:39:53 -0000      1.50
  +++ XSLTProcess.java  23 Jul 2002 15:13:37 -0000      1.51
  @@ -734,8 +734,8 @@
       }
   
       /**
  -     * Specific configuration for the TRaX liaison... support for
  -     * all other has been dropped so this liaison will soon look
  +     * Specific configuration for the TRaX liaison. Support for
  +     * all others has been dropped so this liaison will soon look
        * like the exact copy of JAXP interface..
        * @param liaison the TRaXLiaison to configure.
        */
  
  
  
  1.34      +1 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Replace.java      23 Jul 2002 08:39:53 -0000      1.33
  +++ Replace.java      23 Jul 2002 15:13:37 -0000      1.34
  @@ -183,8 +183,7 @@
           }
   
           /**
  -         * get the replacement value for this filter token
  -         * @return
  +         * Get the replacement value for this filter token.
            */
           public String getReplaceValue() {
               if (property != null) {
  
  
  
  1.4       +14 -14    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/TempFile.java
  
  Index: TempFile.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/TempFile.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TempFile.java     23 Jul 2002 07:54:48 -0000      1.3
  +++ TempFile.java     23 Jul 2002 15:13:37 -0000      1.4
  @@ -80,30 +80,30 @@
   public class TempFile extends Task {
   
       /**
  -     *  name of property to set
  +     * Name of property to set.
        */
       private String property;
   
       /**
  -     *  directory to create the file in. can be null
  +     * Directory to create the file in. Can be null.
        */
       private File destDir = null;
   
       /**
  -     *  prefix for the file
  +     * Prefix for the file.
        */
       private String prefix;
   
       /**
  -     *  suffix for the file
  +     * Suffix for the file.
        */
       private String suffix = "";
   
   
       /**
  -     *  The property you wish to assign the temporary file to
  +     * Sets the property you wish to assign the temporary file to.
        *
  -     [EMAIL PROTECTED]  property  The property to set
  +     * @param  property  The property to set
        */
       public void setProperty(String property) {
           this.property = property;
  @@ -111,10 +111,10 @@
   
   
       /**
  -     *  destination directory. If null, 
  -     the parent directory is used instead
  +     * Sets the destination directory. If null, 
  +     * the parent directory is used instead.
        *
  -     [EMAIL PROTECTED]  destDir  The new destDir value
  +     * @param  destDir  The new destDir value
        */
       public void setDestDir(File destDir) {
           this.destDir = destDir;
  @@ -122,9 +122,9 @@
   
   
       /**
  -     *  optional prefix string
  +     * Sets the optional prefix string.
        *
  -     [EMAIL PROTECTED]  prefix  string to prepend to generated string
  +     * @param  prefix  string to prepend to generated string
        */
       public void setPrefix(String prefix) {
           this.prefix = prefix;
  @@ -132,9 +132,9 @@
   
   
       /**
  -     *  Suffix string for the temp file (optional)
  +     * Sets the suffix string for the temp file (optional)
        *
  -     [EMAIL PROTECTED]  suffix  suffix including any "." , e.g ".xml"
  +     * @param  suffix  suffix including any "." , e.g ".xml"
        */
       public void setSuffix(String suffix) {
           this.suffix = suffix;
  @@ -142,7 +142,7 @@
   
   
       /**
  -     *  create the temp file
  +     * Creates the temporary file.
        *
        [EMAIL PROTECTED]  BuildException  if something goes wrong with the 
build
        */
  
  
  
  1.23      +2 -1      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JspC.java 23 Jul 2002 08:39:57 -0000      1.22
  +++ JspC.java 23 Jul 2002 15:13:37 -0000      1.23
  @@ -210,7 +210,8 @@
   
       /* ------------------------------------------------------------ */
       /**
  -     * should the build halt if compilation fails? default=true
  +     * Whether or not the build should halt if compilation fails.
  +     * Defaults to <code>true</code>.
        */
       public void setFailonerror(boolean fail) {
           failOnError = fail;
  
  
  
  1.12      +4 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
  
  Index: MSVSSCHECKIN.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MSVSSCHECKIN.java 23 Jul 2002 08:39:58 -0000      1.11
  +++ MSVSSCHECKIN.java 23 Jul 2002 15:13:37 -0000      1.12
  @@ -175,14 +175,16 @@
       }
   
       /**
  -     * Leave checked in files writable? Default: false. 
  +     * Whether or not to leave checked in files writable.
  +     * Default is <code>false</code>.
        */
       public final void setWritable(boolean argWritable) {
           m_Writable = argWritable;
       }
   
       /**
  -     * the 'make writable' command if the attribute was 'true', otherwise an 
empty string
  +     * The 'make writable' command if the attribute was <code>true</code>, 
  +     * otherwise an empty string.
        */
       public void getWritableCommand(Commandline cmd) {
           if (!m_Writable) {
  
  
  
  1.7       +4 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java
  
  Index: MSVSSADD.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MSVSSADD.java     23 Jul 2002 08:39:58 -0000      1.6
  +++ MSVSSADD.java     23 Jul 2002 15:13:37 -0000      1.7
  @@ -136,14 +136,16 @@
       }
   
       /**
  -     * Leave added files writable? Default: false. 
  +     * Whether or not to leave added files writable.
  +     * Default is <code>false</code>.
        */
       public final void setWritable(boolean argWritable) {
           m_Writable = argWritable;
       }
   
       /**
  -     * @return the 'make writable' command if the attribute was 'true', 
otherwise an empty string
  +     * The 'make writable' command if the attribute was <code>true</code>, 
  +     * otherwise an empty string.
        */
       public void getWritableCommand(Commandline cmd) {
           if (!m_Writable) {
  
  
  
  1.72      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- Main.java 16 Jul 2002 13:06:45 -0000      1.71
  +++ Main.java 23 Jul 2002 15:13:37 -0000      1.72
  @@ -140,7 +140,7 @@
       private boolean projectHelp = false;
   
       /**
  -     * Is a logfile being used?  This is used to
  +     * Whether or not a logfile is being used. This is used to
        * check if the output streams must be closed.
        */
       private static boolean isLogFileUsed = false;
  
  
  
  1.6       +1 -1      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
  
  Index: SetProxy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SetProxy.java     1 Jun 2002 12:26:41 -0000       1.5
  +++ SetProxy.java     23 Jul 2002 15:13:37 -0000      1.6
  @@ -108,7 +108,7 @@
       private String socksProxyHost = null;
       
       /**
  -     * socks proxy port. 1080 is the default
  +     * Socks proxy port. Default is 1080.
        */
       private int socksProxyPort = 1080;
   
  
  
  
  1.16      +3 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
  
  Index: TelnetTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TelnetTask.java   9 Jul 2002 21:06:09 -0000       1.15
  +++ TelnetTask.java   23 Jul 2002 15:13:37 -0000      1.16
  @@ -268,7 +268,8 @@
           }
   
           /**
  -         * should the message be echoed to the log? default=true.
  +         * Whether or not the message should be echoed to the log.
  +         * Defaults to <code>true</code>.
            */
           public void setEcho(boolean b) {
              echoString = b;
  
  
  
  1.5       +838 -838  
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
  
  Index: JonasDeploymentTool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JonasDeploymentTool.java  22 Jun 2002 23:38:36 -0000      1.4
  +++ JonasDeploymentTool.java  23 Jul 2002 15:13:37 -0000      1.5
  @@ -1,838 +1,838 @@
  -/*
  - * 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 [EMAIL PROTECTED]
  - *
  - * 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.AntClassLoader;
  -import org.apache.tools.ant.taskdefs.Java;
  -
  -import java.io.File;
  -import java.io.IOException;
  -import java.util.Hashtable;
  -import java.util.Enumeration;
  -
  -import javax.xml.parsers.SAXParser;
  -
  -/**
  - * 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="mailto:[EMAIL PROTECTED]">Cyrille Morvan</a> , <a
  - * href="http://www.ingenosya.com";>Ingenosya France</a>, <a
  - * href="mailto:[EMAIL PROTECTED]">Mathieu Peltier</a>
  - * @version 1.0
  - * @see EjbJar#createJonas
  - */
  -public class JonasDeploymentTool extends GenericDeploymentTool {
  -
  -    /** Public Id of the standard deployment descriptor DTD. */
  -    protected static final String EJB_JAR_1_1_PUBLIC_ID = "-//Sun 
Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
  -    protected static final String EJB_JAR_2_0_PUBLIC_ID = "-//Sun 
Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";
  -
  -    /** Public Id of the JOnAS-specific deployment descriptor DTD. */
  -    protected static final String JONAS_EJB_JAR_2_4_PUBLIC_ID = 
"-//ObjectWeb//DTD JOnAS 2.4//EN";
  -    protected static final String JONAS_EJB_JAR_2_5_PUBLIC_ID = 
"-//ObjectWeb//DTD JOnAS 2.5//EN";
  -
  -    /** RMI ORB. */
  -    protected static final String RMI_ORB = "RMI";
  -
  -    /** JEREMIE ORB. */
  -    protected static final String JEREMIE_ORB = "JEREMIE";
  -
  -    /** DAVID ORB. */
  -    protected static final String DAVID_ORB = "DAVID";
  -
  -    /**
  -     * Name of the standard deployment descriptor DTD (these files are 
stored in
  -     * the ${JONAS_ROOT}/xml directory).
  -     */
  -    protected static final String EJB_JAR_1_1_DTD = "ejb-jar_1_1.dtd";
  -    protected static final String EJB_JAR_2_0_DTD = "ejb-jar_2_0.dtd";
  -
  -    /**
  -     * Name of the JOnAS-specific deployment descriptor DTD (these files are
  -     * stored in the ${JONAS_ROOT}/xml directory).
  -     */
  -    protected static final String JONAS_EJB_JAR_2_4_DTD = 
"jonas-ejb-jar_2_4.dtd";
  -    protected static final String JONAS_EJB_JAR_2_5_DTD = 
"jonas-ejb-jar_2_5.dtd";
  -
  -    /** Default JOnAS deployment descriptor name. */
  -    protected static final String JONAS_DD = "jonas-ejb-jar.xml";
  -
  -    /** GenIC class name (JOnAS 2.5) */
  -    protected static final String GENIC_CLASS =
  -     "org.objectweb.jonas_ejb.genic.GenIC";
  -
  -    /** Old GenIC class name (JOnAS 2.4.x). */
  -    protected static final String OLD_GENIC_CLASS_1 =
  -        "org.objectweb.jonas_ejb.tools.GenWholeIC";
  -
  -    /** Old GenIC class name. */
  -    protected static final String OLD_GENIC_CLASS_2 =
  -        "org.objectweb.jonas_ejb.tools.GenIC";
  -
  -    /**
  -     * Filename of the standard EJB descriptor (which is passed to this class
  -     * from the parent "ejbjar" task). This file is relative to the directory
  -     * specified by the "srcdir" attribute in the ejbjar task.
  -     */
  -    private String descriptorName;
  -
  -    /**
  -     * Filename of the JOnAS-specific EJB descriptor (which is passed to this
  -     * class from the parent "ejbjar" task). This file is relative to the
  -     * directory specified by the "srcdir" attribute in the ejbjar task.
  -     */
  -    private String jonasDescriptorName;
  -
  -    /* ------------- */
  -    /* GenIC options */
  -    /* ------------- */
  -
  -    /**
  -     * Temporary output directory used by GenIC.
  -     */
  -    private File outputdir;
  -
  -    /**
  -     * <code>true</code> if the intermediate Java source files generated by
  -     * GenIC must be deleted or not. The default is <code>false</code>
  -     */
  -    private boolean keepgenerated = false;
  -
  -    /**
  -     * <code>true</code> if the generated source files must not be compiled 
via
  -     * the java and rmi compilers. The default is <code>false</code>.
  -     */
  -    private boolean nocompil = false;
  -
  -    /**
  -     * <code>true</code> if the XML deployment descriptors must be parsed
  -     * without validation. The default is <code>false</code>.
  -     */
  -    private boolean novalidation = false;
  -
  -    /**
  -     * Java compiler to use. The default is the value of
  -     * <code>build.compiler</code> property.
  -     */
  -    private String javac;
  -
  -    /** Options to pass to the java compiler. */
  -    private String javacopts;
  -
  -    /** Options to pass to the rmi compiler. */
  -    private String rmicopts;
  -
  -    /**
  -     * <code>true</code> if the RMI Skel. and Stub. must be modified to
  -     * implement the implicit propagation of the security context (the
  -     * transactional context is always provided). The default is
  -     * <code>false</code>.
  -     */
  -    private boolean secpropag = false;
  -
  -    /**
  -     * <code>true</code> if the GenIC call must be verbose. The default
  -     * is <code>false</code>. 
  -     */
  -    private boolean verbose = false;
  -
  -    /** Additional args to send to GenIC. */
  -    private String additionalargs;
  -
  -    /* ------------- */
  -    /* other options */
  -    /* ------------- */
  -
  -    /** JOnAS root directory. */
  -    private File jonasroot;
  -
  -    /**
  -     * <code>true</code> if the generic JAR file used as input to GenIC must 
be
  -     * retained. The default is <code>false</code>.
  -     */    
  -    private boolean keepgeneric = false;
  -
  -    /** Stores the suffix for the JOnAS JAR file. The default is '.jar'. */
  -    private String suffix = ".jar";
  -   
  -    /**
  -     *  ORB to use (RMI, JEREMIE or DAVID). If omitted, it defaults to the 
one
  -     *  present in classpath. If specified, the corresponding JOnAS JAR is
  -     *  automatically added to the classpath.
  -     */
  -    private String orb;
  -
  -    /** <code>true</code> if GenIC must not be run on the EJB JAR. The 
default is <code>false</code>. */    
  -    private boolean nogenic = false;
  -
  -    /* -------------------- */
  -    /* GenIC options setter */
  -    /* -------------------- */
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #keepgenerated} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setKeepgenerated(boolean aBoolean) {
  -        keepgenerated = aBoolean;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #additionalargs}.
  -     *
  -     * @param aString additional args.
  -     */
  -    public void setAdditionalargs(String aString) {
  -        additionalargs = aString;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #nocompil} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setNocompil(boolean aBoolean) {
  -        nocompil = aBoolean;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #novalidation} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setNovalidation(boolean aBoolean) {
  -        novalidation = aBoolean;
  -    }
  -
  -    /**
  -     * Set the java compiler [EMAIL PROTECTED] #javac} to use.
  -     *
  -     * @param aString the java compiler.
  -     */
  -    public void setJavac(String aString) {
  -        javac = aString;
  -    }
  -
  -    /**
  -     * Set the options to pass to the java compiler.
  -     *
  -     * @param aString the options.
  -     */
  -    public void setJavacopts(String aString) {
  -        javacopts = aString;
  -    }
  -
  -    /**
  -     * Set the options to pass to the rmi compiler.
  -     *
  -     * @param aString the options.
  -     */
  -    public void setRmicopts(String aString) {
  -        rmicopts = aString;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #secpropag} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setSecpropag(boolean aBoolean) {
  -        secpropag = aBoolean;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #verbose} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setVerbose(boolean aBoolean) {
  -        verbose = aBoolean;
  -    }
  -
  -    /* -------------------- */
  -    /* other options setter */
  -    /* -------------------- */
  -
  -    /**
  -     * Set the JOnAS root directory.
  -     * 
  -     * @param aFile the JOnAS root directory.
  -     */
  -    public void setJonasroot(File aFile) {
  -        jonasroot = aFile;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #keepgeneric} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setKeepgeneric(boolean aBoolean) {
  -        keepgeneric = aBoolean;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #jarsuffix}.
  -     *
  -     * @param aString the string to use as the suffix.
  -     */
  -    public void setJarsuffix(String aString) {
  -        suffix = aString;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #orb} to construct classpath.
  -     *
  -     * @param aString 'RMI', 'JEREMIE', or 'DAVID'.
  -     */
  -    public void setOrb(String aString) {
  -        orb = aString;
  -    }
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] #nogenic} flag.
  -     *
  -     * @param aBoolean <code>true</code> if the flag must be set.
  -     */
  -    public void setNogenic(boolean aBoolean) {
  -        nogenic = aBoolean;
  -    }
  -
  -    /* ------------- */
  -    /* other methods */
  -    /* ------------- */
  -
  -    public void processDescriptor(String aDescriptorName, SAXParser 
saxParser) {
  -     
  -        descriptorName = aDescriptorName;
  - 
  -        log("JOnAS Deployment Tool processing: " + descriptorName,
  -            Project.MSG_VERBOSE);
  -
  -        super.processDescriptor(descriptorName, saxParser);
  -
  -     if ( outputdir != null ) {
  -         // the method deleteOnExit() do not work because the directory is 
not empty      
  -         log("Deleting temp output directory '" + outputdir + "'.", 
Project.MSG_VERBOSE);
  -         deleteAllFiles(outputdir);
  -     }
  -    }
  -
  -    protected void writeJar(String baseName, File jarfile, Hashtable 
ejbFiles, String publicId) 
  -     throws BuildException {
  -
  -     // create the generic jar first
  -     File genericJarFile = super.getVendorOutputJarFile(baseName);   
  -     super.writeJar(baseName, genericJarFile, ejbFiles, publicId);
  -          
  -     // GenIC call on generic jar
  -     addGenICGeneratedFiles(genericJarFile, ejbFiles);
  -
  -     // create the real jar
  -     super.writeJar(baseName, getVendorOutputJarFile(baseName), ejbFiles, 
publicId);
  -
  -     if ( !keepgeneric ) {
  -         log("Deleting generic JAR " + genericJarFile.toString(), 
Project.MSG_VERBOSE);
  -         genericJarFile.delete();         
  -     }
  -    }
  -
  -    protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
  -
  -     // JOnAS-specific descriptor deployment
  -     jonasDescriptorName = getJonasDescriptorName();
  -        File jonasDD = new File(getConfig().descriptorDir, 
jonasDescriptorName);
  - 
  -        if ( jonasDD.exists() ) {
  -            ejbFiles.put(META_DIR + JONAS_DD, jonasDD);
  -        } else {
  -            log("Unable to locate the JOnAS deployment descriptor. It was 
expected to be in: "
  -                + jonasDD.getPath() + ".", Project.MSG_WARN);
  -        }
  -    }
  -
  -    protected File getVendorOutputJarFile(String baseName) {
  -        return new File(getDestDir(), baseName + suffix);
  -    }
  -
  -    /**
  -     * Determines the name of the JOnAS-specific EJB descriptor using the
  -     * specified standard EJB descriptor name. In general, the standard
  -     * descriptor will be named "[basename]-ejb-jar.xml", and this method 
will
  -     * return "[basename]-jonas-ejb-jar.xml" or "jonas-[basename].xml"
  -     *
  -     * @return The name of the JOnAS-specific EJB descriptor file.
  -     */
  -    private String getJonasDescriptorName() {
  -
  -        // descriptorName = <path><basename><basenameterminator><remainder>
  -        // examples = /org/objectweb/fooAppli/foo/Foo-ejb-jar.xml
  -        // examples = /org/objectweb/fooAppli/foo/Foo.xml (JOnAS convention)
  - 
  -        String jonasDescriptorName; // JOnAS-specific DD
  -        boolean jonasConvention = false; // true if the JOnAS convention is 
used for the DD
  -        String path;            // Directory path of the EJB descriptor
  -        String fileName;        // EJB descriptor file name
  -        String baseName;        // Filename appearing before name terminator
  -        String remainder;       // Filename appearing after the name 
terminator
  - 
  -        int startOfFileName = descriptorName.lastIndexOf(File.separatorChar);
  -        if ( startOfFileName != -1 ) {
  -            // extract path info
  -            path = descriptorName.substring(0, startOfFileName+1);
  -            fileName = descriptorName.substring(startOfFileName+1);
  -        } else {
  -            // descriptorName is just a file without path
  -            path = "";
  -            fileName = descriptorName;
  -        }
  - 
  -        if ( fileName.startsWith(EJB_DD) )
  -            return path + JONAS_DD;
  -
  -        int endOfBaseName = 
descriptorName.indexOf(getConfig().baseNameTerminator, startOfFileName);
  - 
  -        /*
  -         * Check for the odd case where the terminator and/or filename
  -         * extension aren't found.  These will ensure "jonas-" appears at the
  -         * end of the name and before the '.' (if present).
  -         */
  -        if ( endOfBaseName < 0 ) { 
  -            // baseNameTerminator not found: the descriptor use the
  -            // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
  -            // not [Foo<baseNameTerminator>-ejb-jar.xml,
  -            // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
  -            endOfBaseName = descriptorName.lastIndexOf('.') - 1;
  -            if (endOfBaseName < 0) {
  -                // no . found
  -                endOfBaseName = descriptorName.length() - 1;
  -            }
  - 
  -            jonasConvention = true;
  -        }
  -
  -        baseName = descriptorName.substring(startOfFileName + 1, 
endOfBaseName + 1);
  -        remainder = descriptorName.substring(endOfBaseName + 1);
  - 
  -        if ( jonasConvention ) {
  -            jonasDescriptorName = path + "jonas-" + baseName + ".xml";
  -        } else {
  -            jonasDescriptorName = path + baseName + "jonas-" + remainder;
  -        }
  - 
  -        log("Standard EJB descriptor name: " + descriptorName, 
Project.MSG_VERBOSE);
  -        log("JOnAS-specific descriptor name: " + jonasDescriptorName, 
Project.MSG_VERBOSE);
  - 
  -        return jonasDescriptorName;
  -    }
  -
  -    protected String getJarBaseName(String descriptorFileName) {
  -
  -        String baseName = null;
  -
  -        if ( 
getConfig().namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR) ) {
  -
  -            // try to find JOnAS specific convention name
  -            if ( descriptorFileName.indexOf(getConfig().baseNameTerminator) 
== -1 ) {
  -
  -             // baseNameTerminator not found: the descriptor use the
  -             // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
  -             // not [Foo<baseNameTerminator>-ejb-jar.xml,
  -             // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
  -             
  -                String aCanonicalDescriptor = 
descriptorFileName.replace('\\', '/');
  -                int lastSeparatorIndex = 
aCanonicalDescriptor.lastIndexOf('/');
  -                int endOfBaseName;
  -
  -                if ( lastSeparatorIndex != -1 ) {
  -                    endOfBaseName = descriptorFileName.indexOf(".xml", 
lastSeparatorIndex);
  -                } else {
  -                    endOfBaseName = descriptorFileName.indexOf(".xml");
  -                }
  -
  -                if ( endOfBaseName != -1 ) {
  -                    baseName = descriptorFileName.substring(0, 
endOfBaseName);
  -                }
  -            }
  -        }
  -
  -        if ( baseName == null ) {
  -            // else get standard baseName
  -            baseName = super.getJarBaseName(descriptorFileName);
  -        }
  -     
  -        log("JAR base name: " + baseName, Project.MSG_VERBOSE);      
  -
  -        return baseName;
  -    }
  -
  -    protected void registerKnownDTDs(DescriptorHandler handler) {
  -     handler.registerDTD(EJB_JAR_1_1_PUBLIC_ID, 
  -                         jonasroot + File.separator + "xml" + File.separator 
+ EJB_JAR_1_1_DTD);
  -     handler.registerDTD(EJB_JAR_2_0_PUBLIC_ID, 
  -                         jonasroot + File.separator + "xml" + File.separator 
+ EJB_JAR_2_0_DTD);
  -
  -     handler.registerDTD(JONAS_EJB_JAR_2_4_PUBLIC_ID, 
  -                         jonasroot + File.separator + "xml" + File.separator 
+ JONAS_EJB_JAR_2_4_DTD);
  -     handler.registerDTD(JONAS_EJB_JAR_2_5_PUBLIC_ID, 
  -                         jonasroot + File.separator + "xml" + File.separator 
+ JONAS_EJB_JAR_2_5_DTD);
  -    }
  -
  -    /**
  -     * Add to the given hashtable all the file generated by GenIC.
  -     *
  -     * @param genericJarFile jar file.
  -     * @param ejbFiles the hashtable.
  -     */
  -    private void addGenICGeneratedFiles(File genericJarFile, Hashtable 
ejbFiles) {
  -     
  -        Java genicTask = null;       // GenIC task 
  -     String genicClass = null; // GenIC class (3 GenIC classes for various 
versions of JOnAS are supported)
  -     boolean error = false;  // true if an error occurs during the GenIC call
  -
  -        if ( nogenic ) {
  -         return;
  -        }
  -
  -     genicTask = (Java) getTask().getProject().createTask("java");
  -     genicTask.setTaskName("genic");
  -     genicTask.setFork(true);
  -     
  -     // jonasroot
  -     genicTask.createJvmarg().setValue("-Dinstall.root=" + jonasroot);
  -     
  -     // java policy file
  -     String jonasConfigDir = jonasroot + File.separator + "config";          
  
  -     File javaPolicyFile = new File(jonasConfigDir, "java.policy");
  -     if ( javaPolicyFile.exists() ) {
  -         genicTask.createJvmarg().setValue("-Djava.security.policy="
  -                                           + javaPolicyFile.toString());
  -     }
  -     
  -     // outputdir
  -     try {
  -         outputdir = createTempDir();            
  -     } catch (IOException aIOException) {
  -         String msg = "Cannot create temp dir: " + aIOException.getMessage();
  -         throw new BuildException(msg, aIOException);
  -     }
  -     log("Using temporary output directory: " + outputdir, 
Project.MSG_VERBOSE);
  -     
  -     genicTask.createArg().setValue("-d");
  -     genicTask.createArg().setFile(outputdir);
  -     
  -     // work around a bug of GenIC 2.5
  -     String key;
  -     File f;
  -     Enumeration keys = ejbFiles.keys();
  -     while ( keys.hasMoreElements() ) {
  -         key = (String)keys.nextElement();
  -         f = new File(outputdir + File.separator + key);         
  -         f.getParentFile().mkdirs();
  -     }
  -     log("Worked around a bug of GenIC 2.5.", Project.MSG_VERBOSE);
  -
  -     // classpath 
  -     Path classpath = getCombinedClasspath();            
  -     if ( classpath == null ) {
  -         classpath = new Path(getTask().getProject());
  -     }
  -     classpath.append(new Path(classpath.getProject(), jonasConfigDir));
  -     classpath.append(new Path(classpath.getProject(), 
outputdir.toString()));
  -     
  -     // try to create the classpath for the correct ORB
  -     if ( orb != null ) {        
  -         String orbJar = jonasroot + File.separator + "lib" + File.separator 
+ orb + "_jonas.jar";
  -         classpath.append(new Path(classpath.getProject(), orbJar));
  -     }
  -     
  -     log("Using classpath: " + classpath.toString(), Project.MSG_VERBOSE);
  -     genicTask.setClasspath(classpath);
  -     
  -     // class name (search in the classpath provided for the ejbjar element)
  -     genicClass = getGenicClassName(classpath);
  -     if ( genicClass == null ) {
  -         log("Cannot find GenIC class in classpath.", Project.MSG_ERR);
  -         throw new BuildException("GenIC class not found, please check the 
classpath.");
  -     } else {
  -         log("Using '" + genicClass + "' GenIC class." , 
Project.MSG_VERBOSE);           
  -         genicTask.setClassname(genicClass);
  -     }
  -     
  -     // keepgenerated
  -     if ( keepgenerated ) {
  -         genicTask.createArg().setValue("-keepgenerated");
  -     }
  -     
  -     // nocompil
  -     if ( nocompil ) {
  -         genicTask.createArg().setValue("-nocompil");
  -     }
  -     
  -     // novalidation
  -     if ( novalidation ) {
  -         genicTask.createArg().setValue("-novalidation");
  -     }
  -     
  -     // javac
  -     if ( javac != null ) {
  -         genicTask.createArg().setValue("-javac");
  -         genicTask.createArg().setLine(javac);
  -     }
  -     
  -     // javacopts
  -     if ( javacopts != null && !javacopts.equals("") ) {
  -         genicTask.createArg().setValue("-javacopts");
  -         genicTask.createArg().setLine(javacopts);
  -     }
  -
  -     // rmicopts
  -     if ( rmicopts != null && !rmicopts.equals("") ) {
  -         genicTask.createArg().setValue("-rmicopts");
  -         genicTask.createArg().setLine(rmicopts);
  -     }
  -     
  -     // secpropag
  -     if ( secpropag ) {
  -         genicTask.createArg().setValue("-secpropag");
  -     }
  -     
  -     // verbose
  -     if ( verbose ) {
  -         genicTask.createArg().setValue("-verbose");
  -            }
  -     
  -     // additionalargs
  -     if ( additionalargs != null ) {
  -         genicTask.createArg().setValue(additionalargs);
  -     }
  -     
  -     // the generated classes must not be added in the generic JAR!
  -     // is that buggy on old JOnAS (2.4) ??
  -     genicTask.createArg().setValue("-noaddinjar");
  -     
  -     // input file to process by GenIC
  -     genicTask.createArg().setValue(genericJarFile.getPath());
  -
  -     // calling GenIC task
  -     log("Calling " + genicClass + " for " + getConfig().descriptorDir + 
File.separator + descriptorName
  -         + ".", Project.MSG_VERBOSE);
  -
  -     if ( genicTask.executeJava() != 0 ) {
  -
  -         // the method deleteOnExit() do not work because the directory is 
not empty
  -         log("Deleting temp output directory '" + outputdir + "'.", 
Project.MSG_VERBOSE);
  -         deleteAllFiles(outputdir);
  -
  -         if ( !keepgeneric ) {
  -             log("Deleting generic JAR " + genericJarFile.toString(), 
Project.MSG_VERBOSE);
  -             genericJarFile.delete();             
  -         }
  -
  -         throw new BuildException("GenIC reported an error.");
  -     }
  -     
  -     // add the generated files to the ejbFiles
  -     addAllFiles(outputdir, "", ejbFiles);
  -    }
  -
  -    /**
  -     * Get the GenIC class name to use in the given classpath.
  -     *
  -     * @param classpath classpath where the GenIC class must be searched.
  -     * @return the GenIC class name. Return <code>null</code> if the class 
name
  -     * cannot be found.
  -     */
  -    String getGenicClassName(Path classpath) {
  -
  -     log("Looking for GenIC class in classpath: " + classpath.toString(), 
Project.MSG_VERBOSE);
  -
  -     AntClassLoader cl = new AntClassLoader(classpath.getProject(), 
classpath);
  -
  -     try {
  -         cl.loadClass(JonasDeploymentTool.GENIC_CLASS);
  -         log("Found GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "' in 
classpath.", Project.MSG_VERBOSE);
  -         return JonasDeploymentTool.GENIC_CLASS;
  -
  -     } catch (ClassNotFoundException cnf1) {
  -         log("GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "' not 
found in classpath.", 
  -             Project.MSG_VERBOSE);
  -     } 
  -
  -     try {
  -         cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_1);
  -         log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1 + 
  -             "' in classpath.", Project.MSG_VERBOSE);
  -         return JonasDeploymentTool.OLD_GENIC_CLASS_1;
  -
  -     } catch (ClassNotFoundException cnf2) {
  -         log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1 + 
  -             "' not found in classpath.",
  -             Project.MSG_VERBOSE);
  -     } 
  -
  -     try {
  -         cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_2);
  -         log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2 + 
  -             "' in classpath.", Project.MSG_VERBOSE);
  -         return JonasDeploymentTool.OLD_GENIC_CLASS_2;
  -
  -     } catch (ClassNotFoundException cnf3) {
  -         log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2 + 
  -             "' not found in classpath.",
  -             Project.MSG_VERBOSE);
  -     } 
  -     return null;
  -    }
  -
  -    protected void checkConfiguration(String descriptorFileName,
  -                                   SAXParser saxParser) throws 
BuildException {
  -
  -     // jonasroot
  -     if ( jonasroot == null ) {
  -         throw new BuildException("The jonasroot attribut is not set.");
  -     } else if ( !jonasroot.isDirectory() ) {
  -         throw new BuildException("The jonasroot attribut '" + jonasroot + 
  -                                  "' is not a valid directory.");
  -     }
  -
  -     // orb
  -     if ( orb != null && !orb.equals(RMI_ORB) && !orb.equals(JEREMIE_ORB) && 
!orb.equals(DAVID_ORB) ) {
  -         throw new BuildException("The orb attribut '" + orb + "' is not 
valid (must be either " +
  -                                  RMI_ORB + ", " + JEREMIE_ORB + " or " + 
DAVID_ORB + ").");
  -     }
  -
  -     // additionalargs
  -     if ( additionalargs != null && additionalargs.equals("") ) {
  -         throw new BuildException("Empty additionalargs attribut.");
  -     }
  -
  -     // javac
  -     if ( javac != null && javac.equals("") ) {
  -         throw new BuildException("Empty javac attribut.");  
  -     }
  -    }
  -
  -    /* 
-----------------------------------------------------------------------------------
 */
  -    /* utilitary methods */
  -    /* 
-----------------------------------------------------------------------------------
 */    
  -
  -    /**
  -     * Create a temporary directory for GenIC output.
  -     *
  -     * @return the temp directory.
  -     * @throws BuildException if a temp directory cannot be created.
  -     */
  -    private File createTempDir() throws IOException {       
  -     File tmpDir = File.createTempFile("genic", null, null);     
  -     tmpDir.delete();
  -     if ( !tmpDir.mkdir() ) {
  -         throw new IOException("Cannot create the temporary directory '" + 
tmpDir + "'.");
  -     }
  -     return tmpDir;
  -    }
  -
  -    /**
  -     * Delete a file. If the file is a directory, delete recursivly all the
  -     * files inside.
  -     *
  -     * @param aFile file to delete.
  -     */
  -    private void deleteAllFiles(File aFile) {
  -        if ( aFile.isDirectory() ) {
  -            File someFiles[] = aFile.listFiles();
  -
  -            for (int i = 0; i < someFiles.length; i++) {
  -                deleteAllFiles(someFiles[i]);
  -            }
  -        }
  -        aFile.delete();
  -    }
  -
  -    /**
  -     * Add a file to the a given hashtable. If the file is a directory, add
  -     * recursivly all the files inside to the hashtable.
  -     *
  -     * @param file the file to add.
  -     * @param rootDir the current sub-directory to scan.
  -     * @param hashtable the hashtable where to add the files.
  -     */
  -    private void addAllFiles(File file, String rootDir, Hashtable hashtable) 
{
  -
  -        if ( !file.exists() ) {
  -         throw new IllegalArgumentException();
  -     }
  -     
  -     String newRootDir;
  -        if ( file.isDirectory() ) {
  -         File files[] = file.listFiles();    
  -         for (int i = 0; i < files.length; i++) {
  -             if ( rootDir.length() > 0 ) {
  -                 newRootDir = rootDir + File.separator + files[i].getName();
  -             } else {
  -                 newRootDir = files[i].getName();                 
  -             }
  -             addAllFiles(files[i], newRootDir, hashtable);
  -         }
  -        } else {
  -            hashtable.put(rootDir, file);
  -        }
  -    }
  -}
  +/*
  + * 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 [EMAIL PROTECTED]
  + *
  + * 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.AntClassLoader;
  +import org.apache.tools.ant.taskdefs.Java;
  +
  +import java.io.File;
  +import java.io.IOException;
  +import java.util.Hashtable;
  +import java.util.Enumeration;
  +
  +import javax.xml.parsers.SAXParser;
  +
  +/**
  + * 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="mailto:[EMAIL PROTECTED]">Cyrille Morvan</a> , <a
  + * href="http://www.ingenosya.com";>Ingenosya France</a>, <a
  + * href="mailto:[EMAIL PROTECTED]">Mathieu Peltier</a>
  + * @version 1.0
  + * @see EjbJar#createJonas
  + */
  +public class JonasDeploymentTool extends GenericDeploymentTool {
  +
  +    /** Public Id of the standard deployment descriptor DTD. */
  +    protected static final String EJB_JAR_1_1_PUBLIC_ID = "-//Sun 
Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
  +    protected static final String EJB_JAR_2_0_PUBLIC_ID = "-//Sun 
Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";
  +
  +    /** Public Id of the JOnAS-specific deployment descriptor DTD. */
  +    protected static final String JONAS_EJB_JAR_2_4_PUBLIC_ID = 
"-//ObjectWeb//DTD JOnAS 2.4//EN";
  +    protected static final String JONAS_EJB_JAR_2_5_PUBLIC_ID = 
"-//ObjectWeb//DTD JOnAS 2.5//EN";
  +
  +    /** RMI ORB. */
  +    protected static final String RMI_ORB = "RMI";
  +
  +    /** JEREMIE ORB. */
  +    protected static final String JEREMIE_ORB = "JEREMIE";
  +
  +    /** DAVID ORB. */
  +    protected static final String DAVID_ORB = "DAVID";
  +
  +    /**
  +     * Name of the standard deployment descriptor DTD (these files are 
stored in
  +     * the ${JONAS_ROOT}/xml directory).
  +     */
  +    protected static final String EJB_JAR_1_1_DTD = "ejb-jar_1_1.dtd";
  +    protected static final String EJB_JAR_2_0_DTD = "ejb-jar_2_0.dtd";
  +
  +    /**
  +     * Name of the JOnAS-specific deployment descriptor DTD (these files are
  +     * stored in the ${JONAS_ROOT}/xml directory).
  +     */
  +    protected static final String JONAS_EJB_JAR_2_4_DTD = 
"jonas-ejb-jar_2_4.dtd";
  +    protected static final String JONAS_EJB_JAR_2_5_DTD = 
"jonas-ejb-jar_2_5.dtd";
  +
  +    /** Default JOnAS deployment descriptor name. */
  +    protected static final String JONAS_DD = "jonas-ejb-jar.xml";
  +
  +    /** GenIC class name (JOnAS 2.5) */
  +    protected static final String GENIC_CLASS =
  +     "org.objectweb.jonas_ejb.genic.GenIC";
  +
  +    /** Old GenIC class name (JOnAS 2.4.x). */
  +    protected static final String OLD_GENIC_CLASS_1 =
  +        "org.objectweb.jonas_ejb.tools.GenWholeIC";
  +
  +    /** Old GenIC class name. */
  +    protected static final String OLD_GENIC_CLASS_2 =
  +        "org.objectweb.jonas_ejb.tools.GenIC";
  +
  +    /**
  +     * Filename of the standard EJB descriptor (which is passed to this class
  +     * from the parent "ejbjar" task). This file is relative to the directory
  +     * specified by the "srcdir" attribute in the ejbjar task.
  +     */
  +    private String descriptorName;
  +
  +    /**
  +     * Filename of the JOnAS-specific EJB descriptor (which is passed to this
  +     * class from the parent "ejbjar" task). This file is relative to the
  +     * directory specified by the "srcdir" attribute in the ejbjar task.
  +     */
  +    private String jonasDescriptorName;
  +
  +    /* ------------- */
  +    /* GenIC options */
  +    /* ------------- */
  +
  +    /**
  +     * Temporary output directory used by GenIC.
  +     */
  +    private File outputdir;
  +
  +    /**
  +     * <code>true</code> if the intermediate Java source files generated by
  +     * GenIC must be deleted or not. The default is <code>false</code>
  +     */
  +    private boolean keepgenerated = false;
  +
  +    /**
  +     * <code>true</code> if the generated source files must not be compiled 
via
  +     * the java and rmi compilers. The default is <code>false</code>.
  +     */
  +    private boolean nocompil = false;
  +
  +    /**
  +     * <code>true</code> if the XML deployment descriptors must be parsed
  +     * without validation. The default is <code>false</code>.
  +     */
  +    private boolean novalidation = false;
  +
  +    /**
  +     * Java compiler to use. The default is the value of
  +     * <code>build.compiler</code> property.
  +     */
  +    private String javac;
  +
  +    /** Options to pass to the java compiler. */
  +    private String javacopts;
  +
  +    /** Options to pass to the rmi compiler. */
  +    private String rmicopts;
  +
  +    /**
  +     * Whether or not the RMI skeleton and stub must be modified to
  +     * implement the implicit propagation of the security context (the
  +     * transactional context is always provided). The default is
  +     * <code>false</code>.
  +     */
  +    private boolean secpropag = false;
  +
  +    /**
  +     * <code>true</code> if the GenIC call must be verbose. The default
  +     * is <code>false</code>. 
  +     */
  +    private boolean verbose = false;
  +
  +    /** Additional args to send to GenIC. */
  +    private String additionalargs;
  +
  +    /* ------------- */
  +    /* other options */
  +    /* ------------- */
  +
  +    /** JOnAS root directory. */
  +    private File jonasroot;
  +
  +    /**
  +     * <code>true</code> if the generic JAR file used as input to GenIC must 
be
  +     * retained. The default is <code>false</code>.
  +     */    
  +    private boolean keepgeneric = false;
  +
  +    /** Stores the suffix for the JOnAS JAR file. The default is '.jar'. */
  +    private String suffix = ".jar";
  +   
  +    /**
  +     *  ORB to use (RMI, JEREMIE or DAVID). If omitted, it defaults to the 
one
  +     *  present in classpath. If specified, the corresponding JOnAS JAR is
  +     *  automatically added to the classpath.
  +     */
  +    private String orb;
  +
  +    /** <code>true</code> if GenIC must not be run on the EJB JAR. The 
default is <code>false</code>. */    
  +    private boolean nogenic = false;
  +
  +    /* -------------------- */
  +    /* GenIC options setter */
  +    /* -------------------- */
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #keepgenerated} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setKeepgenerated(boolean aBoolean) {
  +        keepgenerated = aBoolean;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #additionalargs}.
  +     *
  +     * @param aString additional args.
  +     */
  +    public void setAdditionalargs(String aString) {
  +        additionalargs = aString;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #nocompil} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setNocompil(boolean aBoolean) {
  +        nocompil = aBoolean;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #novalidation} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setNovalidation(boolean aBoolean) {
  +        novalidation = aBoolean;
  +    }
  +
  +    /**
  +     * Set the java compiler [EMAIL PROTECTED] #javac} to use.
  +     *
  +     * @param aString the java compiler.
  +     */
  +    public void setJavac(String aString) {
  +        javac = aString;
  +    }
  +
  +    /**
  +     * Set the options to pass to the java compiler.
  +     *
  +     * @param aString the options.
  +     */
  +    public void setJavacopts(String aString) {
  +        javacopts = aString;
  +    }
  +
  +    /**
  +     * Set the options to pass to the rmi compiler.
  +     *
  +     * @param aString the options.
  +     */
  +    public void setRmicopts(String aString) {
  +        rmicopts = aString;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #secpropag} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setSecpropag(boolean aBoolean) {
  +        secpropag = aBoolean;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #verbose} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setVerbose(boolean aBoolean) {
  +        verbose = aBoolean;
  +    }
  +
  +    /* -------------------- */
  +    /* other options setter */
  +    /* -------------------- */
  +
  +    /**
  +     * Set the JOnAS root directory.
  +     * 
  +     * @param aFile the JOnAS root directory.
  +     */
  +    public void setJonasroot(File aFile) {
  +        jonasroot = aFile;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #keepgeneric} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setKeepgeneric(boolean aBoolean) {
  +        keepgeneric = aBoolean;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #suffix jar suffix}.
  +     *
  +     * @param aString the string to use as the suffix.
  +     */
  +    public void setJarsuffix(String aString) {
  +        suffix = aString;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #orb} to construct classpath.
  +     *
  +     * @param aString 'RMI', 'JEREMIE', or 'DAVID'.
  +     */
  +    public void setOrb(String aString) {
  +        orb = aString;
  +    }
  +
  +    /**
  +     * Set the [EMAIL PROTECTED] #nogenic} flag.
  +     *
  +     * @param aBoolean <code>true</code> if the flag must be set.
  +     */
  +    public void setNogenic(boolean aBoolean) {
  +        nogenic = aBoolean;
  +    }
  +
  +    /* ------------- */
  +    /* other methods */
  +    /* ------------- */
  +
  +    public void processDescriptor(String aDescriptorName, SAXParser 
saxParser) {
  +     
  +        descriptorName = aDescriptorName;
  + 
  +        log("JOnAS Deployment Tool processing: " + descriptorName,
  +            Project.MSG_VERBOSE);
  +
  +        super.processDescriptor(descriptorName, saxParser);
  +
  +     if ( outputdir != null ) {
  +         // the method deleteOnExit() do not work because the directory is 
not empty      
  +         log("Deleting temp output directory '" + outputdir + "'.", 
Project.MSG_VERBOSE);
  +         deleteAllFiles(outputdir);
  +     }
  +    }
  +
  +    protected void writeJar(String baseName, File jarfile, Hashtable 
ejbFiles, String publicId) 
  +     throws BuildException {
  +
  +     // create the generic jar first
  +     File genericJarFile = super.getVendorOutputJarFile(baseName);   
  +     super.writeJar(baseName, genericJarFile, ejbFiles, publicId);
  +          
  +     // GenIC call on generic jar
  +     addGenICGeneratedFiles(genericJarFile, ejbFiles);
  +
  +     // create the real jar
  +     super.writeJar(baseName, getVendorOutputJarFile(baseName), ejbFiles, 
publicId);
  +
  +     if ( !keepgeneric ) {
  +         log("Deleting generic JAR " + genericJarFile.toString(), 
Project.MSG_VERBOSE);
  +         genericJarFile.delete();         
  +     }
  +    }
  +
  +    protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
  +
  +     // JOnAS-specific descriptor deployment
  +     jonasDescriptorName = getJonasDescriptorName();
  +        File jonasDD = new File(getConfig().descriptorDir, 
jonasDescriptorName);
  + 
  +        if ( jonasDD.exists() ) {
  +            ejbFiles.put(META_DIR + JONAS_DD, jonasDD);
  +        } else {
  +            log("Unable to locate the JOnAS deployment descriptor. It was 
expected to be in: "
  +                + jonasDD.getPath() + ".", Project.MSG_WARN);
  +        }
  +    }
  +
  +    protected File getVendorOutputJarFile(String baseName) {
  +        return new File(getDestDir(), baseName + suffix);
  +    }
  +
  +    /**
  +     * Determines the name of the JOnAS-specific EJB descriptor using the
  +     * specified standard EJB descriptor name. In general, the standard
  +     * descriptor will be named "[basename]-ejb-jar.xml", and this method 
will
  +     * return "[basename]-jonas-ejb-jar.xml" or "jonas-[basename].xml"
  +     *
  +     * @return The name of the JOnAS-specific EJB descriptor file.
  +     */
  +    private String getJonasDescriptorName() {
  +
  +        // descriptorName = <path><basename><basenameterminator><remainder>
  +        // examples = /org/objectweb/fooAppli/foo/Foo-ejb-jar.xml
  +        // examples = /org/objectweb/fooAppli/foo/Foo.xml (JOnAS convention)
  + 
  +        String jonasDescriptorName; // JOnAS-specific DD
  +        boolean jonasConvention = false; // true if the JOnAS convention is 
used for the DD
  +        String path;            // Directory path of the EJB descriptor
  +        String fileName;        // EJB descriptor file name
  +        String baseName;        // Filename appearing before name terminator
  +        String remainder;       // Filename appearing after the name 
terminator
  + 
  +        int startOfFileName = descriptorName.lastIndexOf(File.separatorChar);
  +        if ( startOfFileName != -1 ) {
  +            // extract path info
  +            path = descriptorName.substring(0, startOfFileName+1);
  +            fileName = descriptorName.substring(startOfFileName+1);
  +        } else {
  +            // descriptorName is just a file without path
  +            path = "";
  +            fileName = descriptorName;
  +        }
  + 
  +        if ( fileName.startsWith(EJB_DD) )
  +            return path + JONAS_DD;
  +
  +        int endOfBaseName = 
descriptorName.indexOf(getConfig().baseNameTerminator, startOfFileName);
  + 
  +        /*
  +         * Check for the odd case where the terminator and/or filename
  +         * extension aren't found.  These will ensure "jonas-" appears at the
  +         * end of the name and before the '.' (if present).
  +         */
  +        if ( endOfBaseName < 0 ) { 
  +            // baseNameTerminator not found: the descriptor use the
  +            // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
  +            // not [Foo<baseNameTerminator>-ejb-jar.xml,
  +            // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
  +            endOfBaseName = descriptorName.lastIndexOf('.') - 1;
  +            if (endOfBaseName < 0) {
  +                // no . found
  +                endOfBaseName = descriptorName.length() - 1;
  +            }
  + 
  +            jonasConvention = true;
  +        }
  +
  +        baseName = descriptorName.substring(startOfFileName + 1, 
endOfBaseName + 1);
  +        remainder = descriptorName.substring(endOfBaseName + 1);
  + 
  +        if ( jonasConvention ) {
  +            jonasDescriptorName = path + "jonas-" + baseName + ".xml";
  +        } else {
  +            jonasDescriptorName = path + baseName + "jonas-" + remainder;
  +        }
  + 
  +        log("Standard EJB descriptor name: " + descriptorName, 
Project.MSG_VERBOSE);
  +        log("JOnAS-specific descriptor name: " + jonasDescriptorName, 
Project.MSG_VERBOSE);
  + 
  +        return jonasDescriptorName;
  +    }
  +
  +    protected String getJarBaseName(String descriptorFileName) {
  +
  +        String baseName = null;
  +
  +        if ( 
getConfig().namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR) ) {
  +
  +            // try to find JOnAS specific convention name
  +            if ( descriptorFileName.indexOf(getConfig().baseNameTerminator) 
== -1 ) {
  +
  +             // baseNameTerminator not found: the descriptor use the
  +             // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and
  +             // not [Foo<baseNameTerminator>-ejb-jar.xml,
  +             // Foo<baseNameTerminator>-jonas-ejb-jar.xml].
  +             
  +                String aCanonicalDescriptor = 
descriptorFileName.replace('\\', '/');
  +                int lastSeparatorIndex = 
aCanonicalDescriptor.lastIndexOf('/');
  +                int endOfBaseName;
  +
  +                if ( lastSeparatorIndex != -1 ) {
  +                    endOfBaseName = descriptorFileName.indexOf(".xml", 
lastSeparatorIndex);
  +                } else {
  +                    endOfBaseName = descriptorFileName.indexOf(".xml");
  +                }
  +
  +                if ( endOfBaseName != -1 ) {
  +                    baseName = descriptorFileName.substring(0, 
endOfBaseName);
  +                }
  +            }
  +        }
  +
  +        if ( baseName == null ) {
  +            // else get standard baseName
  +            baseName = super.getJarBaseName(descriptorFileName);
  +        }
  +     
  +        log("JAR base name: " + baseName, Project.MSG_VERBOSE);      
  +
  +        return baseName;
  +    }
  +
  +    protected void registerKnownDTDs(DescriptorHandler handler) {
  +     handler.registerDTD(EJB_JAR_1_1_PUBLIC_ID, 
  +                         jonasroot + File.separator + "xml" + File.separator 
+ EJB_JAR_1_1_DTD);
  +     handler.registerDTD(EJB_JAR_2_0_PUBLIC_ID, 
  +                         jonasroot + File.separator + "xml" + File.separator 
+ EJB_JAR_2_0_DTD);
  +
  +     handler.registerDTD(JONAS_EJB_JAR_2_4_PUBLIC_ID, 
  +                         jonasroot + File.separator + "xml" + File.separator 
+ JONAS_EJB_JAR_2_4_DTD);
  +     handler.registerDTD(JONAS_EJB_JAR_2_5_PUBLIC_ID, 
  +                         jonasroot + File.separator + "xml" + File.separator 
+ JONAS_EJB_JAR_2_5_DTD);
  +    }
  +
  +    /**
  +     * Add to the given hashtable all the file generated by GenIC.
  +     *
  +     * @param genericJarFile jar file.
  +     * @param ejbFiles the hashtable.
  +     */
  +    private void addGenICGeneratedFiles(File genericJarFile, Hashtable 
ejbFiles) {
  +     
  +        Java genicTask = null;       // GenIC task 
  +     String genicClass = null; // GenIC class (3 GenIC classes for various 
versions of JOnAS are supported)
  +     boolean error = false;  // true if an error occurs during the GenIC call
  +
  +        if ( nogenic ) {
  +         return;
  +        }
  +
  +     genicTask = (Java) getTask().getProject().createTask("java");
  +     genicTask.setTaskName("genic");
  +     genicTask.setFork(true);
  +     
  +     // jonasroot
  +     genicTask.createJvmarg().setValue("-Dinstall.root=" + jonasroot);
  +     
  +     // java policy file
  +     String jonasConfigDir = jonasroot + File.separator + "config";          
  
  +     File javaPolicyFile = new File(jonasConfigDir, "java.policy");
  +     if ( javaPolicyFile.exists() ) {
  +         genicTask.createJvmarg().setValue("-Djava.security.policy="
  +                                           + javaPolicyFile.toString());
  +     }
  +     
  +     // outputdir
  +     try {
  +         outputdir = createTempDir();            
  +     } catch (IOException aIOException) {
  +         String msg = "Cannot create temp dir: " + aIOException.getMessage();
  +         throw new BuildException(msg, aIOException);
  +     }
  +     log("Using temporary output directory: " + outputdir, 
Project.MSG_VERBOSE);
  +     
  +     genicTask.createArg().setValue("-d");
  +     genicTask.createArg().setFile(outputdir);
  +     
  +     // work around a bug of GenIC 2.5
  +     String key;
  +     File f;
  +     Enumeration keys = ejbFiles.keys();
  +     while ( keys.hasMoreElements() ) {
  +         key = (String)keys.nextElement();
  +         f = new File(outputdir + File.separator + key);         
  +         f.getParentFile().mkdirs();
  +     }
  +     log("Worked around a bug of GenIC 2.5.", Project.MSG_VERBOSE);
  +
  +     // classpath 
  +     Path classpath = getCombinedClasspath();            
  +     if ( classpath == null ) {
  +         classpath = new Path(getTask().getProject());
  +     }
  +     classpath.append(new Path(classpath.getProject(), jonasConfigDir));
  +     classpath.append(new Path(classpath.getProject(), 
outputdir.toString()));
  +     
  +     // try to create the classpath for the correct ORB
  +     if ( orb != null ) {        
  +         String orbJar = jonasroot + File.separator + "lib" + File.separator 
+ orb + "_jonas.jar";
  +         classpath.append(new Path(classpath.getProject(), orbJar));
  +     }
  +     
  +     log("Using classpath: " + classpath.toString(), Project.MSG_VERBOSE);
  +     genicTask.setClasspath(classpath);
  +     
  +     // class name (search in the classpath provided for the ejbjar element)
  +     genicClass = getGenicClassName(classpath);
  +     if ( genicClass == null ) {
  +         log("Cannot find GenIC class in classpath.", Project.MSG_ERR);
  +         throw new BuildException("GenIC class not found, please check the 
classpath.");
  +     } else {
  +         log("Using '" + genicClass + "' GenIC class." , 
Project.MSG_VERBOSE);           
  +         genicTask.setClassname(genicClass);
  +     }
  +     
  +     // keepgenerated
  +     if ( keepgenerated ) {
  +         genicTask.createArg().setValue("-keepgenerated");
  +     }
  +     
  +     // nocompil
  +     if ( nocompil ) {
  +         genicTask.createArg().setValue("-nocompil");
  +     }
  +     
  +     // novalidation
  +     if ( novalidation ) {
  +         genicTask.createArg().setValue("-novalidation");
  +     }
  +     
  +     // javac
  +     if ( javac != null ) {
  +         genicTask.createArg().setValue("-javac");
  +         genicTask.createArg().setLine(javac);
  +     }
  +     
  +     // javacopts
  +     if ( javacopts != null && !javacopts.equals("") ) {
  +         genicTask.createArg().setValue("-javacopts");
  +         genicTask.createArg().setLine(javacopts);
  +     }
  +
  +     // rmicopts
  +     if ( rmicopts != null && !rmicopts.equals("") ) {
  +         genicTask.createArg().setValue("-rmicopts");
  +         genicTask.createArg().setLine(rmicopts);
  +     }
  +     
  +     // secpropag
  +     if ( secpropag ) {
  +         genicTask.createArg().setValue("-secpropag");
  +     }
  +     
  +     // verbose
  +     if ( verbose ) {
  +         genicTask.createArg().setValue("-verbose");
  +            }
  +     
  +     // additionalargs
  +     if ( additionalargs != null ) {
  +         genicTask.createArg().setValue(additionalargs);
  +     }
  +     
  +     // the generated classes must not be added in the generic JAR!
  +     // is that buggy on old JOnAS (2.4) ??
  +     genicTask.createArg().setValue("-noaddinjar");
  +     
  +     // input file to process by GenIC
  +     genicTask.createArg().setValue(genericJarFile.getPath());
  +
  +     // calling GenIC task
  +     log("Calling " + genicClass + " for " + getConfig().descriptorDir + 
File.separator + descriptorName
  +         + ".", Project.MSG_VERBOSE);
  +
  +     if ( genicTask.executeJava() != 0 ) {
  +
  +         // the method deleteOnExit() do not work because the directory is 
not empty
  +         log("Deleting temp output directory '" + outputdir + "'.", 
Project.MSG_VERBOSE);
  +         deleteAllFiles(outputdir);
  +
  +         if ( !keepgeneric ) {
  +             log("Deleting generic JAR " + genericJarFile.toString(), 
Project.MSG_VERBOSE);
  +             genericJarFile.delete();             
  +         }
  +
  +         throw new BuildException("GenIC reported an error.");
  +     }
  +     
  +     // add the generated files to the ejbFiles
  +     addAllFiles(outputdir, "", ejbFiles);
  +    }
  +
  +    /**
  +     * Get the GenIC class name to use in the given classpath.
  +     *
  +     * @param classpath classpath where the GenIC class must be searched.
  +     * @return the GenIC class name. Return <code>null</code> if the class 
name
  +     * cannot be found.
  +     */
  +    String getGenicClassName(Path classpath) {
  +
  +     log("Looking for GenIC class in classpath: " + classpath.toString(), 
Project.MSG_VERBOSE);
  +
  +     AntClassLoader cl = new AntClassLoader(classpath.getProject(), 
classpath);
  +
  +     try {
  +         cl.loadClass(JonasDeploymentTool.GENIC_CLASS);
  +         log("Found GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "' in 
classpath.", Project.MSG_VERBOSE);
  +         return JonasDeploymentTool.GENIC_CLASS;
  +
  +     } catch (ClassNotFoundException cnf1) {
  +         log("GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "' not 
found in classpath.", 
  +             Project.MSG_VERBOSE);
  +     } 
  +
  +     try {
  +         cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_1);
  +         log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1 + 
  +             "' in classpath.", Project.MSG_VERBOSE);
  +         return JonasDeploymentTool.OLD_GENIC_CLASS_1;
  +
  +     } catch (ClassNotFoundException cnf2) {
  +         log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1 + 
  +             "' not found in classpath.",
  +             Project.MSG_VERBOSE);
  +     } 
  +
  +     try {
  +         cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_2);
  +         log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2 + 
  +             "' in classpath.", Project.MSG_VERBOSE);
  +         return JonasDeploymentTool.OLD_GENIC_CLASS_2;
  +
  +     } catch (ClassNotFoundException cnf3) {
  +         log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2 + 
  +             "' not found in classpath.",
  +             Project.MSG_VERBOSE);
  +     } 
  +     return null;
  +    }
  +
  +    protected void checkConfiguration(String descriptorFileName,
  +                                   SAXParser saxParser) throws 
BuildException {
  +
  +     // jonasroot
  +     if ( jonasroot == null ) {
  +         throw new BuildException("The jonasroot attribut is not set.");
  +     } else if ( !jonasroot.isDirectory() ) {
  +         throw new BuildException("The jonasroot attribut '" + jonasroot + 
  +                                  "' is not a valid directory.");
  +     }
  +
  +     // orb
  +     if ( orb != null && !orb.equals(RMI_ORB) && !orb.equals(JEREMIE_ORB) && 
!orb.equals(DAVID_ORB) ) {
  +         throw new BuildException("The orb attribut '" + orb + "' is not 
valid (must be either " +
  +                                  RMI_ORB + ", " + JEREMIE_ORB + " or " + 
DAVID_ORB + ").");
  +     }
  +
  +     // additionalargs
  +     if ( additionalargs != null && additionalargs.equals("") ) {
  +         throw new BuildException("Empty additionalargs attribut.");
  +     }
  +
  +     // javac
  +     if ( javac != null && javac.equals("") ) {
  +         throw new BuildException("Empty javac attribut.");  
  +     }
  +    }
  +
  +    /* 
-----------------------------------------------------------------------------------
 */
  +    /* utilitary methods */
  +    /* 
-----------------------------------------------------------------------------------
 */    
  +
  +    /**
  +     * Create a temporary directory for GenIC output.
  +     *
  +     * @return the temp directory.
  +     * @throws BuildException if a temp directory cannot be created.
  +     */
  +    private File createTempDir() throws IOException {       
  +     File tmpDir = File.createTempFile("genic", null, null);     
  +     tmpDir.delete();
  +     if ( !tmpDir.mkdir() ) {
  +         throw new IOException("Cannot create the temporary directory '" + 
tmpDir + "'.");
  +     }
  +     return tmpDir;
  +    }
  +
  +    /**
  +     * Delete a file. If the file is a directory, delete recursivly all the
  +     * files inside.
  +     *
  +     * @param aFile file to delete.
  +     */
  +    private void deleteAllFiles(File aFile) {
  +        if ( aFile.isDirectory() ) {
  +            File someFiles[] = aFile.listFiles();
  +
  +            for (int i = 0; i < someFiles.length; i++) {
  +                deleteAllFiles(someFiles[i]);
  +            }
  +        }
  +        aFile.delete();
  +    }
  +
  +    /**
  +     * Add a file to the a given hashtable. If the file is a directory, add
  +     * recursivly all the files inside to the hashtable.
  +     *
  +     * @param file the file to add.
  +     * @param rootDir the current sub-directory to scan.
  +     * @param hashtable the hashtable where to add the files.
  +     */
  +    private void addAllFiles(File file, String rootDir, Hashtable hashtable) 
{
  +
  +        if ( !file.exists() ) {
  +         throw new IllegalArgumentException();
  +     }
  +     
  +     String newRootDir;
  +        if ( file.isDirectory() ) {
  +         File files[] = file.listFiles();    
  +         for (int i = 0; i < files.length; i++) {
  +             if ( rootDir.length() > 0 ) {
  +                 newRootDir = rootDir + File.separator + files[i].getName();
  +             } else {
  +                 newRootDir = files[i].getName();                 
  +             }
  +             addAllFiles(files[i], newRootDir, hashtable);
  +         }
  +        } else {
  +            hashtable.put(rootDir, file);
  +        }
  +    }
  +}
  
  
  
  1.9       +2 -1      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java
  
  Index: WsdlToDotnet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WsdlToDotnet.java 9 Jul 2002 21:06:04 -0000       1.8
  +++ WsdlToDotnet.java 23 Jul 2002 15:13:37 -0000      1.9
  @@ -165,7 +165,8 @@
       }
   
       /**
  -     * Should failure halt the build? optional, default=true
  +     * Whether or not a failure should halt the build.
  +     * Optional - default is <code>true</code>.
        * @param failOnError new failure option
        */
       public void setFailOnError(boolean failOnError) {
  
  
  
  1.11      +2 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamCheckout.java
  
  Index: StarTeamCheckout.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamCheckout.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StarTeamCheckout.java     9 Jul 2002 21:06:13 -0000       1.10
  +++ StarTeamCheckout.java     23 Jul 2002 15:13:37 -0000      1.11
  @@ -112,8 +112,8 @@
       }
   
       /**
  -     * Should all all local files <i>not<i> in StarTeam be deleted?
  -     * Optional, defaults to "true".     
  +     * Whether or not all local files <i>not<i> in StarTeam should be 
deleted.
  +     * Optional, defaults to <code>true</code>.
        * @param value  the value to set the attribute to.
        */
       public void setDeleteUncontrolled(boolean value) {
  
  
  
  1.22      +4 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  
  Index: XMLValidateTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- XMLValidateTask.java      23 Jul 2002 07:54:51 -0000      1.21
  +++ XMLValidateTask.java      23 Jul 2002 15:13:37 -0000      1.22
  @@ -121,10 +121,11 @@
       private XMLCatalog xmlCatalog = new XMLCatalog();
   
       /**
  -     * Specify how parser error are to be handled; 
  -     * optional, default=true
  +     * Specify how parser error are to be handled. 
  +     * Optional, default is <code>true</code>.
        * <p>
  -     * If set to <code>true</code> (default), throw a buildException if the 
parser yields an error.
  +     * If set to <code>true</code> (default), throw a buildException if the 
  +     * parser yields an error.
        */
       public void setFailOnError(boolean fail) {
   
  
  
  
  1.7       +2 -1      
jakarta-ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java
  
  Index: StripJavaComments.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StripJavaComments.java    30 Apr 2002 10:32:01 -0000      1.6
  +++ StripJavaComments.java    23 Jul 2002 15:13:38 -0000      1.7
  @@ -69,7 +69,8 @@
           
       /** 
        * The read-ahead character, used for effectively pushing a single
  -     * character back. -1 indicates that no character is in the buffer.
  +     * character back. A value of -1 indicates that no character is in the 
  +     * buffer.
        */
       private int readAheadCh = -1;
   
  
  
  
  1.9       +3 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
  
  Index: SOS.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SOS.java  23 Jul 2002 08:39:58 -0000      1.8
  +++ SOS.java  23 Jul 2002 15:13:38 -0000      1.9
  @@ -202,8 +202,9 @@
   
   
       /**
  -     * Set the address and port of SourceOffSite Server,
  -     * eg. 192.168.0.1:8888 ; required. 
  +     * Sets the address and port of SourceOffSite Server,
  +     * for example 192.168.0.1:8888.
  +     * This attribute is required. 
        *
        * @param  sosServerPath  The new sosServerPath value
        */
  
  
  
  1.7       +1 -2      
jakarta-ant/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
  
  Index: JavaEnvUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/JavaEnvUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JavaEnvUtils.java 9 Jul 2002 21:06:14 -0000       1.6
  +++ JavaEnvUtils.java 23 Jul 2002 15:13:38 -0000      1.7
  @@ -311,8 +311,7 @@
       }
   
       /**
  -     * testing helper method; kept here for unification of changes.
  -     * @return
  +     * Testing helper method; kept here for unification of changes.
        */
       public static Vector getJrePackageTestCases() {
           Vector tests=new Vector();
  
  
  
  1.4       +1 -1      
jakarta-ant/src/main/org/apache/tools/ant/util/CollectionUtils.java
  
  Index: CollectionUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/CollectionUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionUtils.java      9 Jul 2002 21:06:14 -0000       1.3
  +++ CollectionUtils.java      23 Jul 2002 15:13:38 -0000      1.4
  @@ -100,7 +100,7 @@
       }
   
       /**
  -     * Hashtable.equals() doesn't do any good in 1.1
  +     * Hashtable.equals() doesn't do any good in 1.1.
        *
        * <p>Follows the equals contract of Java 2's Map.</p>
        *
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to