001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package javax.xml.rpc.handler;
021    
022    import javax.xml.namespace.QName;
023    import java.io.Serializable;
024    import java.util.HashMap;
025    import java.util.Map;
026    
027    /**
028     * The <code>javax.xml.rpc.handler.HandlerInfo</code> represents
029     * information about a handler in the HandlerChain. A HandlerInfo
030     * instance is passed in the <code>Handler.init</code> method to
031     * initialize a <code>Handler</code> instance.
032     *
033     * @version $Rev: 467553 $ $Date: 2006-10-25 00:01:51 -0400 (Wed, 25 Oct 2006) $
034     * @see HandlerChain
035     */
036    public class HandlerInfo implements Serializable {
037    
038        /** Default constructor. */
039        public HandlerInfo() {
040            handlerClass = null;
041            config       = new HashMap();
042        }
043    
044        /**
045         *  Constructor for HandlerInfo.
046         *
047         *  @param  handlerClass Java Class for the Handler
048         *  @param  config Handler Configuration as a java.util.Map
049         *  @param  headers QNames for the header blocks processed
050         *          by this Handler.  QName is the qualified name
051         *          of the outermost element of a header block
052         */
053        public HandlerInfo(Class handlerClass, Map config, QName[] headers) {
054    
055            this.handlerClass = handlerClass;
056            this.config       = config;
057            this.headers      = headers;
058        }
059    
060        /**
061         *  Sets the Handler class.
062         *
063         *  @param  handlerClass Class for the Handler
064         */
065        public void setHandlerClass(Class handlerClass) {
066            this.handlerClass = handlerClass;
067        }
068    
069        /**
070         *  Gets the Handler class.
071         *
072         *  @return Returns null if no Handler class has been
073         *    set; otherwise the set handler class
074         */
075        public Class getHandlerClass() {
076            return handlerClass;
077        }
078    
079        /**
080         *  Sets the Handler configuration as <code>java.util.Map</code>
081         *  @param  config Configuration map
082         */
083        public void setHandlerConfig(Map config) {
084            this.config = config;
085        }
086    
087        /**
088         *  Gets the Handler configuration.
089         *
090         *  @return  Returns empty Map if no configuration map
091         *     has been set; otherwise returns the set configuration map
092         */
093        public Map getHandlerConfig() {
094            return config;
095        }
096    
097        /**
098         * Sets the header blocks processed by this Handler.
099         * @param headers QNames of the header blocks. QName
100         *            is the qualified name of the outermost
101         *            element of the SOAP header block
102         */
103        public void setHeaders(QName[] headers) {
104            this.headers = headers;
105        }
106    
107        /**
108         * Gets the header blocks processed by this Handler.
109         * @return Array of QNames for the header blocks. Returns
110         *      <code>null</code> if no header blocks have been
111         *      set using the <code>setHeaders</code> method.
112         */
113        public QName[] getHeaders() {
114            return headers;
115        }
116    
117        /** Handler Class. */
118        private Class handlerClass;
119    
120        /** Configuration Map. */
121        private Map config;
122    
123        /** Headers. */
124        private QName[] headers;
125    }
126