##### Coverage Report - org.apache.turbine.pipeline.Pipeline

Classes in this File | Line Coverage | Branch Coverage | Complexity
Pipeline |
N/A | N/A
N/A | N/A
| 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 |  |
          * @throws Exception if the initialization fails
58 |  |
          */
59 |  |
         void initialize()
60 |  |
             throws Exception;
61 |  |
62 |  |
         /**
63 |  |
          * <p>Add a new Valve to the end of the pipeline.</p>
64 |  |
          *
65 |  |
          * @param valve Valve to be added.
66 |  |
          *
67 |  |
          * @exception IllegalStateException If the pipeline has not been
68 |  |
          * initialized.
69 |  |
          */
70 |  |
         void addValve(Valve valve);
71 |  |
72 |  |
         /**
73 |  |
          * Return the set of all Valves in the pipeline.  If there are no
74 |  |
          * such Valves, a zero-length array is returned.
75 |  |
          *
76 |  |
          * @return An array of valves.
77 |  |
          */
78 |  |
         Valve[] getValves();
79 |  |
80 |  |
         /**
81 |  |
          * <p>Cause the specified request and response to be processed by
82 |  |
          * the sequence of Valves associated with this pipeline, until one
83 |  |
          * of these Valves decides to end the processing.</p>
84 |  |
          *
85 |  |
          * <p>The implementation must ensure that multiple simultaneous
86 |  |
          * requests (on different threads) can be processed through the
87 |  |
          * same Pipeline without interfering with each other's control
88 |  |
          * flow.</p>
89 |  |
          *
90 |  |
          * @param pipelineData The run-time information, including the servlet
91 |  |
          * request and response we are processing.
92 |  |
          * @throws TurbineException if the invocation fails
93 |  |
          * @throws IOException an input/output error occurred.
94 |  |
          */
95 |  |
         void invoke(PipelineData pipelineData)
96 |  |
             throws TurbineException, IOException;
97 |  |
98 |  |
         /**
99 |  |
          * Remove the specified Valve from the pipeline, if it is found;
100 |  |
          * otherwise, do nothing.
101 |  |
          *
102 |  |
          * @param valve Valve to be removed.
103 |  |
          */
104 |  |
         void removeValve(Valve valve);
105 |  |
     }