Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 191   Methods: 8
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ServerDeploy.java 0% 0% 0% 0%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2002 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 
 55   
 package org.apache.tools.ant.taskdefs.optional.j2ee;
 56   
 
 57   
 import java.io.File;
 58   
 import java.util.Enumeration;
 59   
 import java.util.Vector;
 60   
 import org.apache.tools.ant.BuildException;
 61   
 import org.apache.tools.ant.Task;
 62   
 
 63   
 /**
 64   
  *  Controls hot deployment tools for J2EE servers.
 65   
  *
 66   
  *  This class is used as a framework for the creation of vendor specific
 67   
  *  hot deployment tools.
 68   
  *
 69   
  *  @author Christopher A. Longo - cal@cloud9.net
 70   
  *
 71   
  *  @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool
 72   
  *  @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool
 73   
  *  @see org.apache.tools.ant.taskdefs.optional.j2ee.GenericHotDeploymentTool
 74   
  *  @see org.apache.tools.ant.taskdefs.optional.j2ee.WebLogicHotDeploymentTool
 75   
  */
 76   
 public class ServerDeploy extends Task {
 77   
     /** The action to be performed.  IE: "deploy", "delete", etc... **/
 78   
     private String action;
 79   
 
 80   
     /** The source (fully-qualified path) to the component being deployed **/
 81   
     private File source;
 82   
 
 83   
     /** The vendor specific tool for deploying the component **/
 84   
     private Vector vendorTools = new Vector();
 85   
 
 86   
     ///////////////////////////////////////////////////////////////////////////
 87   
     //
 88   
     // Place vendor specific tool creations here.
 89   
     //
 90   
     ///////////////////////////////////////////////////////////////////////////
 91   
 
 92   
     /**
 93   
      *  Creates a generic deployment tool.
 94   
      *  <p>Ant calls this method on creation to handle embedded "generic" elements
 95   
      *  in the ServerDeploy task.
 96   
      *  @param tool An instance of GenericHotDeployment tool, passed in by Ant.
 97   
      */
 98  0
     public void addGeneric(GenericHotDeploymentTool tool) {
 99  0
         tool.setTask(this);
 100  0
         vendorTools.addElement(tool);
 101   
     }
 102   
 
 103   
     /**
 104   
      *  Creates a WebLogic deployment tool, for deployment to WebLogic servers.
 105   
      *  <p>Ant calls this method on creation to handle embedded "weblogic" elements
 106   
      *  in the ServerDeploy task.
 107   
      *  @param tool An instance of WebLogicHotDeployment tool, passed in by Ant.
 108   
      */
 109  0
     public void addWeblogic(WebLogicHotDeploymentTool tool) {
 110  0
         tool.setTask(this);
 111  0
         vendorTools.addElement(tool);
 112   
     }
 113   
 
 114   
     /**
 115   
      *  Creates a JOnAS deployment tool, for deployment to JOnAS servers.
 116   
      *  <p>Ant calls this method on creation to handle embedded "jonas" elements
 117   
      *  in the ServerDeploy task.
 118   
      *  @param tool An instance of JonasHotDeployment tool, passed in by Ant.
 119   
      */
 120  0
     public void addJonas(JonasHotDeploymentTool tool) {
 121  0
         tool.setTask(this);
 122  0
         vendorTools.addElement(tool);
 123   
     }
 124   
 
 125   
 
 126   
     ///////////////////////////////////////////////////////////////////////////
 127   
     //
 128   
     // Execute method
 129   
     //
 130   
     ///////////////////////////////////////////////////////////////////////////
 131   
 
 132   
     /**
 133   
      *  Execute the task.
 134   
      *  <p>This method calls the deploy() method on each of the vendor-specific tools
 135   
      *  in the <code>vendorTools</code> collection.  This performs the actual
 136   
      *  process of deployment on each tool.
 137   
      *  @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete, or
 138   
      *  a failure occurs in the deployment process.
 139   
      */
 140  0
     public void execute() throws BuildException {
 141  0
         for (Enumeration enum = vendorTools.elements(); 
 142  0
              enum.hasMoreElements();) {
 143  0
             HotDeploymentTool tool = (HotDeploymentTool) enum.nextElement();
 144  0
             tool.validateAttributes();
 145  0
             tool.deploy();
 146   
         }
 147   
     }
 148   
 
 149   
     ///////////////////////////////////////////////////////////////////////////
 150   
     //
 151   
     // Set/get methods
 152   
     //
 153   
     ///////////////////////////////////////////////////////////////////////////
 154   
 
 155   
     /**
 156   
      *  Returns the action field.
 157   
      *  @return A string representing the "action" attribute.
 158   
      */
 159  0
     public String getAction() {
 160  0
         return action;
 161   
     }
 162   
 
 163   
     /**
 164   
      *  The action to be performed, usually "deploy"; required.
 165   
      *   Some tools support additional actions, such as "delete", "list", "undeploy", "update"...
 166   
      *  @param action A String representing the "action" attribute.
 167   
      */
 168  0
     public void setAction(String action) {
 169  0
         this.action = action;
 170   
     }
 171   
 
 172   
     /**
 173   
      *  Returns the source field (the path/filename of the component to be
 174   
      *  deployed.
 175   
      *  @return A File object representing the "source" attribute.
 176   
      */
 177  0
     public File getSource() {
 178  0
         return source;
 179   
     }
 180   
 
 181   
     /**
 182   
      *  The filename of the component to be deployed; optional
 183   
      *  depending upon the tool and the action.
 184   
      *  @param source String representing the "source" attribute.
 185   
      */
 186  0
     public void setSource(File source) {
 187  0
         this.source = source;
 188   
     }
 189   
 }
 190   
 
 191