View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.pipeline;
18  
19  import java.io.IOException;
20  
21  import org.apache.jetspeed.pipeline.valve.Valve;
22  import org.apache.jetspeed.request.RequestContext;
23  
24  /***
25   * Jetspeed Pipeline
26   *
27   * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
28   * @version $Id: Pipeline.java 516448 2007-03-09 16:25:47Z ate $
29   */
30  public interface Pipeline
31  {
32      void initialize()
33          throws PipelineException;
34      /***
35       * <p>Add a new Valve to the end of the pipeline.</p>
36       *
37       * @param valve Valve to be added.
38       *
39       * @exception IllegalStateException If the pipeline has not been
40       * initialized.
41       */
42      void addValve(Valve valve);
43  
44      /***
45       * <p>Return the set of all Valves in the pipeline.  If there are no
46       * such Valves, a zero-length array is returned.</p>
47       *
48       * @return An array of valves.
49       */
50      Valve[] getValves();
51  
52      /***
53       * <p>Cause the specified request and response to be processed by
54       * the sequence of Valves associated with this pipeline, until one
55       * of these Valves decides to end the processing.</p>
56       *
57       * <p>The implementation must ensure that multiple simultaneous
58       * requests (on different threads) can be processed through the
59       * same Pipeline without interfering with each other's control
60       * flow.</p>
61       *
62       * @param data The run-time information, including the servlet
63       * request and response we are processing.
64       *
65       * @exception IOException an input/output error occurred.
66       */
67      void invoke(RequestContext context)
68          throws PipelineException;
69  
70      /***
71       * <p>Remove the specified Valve from the pipeline, if it is found;
72       * otherwise, do nothing.</p>
73       *
74       * @param valve Valve to be removed.
75       */
76      void removeValve(Valve valve);
77      
78      /***
79       * Get the name of the pipeine
80       * 
81       * @return name of the pipeline
82       */
83      String getName();
84  
85  }