View Javadoc

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  package javax.xml.rpc.handler;
17  
18  import java.util.Iterator;
19  
20  /**
21   * The interface <code>MessageContext</code> abstracts the message
22   * context that is processed by a handler in the <code>handle</code>
23   * method.
24   *
25   * <p>The <code>MessageContext</code> interface provides methods to
26   * manage a property set. <code>MessageContext</code> properties
27   * enable handlers in a handler chain to share processing related
28   * state.
29   *
30   * @version 1.0
31   */
32  public interface MessageContext {
33  
34      /**
35       * Sets the name and value of a property associated with the
36       * <code>MessageContext</code>. If the <code>MessageContext</code>
37       * contains a value of the same property, the old value is replaced.
38       *
39       * @param  name ame of the property associated with the
40       *         <code>MessageContext</code>
41       * @param  value Value of the property
42       * @throws java.lang.IllegalArgumentException If some aspect
43       *         the property is prevents it from being stored
44       *         in the context
45       * @throws java.lang.UnsupportedOperationException If this method is
46       *         not supported.
47       */
48      public abstract void setProperty(String name, Object value);
49  
50      /**
51       * Gets the value of a specific property from the
52       * <code>MessageContext</code>.
53       *
54       * @param name the name of the property whose value is to be
55       *        retrieved
56       * @return the value of the property
57       * @throws java.lang.IllegalArgumentException if an illegal
58       *        property name is specified
59       */
60      public abstract Object getProperty(String name);
61  
62      /**
63       * Removes a property (name-value pair) from the
64       * <code>MessageContext</code>.
65       *
66       * @param  name the name of the property to be removed
67       *
68       * @throws java.lang.IllegalArgumentException if an illegal
69       *        property name is specified
70       */
71      public abstract void removeProperty(String name);
72  
73      /**
74       * Returns true if the <code>MessageContext</code> contains a property
75       * with the specified name.
76       * @param   name Name of the property whose presense is to be tested
77       * @return  Returns true if the MessageContext contains the
78       *     property; otherwise false
79       */
80      public abstract boolean containsProperty(String name);
81  
82      /**
83       * Returns an Iterator view of the names of the properties
84       * in this <code>MessageContext</code>.
85       *
86       * @return Iterator for the property names
87       */
88      public abstract Iterator getPropertyNames();
89  }
90