KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > Chain


1 /*
2  * Copyright 2001-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
17 package org.apache.axis ;
18
19
20
21 /**
22  * A <code>Handler</code> that executes a 'chain' of child handlers in order.
23  *
24  * @author Doug Davis (dug@us.ibm.com.com)
25  */

26
27 public interface Chain extends Handler {
28     // fixme: if this can't be called after invoke, what exception should we
29
// document as being thrown if someone tries it?
30
/**
31      * Adds a handler to the end of the chain. May not be called after invoke.
32      *
33      * @param handler the <code>Handler</code> to be added
34      */

35     public void addHandler(Handler handler);
36
37     /**
38      * Discover if a handler is in this chain.
39      *
40      * @param handler the <code>Handler</code> to check
41      * @return <code>true</code> if it is in this chain, <code>false</code>
42      * otherwise
43      */

44     public boolean contains(Handler handler);
45
46     // fixme: do we want to use an array here, or a List? the addHandler method
47
// kind of indicates that the chain is dynamic
48
// fixme: there's nothing in this contract about whether modifying this
49
// list of handlers will modify the chain or not - seems like a bad idea to
50
// expose the stoorage as we have addHandler and contains methods.
51
// fixme: would adding an iterator, size and remove method mean we could
52
// drop this entirely?
53
/**
54      * Get the list of handlers in the chain. Is Handler[] the right form?
55      *
56      * @return an array of <code>Handler</code>s that have been added
57      */

58     public Handler[] getHandlers();
59
60     // How many do we want to force people to implement?
61
};
62
Popular Tags