Coverage Report - org.apache.turbine.pipeline.AbstractValve
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractValve
80%
4/5
50%
1/2
1,667
 
 1  
 package org.apache.turbine.pipeline;
 2  
 
 3  
 
 4  
 /*
 5  
  * Licensed to the Apache Software Foundation (ASF) under one
 6  
  * or more contributor license agreements.  See the NOTICE file
 7  
  * distributed with this work for additional information
 8  
  * regarding copyright ownership.  The ASF licenses this file
 9  
  * to you under the Apache License, Version 2.0 (the
 10  
  * "License"); you may not use this file except in compliance
 11  
  * with the License.  You may obtain a copy of the License at
 12  
  *
 13  
  *   http://www.apache.org/licenses/LICENSE-2.0
 14  
  *
 15  
  * Unless required by applicable law or agreed to in writing,
 16  
  * software distributed under the License is distributed on an
 17  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 18  
  * KIND, either express or implied.  See the License for the
 19  
  * specific language governing permissions and limitations
 20  
  * under the License.
 21  
  */
 22  
 
 23  
 
 24  
 import java.io.IOException;
 25  
 
 26  
 import org.apache.turbine.util.RunData;
 27  
 import org.apache.turbine.util.TurbineException;
 28  
 
 29  
 /**
 30  
  * Valve that can be used as the basis of Valve implementations.
 31  
  *
 32  
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
 33  
  * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
 34  
  * @version $Id: AbstractValve.java 757213 2009-03-22 16:43:31Z tv $
 35  
  */
 36  32
 public abstract class AbstractValve
 37  
     implements Valve
 38  
 {
 39  
     /**
 40  
      * Initialize this valve for use in a pipeline.
 41  
      *
 42  
      * @throws Exception
 43  
      */
 44  
     public void initialize()
 45  
         throws Exception
 46  
     {
 47  
         // empty
 48  856
     }
 49  
 
 50  
     /**
 51  
      * @see org.apache.turbine.Valve#invoke(PipelineData, ValveContext)
 52  
      */
 53  
     public abstract void invoke(PipelineData data, ValveContext context)
 54  
         throws IOException, TurbineException;
 55  
 
 56  
 
 57  
     /**
 58  
      * utility for getting RunData out of the pielineData object.
 59  
      * @param pipelineData
 60  
      * @return
 61  
      */
 62  
     public final RunData getRunData(PipelineData pipelineData)
 63  
     {
 64  24
         if(!(pipelineData instanceof RunData)){
 65  0
             throw new RuntimeException("Can't cast pipelineData to rundata");
 66  
         }
 67  24
         return (RunData)pipelineData;
 68  
     }
 69  
 
 70  
 }