001 /*
002 * Copyright 2001-2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package javax.xml.rpc.handler;
017
018 import javax.xml.namespace.QName;
019 import java.io.Serializable;
020 import java.util.HashMap;
021 import java.util.Map;
022
023 /**
024 * The <code>javax.xml.rpc.handler.HandlerInfo</code> represents
025 * information about a handler in the HandlerChain. A HandlerInfo
026 * instance is passed in the <code>Handler.init</code> method to
027 * initialize a <code>Handler</code> instance.
028 *
029 * @version 1.0
030 * @see HandlerChain
031 */
032 public class HandlerInfo implements Serializable {
033
034 /** Default constructor. */
035 public HandlerInfo() {
036 handlerClass = null;
037 config = new HashMap();
038 }
039
040 /**
041 * Constructor for HandlerInfo.
042 *
043 * @param handlerClass Java Class for the Handler
044 * @param config Handler Configuration as a java.util.Map
045 * @param headers QNames for the header blocks processed
046 * by this Handler. QName is the qualified name
047 * of the outermost element of a header block
048 */
049 public HandlerInfo(Class handlerClass, Map config, QName[] headers) {
050
051 this.handlerClass = handlerClass;
052 this.config = config;
053 this.headers = headers;
054 }
055
056 /**
057 * Sets the Handler class.
058 *
059 * @param handlerClass Class for the Handler
060 */
061 public void setHandlerClass(Class handlerClass) {
062 this.handlerClass = handlerClass;
063 }
064
065 /**
066 * Gets the Handler class.
067 *
068 * @return Returns null if no Handler class has been
069 * set; otherwise the set handler class
070 */
071 public Class getHandlerClass() {
072 return handlerClass;
073 }
074
075 /**
076 * Sets the Handler configuration as <code>java.util.Map</code>
077 * @param config Configuration map
078 */
079 public void setHandlerConfig(Map config) {
080 this.config = config;
081 }
082
083 /**
084 * Gets the Handler configuration.
085 *
086 * @return Returns empty Map if no configuration map
087 * has been set; otherwise returns the set configuration map
088 */
089 public Map getHandlerConfig() {
090 return config;
091 }
092
093 /**
094 * Sets the header blocks processed by this Handler.
095 * @param headers QNames of the header blocks. QName
096 * is the qualified name of the outermost
097 * element of the SOAP header block
098 */
099 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