You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by rs...@apache.org on 2002/05/09 20:07:30 UTC

cvs commit: xml-axis/java/src/org/apache/axis/handlers BasicHandler.java

rsitze      02/05/09 11:07:30

  Modified:    java/src/org/apache/axis/handlers BasicHandler.java
  Log:
  Added method to 'optionally' set properties, i.e. defaults.
  
  Revision  Changes    Path
  1.29      +25 -4     xml-axis/java/src/org/apache/axis/handlers/BasicHandler.java
  
  Index: BasicHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/BasicHandler.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- BasicHandler.java	23 Apr 2002 03:54:25 -0000	1.28
  +++ BasicHandler.java	9 May 2002 18:07:30 -0000	1.29
  @@ -86,7 +86,10 @@
       protected Hashtable options;
       protected String name;
   
  -    /** Should this Handler use a LockableHashtable for options? */
  +
  +    /**
  +     * Should this Handler use a LockableHashtable for options?
  +     */
       protected void initHashtable(boolean makeLockable)
       {
           if (makeLockable) {
  @@ -99,7 +102,6 @@
       /** Stubbed-out methods.  Override in your child class to implement
        * any real behavior.
        */
  -
       public void init()
       {
       }
  @@ -116,6 +118,7 @@
       public void onFault(MessageContext msgContext)
       {
       }
  +
       /** Must implement this in subclasses.
        */
       public abstract void invoke(MessageContext msgContext) throws AxisFault;
  @@ -127,6 +130,24 @@
           if ( options == null ) initHashtable(false);
           options.put( name, value );
       }
  +
  +    /**
  +     * Set a default value for the given option:
  +     * if the option is not already set, then set it.
  +     * if the option is already set, then do not set it.
  +     * <p>
  +     * If this is called multiple times, the first with a non-null value
  +     * if 'value' will set the default, remaining calls will be ignored.
  +     * <p>
  +     * Returns true if value set (by this call), otherwise false;
  +     */
  +    public boolean setOptionDefault(String name, Object value) {
  +        boolean val = (options == null  || options.get(name) == null) && value != null;
  +        if (val) {
  +            setOption(name, value);
  +        }
  +        return val;
  +    }
       
       /**
        * Returns the option corresponding to the 'name' given
  @@ -164,7 +185,7 @@
       }
   
       public Element getDeploymentData(Document doc) {
  -        log.debug(JavaUtils.getMessage("enter00", "BasicHandler::getDeploymentData") );
  +        log.debug("Enter: BasicHandler::getDeploymentData");
   
           Element  root = doc.createElementNS("", "handler");
   
  @@ -181,7 +202,7 @@
                   root.appendChild( e1 );
               }
           }
  -        log.debug(JavaUtils.getMessage("exit00", "BasicHandler::getDeploymentData") );
  +        log.debug("Exit: BasicHandler::getDeploymentData");
           return( root );
       }