| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Pipeline |
|
| 1.0;1 |
| 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.TurbineException; | |
| 27 | ||
| 28 | /** | |
| 29 | * The idea of a pipeline is being taken from Catalina | |
| 30 | * in its entirety :-) | |
| 31 | * | |
| 32 | * I would like to take the idea further and implement | |
| 33 | * Valves instead of hardcoding particular methods | |
| 34 | * in a pipeline. | |
| 35 | * | |
| 36 | * It would be more flexible to specify Valves for | |
| 37 | * a pipeline in an XML file (we can also rip off the | |
| 38 | * digester rules from T4) and have invoke() as part | |
| 39 | * of the interface. | |
| 40 | * | |
| 41 | * So a set of Valves would be added to the pipeline | |
| 42 | * and the pipeline would 'invoke' each valve. In the | |
| 43 | * case Turbine each Valve would produce some output | |
| 44 | * to be sent out the pipe. I think with another days | |
| 45 | * work this can be fully working. The first pipeline | |
| 46 | * to be fully implemented will the ClassicPipeline | |
| 47 | * will emulate the Turbine 2.1 way of doing things. | |
| 48 | * | |
| 49 | * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> | |
| 50 | * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> | |
| 51 | * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> | |
| 52 | */ | |
| 53 | public interface Pipeline | |
| 54 | { | |
| 55 | /** | |
| 56 | * Initializes this instance. Called once by the Turbine servlet. | |
| 57 | */ | |
| 58 | public void initialize() | |
| 59 | throws Exception; | |
| 60 | ||
| 61 | /** | |
| 62 | * <p>Add a new Valve to the end of the pipeline.</p> | |
| 63 | * | |
| 64 | * @param valve Valve to be added. | |
| 65 | * | |
| 66 | * @exception IllegalStateException If the pipeline has not been | |
| 67 | * initialized. | |
| 68 | */ | |
| 69 | public void addValve(Valve valve); | |
| 70 | ||
| 71 | /** | |
| 72 | * Return the set of all Valves in the pipeline. If there are no | |
| 73 | * such Valves, a zero-length array is returned. | |
| 74 | * | |
| 75 | * @return An array of valves. | |
| 76 | */ | |
| 77 | public Valve[] getValves(); | |
| 78 | ||
| 79 | /** | |
| 80 | * <p>Cause the specified request and response to be processed by | |
| 81 | * the sequence of Valves associated with this pipeline, until one | |
| 82 | * of these Valves decides to end the processing.</p> | |
| 83 | * | |
| 84 | * <p>The implementation must ensure that multiple simultaneous | |
| 85 | * requests (on different threads) can be processed through the | |
| 86 | * same Pipeline without interfering with each other's control | |
| 87 | * flow.</p> | |
| 88 | * | |
| 89 | * @param data The run-time information, including the servlet | |
| 90 | * request and response we are processing. | |
| 91 | * | |
| 92 | * @exception IOException an input/output error occurred. | |
| 93 | */ | |
| 94 | public void invoke(PipelineData data) | |
| 95 | throws TurbineException, IOException; | |
| 96 | ||
| 97 | /** | |
| 98 | * Remove the specified Valve from the pipeline, if it is found; | |
| 99 | * otherwise, do nothing. | |
| 100 | * | |
| 101 | * @param valve Valve to be removed. | |
| 102 | */ | |
| 103 | public void removeValve(Valve valve); | |
| 104 | } |