2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

Clover coverage report - Cactus 1.8dev for J2EE API 1.3
Coverage timestamp: Sun Mar 26 2006 18:50:18 BRT
file stats: LOC: 129   Methods: 4
NCLOC: 66   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
DefaultEarArchive.java 62.5% 88.9% 75% 80%
coverage coverage
 1   
 /* 
 2   
  * ========================================================================
 3   
  * 
 4   
  * Copyright 2003 The Apache Software Foundation.
 5   
  *
 6   
  * Licensed under the Apache License, Version 2.0 (the "License");
 7   
  * you may not use this file except in compliance with the License.
 8   
  * You may obtain a copy of the License at
 9   
  * 
 10   
  *   http://www.apache.org/licenses/LICENSE-2.0
 11   
  * 
 12   
  * Unless required by applicable law or agreed to in writing, software
 13   
  * distributed under the License is distributed on an "AS IS" BASIS,
 14   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15   
  * See the License for the specific language governing permissions and
 16   
  * limitations under the License.
 17   
  * 
 18   
  * ========================================================================
 19   
  */
 20   
 package org.apache.cactus.integration.ant.deployment.application;
 21   
 
 22   
 import java.io.File;
 23   
 import java.io.IOException;
 24   
 import java.io.InputStream;
 25   
 
 26   
 import javax.xml.parsers.ParserConfigurationException;
 27   
 
 28   
 import org.apache.cactus.integration.ant.deployment.DefaultJarArchive;
 29   
 import org.apache.cactus.integration.ant.deployment.webapp.DefaultWarArchive;
 30   
 import org.apache.cactus.integration.ant.deployment.webapp.WarArchive;
 31   
 import org.xml.sax.SAXException;
 32   
 
 33   
 /**
 34   
  * Encapsulates access to an EAR.
 35   
  * 
 36   
  * @since Cactus 1.5
 37   
  * @version $Id: DefaultEarArchive.java 239003 2004-05-31 20:05:27Z vmassol $
 38   
  */
 39   
 public class DefaultEarArchive extends DefaultJarArchive implements EarArchive
 40   
 {
 41   
     // Instance Variables ------------------------------------------------------
 42   
 
 43   
     /**
 44   
      * The parsed deployment descriptor.
 45   
      */
 46   
     private ApplicationXml applicationXml;
 47   
 
 48   
     // Constructors ------------------------------------------------------------
 49   
     
 50   
     /**
 51   
      * Constructor.
 52   
      * 
 53   
      * @param theFile The enterprise application archive
 54   
      * @throws IOException If there was a problem reading the EAR
 55   
      */
 56  4
     public DefaultEarArchive(File theFile)
 57   
         throws IOException
 58   
     {
 59  4
         super(theFile);
 60   
     }
 61   
 
 62   
     /**
 63   
      * Constructor.
 64   
      * 
 65   
      * @param theInputStream The input stream for the enterprise application
 66   
      *        archive
 67   
      * @throws IOException If there was a problem reading the EAR
 68   
      */
 69  0
     public DefaultEarArchive(InputStream theInputStream)
 70   
         throws IOException
 71   
     {
 72  0
         super(theInputStream);
 73   
     }
 74   
 
 75   
     // Public Methods ----------------------------------------------------------
 76   
 
 77   
     /**
 78   
      * @see EarArchive#getApplicationXml()
 79   
      */
 80  6
     public final ApplicationXml getApplicationXml()
 81   
         throws IOException, SAXException, ParserConfigurationException
 82   
     {
 83  6
         if (this.applicationXml == null)
 84   
         {
 85  4
             InputStream in = null;
 86  4
             try
 87   
             {
 88  4
                 in = getResource("META-INF/application.xml");
 89  4
                 this.applicationXml =
 90   
                     ApplicationXmlIo.parseApplicationXml(in, null);
 91   
             }
 92   
             finally
 93   
             {
 94  4
                 if (in != null)
 95   
                 {
 96  4
                     in.close();
 97   
                 }
 98   
             }
 99   
         }
 100  6
         return this.applicationXml;
 101   
     }
 102   
 
 103   
     /**
 104   
      * @see EarArchive#getWebModule(String)
 105   
      */
 106  5
     public final WarArchive getWebModule(String theUri)
 107   
         throws IOException
 108   
     {
 109  5
         InputStream war = null;
 110  5
         try
 111   
         {
 112  5
             war = getResource(theUri);
 113  5
             if (war != null)
 114   
             {
 115  5
                 return new DefaultWarArchive(war);
 116   
             }
 117   
         }
 118   
         finally
 119   
         {
 120  5
             if (war != null)
 121   
             {
 122  5
                 war.close();
 123   
             }
 124   
         }
 125  0
         return null;
 126   
     }
 127   
 
 128   
 }
 129