| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbstractValve |
|
| 1.6666666666666667;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 1706239 2015-10-01 13:18:35Z tv $ | |
| 35 | */ | |
| 36 | 13 | public abstract class AbstractValve |
| 37 | implements Valve | |
| 38 | { | |
| 39 | /** | |
| 40 | * Initialize this valve for use in a pipeline. | |
| 41 | * | |
| 42 | * @throws Exception | |
| 43 | */ | |
| 44 | @Override | |
| 45 | public void initialize() | |
| 46 | throws Exception | |
| 47 | { | |
| 48 | // empty | |
| 49 | 375 | } |
| 50 | ||
| 51 | /** | |
| 52 | * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext) | |
| 53 | */ | |
| 54 | @Override | |
| 55 | public abstract void invoke(PipelineData data, ValveContext context) | |
| 56 | throws IOException, TurbineException; | |
| 57 | ||
| 58 | ||
| 59 | /** | |
| 60 | * utility for getting RunData out of the pipelineData object. | |
| 61 | * @param pipelineData | |
| 62 | * @return the RunData object extracted from pipelineData | |
| 63 | */ | |
| 64 | public final RunData getRunData(PipelineData pipelineData) | |
| 65 | { | |
| 66 | 10 | if(!(pipelineData instanceof RunData)) |
| 67 | { | |
| 68 | 0 | throw new RuntimeException("Can't cast pipelineData to rundata"); |
| 69 | } | |
| 70 | 10 | return (RunData)pipelineData; |
| 71 | } | |
| 72 | ||
| 73 | } |