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 javax.xml.namespace.QName;
19  import java.io.Serializable;
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  /**
24   * The <code>javax.xml.rpc.handler.HandlerInfo</code> represents
25   * information about a handler in the HandlerChain. A HandlerInfo
26   * instance is passed in the <code>Handler.init</code> method to
27   * initialize a <code>Handler</code> instance.
28   *
29   * @version 1.0
30   * @see HandlerChain
31   */
32  public class HandlerInfo implements Serializable {
33  
34      /** Default constructor. */
35      public HandlerInfo() {
36          handlerClass = null;
37          config       = new HashMap();
38      }
39  
40      /**
41       *  Constructor for HandlerInfo.
42       *
43       *  @param  handlerClass Java Class for the Handler
44       *  @param  config Handler Configuration as a java.util.Map
45       *  @param  headers QNames for the header blocks processed
46       *          by this Handler.  QName is the qualified name
47       *          of the outermost element of a header block
48       */
49      public HandlerInfo(Class handlerClass, Map config, QName[] headers) {
50  
51          this.handlerClass = handlerClass;
52          this.config       = config;
53          this.headers      = headers;
54      }
55  
56      /**
57       *  Sets the Handler class.
58       *
59       *  @param  handlerClass Class for the Handler
60       */
61      public void setHandlerClass(Class handlerClass) {
62          this.handlerClass = handlerClass;
63      }
64  
65      /**
66       *  Gets the Handler class.
67       *
68       *  @return Returns null if no Handler class has been
69       *    set; otherwise the set handler class
70       */
71      public Class getHandlerClass() {
72          return handlerClass;
73      }
74  
75      /**
76       *  Sets the Handler configuration as <code>java.util.Map</code>
77       *  @param  config Configuration map
78       */
79      public void setHandlerConfig(Map config) {
80          this.config = config;
81      }
82  
83      /**
84       *  Gets the Handler configuration.
85       *
86       *  @return  Returns empty Map if no configuration map
87       *     has been set; otherwise returns the set configuration map
88       */
89      public Map getHandlerConfig() {
90          return config;
91      }
92  
93      /**
94       * Sets the header blocks processed by this Handler.
95       * @param headers QNames of the header blocks. QName
96       *            is the qualified name of the outermost
97       *            element of the SOAP header block
98       */
99      public void setHeaders(QName[] headers) {
100         this.headers = headers;
101     }
102 
103     /**
104      * Gets the header blocks processed by this Handler.
105      * @return Array of QNames for the header blocks. Returns
106      *      <code>null</code> if no header blocks have been
107      *      set using the <code>setHeaders</code> method.
108      */
109     public QName[] getHeaders() {
110         return headers;
111     }
112 
113     /** Handler Class. */
114     private Class handlerClass;
115 
116     /** Configuration Map. */
117     private Map config;
118 
119     /** Headers. */
120     private QName[] headers;
121 }
122