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: 134   Methods: 6
NCLOC: 56   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
Tomcat4xContainer.java 0% 0% 0% 0%
coverage
 1   
 /* 
 2   
  * ========================================================================
 3   
  * 
 4   
  * Copyright 2003-2004 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.container.tomcat;
 21   
 
 22   
 import java.io.File;
 23   
 import java.io.IOException;
 24   
 
 25   
 import org.apache.tools.ant.BuildException;
 26   
 import org.apache.tools.ant.util.FileUtils;
 27   
 
 28   
 /**
 29   
  * Special container support for the Apache Tomcat 4.x servlet container.
 30   
  * 
 31   
  * @version $Id: Tomcat4xContainer.java 238811 2004-02-29 10:10:42Z vmassol $
 32   
  */
 33   
 public class Tomcat4xContainer extends AbstractCatalinaContainer
 34   
 {
 35   
     // Instance Variables ------------------------------------------------------
 36   
 
 37   
     /**
 38   
      * A user-specific context xml configuration file.
 39   
      */
 40   
     private File contextXml;
 41   
 
 42   
     // Public Methods ----------------------------------------------------------
 43   
 
 44   
     /**
 45   
      * @return The context xml file, if set or null otherwise
 46   
      */
 47  0
     public final File getContextXml()
 48   
     {
 49  0
         return this.contextXml;
 50   
     }
 51   
 
 52   
     /**
 53   
      * Sets a user-custom context xml configuration file to use for the test
 54   
      * installation of Tomcat.
 55   
      * 
 56   
      * @param theContextXml the custom context xml file to use
 57   
      */
 58  0
     public final void setContextXml(File theContextXml)
 59   
     {
 60  0
         this.contextXml = theContextXml;
 61   
     }
 62   
     
 63   
     // Container Implementation ------------------------------------------------
 64   
 
 65   
     /**
 66   
      * @see org.apache.cactus.integration.ant.container.Container#init
 67   
      */
 68  0
     public final void init()
 69   
     {
 70  0
         super.init();
 71   
 
 72  0
         if (!getVersion().startsWith("4"))
 73   
         {
 74  0
             throw new BuildException(
 75   
                 "This element doesn't support version " + getVersion()
 76   
                 + " of Tomcat");
 77   
         }
 78   
     }
 79   
 
 80   
     /**
 81   
      * @see org.apache.cactus.integration.ant.container.Container#startUp
 82   
      */
 83  0
     public final void startUp()
 84   
     {
 85  0
         try
 86   
         {
 87  0
             prepare("tomcat4x", "cactus/tomcat4x");
 88  0
             invokeBootstrap("start");
 89   
         }
 90   
         catch (IOException ioe)
 91   
         {
 92  0
             getLog().error("Failed to startup the container", ioe);
 93  0
             throw new BuildException(ioe);
 94   
         }
 95   
     }
 96   
 
 97   
     /**
 98   
      * @see org.apache.cactus.integration.ant.container.Container#shutDown
 99   
      */
 100  0
     public final void shutDown()
 101   
     {
 102  0
         invokeBootstrap("stop");
 103   
     }
 104   
 
 105   
     /**
 106   
      * Tomcat 4.x-specific setup of a temporary installation of the container.
 107   
      * 
 108   
      * @param theResourcePrefix The prefix to use when looking up container
 109   
      *        resource in the JAR
 110   
      * @param theDirName The name of the temporary container installation
 111   
      *        directory
 112   
      * @throws IOException If an I/O error occurs
 113   
      * @see AbstractCatalinaContainer#prepare(String, String)
 114   
      */
 115  0
     protected void prepare(String theResourcePrefix, String theDirName)
 116   
         throws IOException
 117   
     {
 118  0
         super.prepare(theResourcePrefix, theDirName);
 119   
 
 120  0
         FileUtils fileUtils = FileUtils.newFileUtils();
 121   
         
 122   
         // Copy user-provided context xml file into the temporary webapp/
 123   
         // container directory
 124  0
         File webappsDir = new File(getTmpDir(), "webapps");
 125  0
         if (getContextXml() != null)
 126   
         {
 127  0
             fileUtils.copyFile(getContextXml(), 
 128   
                 new File(webappsDir, getContextXml().getName()));
 129   
         }
 130   
         
 131   
     }
 132   
     
 133   
 }
 134