Home » xml-commons-external-1.4.01-src » javax » xml » rpc » handler » [javadoc | source]

    1   /*
    2    * JBoss, Home of Professional Open Source.
    3    * Copyright 2006, Red Hat Middleware LLC, and individual contributors
    4    * as indicated by the @author tags. See the copyright.txt file in the
    5    * distribution for a full listing of individual contributors.
    6    *
    7    * This is free software; you can redistribute it and/or modify it
    8    * under the terms of the GNU Lesser General Public License as
    9    * published by the Free Software Foundation; either version 2.1 of
   10    * the License, or (at your option) any later version.
   11    *
   12    * This software is distributed in the hope that it will be useful,
   13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   15    * Lesser General Public License for more details.
   16    *
   17    * You should have received a copy of the GNU Lesser General Public
   18    * License along with this software; if not, write to the Free
   19    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   20    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   21    */
   22   package javax.xml.rpc.handler;
   23   
   24   import java.io.Serializable;
   25   import java.util.Arrays;
   26   import java.util.HashMap;
   27   import java.util.List;
   28   import java.util.Map;
   29   
   30   import javax.xml.namespace.QName;
   31   
   32   /** This represents information about a handler in the HandlerChain. A
   33    * HandlerInfo instance is passed in the Handler.init method to initialize a
   34    * Handler instance.
   35    * 
   36    * @author Scott.Stark@jboss.org
   37    */
   38   public class HandlerInfo implements Serializable
   39   {
   40      private static final long serialVersionUID = -6735139577513563610L;
   41   
   42      private Class handlerClass;
   43      private Map configMap = new HashMap();
   44      private QName[] headers;
   45   
   46      /** Default constructor */
   47      public HandlerInfo()
   48      {
   49      }
   50   
   51      /** Constructor for HandlerInfo
   52       *
   53       * @param handlerClass Java Class for the Handler
   54       * @param config Handler Configuration as a java.util.Map
   55       * @param headers QNames for the header blocks processed by this Handler.
   56       * QName is the qualified name of the outermost element of a header block
   57       */
   58      public HandlerInfo(Class handlerClass, Map config, QName[] headers)
   59      {
   60         this.handlerClass = handlerClass;
   61         this.headers = headers;
   62         if (config != null)
   63            this.configMap.putAll(config);
   64      }
   65   
   66      /** Gets the Handler class
   67       *
   68       * @return Returns null if no Handler class has been set; otherwise the set handler class
   69       */
   70      public Class getHandlerClass()
   71      {
   72         return handlerClass;
   73      }
   74   
   75      /** Sets the Handler class
   76       *
   77       * @param handlerClass Class for the Handler
   78       */
   79      public void setHandlerClass(Class handlerClass)
   80      {
   81         this.handlerClass = handlerClass;
   82      }
   83   
   84      /** Gets the Handler configuration
   85       *
   86       * @return Returns empty Map if no configuration map has been set; otherwise returns the set configuration map
   87       */
   88      public Map getHandlerConfig()
   89      {
   90         return new HashMap(configMap);
   91      }
   92   
   93      /** Sets the Handler configuration as java.util.Map
   94       *
   95       * @param config Configuration map
   96       */
   97      public void setHandlerConfig(Map config)
   98      {
   99         configMap.clear();
  100         if (config != null)
  101            configMap.putAll(config);
  102      }
  103   
  104      /** Gets the header blocks processed by this Handler.
  105       *
  106       * @return Array of QNames for the header blocks. Returns null if no header blocks have been set using the setHeaders method.
  107       */
  108      public QName[] getHeaders()
  109      {
  110         return headers;
  111      }
  112   
  113      /** Sets the header blocks processed by this Handler.
  114       *
  115       * @param qnames QNames of the header blocks. QName is the qualified name of the outermost element of the SOAP header block
  116       */
  117      public void setHeaders(QName[] qnames)
  118      {
  119         headers = qnames;
  120      }
  121   
  122      /** Returns a string representation of the object.
  123       */
  124      public String toString()
  125      {
  126         List hlist = (headers != null ? Arrays.asList(headers) : null);
  127         return "[class=" + handlerClass.getName() + ",headers=" + hlist + ",config=" + configMap + "]";
  128      }
  129   }

Home » xml-commons-external-1.4.01-src » javax » xml » rpc » handler » [javadoc | source]