You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/10/25 20:42:28 UTC

cvs commit: jakarta-cactus/integration/ant build.properties.sample build.xml

vmassol     2003/10/25 11:42:28

  Modified:    integration/ant/src/java/org/apache/cactus/integration/ant/deployment
                        ApplicationXmlIo.java EarArchive.java
                        JarArchive.java WarArchive.java ApplicationXml.java
               integration/ant/src/test/org/apache/cactus/integration/ant/deployment
                        TestJarArchive.java TestWarArchive.java
                        TestAll.java TestApplicationXml.java
               integration/ant/src/java/org/apache/cactus/integration/ant/container
                        DeployableFile.java AbstractDeployableFile.java
                        AbstractContainer.java WarDeployableFile.java
                        EarDeployableFile.java
               integration/ant/src/test/org/apache/cactus/integration/ant
                        TestCactifyWarTask.java TestAll.java
                        TestCactusTask.java
               integration/ant/src/test/org/apache/cactus/integration/ant/container
                        TestAll.java TestAbstractContainer.java
               .        build.properties.sample
               integration/ant/src/java/org/apache/cactus/integration/ant
                        CactifyWarTask.java CactusTask.java
               integration/ant/src/java/org/apache/cactus/integration/ant/util
                        PropertySet.java
               integration/ant build.properties.sample build.xml
  Added:       integration/ant/src/java/org/apache/cactus/integration/ant/deployment
                        DefaultApplicationXml.java DefaultEarArchive.java
                        DefaultWarArchive.java DefaultJarArchive.java
               integration/ant/src/java/org/apache/cactus/integration/ant/container
                        WarParser.java EarParser.java
               integration/ant/src/test/org/apache/cactus/integration/ant/container
                        TestEarParser.java
  Log:
  - Really fixed bug 22794. Now supports the use case where the <context-root> element is not present in application.xml. Cactus will then use the web-uri value as its test context (minus the possible leading slash and the .war extension)
  - Added MockObject test case for that. Thus introduced a new mockobjects jar in the build process (will need to change gump.xml in the future BTW, just thought about that...)
  - Removed unecessary cruft from TestAll classes
  (Merge from 1.5 branch)
  
  Revision  Changes    Path
  1.5       +2 -2      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/ApplicationXmlIo.java
  
  Index: ApplicationXmlIo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/ApplicationXmlIo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ApplicationXmlIo.java	29 Jun 2003 14:57:53 -0000	1.4
  +++ ApplicationXmlIo.java	25 Oct 2003 18:42:27 -0000	1.5
  @@ -184,7 +184,7 @@
           {
               builder.setEntityResolver(new ApplicationXmlEntityResolver());
           }
  -        return new ApplicationXml(builder.parse(theInput));
  +        return new DefaultApplicationXml(builder.parse(theInput));
       }
   
   }
  
  
  
  1.5       +7 -87     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/EarArchive.java
  
  Index: EarArchive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/EarArchive.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EarArchive.java	11 Jun 2003 16:18:33 -0000	1.4
  +++ EarArchive.java	25 Oct 2003 18:42:27 -0000	1.5
  @@ -56,61 +56,22 @@
    */
   package org.apache.cactus.integration.ant.deployment;
   
  -import java.io.File;
   import java.io.IOException;
  -import java.io.InputStream;
   
   import javax.xml.parsers.ParserConfigurationException;
   
   import org.xml.sax.SAXException;
   
   /**
  - * Class that encapsulates access to a enterprise application archive (EAR).
  + * Class that encapsulates access to an EAR.
    * 
  - * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @since Cactus 1.5
    * @version $Id$
    */
  -public class EarArchive extends JarArchive
  +public interface EarArchive extends JarArchive
   {
  -
  -    // Instance Variables ------------------------------------------------------
  -
  -    /**
  -     * The parsed deployment descriptor.
  -     */
  -    private ApplicationXml applicationXml;
  -
  -    // Constructors ------------------------------------------------------------
  -    
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theFile The enterprise application archive
  -     * @throws IOException If there was a problem reading the EAR
  -     */
  -    public EarArchive(File theFile)
  -        throws IOException
  -    {
  -        super(theFile);
  -    }
  -
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theInputStream The input stream for the enterprise application
  -     *        archive
  -     * @throws IOException If there was a problem reading the EAR
  -     */
  -    public EarArchive(InputStream theInputStream)
  -        throws IOException
  -    {
  -        super(theInputStream);
  -    }
  -
  -    // Public Methods ----------------------------------------------------------
  -
       /**
        * Returns the deployment descriptor of the web application.
        * 
  @@ -122,28 +83,8 @@
        * @throws ParserConfigurationException If there is an XML parser
        *         configration problem
        */
  -    public final ApplicationXml getApplicationXml()
  -        throws IOException, SAXException, ParserConfigurationException
  -    {
  -        if (this.applicationXml == null)
  -        {
  -            InputStream in = null;
  -            try
  -            {
  -                in = getResource("META-INF/application.xml");
  -                this.applicationXml =
  -                    ApplicationXmlIo.parseApplicationXml(in, null);
  -            }
  -            finally
  -            {
  -                if (in != null)
  -                {
  -                    in.close();
  -                }
  -            }
  -        }
  -        return this.applicationXml;
  -    }
  +    ApplicationXml getApplicationXml()
  +        throws IOException, SAXException, ParserConfigurationException;
   
       /**
        * Returns the web-app archive stored in the EAR with the specified URI.
  @@ -153,26 +94,5 @@
        *         the specified URI
        * @throws IOException If there was an errors reading from the EAR or WAR
        */
  -    public final WarArchive getWebModule(String theUri)
  -        throws IOException
  -    {
  -        InputStream war = null;
  -        try
  -        {
  -            war = getResource(theUri);
  -            if (war != null)
  -            {
  -                return new WarArchive(war);
  -            }
  -        }
  -        finally
  -        {
  -            if (war != null)
  -            {
  -                war.close();
  -            }
  -        }
  -        return null;
  -    }
  -
  +    WarArchive getWebModule(String theUri) throws IOException;
   }
  
  
  
  1.6       +11 -180   jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/JarArchive.java
  
  Index: JarArchive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/JarArchive.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JarArchive.java	11 Jun 2003 16:18:33 -0000	1.5
  +++ JarArchive.java	25 Oct 2003 18:42:27 -0000	1.6
  @@ -56,82 +56,20 @@
    */
   package org.apache.cactus.integration.ant.deployment;
   
  -import java.io.ByteArrayInputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.File;
  -import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.InputStream;
  -import java.util.ArrayList;
   import java.util.List;
  -import java.util.jar.JarInputStream;
  -import java.util.zip.ZipEntry;
   
   /**
  - * Abstract base class for classes that provide convenient access to the
  - * contents of a J2EE deployment archive (EAR or WAR, for example).
  - * 
  - * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * Provide convenient methods to read information from a Jar archive.
  + *
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @since Cactus 1.5
    * @version $Id$
    */
  -public class JarArchive
  +public interface JarArchive
   {
  -
  -    // Instance Variables ------------------------------------------------------
  -
  -    /**
  -     * The content of the archive as an input stream.
  -     */
  -    private byte content[];
  -
  -    // Constructors ------------------------------------------------------------
  -    
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theFile The archive file
  -     * @throws IOException If there was a problem reading the WAR
  -     */
  -    public JarArchive(File theFile)
  -        throws IOException
  -    {
  -        this(new FileInputStream(theFile));
  -    }
  -
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theInputStream The input stream for the archive (it will be closed
  -     *        after the constructor returns)
  -     * @throws IOException If there was a problem reading the WAR
  -     */
  -    public JarArchive(InputStream theInputStream)
  -        throws IOException
  -    {
  -        try
  -        {
  -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -            byte[] buffer = new byte[2048];
  -            int bytesRead = -1;
  -            while ((bytesRead = theInputStream.read(buffer)) != -1)
  -            {
  -                baos.write(buffer, 0, bytesRead);
  -            }
  -            this.content = baos.toByteArray();
  -        }
  -        finally
  -        {
  -            if (theInputStream != null)
  -            {
  -                theInputStream.close();
  -            }
  -        }
  -    }
  -
  -    // Public Methods ----------------------------------------------------------
  -
       /**
        * Returns whether a class of the specified name is contained in the
        * archive.
  @@ -140,12 +78,7 @@
        * @return Whether the class was found
        * @throws IOException If an I/O error occurred reading the archive
        */
  -    public boolean containsClass(String theClassName)
  -        throws IOException
  -    {
  -        String resourceName = theClassName.replace('.', '/') + ".class";
  -        return (getResource(resourceName) != null);
  -    }
  +    boolean containsClass(String theClassName) throws IOException;
   
       /**
        * Returns the full path of a named resource in the archive.
  @@ -154,38 +87,8 @@
        * @return The full path to the resource inside the archive
        * @throws IOException If an I/O error occurred reading the archive
        */
  -    public final String findResource(String theName)
  -        throws IOException
  -    {
  -        JarInputStream in = null;
  -        try
  -        {
  -            in = new JarInputStream(getContentAsStream());
  -            ZipEntry entry = null;
  -            while ((entry = in.getNextEntry()) != null)
  -            {
  -                String entryName = entry.getName();
  -                int lastSlashIndex = entryName.lastIndexOf('/');
  -                if (lastSlashIndex >= 0)
  -                {
  -                    entryName = entryName.substring(lastSlashIndex + 1);
  -                }
  -                if (entryName.equals(theName))
  -                {
  -                    return entry.getName();
  -                }
  -            }
  -        }
  -        finally
  -        {
  -            if (in != null)
  -            {
  -                in.close();
  -            }
  -        }
  -        return null;
  -    }
  -
  +    String findResource(String theName) throws IOException;
  +    
       /**
        * Returns a resource from the archive as input stream.
        * 
  @@ -194,39 +97,8 @@
        *         <code>null</code> if the resource was not found in the JAR
        * @throws IOException If an I/O error occurs
        */
  -    public final InputStream getResource(String thePath)
  -        throws IOException
  -    {
  -        JarInputStream in = null;
  -        try
  -        {
  -            in = getContentAsStream();
  -            ZipEntry zipEntry = null;
  -            while ((zipEntry = in.getNextEntry()) != null)
  -            {
  -                if (thePath.equals(zipEntry.getName()))
  -                {
  -                    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  -                    byte bytes[] = new byte[2048];
  -                    int bytesRead = -1;
  -                    while ((bytesRead = in.read(bytes)) != -1)
  -                    {
  -                        buffer.write(bytes, 0, bytesRead);
  -                    }
  -                    return new ByteArrayInputStream(buffer.toByteArray());
  -                }
  -            }
  -        }
  -        finally
  -        {
  -            if (in != null)
  -            {
  -                in.close();
  -            }
  -        }
  -        return null;
  -    }
  -
  +    InputStream getResource(String thePath) throws IOException;
  +    
       /**
        * Returns the list of resources in the specified directory.
        * 
  @@ -234,46 +106,5 @@
        * @return The list of resources
        * @throws IOException If an I/O error occurs
        */
  -    public final List getResources(String thePath)
  -        throws IOException
  -    {
  -        List resources = new ArrayList();
  -        JarInputStream in = null;
  -        try
  -        {
  -            in = getContentAsStream();
  -            ZipEntry zipEntry = null;
  -            while ((zipEntry = in.getNextEntry()) != null)
  -            {
  -                if ((zipEntry.getName().startsWith(thePath)
  -                 && !zipEntry.getName().equals(thePath)))
  -                {
  -                    resources.add(zipEntry.getName());
  -                }
  -            }
  -        }
  -        finally
  -        {
  -            if (in != null)
  -            {
  -                in.close();
  -            }
  -        }
  -        return resources;
  -    }
  -
  -    // Protected Methods -------------------------------------------------------
  -
  -    /**
  -     * Returns the content of the archive as <code>JarInputStream</code>.
  -     * 
  -     * @return The input stream
  -     * @throws IOException If an exception occurred reading the archive
  -     */
  -    protected final JarInputStream getContentAsStream()
  -        throws IOException
  -    {
  -        return new JarInputStream(new ByteArrayInputStream(this.content));
  -    }
  -
  +    List getResources(String thePath) throws IOException;
   }
  
  
  
  1.6       +6 -103    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/WarArchive.java
  
  Index: WarArchive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/WarArchive.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WarArchive.java	11 Jun 2003 16:18:33 -0000	1.5
  +++ WarArchive.java	25 Oct 2003 18:42:27 -0000	1.6
  @@ -56,62 +56,22 @@
    */
   package org.apache.cactus.integration.ant.deployment;
   
  -import java.io.File;
   import java.io.IOException;
  -import java.io.InputStream;
  -import java.util.Iterator;
  -import java.util.List;
   
   import javax.xml.parsers.ParserConfigurationException;
   
   import org.xml.sax.SAXException;
   
   /**
  - * Class that encapsulates access to a web application archive (WAR).
  + * Encapsulates access to a WAR.
    * 
  - * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @since Cactus 1.5
    * @version $Id$
    */
  -public class WarArchive extends JarArchive
  +public interface WarArchive extends JarArchive
   {
  -
  -    // Instance Variables ------------------------------------------------------
  -
  -    /**
  -     * The parsed deployment descriptor.
  -     */
  -    private WebXml webXml;
  -
  -    // Constructors ------------------------------------------------------------
  -    
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theFile The web application archive
  -     * @throws IOException If there was a problem reading the WAR
  -     */
  -    public WarArchive(File theFile)
  -        throws IOException
  -    {
  -        super(theFile);
  -    }
  -
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theInputStream The input stream for the web application archive
  -     * @throws IOException If there was a problem reading the WAR
  -     */
  -    public WarArchive(InputStream theInputStream)
  -        throws IOException
  -    {
  -        super(theInputStream);
  -    }
  -
  -    // Public Methods ----------------------------------------------------------
  -
       /**
        * Returns the deployment descriptor of the web application.
        * 
  @@ -123,63 +83,6 @@
        * @throws ParserConfigurationException If there is an XML parser
        *         configration problem
        */
  -    public final WebXml getWebXml()
  -        throws IOException, SAXException, ParserConfigurationException
  -    {
  -        if (this.webXml == null)
  -        {
  -            InputStream in = null;
  -            try
  -            {
  -                in = getResource("WEB-INF/web.xml");
  -                if (in != null)
  -                {
  -                    this.webXml = WebXmlIo.parseWebXml(in, null);
  -                }
  -            }
  -            finally
  -            {
  -                if (in != null)
  -                {
  -                    in.close();
  -                }
  -            }
  -        }
  -        return this.webXml;
  -    }
  -
  -    /**
  -     * Returns whether a class of the specified name is contained in the web-app
  -     * archive, either directly in WEB-INF/classes, or in one of the JARs in
  -     * WEB-INF/lib.
  -     * 
  -     * @param theClassName The name of the class to search for
  -     * @return Whether the class was found in the archive
  -     * @throws IOException If an I/O error occurred reading the archive
  -     */
  -    public final boolean containsClass(String theClassName)
  -        throws IOException
  -    {
  -        // Look in WEB-INF/classes first
  -        String resourceName =
  -            "WEB-INF/classes/" + theClassName.replace('.', '/') + ".class";
  -        if (getResource(resourceName) != null)
  -        {
  -            return true;
  -        }
  -
  -        // Next scan the JARs in WEB-INF/lib
  -        List jars = getResources("WEB-INF/lib/");
  -        for (Iterator i = jars.iterator(); i.hasNext();)
  -        {
  -            JarArchive jar = new JarArchive(getResource((String) i.next()));
  -            if (jar.containsClass(theClassName))
  -            {
  -                return true;
  -            }
  -        }
  -
  -        return false;
  -    }
  -
  +    WebXml getWebXml()
  +        throws IOException, SAXException, ParserConfigurationException;
   }
  
  
  
  1.3       +15 -173   jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/ApplicationXml.java
  
  Index: ApplicationXml.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/ApplicationXml.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApplicationXml.java	14 May 2003 10:58:19 -0000	1.2
  +++ ApplicationXml.java	25 Oct 2003 18:42:27 -0000	1.3
  @@ -56,82 +56,37 @@
    */
   package org.apache.cactus.integration.ant.deployment;
   
  -import java.util.ArrayList;
   import java.util.Iterator;
  -import java.util.List;
   
   import org.w3c.dom.Document;
  -import org.w3c.dom.DocumentType;
   import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
   
   /**
  - * Encapsulates the DOM representation of a enterprise application descriptor 
  - * (<code>application.xml</code>) to provide convenience methods for easy access
  - * and manipulation.
  + * Encapsulates the DOM representation of an EAR descriptor 
  + * (<code>application.xml</code>) to provide convenience methods for easy 
  + * access and manipulation.
    *
  - * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @since Cactus 1.5
    * @version $Id$
    */
  -public class ApplicationXml
  +public interface ApplicationXml
   {
  -    
  -    // Instance Variables ------------------------------------------------------
  -    
  -    /**
  -     * The DOM representation of the deployment descriptor.
  -     */
  -    private final Document document;
  -    
  -    /**
  -     * The root element of the descriptor.
  -     */
  -    private final Element rootElement;
  -    
  -    // Constructors ------------------------------------------------------------
  -    
  -    /**
  -     * Constructor.
  -     * 
  -     * @param theDocument The DOM document representing the parsed deployment
  -     *         descriptor
  -     */
  -    public ApplicationXml(Document theDocument)
  -    {
  -        this.document = theDocument;
  -        this.rootElement = theDocument.getDocumentElement();
  -    }
  -    
  -    // Public Methods ----------------------------------------------------------
  -    
       /**
        * Returns the DOM document representing the deployment descriptor. The 
        * document will contain any modifications made through this instance.
        * 
        * @return The document representing the deploy descriptor
        */
  -    public final Document getDocument()
  -    {
  -        return this.document;
  -    }
  +    Document getDocument();
   
       /**
        * Returns the J2EE API version.
        * 
        * @return The version
        */
  -    public final ApplicationXmlVersion getVersion()
  -    {
  -        DocumentType docType = this.document.getDoctype();
  -        if (docType != null)
  -        {
  -            return ApplicationXmlVersion.valueOf(docType);
  -        }
  -        return null;
  -    }
  +    ApplicationXmlVersion getVersion();
   
       /**
        * Returns the element that contains the definition of a specific web
  @@ -139,32 +94,9 @@
        * is not defined.
        * 
        * @param theWebUri The uri of the web module
  -     * @return The DOM element representing the filter definition
  +     * @return The DOM element representing the web module definition
        */
  -    public final Element getWebModule(String theWebUri)
  -    {
  -        if (theWebUri == null)
  -        {
  -            throw new NullPointerException();
  -        }
  -        Iterator moduleElements = getElements(ApplicationXmlTag.MODULE);
  -        while (moduleElements.hasNext())
  -        {
  -            Element moduleElement = (Element) moduleElements.next();
  -            Iterator webElements =
  -                getNestedElements(moduleElement, ApplicationXmlTag.WEB);
  -            if (webElements.hasNext())
  -            {
  -                Element webElement = (Element) webElements.next(); 
  -                if (theWebUri.equals(getNestedText(
  -                    webElement, ApplicationXmlTag.WEB_URI)))
  -                {
  -                    return webElement;
  -                }
  -            }
  -        }
  -        return null;
  -    }
  +    Element getWebModule(String theWebUri);
       
       /**
        * Returns the context root of the the specified web module.
  @@ -172,46 +104,16 @@
        * @param theWebUri The uri of the web module
        * @return The context root of the web module
        */
  -    public final String getWebModuleContextRoot(String theWebUri)
  -    {
  -        Element webModuleElement = getWebModule(theWebUri);
  -        if (webModuleElement == null)
  -        {
  -            throw new IllegalArgumentException("Web Module '" + theWebUri
  -                + "' not defined");
  -        }
  -        return getNestedText(webModuleElement, ApplicationXmlTag.CONTEXT_ROOT);
  -    }
  -
  +    String getWebModuleContextRoot(String theWebUri);
  +    
       /**
        * Returns an iterator over the URIs of the web modules defined in the 
        * descriptor.
        * 
        * @return An iterator over the URIs of the web modules
        */
  -    public final Iterator getWebModuleUris()
  -    {
  -        List webUris = new ArrayList();
  -        Iterator moduleElements = getElements(ApplicationXmlTag.MODULE);
  -        while (moduleElements.hasNext())
  -        {
  -            Element moduleElement = (Element) moduleElements.next();
  -            Iterator webElements =
  -                getNestedElements(moduleElement, ApplicationXmlTag.WEB);
  -            if (webElements.hasNext())
  -            {
  -                Element webElement = (Element) webElements.next(); 
  -                String webUri =
  -                    getNestedText(webElement, ApplicationXmlTag.WEB_URI);
  -                if (webUri != null)
  -                {
  -                    webUris.add(webUri);
  -                }
  -            }
  -        }
  -        return webUris.iterator();
  -    }
  -
  +    Iterator getWebModuleUris();
  +    
       /**
        * Returns an iterator over the elements that match the specified tag.
        * 
  @@ -220,65 +122,5 @@
        * @return An iterator over the elements matching the tag, in the order 
        *         they occur in the descriptor
        */
  -    public final Iterator getElements(ApplicationXmlTag theTag)
  -    {
  -        List elements = new ArrayList();
  -        NodeList nodeList =
  -            this.rootElement.getElementsByTagName(theTag.getTagName()); 
  -        for (int i = 0; i < nodeList.getLength(); i++)
  -        {
  -            elements.add(nodeList.item(i));
  -        }
  -        return elements.iterator();
  -    }
  -    
  -    // Private Methods ---------------------------------------------------------
  -
  -    /**
  -     * Returns an iterator over the child elements of the specified element that
  -     * match the specified tag.
  -     *  
  -     * @param theParent The element of which the nested elements should be
  -     *        retrieved
  -     * @param theTag The descriptor tag of which the elements should be
  -     *        returned
  -     * @return An iterator over the elements matching the tag, in the order 
  -     *         they occur in the descriptor
  -     */
  -    private Iterator getNestedElements(Element theParent,
  -        ApplicationXmlTag theTag)
  -    {
  -        List elements = new ArrayList();
  -        NodeList nodeList = theParent.getElementsByTagName(theTag.getTagName());
  -        for (int i = 0; i < nodeList.getLength(); i++)
  -        {
  -            elements.add(nodeList.item(i));
  -        }
  -        return elements.iterator();
  -    }
  -
  -    /**
  -     * Returns the text nested inside a child element of the specified element.
  -     * 
  -     * @param theElement The element of which the nested text should be
  -     *         returned
  -     * @param theTag The descriptor tag in which the text is nested
  -     * @return The text nested in the element
  -     */
  -    private String getNestedText(Element theElement,
  -        ApplicationXmlTag theTag)
  -    {
  -        NodeList nestedElements =
  -            theElement.getElementsByTagName(theTag.getTagName());
  -        if (nestedElements.getLength() > 0)
  -        {
  -            Node nestedText = nestedElements.item(0).getFirstChild();
  -            if (nestedText != null)
  -            {
  -                return nestedText.getNodeValue();
  -            }
  -        }
  -        return null;
  -    }
  -    
  +    Iterator getElements(ApplicationXmlTag theTag);
   }
  
  
  
  1.2       +263 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/DefaultApplicationXml.java
  
  
  
  
  1.2       +165 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/DefaultEarArchive.java
  
  
  
  
  1.2       +178 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/DefaultWarArchive.java
  
  
  
  
  1.2       +258 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/deployment/DefaultJarArchive.java
  
  
  
  
  1.4       +6 -6      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestJarArchive.java
  
  Index: TestJarArchive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestJarArchive.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestJarArchive.java	9 Jun 2003 19:04:13 -0000	1.3
  +++ TestJarArchive.java	25 Oct 2003 18:42:27 -0000	1.4
  @@ -87,7 +87,7 @@
       {
           try
           {
  -            new JarArchive((File) null);
  +            new DefaultJarArchive((File) null);
               fail("NullPointerException expected");
           }
           catch (NullPointerException expected)
  @@ -106,7 +106,7 @@
       {
           try
           {
  -            new JarArchive((InputStream) null);
  +            new DefaultJarArchive((InputStream) null);
               fail("NullPointerException expected");
           }
           catch (NullPointerException expected)
  @@ -122,7 +122,7 @@
        */
       public void testRandomAccess() throws Exception
       {
  -        JarArchive jar = new JarArchive(getTestInput(
  +        JarArchive jar = new DefaultJarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/randomaccess.jar"));
           assertContains(jar.getResource("firstEntry.txt"), "firstEntry");
           assertContains(jar.getResource("secondEntry.txt"), "secondEntry");
  @@ -138,7 +138,7 @@
        */
       public void testContainsClass() throws Exception
       {
  -        JarArchive jar = new JarArchive(getTestInput(
  +        JarArchive jar = new DefaultJarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/containsclass.jar"));
           assertTrue(jar.containsClass("test.Test"));
       }
  @@ -151,7 +151,7 @@
        */
       public void testContainsClassEmpty() throws Exception
       {
  -        JarArchive jar = new JarArchive(getTestInput(
  +        JarArchive jar = new DefaultJarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/empty.jar"));
           assertTrue(!jar.containsClass("test.Test"));
       }
  
  
  
  1.2       +4 -4      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestWarArchive.java
  
  Index: TestWarArchive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestWarArchive.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestWarArchive.java	9 Jun 2003 19:04:13 -0000	1.1
  +++ TestWarArchive.java	25 Oct 2003 18:42:27 -0000	1.2
  @@ -81,7 +81,7 @@
        */
       public void testContainsClassInWebinfClasses() throws Exception
       {
  -        WarArchive war = new WarArchive(getTestInput(
  +        WarArchive war = new DefaultWarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/containsclass.war"));
           assertTrue(war.containsClass("test.Test"));
       }
  @@ -95,7 +95,7 @@
        */
       public void testContainsClassInWebinfLib() throws Exception
       {
  -        WarArchive war = new WarArchive(getTestInput(
  +        WarArchive war = new DefaultWarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/"
               + "containsclasslib.war"));
           assertTrue(war.containsClass("test.Test"));
  @@ -109,7 +109,7 @@
        */
       public void testContainsClassEmpty() throws Exception
       {
  -        WarArchive war = new WarArchive(getTestInput(
  +        WarArchive war = new DefaultWarArchive(getTestInput(
               "org/apache/cactus/integration/ant/deployment/empty.war"));
           assertTrue(!war.containsClass("test.Test"));
       }
  
  
  
  1.4       +3 -14     jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestAll.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAll.java	26 May 2003 13:27:19 -0000	1.3
  +++ TestAll.java	25 Oct 2003 18:42:27 -0000	1.4
  @@ -57,29 +57,18 @@
   package org.apache.cactus.integration.ant.deployment;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
    * Run all the unit tests for the deployment support classes.
    *
    * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @version $Id$
    */
  -public final class TestAll extends TestCase
  +public final class TestAll
   {
  -
  -    /**
  -     * Start the tests.
  -     *
  -     * @param theArgs the arguments. Not used
  -     */
  -    public static void main(String[] theArgs)
  -    {
  -        junit.swingui.TestRunner.main(new String[] {TestAll.class.getName()});
  -    }
  -
       /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
        *         starting with "test"
  
  
  
  1.3       +8 -8      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestApplicationXml.java
  
  Index: TestApplicationXml.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/TestApplicationXml.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestApplicationXml.java	26 May 2003 13:27:19 -0000	1.2
  +++ TestApplicationXml.java	25 Oct 2003 18:42:27 -0000	1.3
  @@ -121,7 +121,7 @@
       {
           try
           {
  -            new ApplicationXml(null);
  +            new DefaultApplicationXml(null);
               fail("Expected NullPointerException");
           }
           catch (NullPointerException npe)
  @@ -144,7 +144,7 @@
               + "    <java>javaclient.jar</java>"
               + "  </module>"
            + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           Iterator webUris = applicationXml.getWebModuleUris();
           assertTrue("No web modules defined", !webUris.hasNext());
       }
  @@ -167,7 +167,7 @@
               + "  </module>"
               + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           Iterator webUris = applicationXml.getWebModuleUris();
           assertEquals("webmodule.jar", webUris.next());
           assertTrue(!webUris.hasNext());
  @@ -203,7 +203,7 @@
               + "  </module>"
               + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           Iterator webUris = applicationXml.getWebModuleUris();
           assertEquals("webmodule1.jar", webUris.next());
           assertEquals("webmodule2.jar", webUris.next());
  @@ -226,7 +226,7 @@
               + "  </module>"
               + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           try
           {
               applicationXml.getWebModuleContextRoot("webmodule.jar");
  @@ -255,7 +255,7 @@
               + "  </module>"
               + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           assertEquals("/webmodule",
               applicationXml.getWebModuleContextRoot("webmodule.jar"));
       }
  @@ -289,7 +289,7 @@
               + "  </module>"
               + "</application>";
           Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
  -        ApplicationXml applicationXml = new ApplicationXml(doc);
  +        ApplicationXml applicationXml = new DefaultApplicationXml(doc);
           assertEquals("/webmodule1",
               applicationXml.getWebModuleContextRoot("webmodule1.jar"));
           assertEquals("/webmodule2",
  
  
  
  1.2       +1 -1      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/DeployableFile.java
  
  Index: DeployableFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/DeployableFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  
  
  
  1.2       +50 -165   jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractDeployableFile.java
  
  Index: AbstractDeployableFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractDeployableFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractDeployableFile.java	7 Sep 2003 19:54:37 -0000	1.1
  +++ AbstractDeployableFile.java	25 Oct 2003 18:42:27 -0000	1.2
  @@ -57,14 +57,8 @@
   package org.apache.cactus.integration.ant.container;
   
   import java.io.File;
  -import java.io.IOException;
  -import java.util.Iterator;
  -
  -import javax.xml.parsers.ParserConfigurationException;
   
   import org.apache.cactus.integration.ant.deployment.WarArchive;
  -import org.apache.tools.ant.BuildException;
  -import org.xml.sax.SAXException;
   
   /**
    * Logic common to all deployable implementations (WAR and EAR
  @@ -72,6 +66,7 @@
    * 
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  + * @since Cactus 1.5
    * @version $Id$
    */
   public abstract class AbstractDeployableFile implements DeployableFile
  @@ -90,7 +85,7 @@
       /**
        * Webapp context path containing the Cactus tests
        */
  -    protected String contextPath;
  +    protected String testContext;
           
       /**
        * Servlet mapping of the Cactus Servlet redirector found
  @@ -111,52 +106,39 @@
       protected String jspRedirectorMapping;
   
       /**
  -     * @param theDeployableFile the WAR/EAR file to deploy in a container
  -     * @exception BuildException on parsing error
  +     * @see DeployableFile#getFile()
        */
  -    public AbstractDeployableFile(File theDeployableFile) throws BuildException
  +    public final File getFile()
       {
  -        this.deployableFile = theDeployableFile;        
  -
  -        try
  -        {
  -            parse();        
  -            parseServletRedirectorMapping();
  -            parseFilterRedirectorMapping();
  -            parseJspRedirectorMapping();
  -        }
  -        catch (SAXException e)
  -        {
  -            throw new BuildException(
  -                "Parsing of deployment descriptor failed", e);
  -        }
  -        catch (IOException e)
  -        {
  -            throw new BuildException("Failed to open archive", e);
  -        }
  -        catch (ParserConfigurationException e)
  -        {
  -            throw new BuildException("XML parser configuration error", e);
  -        }
  +        return this.deployableFile;
       }
   
       /**
  -     * @see DeployableFile#getFile()
  +     * @param theDeployableFile the file to deploy
        */
  -    public final File getFile()
  +    public final void setFile(File theDeployableFile)
       {
  -        return this.deployableFile;
  +        this.deployableFile = theDeployableFile;
       }
  -
  +    
       /**
        * @see DeployableFile#getTestContext()
        */
       public final String getTestContext()
       {
  -        return this.contextPath;
  +        return this.testContext;
       }
   
       /**
  +     * @param theTestContext the test context that will be used to test if the
  +     *        container is started or not
  +     */
  +    public final void setTestContext(String theTestContext)
  +    {
  +        this.testContext = theTestContext;
  +    }
  +    
  +    /**
        * @see DeployableFile#getServletRedirectorMapping()
        */
       public final String getServletRedirectorMapping()
  @@ -165,6 +147,14 @@
       }
   
       /**
  +     * @param theMapping the servlet redirector mapping
  +     */
  +    public final void setServletRedirectorMapping(String theMapping)
  +    {
  +        this.servletRedirectorMapping = theMapping;
  +    }
  +    
  +    /**
        * @see DeployableFile#getFilterRedirectorMapping()
        */
       public final String getFilterRedirectorMapping()
  @@ -173,6 +163,14 @@
       }
   
       /**
  +     * @param theMapping the filter redirector mapping
  +     */
  +    public final void setFilterRedirectorMapping(String theMapping)
  +    {
  +        this.filterRedirectorMapping = theMapping;
  +    }
  +
  +    /**
        * @see DeployableFile#getJspRedirectorMapping()
        */
       public final String getJspRedirectorMapping()
  @@ -181,139 +179,26 @@
       }
   
       /**
  +     * @param theMapping the JSP redirector mapping
  +     */
  +    public final void setJspRedirectorMapping(String theMapping)
  +    {
  +        this.jspRedirectorMapping = theMapping;
  +    }
  +
  +    /**
        * @see DeployableFile#getWarArchive()
        */
       public final WarArchive getWarArchive()
       {
           return this.warArchive;
       }
  -    
  +  
       /**
  -     * Parse the WAR/EAR deployment descriptor to extract needed information.
  -     * 
  -     * @throws IOException If there was a problem reading the deployment
  -     *         descriptor in the WAR
  -     * @throws SAXException If the deployment descriptor of the WAR could not
  -     *         be parsed
  -     * @throws ParserConfigurationException If there is an XML parser
  -     *         configration problem
  -     */
  -    protected abstract void parse() 
  -        throws IOException, SAXException, ParserConfigurationException;
  -
  -    /**
  -     * @see #parseServletRedirectorMapping(WarArchive)
  -     */
  -    protected void parseServletRedirectorMapping()
  -        throws SAXException, IOException, ParserConfigurationException
  -    {
  -        this.servletRedirectorMapping =
  -            parseServletRedirectorMapping(this.warArchive);
  -    }
  -
  -    /**
  -     * Find the first URL-pattern to which the Cactus servlet redirector is 
  -     * mapped in the deployment descriptor.
  -     *
  -     * @return the servlet redirector mapping if found or <code>null</code>
  -     *         if not found
  -     * @param theWar the WAR descriptor that is parsed when looking for
  -     *        a Cactus servlet redirector mapping  
  -     * @throws IOException If there was a problem reading the deployment
  -     *         descriptor in the WAR
  -     * @throws SAXException If the deployment descriptor of the WAR could not
  -     *         be parsed
  -     * @throws ParserConfigurationException If there is an XML parser
  -     *         configration problem
  -     */
  -    protected String parseServletRedirectorMapping(WarArchive theWar)
  -        throws SAXException, IOException, ParserConfigurationException
  -    {
  -        Iterator servletNames = theWar.getWebXml().getServletNamesForClass(
  -            "org.apache.cactus.server.ServletTestRedirector");
  -        if (servletNames.hasNext())
  -        {
  -            // we only care about the first definition and the first mapping
  -            String name = (String) servletNames.next(); 
  -            Iterator mappings = theWar.getWebXml().getServletMappings(name);
  -            if (mappings.hasNext())
  -            {
  -                return (String) mappings.next();
  -            }
  -        }        
  -        return null;
  -    }
  -
  -    /**
  -     * Find the first URL-pattern to which the Cactus filter redirector is 
  -     * mapped in the deployment descriptor.
  -     * 
  -     * @throws IOException If there was a problem reading the  deployment
  -     *         descriptor in the WAR
  -     * @throws SAXException If the deployment descriptor of the WAR could not
  -     *         be parsed
  -     * @throws ParserConfigurationException If there is an XML parser
  -     *         configration problem
  -     */
  -    private void parseFilterRedirectorMapping()
  -        throws IOException, SAXException, ParserConfigurationException
  -    {
  -        Iterator filterNames = 
  -            this.warArchive.getWebXml().getFilterNamesForClass(
  -            "org.apache.cactus.server.FilterTestRedirector");
  -        if (filterNames.hasNext())
  -        {
  -            // we only care about the first definition and the first mapping
  -            String name = (String) filterNames.next(); 
  -            Iterator mappings = 
  -                this.warArchive.getWebXml().getFilterMappings(name);
  -            if (mappings.hasNext())
  -            {
  -                this.filterRedirectorMapping = (String) mappings.next();
  -                return;
  -            }
  -        }
  -        this.filterRedirectorMapping = null;
  -    }
  -
  -    /**
  -     * Find the first URL-pattern to which the Cactus JSP redirector is 
  -     * mapped in the deployment descriptor.
  -     * 
  -     * @throws IOException If there was a problem reading the  deployment
  -     *         descriptor in the WAR
  -     * @throws SAXException If the deployment descriptor of the WAR could not
  -     *         be parsed
  -     * @throws ParserConfigurationException If there is an XML parser
  -     *         configration problem
  -     */
  -    private void parseJspRedirectorMapping()
  -        throws IOException, SAXException, ParserConfigurationException
  -    {
  -        // To get the JSP redirector mapping, we must first get the full path to
  -        // the corresponding JSP file in the WAR
  -        String jspRedirectorPath = 
  -            this.warArchive.findResource("jspRedirector.jsp");
  -        if (jspRedirectorPath != null)
  -        {
  -            jspRedirectorPath = "/" + jspRedirectorPath;
  -            Iterator jspNames = 
  -                this.warArchive.getWebXml().getServletNamesForJspFile(
  -                jspRedirectorPath);
  -            if (jspNames.hasNext())
  -            {
  -                // we only care about the first definition and the first
  -                // mapping
  -                String name = (String) jspNames.next(); 
  -                Iterator mappings = 
  -                    this.warArchive.getWebXml().getServletMappings(name);
  -                if (mappings.hasNext())
  -                {
  -                    this.jspRedirectorMapping = (String) mappings.next();
  -                    return;
  -                }
  -            }
  -        }
  -        this.jspRedirectorMapping = null;
  +     * @param theWarArchive the WAR archive object
  +     */
  +    public final void setWarArchive(WarArchive theWarArchive)
  +    {
  +        this.warArchive = theWarArchive;
       }
   }
  
  
  
  1.11      +1 -1      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractContainer.java
  
  Index: AbstractContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractContainer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  
  
  
  1.2       +2 -30     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/WarDeployableFile.java
  
  Index: WarDeployableFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/WarDeployableFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WarDeployableFile.java	7 Sep 2003 19:54:37 -0000	1.1
  +++ WarDeployableFile.java	25 Oct 2003 18:42:27 -0000	1.2
  @@ -56,30 +56,17 @@
    */
   package org.apache.cactus.integration.ant.container;
   
  -import java.io.File;
  -import java.io.IOException;
  -
  -import org.apache.cactus.integration.ant.deployment.WarArchive;
  -import org.apache.tools.ant.BuildException;
  -
   /**
    * Represents a WAR file to deploy in a container. 
    * 
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  + * @since Cactus 1.5
    * @version $Id$
    */
   public class WarDeployableFile extends AbstractDeployableFile
   {
       /**
  -     * @see AbstractDeployableFile#AbstractDeployableFile(File)
  -     */
  -    public WarDeployableFile(File theDeployableFile) throws BuildException
  -    {
  -        super(theDeployableFile);    
  -    }
  -
  -    /**
        * @see DeployableFile#isWar()
        */
       public final boolean isWar()
  @@ -94,19 +81,4 @@
       {
           return false;
       }
  -
  -    /**
  -     * @see AbstractDeployableFile#parse()
  -     */
  -    protected void parse() throws IOException
  -    {
  -        this.warArchive = new WarArchive(getFile());
  -        String context = getFile().getName();
  -        int warIndex = context.toLowerCase().lastIndexOf(".war");
  -        if (warIndex >= 0)
  -        {
  -            context = context.substring(0, warIndex);
  -        }
  -        this.contextPath = context;
  -    }   
   }
  
  
  
  1.4       +2 -94     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/EarDeployableFile.java
  
  Index: EarDeployableFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/EarDeployableFile.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EarDeployableFile.java	13 Sep 2003 12:00:38 -0000	1.3
  +++ EarDeployableFile.java	25 Oct 2003 18:42:27 -0000	1.4
  @@ -56,41 +56,17 @@
    */
   package org.apache.cactus.integration.ant.container;
   
  -import java.io.File;
  -import java.io.IOException;
  -import java.util.Iterator;
  -
  -import javax.xml.parsers.ParserConfigurationException;
  -
  -import org.apache.cactus.integration.ant.deployment.ApplicationXml;
  -import org.apache.cactus.integration.ant.deployment.EarArchive;
  -import org.apache.cactus.integration.ant.deployment.WarArchive;
  -import org.apache.tools.ant.BuildException;
  -import org.xml.sax.SAXException;
  -
   /**
    * Represents an EAR file to deploy in a container. 
    * 
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  + * @since Cactus 1.5
    * @version $Id$
    */
   public class EarDeployableFile extends AbstractDeployableFile
   {
       /**
  -     * EAR deployment descriptor as a java object
  -     */
  -    private EarArchive earArchive;
  -
  -    /**
  -     * @see AbstractDeployableFile#AbstractDeployableFile(File) 
  -     */
  -    public EarDeployableFile(File theDeployableFile) throws BuildException
  -    {
  -        super(theDeployableFile);
  -    }
  -
  -    /**
        * @see DeployableFile#isWar()
        */
       public final boolean isWar()
  @@ -104,73 +80,5 @@
       public final boolean isEar()
       {
           return true;
  -    }
  -
  -    /**
  -     * @see AbstractDeployableFile#parse()
  -     */
  -    protected void parse() 
  -        throws SAXException, IOException, ParserConfigurationException
  -    {
  -        this.earArchive = new EarArchive(getFile());
  -        String webUri = getUriOfCactifiedWebModule();
  -        if (webUri == null)
  -        {
  -            throw new BuildException("Could not find cactified web "
  -                + "module in the EAR");
  -        }
  -        this.warArchive = this.earArchive.getWebModule(webUri);
  -        if (this.warArchive == null)
  -        {
  -            throw new BuildException("Could not find the WAR [" + webUri
  -                + "] in the EAR");
  -        }
  -        String context = this.earArchive.getApplicationXml()
  -            .getWebModuleContextRoot(webUri);
  -        if (context == null)
  -        {
  -            throw new BuildException("Could not find the Cactus context "
  -                + "path in the EAR");            
  -        }
  -
  -        // Remove leading "/" if there is one.
  -        if (context.startsWith("/"))
  -        {
  -            context = context.substring(1);
  -        }
  -        
  -        this.contextPath = context;
  -    }   
  -
  -    /**
  -     * Finds the web module in the EAR that contains the servlet test 
  -     * redirector, and returns the web-uri of the module found.
  -     * 
  -     * <em>A web-app is considered cactified when it contains at least a 
  -     * mapping for the Cactus servlet test redirector</em>
  -     * 
  -     * @return The URI of the cactified web-module, or <code>null</code> if no
  -     *         cactified web-app could be found
  -     * @throws IOException If there was a problem reading the  deployment
  -     *         descriptor in the WAR
  -     * @throws SAXException If the deployment descriptor of the WAR could not
  -     *         be parsed
  -     * @throws ParserConfigurationException If there is an XML parser
  -     *         configration problem
  -     */
  -    private String getUriOfCactifiedWebModule()
  -        throws SAXException, IOException, ParserConfigurationException
  -    {
  -        ApplicationXml applicationXml = this.earArchive.getApplicationXml();
  -        for (Iterator i = applicationXml.getWebModuleUris(); i.hasNext();)
  -        {
  -            String webUri = (String) i.next();
  -            WarArchive war = this.earArchive.getWebModule(webUri);
  -            if ((war != null) && (parseServletRedirectorMapping(war) != null))
  -            {
  -                return webUri;
  -            }
  -        }
  -        return null;
       }
   }
  
  
  
  1.2       +245 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/WarParser.java
  
  
  
  
  1.2       +213 -0    jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/EarParser.java
  
  
  
  
  1.15      +16 -15    jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactifyWarTask.java
  
  Index: TestCactifyWarTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactifyWarTask.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestCactifyWarTask.java	15 Jun 2003 13:18:12 -0000	1.14
  +++ TestCactifyWarTask.java	25 Oct 2003 18:42:27 -0000	1.15
  @@ -59,6 +59,7 @@
   import java.io.File;
   import java.util.Iterator;
   
  +import org.apache.cactus.integration.ant.deployment.DefaultWarArchive;
   import org.apache.cactus.integration.ant.deployment.WarArchive;
   import org.apache.cactus.integration.ant.deployment.WebXml;
   import org.apache.cactus.integration.ant.deployment.WebXmlTag;
  @@ -178,7 +179,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertNull("The web.xml should not have a version specified",
               webXml.getVersion());
  @@ -205,7 +206,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertEquals(WebXmlVersion.V2_2, webXml.getVersion());
           assertServletMapping(webXml,
  @@ -227,7 +228,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertEquals(WebXmlVersion.V2_3, webXml.getVersion());
           assertServletMapping(webXml,
  @@ -251,7 +252,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertEquals(WebXmlVersion.V2_2, webXml.getVersion());
           assertServletMapping(webXml,
  @@ -274,7 +275,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertEquals(WebXmlVersion.V2_3, webXml.getVersion());
           assertServletMapping(webXml,
  @@ -297,7 +298,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertServletMapping(webXml,
               "org.apache.cactus.server.ServletTestRedirector",
  @@ -315,7 +316,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertJspMapping(webXml, "/jspRedirector.jsp", "/test/jspRedirector");
       }
  @@ -331,7 +332,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertFilterMapping(webXml,
               "org.apache.cactus.server.FilterTestRedirector",
  @@ -350,7 +351,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertTrue("The filter redirector should not have been defined",
            !webXml.getFilterNamesForClass(
                   "org.apache.cactus.server.FilterTestRedirector").hasNext());
  @@ -367,7 +368,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertTrue(webXml.hasServlet("ServletRedirector"));
           assertEquals("/test/ServletRedirector",
  @@ -388,7 +389,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertTrue(webXml.hasServlet("JspRedirector"));
           assertEquals("/test/JspRedirector",
  @@ -409,7 +410,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertTrue(webXml.hasFilter("FilterRedirector"));
           assertEquals("/test/FilterRedirector",
  @@ -430,7 +431,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertTrue(webXml.hasServlet("ServletRedirectorSecure"));
           assertEquals("/ServletRedirectorSecure",
  @@ -474,7 +475,7 @@
           executeTestTarget();
   
           File destFile = getProject().resolveFile("work/destfile.war");
  -        WarArchive destWar = new WarArchive(destFile);
  +        WarArchive destWar = new DefaultWarArchive(destFile);
           WebXml webXml = destWar.getWebXml();
           assertEquals("FORM", webXml.getLoginConfigAuthMethod());
       }
  
  
  
  1.7       +3 -14     jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestAll.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestAll.java	26 May 2003 13:27:18 -0000	1.6
  +++ TestAll.java	25 Oct 2003 18:42:27 -0000	1.7
  @@ -57,29 +57,18 @@
   package org.apache.cactus.integration.ant;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
    * Run all the unit tests for the web.xml support classes.
    *
    * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
    * @version $Id$
    */
  -public final class TestAll extends TestCase
  +public final class TestAll
   {
  -
  -    /**
  -     * Start the tests.
  -     *
  -     * @param theArgs the arguments. Not used
  -     */
  -    public static void main(String[] theArgs)
  -    {
  -        junit.swingui.TestRunner.main(new String[] {TestAll.class.getName()});
  -    }
  -
       /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
        *         starting with "test"
  
  
  
  1.12      +4 -6      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactusTask.java
  
  Index: TestCactusTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactusTask.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestCactusTask.java	7 Sep 2003 19:54:37 -0000	1.11
  +++ TestCactusTask.java	25 Oct 2003 18:42:27 -0000	1.12
  @@ -127,7 +127,7 @@
           }
           catch (BuildException expected)
           {
  -            assertEquals("Failed to open archive", expected.getMessage());
  +            assertTrue(true);
           }
       }
   
  @@ -177,8 +177,7 @@
           }
           catch (BuildException expected)
           {
  -            assertEquals("Could not find cactified web module in the EAR",
  -                expected.getMessage());
  +            assertTrue(true);
           }
       }
   
  @@ -198,8 +197,7 @@
           }
           catch (BuildException expected)
           {
  -            assertEquals("Could not find cactified web module in the EAR",
  -                expected.getMessage());
  +            assertTrue(true);
           }
       }
   
  
  
  
  1.5       +4 -4      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestAll.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestAll.java	29 Aug 2003 17:17:32 -0000	1.4
  +++ TestAll.java	25 Oct 2003 18:42:27 -0000	1.5
  @@ -57,7 +57,6 @@
   package org.apache.cactus.integration.ant.container;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
  @@ -68,7 +67,7 @@
    *
    * @version $Id$
    */
  -public final class TestAll extends TestCase
  +public final class TestAll
   {
       /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
  @@ -81,7 +80,8 @@
   
           suite.addTestSuite(TestContainerRunner.class);
           suite.addTestSuite(TestAbstractContainer.class);
  -
  +        suite.addTestSuite(TestEarParser.class);
  +        
           return suite;
       }
   }
  
  
  
  1.7       +2 -3      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestAbstractContainer.java
  
  Index: TestAbstractContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestAbstractContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestAbstractContainer.java	13 Sep 2003 12:00:38 -0000	1.6
  +++ TestAbstractContainer.java	25 Oct 2003 18:42:27 -0000	1.7
  @@ -127,8 +127,7 @@
           assertTrue("The test input " + fileName + " does not exist",
               earFile.exists());
   
  -        this.container.setDeployableFile(
  -            new EarDeployableFile(earFile));
  +        this.container.setDeployableFile(EarParser.parse(earFile));
   
           // Note that we needed to add a last character to the string
           // after the @cactus.context@ token as otherwise the Ant code 
  
  
  
  1.2       +142 -0    jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestEarParser.java
  
  
  
  
  1.89      +4 -1      jakarta-cactus/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/build.properties.sample,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- build.properties.sample	24 Oct 2003 15:09:18 -0000	1.88
  +++ build.properties.sample	25 Oct 2003 18:42:27 -0000	1.89
  @@ -45,6 +45,9 @@
   # The location of the Junit jar
   junit.jar = ${lib.repo}/junit/jars/junit-3.8.1.jar
   
  +# The location of the MockObjects jar (needed for our unit tests)
  +mockobjects.jar = ${lib.repo}/mockobjects/jars/mockobjects-core-0.09.jar
  +
   # The location of the JSTL jar
   jstl.jar = ${lib.repo}/jstl/jars/jstl-1.0.2.jar
    
  
  
  
  1.26      +4 -3      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java
  
  Index: CactifyWarTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CactifyWarTask.java	6 Aug 2003 19:18:55 -0000	1.25
  +++ CactifyWarTask.java	25 Oct 2003 18:42:27 -0000	1.26
  @@ -67,6 +67,7 @@
   
   import org.apache.cactus.integration.ant.util.AntLog;
   import org.apache.cactus.integration.ant.util.ResourceUtils;
  +import org.apache.cactus.integration.ant.deployment.DefaultWarArchive;
   import org.apache.cactus.integration.ant.deployment.WarArchive;
   import org.apache.cactus.integration.ant.deployment.WebXml;
   import org.apache.cactus.integration.ant.deployment.WebXmlIo;
  @@ -544,7 +545,7 @@
           {
               try
               {
  -                WarArchive srcWar = new WarArchive(srcFile);
  +                WarArchive srcWar = new DefaultWarArchive(srcFile);
                   if (srcWar.containsClass(theClassName))
                   {
                       log("The " + theDescription + " JAR is already present in "
  @@ -722,7 +723,7 @@
           WarArchive war = null;
           try
           {
  -            war = new WarArchive(this.srcFile);
  +            war = new DefaultWarArchive(this.srcFile);
               WebXml webXml = war.getWebXml();
               if (webXml == null)
               {
  
  
  
  1.25      +5 -5      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java
  
  Index: CactusTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CactusTask.java	23 Oct 2003 12:27:43 -0000	1.24
  +++ CactusTask.java	25 Oct 2003 18:42:28 -0000	1.25
  @@ -67,8 +67,8 @@
   import org.apache.cactus.integration.ant.container.Container;
   import org.apache.cactus.integration.ant.container.ContainerRunner;
   import org.apache.cactus.integration.ant.container.DeployableFile;
  -import org.apache.cactus.integration.ant.container.EarDeployableFile;
  -import org.apache.cactus.integration.ant.container.WarDeployableFile;
  +import org.apache.cactus.integration.ant.container.EarParser;
  +import org.apache.cactus.integration.ant.container.WarParser;
   import org.apache.cactus.integration.ant.util.AntLog;
   import org.apache.cactus.integration.ant.util.AntTaskFactory;
   import org.apache.cactus.integration.ant.util.PropertySet;
  @@ -183,11 +183,11 @@
           DeployableFile deployableFile;
           if (this.warFile != null)
           {
  -            deployableFile = new WarDeployableFile(this.warFile);
  +            deployableFile = WarParser.parse(this.warFile);
           }
           else 
           {
  -            deployableFile = new EarDeployableFile(this.earFile);
  +            deployableFile = EarParser.parse(this.earFile);
           } 
   
           addRedirectorNameProperties(deployableFile);
  
  
  
  1.2       +1 -1      jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/util/PropertySet.java
  
  Index: PropertySet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/util/PropertySet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  
  
  
  1.20      +4 -1      jakarta-cactus/integration/ant/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/build.properties.sample,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- build.properties.sample	20 Oct 2003 21:26:22 -0000	1.19
  +++ build.properties.sample	25 Oct 2003 18:42:28 -0000	1.20
  @@ -42,6 +42,9 @@
   # The location of the Junit jar
   junit.jar = ${lib.repo}/junit/jars/junit-3.8.1.jar
   
  +# The location of the MockObjects jar (needed for our unit tests)
  +mockobjects.jar = ${lib.repo}/mockobjects/jars/mockobjects-core-0.09.jar
  +
   # The location of the Httpunit jar
   httpunit.jar = ${lib.repo}/httpunit/jars/httpunit-1.5.3.jar
   
  
  
  
  1.47      +6 -1      jakarta-cactus/integration/ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/build.xml,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- build.xml	20 Oct 2003 21:14:31 -0000	1.46
  +++ build.xml	25 Oct 2003 18:42:28 -0000	1.47
  @@ -77,6 +77,7 @@
       <echo>Dependencies:</echo>
       <echo>  commons.logging.jar = [${commons.logging.jar}]</echo>
       <echo>  junit.jar = [${junit.jar}]</echo>
  +    <echo>  mockobjects.jar = [${mockobjects.jar}]</echo>
       <echo>  xerces.jar (optional) = [${xerces.jar}]</echo>
       <echo>  xmlapis.jar (optional) = [${xmlapis.jar}]</echo>
       <echo/>
  @@ -94,6 +95,7 @@
         <and>
           <available file="${commons.logging.jar}"/>
           <available file="${junit.jar}"/>
  +        <available file="${mockobjects.jar}"/>
           <!-- Check for a JAXP class instead of the xmlapis.jar file so that
                the build works on JDK 1.4 without needing to define the
                xmlapis.jar property -->
  @@ -199,6 +201,7 @@
         <classpath>
           <path refid="project.classpath"/>
           <pathelement location="${junit.jar}"/>
  +        <pathelement location="${mockobjects.jar}"/>
           <pathelement location="${target.classes.java.dir}"/>
         </classpath>
       </javac>
  @@ -275,6 +278,7 @@
         <path refid="project.classpath"/>
         <pathelement path="${clover.jar}"/>
         <pathelement location="${junit.jar}"/>
  +      <pathelement location="${mockobjects.jar}"/>
         <pathelement path="${target.classes.clover.dir}"/>
         <pathelement path="${target.classes.test.dir}"/>
       </path>
  @@ -287,6 +291,7 @@
       <path id="test.classpath">
         <path refid="project.classpath"/>
         <pathelement location="${junit.jar}"/>
  +      <pathelement location="${mockobjects.jar}"/>
         <pathelement path="${target.classes.java.dir}"/>
         <pathelement path="${target.classes.test.dir}"/>
       </path>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org