KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > pipelines > Pipeline


1 /*
2  * Copyright 2000-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.jahia.pipelines;
17
18 import org.jahia.pipelines.valves.Valve;
19
20 /**
21  *
22  * @author <a HREF="mailto:david@bluesunrise.com">David Sean Taylor</a>
23  * @version $Id: Pipeline.java 9810 2005-07-07 10:12:18Z tdraier $
24  */

25 public interface Pipeline {
26
27     void initialize ()
28         throws PipelineException;
29
30     /**
31      * <p>Add a new Valve to the end of the pipeline.</p>
32      *
33      * @param valve Valve to be added.
34      *
35      * @exception IllegalStateException If the pipeline has not been
36      * initialized.
37      */

38     void addValve (Valve valve);
39
40     /**
41      * <p>Return the set of all Valves in the pipeline. If there are no
42      * such Valves, a zero-length array is returned.</p>
43      *
44      * @return An array of valves.
45      */

46     Valve[] getValves ();
47
48     /**
49      * <p>Cause the specified request and response to be processed by
50      * the sequence of Valves associated with this pipeline, until one
51      * of these Valves decides to end the processing.</p>
52      *
53      * <p>The implementation must ensure that multiple simultaneous
54      * requests (on different threads) can be processed through the
55      * same Pipeline without interfering with each other's control
56      * flow.</p>
57      *
58      * @param context The run-time information, including the servlet
59      * request and response we are processing.
60      *
61      * @exception PipelineException an input/output error occurred.
62      */

63     void invoke (Object JavaDoc context)
64         throws PipelineException;
65
66     /**
67      * <p>Remove the specified Valve from the pipeline, if it is found;
68      * otherwise, do nothing.</p>
69      *
70      * @param valve Valve to be removed.
71      */

72     void removeValve (Valve valve);
73
74     // BEGIN [added by Pascal Aubry for CAS authentication]
75
/**
76      * <p>Tell if (at least) one of the valves of the pipeline is an instance
77      * of a given class or interface.</p>
78      * @param c the class or interface
79      * @return
80      */

81     public boolean hasValveOfClass(Class JavaDoc c);
82
83     /**
84      * <p>Return the first valve of the pipeline that is an instance
85      * of a given class or interface.</p>
86      * @param c the class or interface
87      * @return a Valve instance, or null if no valve matches.
88      */

89     public Valve getFirstValveOfClass(Class JavaDoc c);
90     // END [added by Pascal Aubry for CAS authentication]
91

92     /**
93      * <p>Set the descriptor used to create this pipeline.</p>
94      */

95     void setDescriptor(PipelineDescriptor pipelineDescriptor);
96
97     /**
98      * <p>Get the descriptor used to create this pipeline.</p>
99      */

100     PipelineDescriptor getDescriptor();
101
102 }
103
Popular Tags