You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Hans Granqvist <ha...@apache.org> on 2005/09/27 00:56:23 UTC

handler cleanup

Hi all, 

Some diffs to clean up build.xml and handler code as follows.
See what you think.

* Wrap lines at 80 chars (so files are readable on my VT220 ;)

* avoid wsdl2java'ing when not needed (task chkwsdl
  in interop/build.xml)

* build.xml does not dump classpaths etc unless invoked with 
  debug

* replace pattern throughout handlers

    if ((x = (String) getOption(WSHandlerConstants.X)) == null)
{
        x = (String) ((MessageContext)reqData.getMsgContext())
                        .getProperty(WSHandlerConstants.X);
     }

  with something a la:

  x = getString(WSHandlerConstants.X, reqData.getMsgContext()); 


Hans

Re: handler cleanup

Posted by Davanum Srinivas <da...@gmail.com>.
+1 Please feel free to commit

-- dims

On 9/26/05, Hans Granqvist <ha...@apache.org> wrote:
> Hi all,
>
> Some diffs to clean up build.xml and handler code as follows.
> See what you think.
>
> * Wrap lines at 80 chars (so files are readable on my VT220 ;)
>
> * avoid wsdl2java'ing when not needed (task chkwsdl
>   in interop/build.xml)
>
> * build.xml does not dump classpaths etc unless invoked with
>   debug
>
> * replace pattern throughout handlers
>
>     if ((x = (String) getOption(WSHandlerConstants.X)) == null)
> {
>         x = (String) ((MessageContext)reqData.getMsgContext())
>                         .getProperty(WSHandlerConstants.X);
>      }
>
>   with something a la:
>
>   x = getString(WSHandlerConstants.X, reqData.getMsgContext());
>
>
> Hans
>
>
> Index: interop/build.xml
> ===================================================================
> --- interop/build.xml   (revision 291771)
> +++ interop/build.xml   (working copy)
> @@ -46,18 +46,30 @@
>          </java>
>      </target>
>
> -    <target name="compile">
> -        <mkdir dir="${dir.work}"/>
> -        <axis-wsdl2java
> -            output="${dir.work}"
> -            serverSide="yes"
> -            testcase="no"
> -            verbose="no"
> -            url="${dir.interop}/ping.wsdl">
> -            <mapping
> -                namespace="http://xmlsoap.org/Ping"
> -                package="org.apache.ws.axis.oasis.ping"/>
> -        </axis-wsdl2java>
> +    <target name="chkWsdl">
> +      <uptodate property="wsdl.notRequired"
> +        targetfile="${dir.work}/${server}/PingBindingImpl.java"
> +        srcfile="${dir.interop}/ping.wsdl"/>
> +    </target>
> +
> +    <target name="wsdl" depends="chkWsdl" unless="wsdl.notRequired">
> +      <axis-wsdl2java
> +          output="${dir.work}"
> +          serverSide="yes"
> +          testcase="no"
> +          verbose="no"
> +          url="${dir.interop}/ping.wsdl">
> +          <mapping
> +              namespace="http://xmlsoap.org/Ping"
> +              package="org.apache.ws.axis.oasis.ping"/>
> +      </axis-wsdl2java>
> +    </target>
> +
> +    <target name="init">
> +      <mkdir dir="${dir.work}"/>
> +    </target>
> +
> +    <target name="compile" depends="init, wsdl">
>          <copy todir="${dir.work}/${server}" overwrite="yes">
>            <fileset dir="${dir.interop}/${server}">
>              <include name="*.java"/>
> Index: src/org/apache/ws/axis/security/WSDoAllSender.java
> ===================================================================
> --- src/org/apache/ws/axis/security/WSDoAllSender.java  (revision 291771)
> +++ src/org/apache/ws/axis/security/WSDoAllSender.java  (working copy)
> @@ -70,19 +70,15 @@
>
>          reqData.setMsgContext(mc);
>          /*
> -           * The overall try, just to have a finally at the end to perform some
> -           * housekeeping.
> -           */
> +        * The overall try, just to have a finally at the end to perform some
> +        * housekeeping.
> +        */
>          try {
>              /*
> -                * Get the action first.
> -                */
> +            * Get the action first.
> +            */
>              Vector actions = new Vector();
> -            String action = null;
> -            if ((action = (String) getOption(WSHandlerConstants.ACTION)) == null) {
> -                action = (String) ((MessageContext)reqData.getMsgContext())
> -                        .getProperty(WSHandlerConstants.ACTION);
> -            }
> +           String action = getString(WSHandlerConstants.ACTION, mc);
>              if (action == null) {
>                  throw new AxisFault("WSDoAllSender: No action defined");
>              }
> Index: src/org/apache/ws/axis/security/handler/WSDoAllHandler.java
> ===================================================================
> --- src/org/apache/ws/axis/security/handler/WSDoAllHandler.java (revision 291771)
> +++ src/org/apache/ws/axis/security/handler/WSDoAllHandler.java (working copy)
> @@ -107,11 +107,20 @@
>      }
>
>      /**
> -     * Returns the option corresponding to the 'name' given
> +     * Returns the option corresponding to <code>name</code>.
> +     *
> +     * @param name the non-null name of the option.
> +     * @return the option on <code>name</code> if <code>name</code>
> +     *  exists; otherwise null.
>       */
>      public Object getOption(String name) {
> -        if (options == null) return (null);
> -        return (options.get(name));
> +       if (name == null) {
> +           throw new IllegalArgumentException("name cannot be null");
> +       }
> +        if (options == null) {
> +           return null;
> +       }
> +        return options.get(name);
>      }
>
>      /**
> Index: src/org/apache/ws/security/handler/WSHandler.java
> ===================================================================
> --- src/org/apache/ws/security/handler/WSHandler.java   (revision 291771)
> +++ src/org/apache/ws/security/handler/WSHandler.java   (working copy)
> @@ -33,6 +33,7 @@
>  import org.apache.ws.security.util.WSSecurityUtil;
>  import org.apache.ws.security.util.XmlSchemaDateFormat;
>  import org.w3c.dom.Document;
> +//import org.apache.axis.MessageContext;
>
>  import javax.security.auth.callback.Callback;
>  import javax.security.auth.callback.CallbackHandler;
> @@ -68,25 +69,24 @@
>       * @param doAction a set defining the actions to do
>       * @param doc   the request as DOM document
>       * @param reqData a data storage to pass values around bewteen methods
> -     * @param actions a vector holding the actions to do in the order defined in
> -     *                the deployment file or property
> +     * @param actions a vector holding the actions to do in the order defined
> +     *                in the deployment file or property
>       * @throws WSSecurityException
>       */
>      protected void doSenderAction(int doAction, Document doc,
> -                                  RequestData reqData, Vector actions, boolean isRequest)
> +                                  RequestData reqData, Vector actions,
> +                                 boolean isRequest)
>              throws WSSecurityException {
>
>          boolean mu = decodeMustUnderstand(reqData);
>
>          WSSConfig wssConfig = WSSConfig.getNewInstance();
> -        wssConfig.setPrecisionInMilliSeconds(decodeTimestampPrecision(reqData));
> +        wssConfig
> +           .setPrecisionInMilliSeconds(decodeTimestampPrecision(reqData));
>          reqData.setWssConfig(wssConfig);
>
> -        String actor = null;
> -        if ((actor = (String) getOption(WSHandlerConstants.ACTOR)) == null) {
> -            actor = (String) getProperty(reqData.getMsgContext(),
> -                    WSHandlerConstants.ACTOR);
> -        }
> +       Object mc = reqData.getMsgContext();
> +        String actor = getString(WSHandlerConstants.ACTOR, mc);
>          reqData.setActor(actor);
>
>          reqData.setSoapConstants(WSSecurityUtil.getSOAPConstants(doc
> @@ -309,25 +309,23 @@
>       * Hook to allow subclasses to load their Signature Crypto however they see
>       * fit.
>       */
> -    public Crypto loadSignatureCrypto(RequestData reqData) throws WSSecurityException {
> +    public Crypto loadSignatureCrypto(RequestData reqData)
> +       throws WSSecurityException {
>          Crypto crypto = null;
>          /*
>          * Get crypto property file for signature. If none specified throw
>          * fault, otherwise get a crypto instance.
>          */
> -        String sigPropFile = null;
> -        if ((sigPropFile = (String) getOption(WSHandlerConstants.SIG_PROP_FILE))
> -                == null) {
> -            sigPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_PROP_FILE);
> -        }
> +        String sigPropFile = getString(WSHandlerConstants.SIG_PROP_FILE,
> +                                      reqData.getMsgContext());
>          if (sigPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(sigPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(sigPropFile);
>                  cryptos.put(sigPropFile, crypto);
>              }
>          } else {
> -            throw new WSSecurityException("WSHandler: Signature: no crypto property file");
> +            throw new WSSecurityException(
> +                "WSHandler: Signature: no crypto property file");
>          }
>          return crypto;
>      }
> @@ -336,93 +334,87 @@
>       * Hook to allow subclasses to load their Encryption Crypto however they
>       * see fit.
>       */
> -    protected Crypto loadEncryptionCrypto(RequestData reqData) throws WSSecurityException {
> +    protected Crypto loadEncryptionCrypto(RequestData reqData)
> +       throws WSSecurityException {
>          Crypto crypto = null;
>          /*
>          * Get encryption crypto property file. If non specified take crypto
>          * instance from signature, if that fails: throw fault
>          */
> -        String encPropFile = null;
> -        if ((encPropFile = (String) getOption(WSHandlerConstants.ENC_PROP_FILE))
> -                == null) {
> -            encPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_PROP_FILE);
> -        }
> +        String encPropFile = getString(WSHandlerConstants.ENC_PROP_FILE,
> +                                      reqData.getMsgContext());
>          if (encPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(encPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(encPropFile);
>                  cryptos.put(encPropFile, crypto);
>              }
>          } else if ((crypto = reqData.getSigCrypto()) == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no crypto property file");
> +            throw new WSSecurityException(
> +                "WSHandler: Encryption: no crypto property file");
>          }
>          return crypto;
>      }
>
> -    protected void decodeUTParameter(RequestData reqData) throws WSSecurityException {
> -        reqData.setPwType((String) getOption(WSHandlerConstants.PASSWORD_TYPE));
> -        if (reqData.getPwType() == null) {
> -            reqData.setPwType((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.PASSWORD_TYPE));
> +    protected void decodeUTParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +
> +        String type = getString(WSHandlerConstants.PASSWORD_TYPE, mc);
> +       reqData.setPwType(type);
> +        if (type != null) {
> +            reqData.setPwType(type.equals(WSConstants.PW_TEXT)
> +                             ? WSConstants.PASSWORD_TEXT
> +                             : WSConstants.PASSWORD_DIGEST);
>          }
> -        if (reqData.getPwType() != null) {
> -            reqData.setPwType(reqData.getPwType().equals(WSConstants.PW_TEXT)
> -                ? WSConstants.PASSWORD_TEXT
> -                : WSConstants.PASSWORD_DIGEST);
> +
> +        String add = getString(WSHandlerConstants.ADD_UT_ELEMENTS, mc);
> +        if (add != null) {
> +            reqData.setUtElements(StringUtil.split(add, ' '));
>          }
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ADD_UT_ELEMENTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ADD_UT_ELEMENTS);
> -        }
> -        if (tmpS != null) {
> -            reqData.setUtElements(StringUtil.split(tmpS, ' '));
> -        }
>      }
>
> -    protected void decodeSignatureParameter(RequestData reqData) throws WSSecurityException {
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.SIG_KEY_ID)) == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_KEY_ID);
> -        }
> -        if (tmpS != null) {
> -            Integer I = (Integer) WSHandlerConstants.keyIdentifier.get(tmpS);
> -            if (I == null) {
> -                throw new WSSecurityException("WSHandler: Signature: unknown key identification");
> +    protected void decodeSignatureParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +        String keyId = getString(WSHandlerConstants.SIG_KEY_ID, mc);
> +        if (keyId != null) {
> +            Integer id = (Integer) WSHandlerConstants.keyIdentifier.get(keyId);
> +            if (id == null) {
> +                throw new WSSecurityException(
> +                     "WSHandler: Signature: unknown key identification");
>              }
> -            reqData.setSigKeyId(I.intValue());
> -            if (!(reqData.getSigKeyId() == WSConstants.ISSUER_SERIAL
> -                    || reqData.getSigKeyId() == WSConstants.BST_DIRECT_REFERENCE
> -                    || reqData.getSigKeyId() == WSConstants.X509_KEY_IDENTIFIER
> -                    || reqData.getSigKeyId() == WSConstants.SKI_KEY_IDENTIFIER
> -                    || reqData.getSigKeyId() == WSConstants.THUMBPRINT_IDENTIFIER)) {
> -                throw new WSSecurityException("WSHandler: Signature: illegal key identification");
> +            int tmp = id.intValue();
> +            if (!(tmp == WSConstants.ISSUER_SERIAL
> +                 || tmp == WSConstants.BST_DIRECT_REFERENCE
> +                 || tmp == WSConstants.X509_KEY_IDENTIFIER
> +                 || tmp == WSConstants.SKI_KEY_IDENTIFIER
> +                 || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
> +                throw new WSSecurityException(
> +                        "WSHandler: Signature: illegal key identification");
>              }
> +            reqData.setSigKeyId(tmp);
>          }
> -        reqData.setSigAlgorithm((String) getOption(WSHandlerConstants.SIG_ALGO));
> -        if (reqData.getSigAlgorithm() == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_ALGO);
> +        String algo = getString(WSHandlerConstants.SIG_ALGO, mc);
> +        reqData.setSigAlgorithm(algo);
> +
> +        String parts = getString(WSHandlerConstants.SIGNATURE_PARTS, mc);
> +        if (parts != null) {
> +            splitEncParts(parts, reqData.getSignatureParts(), reqData);
>          }
> -        if ((tmpS = (String) getOption(WSHandlerConstants.SIGNATURE_PARTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIGNATURE_PARTS);
> -        }
> -        if (tmpS != null) {
> -            splitEncParts(tmpS, reqData.getSignatureParts(), reqData);
> -        }
>      }
>
> -    protected void decodeEncryptionParameter(RequestData reqData) throws WSSecurityException {
> -        reqData.setEncUser((String) getOption(WSHandlerConstants.ENCRYPTION_USER));
> -        if (reqData.getEncUser() == null) {
> -            reqData.setEncUser((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENCRYPTION_USER));
> -        }
> -        if (reqData.getEncUser() == null) {
> +    protected void decodeEncryptionParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +        String encUser = getString(WSHandlerConstants.ENCRYPTION_USER, mc);
> +
> +        if (encUser != null) {
> +           reqData.setEncUser(encUser);
> +        } else {
>              reqData.setEncUser(reqData.getUsername());
> -        }
> +       }
>          if (reqData.getEncUser() == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no username");
> +           throw new WSSecurityException("WSHandler: Encryption: no username");
>          }
>          /*
>          * String msgType = msgContext.getCurrentMessage().getMessageType(); if
> @@ -430,80 +422,61 @@
>          * handleSpecialUser(encUser); }
>          */
>          handleSpecialUser(reqData);
> -
> +
>          /*
>          * If the following parameters are no used (they return null) then the
>          * default values of WSS4J are used.
>          */
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ENC_KEY_ID)) == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_ID);
> -        }
> -        if (tmpS != null) {
> -            Integer I = (Integer) WSHandlerConstants.keyIdentifier.get(tmpS);
> -            if (I == null) {
> -                throw new WSSecurityException("WSHandler: Encryption: unknown key identification");
> +        String encKeyId = getString(WSHandlerConstants.ENC_KEY_ID, mc);
> +        if (encKeyId != null) {
> +            Integer id = (Integer) WSHandlerConstants
> +               .keyIdentifier.get(encKeyId);
> +            if (id == null) {
> +                throw new WSSecurityException(
> +                     "WSHandler: Encryption: unknown key identification");
>              }
> -            reqData.setEncKeyId(I.intValue());
> -            if (!(reqData.getEncKeyId() == WSConstants.ISSUER_SERIAL
> -                    || reqData.getEncKeyId() == WSConstants.X509_KEY_IDENTIFIER
> -                    || reqData.getEncKeyId() == WSConstants.SKI_KEY_IDENTIFIER
> -                    || reqData.getEncKeyId() == WSConstants.BST_DIRECT_REFERENCE
> -                    || reqData.getEncKeyId() == WSConstants.EMBEDDED_KEYNAME
> -                    || reqData.getSigKeyId() == WSConstants.THUMBPRINT_IDENTIFIER)) {
> -                throw new WSSecurityException("WSHandler: Encryption: illegal key identification");
> +            int tmp = id.intValue();
> +           reqData.setEncKeyId(tmp);
> +           if (!(tmp == WSConstants.ISSUER_SERIAL
> +                 || tmp == WSConstants.X509_KEY_IDENTIFIER
> +                 || tmp == WSConstants.SKI_KEY_IDENTIFIER
> +                 || tmp == WSConstants.BST_DIRECT_REFERENCE
> +                 || tmp == WSConstants.EMBEDDED_KEYNAME
> +                 || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
> +                throw new WSSecurityException(
> +                          "WSHandler: Encryption: illegal key identification");
>              }
> -        }
> +       }
> +        String encSymAlgo = getString(WSHandlerConstants.ENC_SYM_ALGO, mc);
> +        reqData.setEncSymmAlgo(encSymAlgo);
>
> -        reqData.setEncSymmAlgo((String) getOption(WSHandlerConstants.ENC_SYM_ALGO));
> -        if (reqData.getEncSymmAlgo() == null) {
> -            reqData.setEncSymmAlgo((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_SYM_ALGO));
> -        }
> +        String encKeyTransport
> +           = getString(WSHandlerConstants.ENC_KEY_TRANSPORT, mc);
> +        reqData.setEncKeyTransport(encKeyTransport);
>
> -        reqData.setEncKeyTransport((String) getOption(WSHandlerConstants.ENC_KEY_TRANSPORT));
> -        if (reqData.getEncKeyTransport() == null) {
> -            reqData.setEncKeyTransport((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_TRANSPORT));
> +        String encParts = getString(WSHandlerConstants.ENCRYPTION_PARTS, mc);
> +        if (encParts != null) {
> +            splitEncParts(encParts, reqData.getEncryptParts(), reqData);
>          }
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ENCRYPTION_PARTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENCRYPTION_PARTS);
> -        }
> -        if (tmpS != null) {
> -            splitEncParts(tmpS, reqData.getEncryptParts(), reqData);
> -        }
>      }
>
> -    protected boolean decodeMustUnderstand(RequestData reqData) throws WSSecurityException {
> -        boolean mu = true;
> -        String mustUnderstand = null;
> -        if ((mustUnderstand =
> -                (String) getOption(WSHandlerConstants.MUST_UNDERSTAND))
> -                == null) {
> -            mustUnderstand =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.MUST_UNDERSTAND);
> -        }
> -        if (mustUnderstand != null) {
> -            if (mustUnderstand.equals("0") || mustUnderstand.equals("false")) {
> -                mu = false;
> -            } else if (
> -                    mustUnderstand.equals("1") || mustUnderstand.equals("true")) {
> -                mu = true;
> -            } else {
> -                throw new WSSecurityException("WSHandler: illegal mustUnderstand parameter");
> -            }
> -        }
> -        return mu;
> +    protected boolean decodeMustUnderstand(RequestData reqData)
> +       throws WSSecurityException {
> +        String mu = getString(WSHandlerConstants.MUST_UNDERSTAND,
> +                             reqData.getMsgContext());
> +
> +        if (mu == null) {return true;}
> +
> +       if ("0".equals(mu) || "false".equals(mu)) {return false;}
> +       if ("1".equals(mu) || "true".equals(mu)) {return true;}
> +
> +       throw new WSSecurityException(
> +              "WSHandler: illegal mustUnderstand parameter");
>      }
>
>      public int decodeTimeToLive(RequestData reqData) {
> -        String ttl = null;
> -        if ((ttl =
> -                (String) getOption(WSHandlerConstants.TTL_TIMESTAMP))
> -                == null) {
> -            ttl =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.TTL_TIMESTAMP);
> -        }
> +        String ttl = getString(WSHandlerConstants.TTL_TIMESTAMP,
> +                              reqData.getMsgContext());
>          int ttl_i = 0;
>          if (ttl != null) {
>              try {
> @@ -518,26 +491,19 @@
>          return ttl_i;
>      }
>
> -    protected boolean decodeTimestampPrecision(RequestData reqData) throws WSSecurityException {
> +    protected boolean decodeTimestampPrecision(RequestData reqData)
> +       throws WSSecurityException {
>          boolean precisionInMilliSeconds = true;
> -        String value = null;
> -        if ((value =
> -                (String) getOption(WSHandlerConstants.TIMESTAMP_PRECISION))
> -                == null) {
> -            value =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.TIMESTAMP_PRECISION);
> -        }
> -        if (value != null) {
> -            if (value.equals("0") || value.equals("false")) {
> -                precisionInMilliSeconds = false;
> -            } else if (
> -                    value.equals("1") || value.equals("true")) {
> -                precisionInMilliSeconds = true;
> -            } else {
> -                throw new WSSecurityException("WSHandler: illegal precisionInMilliSeconds parameter");
> -            }
> -        }
> -        return precisionInMilliSeconds;
> +        String value = getString(WSHandlerConstants.TIMESTAMP_PRECISION,
> +                                reqData.getMsgContext());
> +
> +        if (value == null) {return true;}
> +
> +       if ("0".equals(value) || "false".equals(value)) {return false;}
> +       if ("1".equals(value) || "true".equals(value)) {return true;}
> +
> +       throw new WSSecurityException(
> +                  "WSHandler: illegal precisionInMilliSeconds parameter");
>      }
>
>      /**
> @@ -553,28 +519,27 @@
>              throws WSSecurityException {
>          WSPasswordCallback pwCb = null;
>          String password = null;
> -        String callback = null;
>          CallbackHandler cbHandler = null;
> -
> -        if ((callback = (String) getOption(clsProp)) == null) {
> -            callback = (String) getProperty(reqData.getMsgContext(), clsProp);
> -        }
> +       String err = "provided null or empty password";
> +       Object mc = reqData.getMsgContext();
> +        String callback = getString(clsProp, mc);
>          if (callback != null) { // we have a password callback class
>              pwCb = readPwViaCallbackClass(callback, username, doAction);
>              if ((pwCb.getPassword() == null) && (pwCb.getKey() == null)) {
> -                throw new WSSecurityException("WSHandler: password callback class provided null or empty password");
> +            throw new WSSecurityException("WSHandler: password callback class "
> +                                         +err);
>              }
> -        } else if (
> -                (cbHandler = (CallbackHandler) getProperty(reqData.getMsgContext(), refProp))
> -                != null) {
> +        } else if ((cbHandler = (CallbackHandler) getProperty(mc, refProp))
> +                  != null) {
>              pwCb = performCallback(cbHandler, username, doAction);
>              if ((pwCb.getPassword() == null) && (pwCb.getKey() == null)) {
> -                throw new WSSecurityException("WSHandler: password callback provided null or empty password");
> +                throw new WSSecurityException("WSHandler: password callback "
> +                                             +err);
>              }
> -        } else if ((password = getPassword(reqData.getMsgContext())) == null) {
> -            throw new WSSecurityException("WSHandler: application provided null or empty password");
> +        } else if ((password = getPassword(mc)) == null) {
> +            throw new WSSecurityException("WSHandler: application "+err);
>          } else {
> -            setPassword(reqData.getMsgContext(), null);
> +            setPassword(mc, null);
>              pwCb = new WSPasswordCallback("", WSPasswordCallback.UNKNOWN);
>              pwCb.setPassword(password);
>          }
> @@ -735,83 +700,84 @@
>      }
>
>      /**
> -     * Hook to allow subclasses to load their Decryption Crypto however they see
> -     * fit.
> +     * Hook to allow subclasses to load their Decryption Crypto however they
> +     * see fit.
>       */
> -    protected Crypto loadDecryptionCrypto(RequestData reqData) throws WSSecurityException {
> +    protected Crypto loadDecryptionCrypto(RequestData reqData)
> +       throws WSSecurityException {
> +
>          Crypto crypto = null;
> -        String decPropFile = null;
> -        if ((decPropFile = (String) getOption(WSHandlerConstants.DEC_PROP_FILE))
> -                == null) {
> -            decPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.DEC_PROP_FILE);
> -        }
> +        String decPropFile = getString(WSHandlerConstants.DEC_PROP_FILE,
> +                                    reqData.getMsgContext());
>          if (decPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(decPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(decPropFile);
>                  cryptos.put(decPropFile, crypto);
>              }
>          } else if ((crypto = reqData.getSigCrypto()) == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no crypto property file");
> +            throw new WSSecurityException(
> +                            "WSHandler: Encryption: no crypto property file");
>          }
>          return crypto;
>      }
>
> -    protected void decodeSignatureParameter2(RequestData reqData) throws WSSecurityException {
> +    protected void decodeSignatureParameter2(RequestData reqData)
> +       throws WSSecurityException {
>          reqData.setSigCrypto(loadSignatureCrypto(reqData));
> -        /* There are currently no other signature parameters that need to be handled
> -        * here, but we call the load crypto hook rather than just changing the visibility
> -        * of this method to maintain parity with WSDoAllSender.
> -        */
> +        /* There are currently no other signature parameters that need
> +        * to be handled here, but we call the load crypto hook rather
> +        * than just changing the visibility
> +        * of this method to maintain parity with WSDoAllSender.
> +        */
>      }
>
>      /*
> -    * Set and check the decryption specific parameters, if necessary
> -    * take over signatur crypto instance.
> -    */
> +     * Set and check the decryption specific parameters, if necessary
> +     * take over signatur crypto instance.
> +     */
>
> -    protected void decodeDecryptionParameter(RequestData reqData) throws WSSecurityException {
> +    protected void decodeDecryptionParameter(RequestData reqData)
> +       throws WSSecurityException {
>          reqData.setDecCrypto(loadDecryptionCrypto(reqData));
> -        /* There are currently no other decryption parameters that need to be handled
> -        * here, but we call the load crypto hook rather than just changing the visibility
> -        * of this method to maintain parity with WSDoAllSender.
> -        */
> +        /* There are currently no other decryption parameters that need
> +        * to be handled here, but we call the load crypto hook rather
> +        * than just changing the visibility
> +        * of this method to maintain parity with WSDoAllSender.
> +        */
>      }
>
>      /**
>       * Get the password callback class and get an instance
>       * <p/>
>       */
> -    protected CallbackHandler getPasswordCB(RequestData reqData) throws WSSecurityException {
> +    protected CallbackHandler getPasswordCB(RequestData reqData)
> +       throws WSSecurityException {
>
> -        String callback = null;
> +       Object mc = reqData.getMsgContext();
>          CallbackHandler cbHandler = null;
> -        if ((callback = (String) getOption(WSHandlerConstants.PW_CALLBACK_CLASS))
> -                == null) {
> -            callback =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.PW_CALLBACK_CLASS);
> -        }
> +        String callback = getString(WSHandlerConstants.PW_CALLBACK_CLASS, mc);
>          if (callback != null) {
>              Class cbClass = null;
>              try {
>                  cbClass = Loader.loadClass(callback);
>              } catch (ClassNotFoundException e) {
> -                throw new WSSecurityException("WSHandler: cannot load password callback class: "
> -                        + callback,
> -                        e);
> +                throw new WSSecurityException(
> +                       "WSHandler: cannot load password callback class: "
> +                      + callback, e);
>              }
>              try {
>                  cbHandler = (CallbackHandler) cbClass.newInstance();
>              } catch (java.lang.Exception e) {
> -                throw new WSSecurityException("WSHandler: cannot create instance of password callback: "
> -                        + callback,
> -                        e);
> +                throw new WSSecurityException(
> +                     "WSHandler: cannot create instance of password callback: "
> +                    + callback, e);
>              }
>          } else {
> -            cbHandler =
> -                    (CallbackHandler) getProperty(reqData.getMsgContext(), WSHandlerConstants.PW_CALLBACK_REF);
> +            cbHandler = (CallbackHandler) getProperty(mc,
> +                                          WSHandlerConstants.PW_CALLBACK_REF);
>              if (cbHandler == null) {
> -                throw new WSSecurityException("WSHandler: no reference in callback property");
> +                throw new WSSecurityException(
> +                           "WSHandler: no reference in callback property");
>              }
>          }
>          return cbHandler;
> @@ -998,12 +964,53 @@
>          log.debug("Validation of Timestamp: Everything is ok");
>          return true;
>      }
> +
> +    /**
> +     * Looks up key first via {@link #getOption(String)} and if not found
> +     * there, via {@link #getProperty(Object, String)}
> +     *
> +     * @param key the key to search for. May not be null.
> +     * @param mc the message context to search.
> +     * @return the value found.
> +     * @throws IllegalArgumentException if <code>key</code> is null.
> +     */
> +    public String getString(String key, Object mc) {
> +       if (key == null) {
> +           throw new IllegalArgumentException("Key cannot be null");
> +       }
> +        String s = getStringOption(key);
> +       if (s != null) {
> +           return s;
> +       }
> +       if (mc == null) {
> +           throw new
> +               IllegalArgumentException("Message context cannot be null");
> +       }
> +       return (String) getProperty(mc, key);
> +    }
>
> +
> +    /**
> +     * Returns the option on <code>name</code>.
> +     *
> +     * @param key the non-null key of the option.
> +     * @return the option on <code>key</code> if <code>key</code>
> +     *  exists and is of type java.lang.String; otherwise null.
> +     */
> +    public String getStringOption(String key) {
> +        Object o = getOption(key);
> +       if (o instanceof String){
> +           return (String) o;
> +       } else {
> +           return null;
> +       }
> +    }
> +
>      public abstract Object getOption(String key);
> -
>      public abstract Object getProperty(Object msgContext, String key);
>
> -    public abstract void setProperty(Object msgContext, String key, Object value);
> +    public abstract void setProperty(Object msgContext, String key,
> +                                    Object value);
>
>
>      public abstract String getPassword(Object msgContext);
> Index: src/org/apache/ws/security/action/SAMLTokenSignedAction.java
> ===================================================================
> --- src/org/apache/ws/security/action/SAMLTokenSignedAction.java        (revision 291771)
> +++ src/org/apache/ws/security/action/SAMLTokenSignedAction.java        (working copy)
> @@ -97,15 +97,11 @@
>          }
>      }
>
> -    protected SAMLIssuer loadSamlIssuer(WSHandler handler, RequestData reqData) {
> -        String samlPropFile = null;
> -
> -        if ((samlPropFile =
> -                (String) handler.getOption(WSHandlerConstants.SAML_PROP_FILE))
> -                == null) {
> -            samlPropFile =
> -                    (String) handler.getProperty(reqData.getMsgContext(), WSHandlerConstants.SAML_PROP_FILE);
> -        }
> +    protected SAMLIssuer loadSamlIssuer(WSHandler handler,
> +                                       RequestData reqData) {
> +        String samlPropFile
> +           = handler.getString(WSHandlerConstants.SAML_PROP_FILE,
> +                               reqData.getMsgContext());
>          return SAMLIssuerFactory.getInstance(samlPropFile);
>      }
>
> Index: src/org/apache/ws/security/action/EncryptionAction.java
> ===================================================================
> --- src/org/apache/ws/security/action/EncryptionAction.java     (revision 291771)
> +++ src/org/apache/ws/security/action/EncryptionAction.java     (working copy)
> @@ -35,13 +35,9 @@
>              wsEncrypt.setKeyIdentifierType(reqData.getEncKeyId());
>          }
>          if (reqData.getEncKeyId() == WSConstants.EMBEDDED_KEYNAME) {
> -            String encKeyName = null;
> -            if ((encKeyName =
> -                    (String) handler.getOption(WSHandlerConstants.ENC_KEY_NAME))
> -                    == null) {
> -                encKeyName =
> -                        (String) handler.getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_NAME);
> -            }
> +            String encKeyName
> +               = handler.getString(WSHandlerConstants.ENC_KEY_NAME,
> +                                   reqData.getMsgContext());
>              wsEncrypt.setEmbeddedKeyName(encKeyName);
>              byte[] embeddedKey =
>                      handler.getPassword(reqData.getEncUser(),
> Index: src/org/apache/ws/sandbox/package.html
> ===================================================================
> --- src/org/apache/ws/sandbox/package.html      (revision 0)
> +++ src/org/apache/ws/sandbox/package.html      (revision 0)
> @@ -0,0 +1,5 @@
> +<html>
> +<! -- $Id$ -->
> +<body>
> +This package contains parts of WSS4J that are experimental.
> +</body>
> Index: build.xml
> ===================================================================
> --- build.xml   (revision 291771)
> +++ build.xml   (working copy)
> @@ -1,7 +1,7 @@
>  <?xml version="1.0"?>
>
>  <project name="Web Services Security (WSS4J)" default="usage" basedir=".">
> -    <!-- =================================================================== -->
> +    <!-- ================================================================== -->
>      <description>
>     Build file for WSS4J
>
> @@ -9,7 +9,7 @@
>     ANT is available from http://jakarta.apache.org/ant/index.html
>
>  Prerequisites:
> -       See the REAME file
> +       See the README file
>
>  Build Instructions:
>     To build, run
> @@ -28,9 +28,12 @@
>          <property name='product.version.major' value='1'/>
>          <property name='product.version.minor' value='1'/>
>          <property name='product.version.level' value='0'/>
> -        <property name='product.Version' value='${product.version.major}.${product.version.minor}.${product.version.level}'/>
> -        <property name='product.version' value='${product.version.major}.${product.version.minor}.${product.version.level}'/>
> -        <property name='product_version' value='${product.version.major}_${product.version.minor}_${product.version.level}'/>
> +        <property name='product.Version' value='${product.version.major}
> +             .${product.version.minor}.${product.version.level}'/>
> +        <property name='product.version' value='${product.version.major}
> +             .${product.version.minor}.${product.version.level}'/>
> +        <property name='product_version' value='${product.version.major}
> +             _${product.version.minor}_${product.version.level}'/>
>          <property name="year" value="2005"/>
>          <property name="copyright" value="Copyright &#169; ${year} Apache WS-Security Project. All Rights Reserved."/>
>
> @@ -103,8 +106,10 @@
>              <path refid="classpath.libraries"/>
>          </path>
>
> -        <taskdef resource="axis-tasks.properties" classpathref="classpath.library"/>
> -        <taskdef name="runaxisfunctionaltests" classname="org.apache.axis.tools.ant.axis.RunAxisFunctionalTestsTask"
> +        <taskdef resource="axis-tasks.properties" classpathref=
> +              "classpath.library"/>
> +        <taskdef name="runaxisfunctionaltests" classname=
> +              "org.apache.axis.tools.ant.axis.RunAxisFunctionalTestsTask"
>              loaderref="axis">
>              <classpath refid="classpath.library"/>
>          </taskdef>
> @@ -132,7 +137,7 @@
>          </patternset>
>
>          <patternset id="srcFiles">
> -            <!-- for some strange reasons, I can't use ${src} but must use src -->
> +         <!-- for some strange reasons, I can't use ${src} but must use src -->
>              <include name="src/**/*"/>
>          </patternset>
>
> @@ -161,54 +166,56 @@
>  org.apache.ws.axis.security.util
>  "/>
>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="-------------- ${product.Name} v${product.Version} [${year}] ----------------"/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="Building with ${ant.version}"/>
> -        <echo message="using build file ${ant.file}"/>
> -        <echo message="Java ${java.version} located at ${java.home} "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="--- Property values ---" />
> -        <echo message="sun.boot.class.path=${sun.boot.class.path}"/>
> -        <pathconvert targetos="windows" property="classpath.test.as.string" refid="classpath.test"/>
> -        <echo message="classpath.test: ${classpath.test.as.string}"/>
> -        <echo message="" />
> -
> +      <echo level="debug">
> +        -------------------------------------------------------------------
> +        ${product.Name} v${product.Version} [${year}]
> +        -------------------------------------------------------------------
> +        Building with ${ant.version}
> +        using build file ${ant.file}
> +        Java ${java.version} located at ${java.home}
> +        -------------------------------------------------------------------
> +        --- Property values ---
> +        sun.boot.class.path=${sun.boot.class.path}
> +      </echo>
> +      <pathconvert targetos="windows" property="classpath.test.as.string"
> +          refid="classpath.test"/>
> +      <echo level="debug">
> +        classpath.test: ${classpath.test.as.string}
> +      </echo>
>      </target>
>
>      <target name="usage" depends="init">
> -        <echo message="                                                                   "/>
> -        <echo message="                                                                   "/>
> -        <echo message=" Build instructions                                                "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="                                                                   "/>
> -        <echo message=" available targets are:                                            "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   compile         --> compiles everything                         "/>
> -        <echo message="   compile.library --> compiles the source code                    "/>
> -        <echo message="   compile.samples --> compiles the samples source code            "/>
> -        <echo message="   compile.tests   --> compiles the tests source code              "/>
> -        <echo message="   compile.interops--> compiles the interop source code            "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   javadoc         --> generates the API documentation             "/>
> -        <echo message="                       (needs Java > 1.2)                          "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   test            --> runs the defined JUnit tests                "/>
> -        <echo message="   report          --> generates html report of test results       "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   clean           --> cleans up all generated files and           "/>
> -        <echo message="                       directories                                 "/>
> -        <echo message="   jar             --> creates the JAR file                        "/>
> -        <echo message="   gump            --> includes javadoc, compile jar and test      "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   usage           --> provides help on using the build tool       "/>
> -        <echo message="                       (default)                                   "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   changelog       --> generates changelog.html                    "/>
> -        <echo message="                                                                   "/>
> -        <echo message=" See comments inside the build.xml file for more details.          "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="                                                                   "/>
> +      <echo>
> +         Build instructions
> +        -------------------------------------------------------------------
> +
> +         available targets are:
> +
> +           compile         --> compiles everything
> +           compile.library --> compiles the source code
> +           compile.samples --> compiles the samples source code
> +           compile.tests   --> compiles the tests source code
> +           compile.interops--> compiles the interop source code
> +
> +           javadoc         --> generates the API documentation
> +                               (needs Java > 1.2)
> +
> +           test            --> runs the defined JUnit tests
> +           report          --> generates html report of test results
> +
> +           clean           --> cleans up all generated files and
> +                               directories
> +           jar             --> creates the JAR file
> +           gump            --> includes javadoc, compile jar and test
> +
> +           usage           --> provides help on using the build tool
> +                               (default)
> +
> +           changelog       --> generates changelog.html
> +
> +         See comments inside the build.xml file for more details.
> +        -------------------------------------------------------------------
> +      </echo>
>      </target>
>
>      <target name="clean" depends="init"
> @@ -230,7 +237,8 @@
>          <delete dir="${build.dir}/test-reports"/>
>          <mkdir dir="${build.dir}/test-reports"/>
>
> -        <available property="junit.present" classname="junit.framework.TestCase">
> +        <available property="junit.present"
> +                classname="junit.framework.TestCase">
>              <!-- check whether JUnit is available -->
>              <classpath refid="classpath.test"/>
>          </available>
> @@ -259,20 +267,22 @@
>              <classpath refid="classpath.test"/>
>          </available>
>
> -        <echo message="--- Flags (Note: If the {property name} is displayed, "/>
> -        <echo message="           then the component is not present)"/>
> -        <echo message="jdk13.present=${jdk13.present}"/>
> -        <echo message="jdk14.present=${jdk14.present}"/>
> -        <echo message="jdk15.present=${jdk15.present}"/>
> -        <echo message="bc.present=${bc.present}"/>
> +        <echo level="debug">
> +        --- Flags (Note: If the {property name} is displayed,
> +                   then the component is not present)
> +        jdk13.present=${jdk13.present}
> +        jdk14.present=${jdk14.present}
> +        jdk15.present=${jdk15.present}
> +        bc.present=${bc.present}
> +        </echo>
>
>      </target>
>
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
>
>      <target name="prepare-src" depends="prepare"
>         description="This target copies the Java sources and brands the version information">
> @@ -300,7 +310,7 @@
>          </javadoc>
>      </target>
>
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
>
>      <!-- Aliases -->
>      <target name="javadocs" depends="javadoc"/>
> @@ -312,14 +322,14 @@
>              description="Target for the gump run"/>
>
>      <target name="compile"
> -            depends="compile.library, compile.samples, compile.tests, compile.interops, fix.properties"
> +     depends="compile.library,compile.samples, compile.tests, compile.interops"
>              description="compile everything"/>
>
>      <target name="test"
>              depends="unitTests, systemTests"
>              description="tests everything"/>
>
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
>
>      <target name="fix.properties" if="jdk13.present">
>          <replace dir="${build.dir}" value="org.apache.ws.security.components.crypto.BouncyCastle">
> @@ -403,7 +413,8 @@
>
>      <target name="start-functional-test-http-server" if="junit.present">
>          <echo message="Starting http server."/>
> -        <java classname="org.apache.axis.transport.http.SimpleAxisServer" fork="yes" dir="${build.dir}">
> +        <java classname="org.apache.axis.transport.http.SimpleAxisServer"
> +          fork="yes" dir="${build.dir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
>              <classpath refid="classpath.library"/>
>          </java>
> @@ -450,7 +461,8 @@
>          <java classname="org.apache.axis.utils.Admin" fork="true">
>              <classpath refid="classpath.library"/>
>              <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> +            <arg file=
> +               "${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
>          </java>
>
>             <junit printsummary="yes"
> @@ -500,14 +512,16 @@
>                  <fileset dir="${build.classes}">
>                      <include name="**/wssec/PackageTests.class"/>
>                      <include name="**/components/PackageTests.class"/>
> -                    <!--<include name="**/secconv/components/PackageTests.class"/> -->
> +             <!--<include name="**/secconv/components/PackageTests.class"/> -->
>                  </fileset>
>              </batchtest>
>          </junit>
>      </target>
>
> -    <target name="tcpmon" depends="init" description="Start standalone tcp monitor application (provided by axis)">
> -        <java dir="${basedir}" fork="yes" failOnError="true" className="org.apache.axis.utils.tcpmon">
> +    <target name="tcpmon" depends="init" description=
> +                "Start standalone tcp monitor application (provided by axis)">
> +        <java dir="${basedir}" fork="yes" failOnError="true"
> +                 className="org.apache.axis.utils.tcpmon">
>              <classpath refid="classpath.library" />
>               <arg value="9080" />
>               <arg value="localhost" />
> @@ -517,9 +531,11 @@
>
>         <!--
>         This runs the selected scenario with SimpleAxisServer locally.
> -       Before you start this target be sure you have started tcpmon too in a separate
> +       Before you start this target be sure you have started tcpmon too
> +        in a separate
>         "ant tcpmon" call.
> -       To run different scenarios use: "ant -DNumber=x scenarioTest" to run scenario x
> +       To run different scenarios use: "ant -DNumber=x scenarioTest"
> +        to run scenario x
>         -->
>      <target name="scenarioTest" depends="compile"
>          if="junit.present"
> @@ -532,11 +548,13 @@
>      </target>
>
>      <target name="scenario" if="junit.present">
> -        <echo message="Running interop test scenario ${Number} on SimpleAxisServer"/>
> +        <echo message=
> +          "Running interop test scenario ${Number} on SimpleAxisServer"/>
>
>         <antcall target="deployWSDD" />
>
> -        <java classname="interop.TestScenario${Number}" fork="yes" dir="${basedir}">
> +        <java classname="interop.TestScenario${Number}" fork="yes"
> +                 dir="${basedir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
>              <classpath refid="classpath.library"/>
>          </java>
> @@ -546,11 +564,14 @@
>      </target>
>
>         <!--
> -       This runs the selected scenario with SimpleAxisServer locally with perfomance
> +       This runs the selected scenario with SimpleAxisServer locally
> +        with perfomance
>         timing switched on.
> -       You may also emable the **.TIME entry in log4j.properties to get the internal
> +       You may also emable the **.TIME entry in log4j.properties to get
> +        the internal
>         timing.
> -       To run different scenarios use: "ant -DNumber=x scenarioTest" to run scenario x
> +       To run different scenarios use: "ant -DNumber=x scenarioTest"
> +        to run scenario x
>         -->
>      <target name="performanceTest" depends="compile"
>          if="junit.present"
> @@ -563,79 +584,82 @@
>      </target>
>
>      <target name="performance" if="junit.present">
> -        <echo message="Running performance test scenario ${Number} on SimpleAxisServer"/>
> +        <echo message=
> +           "Running performance test scenario ${Number} on SimpleAxisServer"/>
>
>         <antcall target="deployWSDD" />
> -        <java classname="interop.TestScenario${Number}" fork="yes" dir="${basedir}">
> +        <java classname="interop.TestScenario${Number}" fork="yes"
> +            dir="${basedir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
> -               <arg value="-lhttp://localhost:8080/axis/services/Ping${Number}" />
> +       <arg value="-lhttp://localhost:8080/axis/services/Ping${Number}" />
>                 <arg value="-t" />
>              <classpath refid="classpath.library"/>
>          </java>
>         <antcall target="undeployWSDD" />
>      </target>
>
> -       <target name="deployWSDD">
> -        <path id="deploy_xml_files">
> -            <fileset dir="${build.work}">
> -                <include name="**/deploy.wsdd"/>
> -            </fileset>
> -        </path>
> +    <target name="deployWSDD">
> +      <path id="deploy_xml_files">
> +      <fileset dir="${build.work}">
> +        <include name="**/deploy.wsdd"/>
> +      </fileset>
> +      </path>
>
> -       <copy todir="${build.dir}/keys">
> -            <fileset dir="${dir.keys}" includes="**"/>
> -        </copy>
> -        <copy todir="${build.dir}/interop">
> -            <fileset dir="${dir.interop}" includes="*.jks"/>
> -        </copy>
> +      <copy todir="${build.dir}/keys">
> +        <fileset dir="${dir.keys}" includes="**"/>
> +      </copy>
> +      <copy todir="${build.dir}/interop">
> +        <fileset dir="${dir.interop}" includes="*.jks"/>
> +      </copy>
>
> -               <property name="deploy_xml_property" refid="deploy_xml_files"/>
> +      <property name="deploy_xml_property" refid="deploy_xml_files"/>
>
> -               <java classname="org.apache.axis.utils.Admin" fork="true">
> -            <classpath refid="classpath.library"/>
> -            <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/Client_deploy.wsdd"/>
> -        </java>
> +      <java classname="org.apache.axis.utils.Admin" fork="true">
> +        <classpath refid="classpath.library"/>
> +        <arg value="client"/>
> +        <arg file="${build.work}/org/apache/ws/axis/oasis/Client_deploy.wsdd"/>
> +      </java>
>
> -        <java classname="org.apache.axis.client.AdminClient" fork="yes">
> -            <classpath refid="classpath.library"/>
> -            <arg line="${deploy_xml_property}"/>
> -        </java>
> -
> -       </target>
> +      <java classname="org.apache.axis.client.AdminClient" fork="yes">
> +        <classpath refid="classpath.library"/>
> +        <arg line="${deploy_xml_property}"/>
> +      </java>
> +    </target>
>
> -       <target name="undeployWSDD">
> -        <path id="undeploy_xml_files">
> -            <fileset dir="${build.work}">
> -                <include name="**/undeploy.wsdd"/>
> -            </fileset>
> -        </path>
> +    <target name="undeployWSDD">
> +      <path id="undeploy_xml_files">
> +        <fileset dir="${build.work}">
> +          <include name="**/undeploy.wsdd"/>
> +        </fileset>
> +      </path>
>
> -        <property name="undeploy_xml_property" refid="undeploy_xml_files"/>
> +      <property name="undeploy_xml_property" refid="undeploy_xml_files"/>
>
> -       <java classname="org.apache.axis.utils.Admin" fork="true">
> +      <java classname="org.apache.axis.utils.Admin" fork="true">
>              <classpath refid="classpath.library"/>
>              <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> -        </java>
> +            <arg file=
> +                 "${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> +      </java>
>
> -        <java classname="org.apache.axis.client.AdminClient" fork="yes">
> -            <classpath refid="classpath.library"/>
> -            <arg line="${undeploy_xml_property}"/>
> -        </java>
> -
> -       </target>
> +      <java classname="org.apache.axis.client.AdminClient" fork="yes">
> +        <classpath refid="classpath.library"/>
> +        <arg line="${undeploy_xml_property}"/>
> +      </java>
> +    </target>
>
>         <!-- generate a report from all the tests.
>             requires Xalan or other XSLT engine in ant\lib-->
> -    <target name="report" depends="init">
> +
> +   <target name="report" depends="init">
>          <junitreport todir="${build.dir}/test-reports">
>              <fileset dir="${build.dir}/test-reports">
>                  <include name="TEST-*.xml"/>
>              </fileset>
>              <report format="frames" todir="${build.dir}/test-reports/html"/>
>          </junitreport>
> -        <echo message="point your browser to ${build.dir}/test-reports/html/index.html"/>
> +        <echo message=
> +            "point your browser to ${build.dir}/test-reports/html/index.html"/>
>      </target>
>
>      <target name="jar"
> @@ -648,35 +672,43 @@
>              />
>      </target>
>
> -   <target name="bindist" depends="gump" description="Build zip file for distro">
> -               <delete dir="${dir.dist}"/>
> -        <mkdir dir="${dir.dist}"/>
> -        <jar jarfile="${dir.dist}/${jar.library}"
> -            basedir="${build.classes}"
> -            includes="**/apache/**/security/**"  />
> -        <zip destfile="${dir.dist}/${product.shortname}-bin-${product.version}.zip">
> -            <zipfileset prefix="wss4j" dir="."
> -                includes="keys/**, interop/**, interop2/**, test/**, samples/**,
> -                                         LICENSE.txt, README.txt legal/**, webapps/**"/>
> -            <zipfileset prefix="wss4j/classes" dir="${build.classes}"
> -                includes="*.properties, interop/**, wssec/**, org/**/oasis/**, org/**/samples/**"/>
> -            <zipfileset prefix="wss4j/doc/api" dir="${build.javadoc}"/>
> -            <zipfileset fullpath="wss4j/${jar.library}" dir="${dir.dist}" includes="${jar.library}"/>
> -        </zip>
> -         <delete file="${dir.dist}/${jar.library}" />
> +   <target name="bindist" depends="gump"
> +      description="Build zip file for distro">
> +     <delete dir="${dir.dist}"/>
> +     <mkdir dir="${dir.dist}"/>
> +     <jar jarfile="${dir.dist}/${jar.library}"
> +       basedir="${build.classes}"
> +       includes="**/apache/**/security/**"  />
> +     <zip destfile=
> +        "${dir.dist}/${product.shortname}-bin-${product.version}.zip">
> +        <zipfileset prefix="wss4j" dir="."
> +          includes="keys/**, interop/**, interop2/**, test/**, samples/**,
> +          LICENSE.txt, README.txt legal/**, webapps/**"/>
> +        <zipfileset prefix="wss4j/classes" dir="${build.classes}"
> +          includes=
> +     "*.properties, interop/**, wssec/**, org/**/oasis/**, org/**/samples/**"/>
> +        <zipfileset prefix="wss4j/doc/api" dir="${build.javadoc}"/>
> +        <zipfileset fullpath="wss4j/${jar.library}" dir="${dir.dist}"
> +          includes="${jar.library}"/>
> +      </zip>
> +      <delete file="${dir.dist}/${jar.library}" />
>      </target>
>
> -    <target name="otherdist" depends="init" description="Build zip for required jars">
> +    <target name="otherdist" depends="init"
> +             description="Build zip for required jars">
>              <mkdir dir="${dir.dist}"/>
> -            <zip destfile="${dir.dist}/${product.shortname}-otherjars-${product.version}.zip">
> +            <zip destfile=
> +           "${dir.dist}/${product.shortname}-otherjars-${product.version}.zip">
>                  <zipfileset prefix="wss4j" dir="."
>                      includes="lib/*.jar, endorsed/*.jar"/>
>              </zip>
>          </target>
>
> -       <target name="srcdist" depends="init" description="Build source zip file for distro">
> +       <target name="srcdist" depends="init" description=
> +               "Build source zip file for distro">
>          <mkdir dir="${dir.dist}"/>
> -        <zip destfile="${dir.dist}/${product.shortname}-src-${product.version}.zip">
> +        <zip destfile=
> +                 "${dir.dist}/${product.shortname}-src-${product.version}.zip">
>              <zipfileset prefix="wss4j" dir="."
>                  includes="src/** LICENSE.txt README.txt legal/** build.xml "/>
>          </zip>
> @@ -751,7 +783,8 @@
>          </fileset>
>      </path>
>      <property name="deploy_xml_property" refid="deploy_xml_files"/>
> -    <java classname="org.apache.axis.utils.Admin" fork="yes" dir="${build.webapp}/WEB-INF">
> +    <java classname="org.apache.axis.utils.Admin" fork="yes"
> +        dir="${build.webapp}/WEB-INF">
>          <classpath refid="classpath.library"/>
>          <arg line="server"/>
>          <arg line="${deploy_xml_property}"/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>


--
Davanum Srinivas : http://wso2.com/ - Oxygenating The Web Service Platform

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: handler cleanup

Posted by Davanum Srinivas <da...@gmail.com>.
+1 Please feel free to commit

-- dims

On 9/26/05, Hans Granqvist <ha...@apache.org> wrote:
> Hi all,
>
> Some diffs to clean up build.xml and handler code as follows.
> See what you think.
>
> * Wrap lines at 80 chars (so files are readable on my VT220 ;)
>
> * avoid wsdl2java'ing when not needed (task chkwsdl
>   in interop/build.xml)
>
> * build.xml does not dump classpaths etc unless invoked with
>   debug
>
> * replace pattern throughout handlers
>
>     if ((x = (String) getOption(WSHandlerConstants.X)) == null)
> {
>         x = (String) ((MessageContext)reqData.getMsgContext())
>                         .getProperty(WSHandlerConstants.X);
>      }
>
>   with something a la:
>
>   x = getString(WSHandlerConstants.X, reqData.getMsgContext());
>
>
> Hans
>
>
> Index: interop/build.xml
> ===================================================================
> --- interop/build.xml   (revision 291771)
> +++ interop/build.xml   (working copy)
> @@ -46,18 +46,30 @@
>          </java>
>      </target>
>
> -    <target name="compile">
> -        <mkdir dir="${dir.work}"/>
> -        <axis-wsdl2java
> -            output="${dir.work}"
> -            serverSide="yes"
> -            testcase="no"
> -            verbose="no"
> -            url="${dir.interop}/ping.wsdl">
> -            <mapping
> -                namespace="http://xmlsoap.org/Ping"
> -                package="org.apache.ws.axis.oasis.ping"/>
> -        </axis-wsdl2java>
> +    <target name="chkWsdl">
> +      <uptodate property="wsdl.notRequired"
> +        targetfile="${dir.work}/${server}/PingBindingImpl.java"
> +        srcfile="${dir.interop}/ping.wsdl"/>
> +    </target>
> +
> +    <target name="wsdl" depends="chkWsdl" unless="wsdl.notRequired">
> +      <axis-wsdl2java
> +          output="${dir.work}"
> +          serverSide="yes"
> +          testcase="no"
> +          verbose="no"
> +          url="${dir.interop}/ping.wsdl">
> +          <mapping
> +              namespace="http://xmlsoap.org/Ping"
> +              package="org.apache.ws.axis.oasis.ping"/>
> +      </axis-wsdl2java>
> +    </target>
> +
> +    <target name="init">
> +      <mkdir dir="${dir.work}"/>
> +    </target>
> +
> +    <target name="compile" depends="init, wsdl">
>          <copy todir="${dir.work}/${server}" overwrite="yes">
>            <fileset dir="${dir.interop}/${server}">
>              <include name="*.java"/>
> Index: src/org/apache/ws/axis/security/WSDoAllSender.java
> ===================================================================
> --- src/org/apache/ws/axis/security/WSDoAllSender.java  (revision 291771)
> +++ src/org/apache/ws/axis/security/WSDoAllSender.java  (working copy)
> @@ -70,19 +70,15 @@
>
>          reqData.setMsgContext(mc);
>          /*
> -           * The overall try, just to have a finally at the end to perform some
> -           * housekeeping.
> -           */
> +        * The overall try, just to have a finally at the end to perform some
> +        * housekeeping.
> +        */
>          try {
>              /*
> -                * Get the action first.
> -                */
> +            * Get the action first.
> +            */
>              Vector actions = new Vector();
> -            String action = null;
> -            if ((action = (String) getOption(WSHandlerConstants.ACTION)) == null) {
> -                action = (String) ((MessageContext)reqData.getMsgContext())
> -                        .getProperty(WSHandlerConstants.ACTION);
> -            }
> +           String action = getString(WSHandlerConstants.ACTION, mc);
>              if (action == null) {
>                  throw new AxisFault("WSDoAllSender: No action defined");
>              }
> Index: src/org/apache/ws/axis/security/handler/WSDoAllHandler.java
> ===================================================================
> --- src/org/apache/ws/axis/security/handler/WSDoAllHandler.java (revision 291771)
> +++ src/org/apache/ws/axis/security/handler/WSDoAllHandler.java (working copy)
> @@ -107,11 +107,20 @@
>      }
>
>      /**
> -     * Returns the option corresponding to the 'name' given
> +     * Returns the option corresponding to <code>name</code>.
> +     *
> +     * @param name the non-null name of the option.
> +     * @return the option on <code>name</code> if <code>name</code>
> +     *  exists; otherwise null.
>       */
>      public Object getOption(String name) {
> -        if (options == null) return (null);
> -        return (options.get(name));
> +       if (name == null) {
> +           throw new IllegalArgumentException("name cannot be null");
> +       }
> +        if (options == null) {
> +           return null;
> +       }
> +        return options.get(name);
>      }
>
>      /**
> Index: src/org/apache/ws/security/handler/WSHandler.java
> ===================================================================
> --- src/org/apache/ws/security/handler/WSHandler.java   (revision 291771)
> +++ src/org/apache/ws/security/handler/WSHandler.java   (working copy)
> @@ -33,6 +33,7 @@
>  import org.apache.ws.security.util.WSSecurityUtil;
>  import org.apache.ws.security.util.XmlSchemaDateFormat;
>  import org.w3c.dom.Document;
> +//import org.apache.axis.MessageContext;
>
>  import javax.security.auth.callback.Callback;
>  import javax.security.auth.callback.CallbackHandler;
> @@ -68,25 +69,24 @@
>       * @param doAction a set defining the actions to do
>       * @param doc   the request as DOM document
>       * @param reqData a data storage to pass values around bewteen methods
> -     * @param actions a vector holding the actions to do in the order defined in
> -     *                the deployment file or property
> +     * @param actions a vector holding the actions to do in the order defined
> +     *                in the deployment file or property
>       * @throws WSSecurityException
>       */
>      protected void doSenderAction(int doAction, Document doc,
> -                                  RequestData reqData, Vector actions, boolean isRequest)
> +                                  RequestData reqData, Vector actions,
> +                                 boolean isRequest)
>              throws WSSecurityException {
>
>          boolean mu = decodeMustUnderstand(reqData);
>
>          WSSConfig wssConfig = WSSConfig.getNewInstance();
> -        wssConfig.setPrecisionInMilliSeconds(decodeTimestampPrecision(reqData));
> +        wssConfig
> +           .setPrecisionInMilliSeconds(decodeTimestampPrecision(reqData));
>          reqData.setWssConfig(wssConfig);
>
> -        String actor = null;
> -        if ((actor = (String) getOption(WSHandlerConstants.ACTOR)) == null) {
> -            actor = (String) getProperty(reqData.getMsgContext(),
> -                    WSHandlerConstants.ACTOR);
> -        }
> +       Object mc = reqData.getMsgContext();
> +        String actor = getString(WSHandlerConstants.ACTOR, mc);
>          reqData.setActor(actor);
>
>          reqData.setSoapConstants(WSSecurityUtil.getSOAPConstants(doc
> @@ -309,25 +309,23 @@
>       * Hook to allow subclasses to load their Signature Crypto however they see
>       * fit.
>       */
> -    public Crypto loadSignatureCrypto(RequestData reqData) throws WSSecurityException {
> +    public Crypto loadSignatureCrypto(RequestData reqData)
> +       throws WSSecurityException {
>          Crypto crypto = null;
>          /*
>          * Get crypto property file for signature. If none specified throw
>          * fault, otherwise get a crypto instance.
>          */
> -        String sigPropFile = null;
> -        if ((sigPropFile = (String) getOption(WSHandlerConstants.SIG_PROP_FILE))
> -                == null) {
> -            sigPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_PROP_FILE);
> -        }
> +        String sigPropFile = getString(WSHandlerConstants.SIG_PROP_FILE,
> +                                      reqData.getMsgContext());
>          if (sigPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(sigPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(sigPropFile);
>                  cryptos.put(sigPropFile, crypto);
>              }
>          } else {
> -            throw new WSSecurityException("WSHandler: Signature: no crypto property file");
> +            throw new WSSecurityException(
> +                "WSHandler: Signature: no crypto property file");
>          }
>          return crypto;
>      }
> @@ -336,93 +334,87 @@
>       * Hook to allow subclasses to load their Encryption Crypto however they
>       * see fit.
>       */
> -    protected Crypto loadEncryptionCrypto(RequestData reqData) throws WSSecurityException {
> +    protected Crypto loadEncryptionCrypto(RequestData reqData)
> +       throws WSSecurityException {
>          Crypto crypto = null;
>          /*
>          * Get encryption crypto property file. If non specified take crypto
>          * instance from signature, if that fails: throw fault
>          */
> -        String encPropFile = null;
> -        if ((encPropFile = (String) getOption(WSHandlerConstants.ENC_PROP_FILE))
> -                == null) {
> -            encPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_PROP_FILE);
> -        }
> +        String encPropFile = getString(WSHandlerConstants.ENC_PROP_FILE,
> +                                      reqData.getMsgContext());
>          if (encPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(encPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(encPropFile);
>                  cryptos.put(encPropFile, crypto);
>              }
>          } else if ((crypto = reqData.getSigCrypto()) == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no crypto property file");
> +            throw new WSSecurityException(
> +                "WSHandler: Encryption: no crypto property file");
>          }
>          return crypto;
>      }
>
> -    protected void decodeUTParameter(RequestData reqData) throws WSSecurityException {
> -        reqData.setPwType((String) getOption(WSHandlerConstants.PASSWORD_TYPE));
> -        if (reqData.getPwType() == null) {
> -            reqData.setPwType((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.PASSWORD_TYPE));
> +    protected void decodeUTParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +
> +        String type = getString(WSHandlerConstants.PASSWORD_TYPE, mc);
> +       reqData.setPwType(type);
> +        if (type != null) {
> +            reqData.setPwType(type.equals(WSConstants.PW_TEXT)
> +                             ? WSConstants.PASSWORD_TEXT
> +                             : WSConstants.PASSWORD_DIGEST);
>          }
> -        if (reqData.getPwType() != null) {
> -            reqData.setPwType(reqData.getPwType().equals(WSConstants.PW_TEXT)
> -                ? WSConstants.PASSWORD_TEXT
> -                : WSConstants.PASSWORD_DIGEST);
> +
> +        String add = getString(WSHandlerConstants.ADD_UT_ELEMENTS, mc);
> +        if (add != null) {
> +            reqData.setUtElements(StringUtil.split(add, ' '));
>          }
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ADD_UT_ELEMENTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ADD_UT_ELEMENTS);
> -        }
> -        if (tmpS != null) {
> -            reqData.setUtElements(StringUtil.split(tmpS, ' '));
> -        }
>      }
>
> -    protected void decodeSignatureParameter(RequestData reqData) throws WSSecurityException {
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.SIG_KEY_ID)) == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_KEY_ID);
> -        }
> -        if (tmpS != null) {
> -            Integer I = (Integer) WSHandlerConstants.keyIdentifier.get(tmpS);
> -            if (I == null) {
> -                throw new WSSecurityException("WSHandler: Signature: unknown key identification");
> +    protected void decodeSignatureParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +        String keyId = getString(WSHandlerConstants.SIG_KEY_ID, mc);
> +        if (keyId != null) {
> +            Integer id = (Integer) WSHandlerConstants.keyIdentifier.get(keyId);
> +            if (id == null) {
> +                throw new WSSecurityException(
> +                     "WSHandler: Signature: unknown key identification");
>              }
> -            reqData.setSigKeyId(I.intValue());
> -            if (!(reqData.getSigKeyId() == WSConstants.ISSUER_SERIAL
> -                    || reqData.getSigKeyId() == WSConstants.BST_DIRECT_REFERENCE
> -                    || reqData.getSigKeyId() == WSConstants.X509_KEY_IDENTIFIER
> -                    || reqData.getSigKeyId() == WSConstants.SKI_KEY_IDENTIFIER
> -                    || reqData.getSigKeyId() == WSConstants.THUMBPRINT_IDENTIFIER)) {
> -                throw new WSSecurityException("WSHandler: Signature: illegal key identification");
> +            int tmp = id.intValue();
> +            if (!(tmp == WSConstants.ISSUER_SERIAL
> +                 || tmp == WSConstants.BST_DIRECT_REFERENCE
> +                 || tmp == WSConstants.X509_KEY_IDENTIFIER
> +                 || tmp == WSConstants.SKI_KEY_IDENTIFIER
> +                 || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
> +                throw new WSSecurityException(
> +                        "WSHandler: Signature: illegal key identification");
>              }
> +            reqData.setSigKeyId(tmp);
>          }
> -        reqData.setSigAlgorithm((String) getOption(WSHandlerConstants.SIG_ALGO));
> -        if (reqData.getSigAlgorithm() == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_ALGO);
> +        String algo = getString(WSHandlerConstants.SIG_ALGO, mc);
> +        reqData.setSigAlgorithm(algo);
> +
> +        String parts = getString(WSHandlerConstants.SIGNATURE_PARTS, mc);
> +        if (parts != null) {
> +            splitEncParts(parts, reqData.getSignatureParts(), reqData);
>          }
> -        if ((tmpS = (String) getOption(WSHandlerConstants.SIGNATURE_PARTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.SIGNATURE_PARTS);
> -        }
> -        if (tmpS != null) {
> -            splitEncParts(tmpS, reqData.getSignatureParts(), reqData);
> -        }
>      }
>
> -    protected void decodeEncryptionParameter(RequestData reqData) throws WSSecurityException {
> -        reqData.setEncUser((String) getOption(WSHandlerConstants.ENCRYPTION_USER));
> -        if (reqData.getEncUser() == null) {
> -            reqData.setEncUser((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENCRYPTION_USER));
> -        }
> -        if (reqData.getEncUser() == null) {
> +    protected void decodeEncryptionParameter(RequestData reqData)
> +       throws WSSecurityException {
> +       Object mc = reqData.getMsgContext();
> +        String encUser = getString(WSHandlerConstants.ENCRYPTION_USER, mc);
> +
> +        if (encUser != null) {
> +           reqData.setEncUser(encUser);
> +        } else {
>              reqData.setEncUser(reqData.getUsername());
> -        }
> +       }
>          if (reqData.getEncUser() == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no username");
> +           throw new WSSecurityException("WSHandler: Encryption: no username");
>          }
>          /*
>          * String msgType = msgContext.getCurrentMessage().getMessageType(); if
> @@ -430,80 +422,61 @@
>          * handleSpecialUser(encUser); }
>          */
>          handleSpecialUser(reqData);
> -
> +
>          /*
>          * If the following parameters are no used (they return null) then the
>          * default values of WSS4J are used.
>          */
> -        String tmpS = null;
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ENC_KEY_ID)) == null) {
> -            tmpS = (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_ID);
> -        }
> -        if (tmpS != null) {
> -            Integer I = (Integer) WSHandlerConstants.keyIdentifier.get(tmpS);
> -            if (I == null) {
> -                throw new WSSecurityException("WSHandler: Encryption: unknown key identification");
> +        String encKeyId = getString(WSHandlerConstants.ENC_KEY_ID, mc);
> +        if (encKeyId != null) {
> +            Integer id = (Integer) WSHandlerConstants
> +               .keyIdentifier.get(encKeyId);
> +            if (id == null) {
> +                throw new WSSecurityException(
> +                     "WSHandler: Encryption: unknown key identification");
>              }
> -            reqData.setEncKeyId(I.intValue());
> -            if (!(reqData.getEncKeyId() == WSConstants.ISSUER_SERIAL
> -                    || reqData.getEncKeyId() == WSConstants.X509_KEY_IDENTIFIER
> -                    || reqData.getEncKeyId() == WSConstants.SKI_KEY_IDENTIFIER
> -                    || reqData.getEncKeyId() == WSConstants.BST_DIRECT_REFERENCE
> -                    || reqData.getEncKeyId() == WSConstants.EMBEDDED_KEYNAME
> -                    || reqData.getSigKeyId() == WSConstants.THUMBPRINT_IDENTIFIER)) {
> -                throw new WSSecurityException("WSHandler: Encryption: illegal key identification");
> +            int tmp = id.intValue();
> +           reqData.setEncKeyId(tmp);
> +           if (!(tmp == WSConstants.ISSUER_SERIAL
> +                 || tmp == WSConstants.X509_KEY_IDENTIFIER
> +                 || tmp == WSConstants.SKI_KEY_IDENTIFIER
> +                 || tmp == WSConstants.BST_DIRECT_REFERENCE
> +                 || tmp == WSConstants.EMBEDDED_KEYNAME
> +                 || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
> +                throw new WSSecurityException(
> +                          "WSHandler: Encryption: illegal key identification");
>              }
> -        }
> +       }
> +        String encSymAlgo = getString(WSHandlerConstants.ENC_SYM_ALGO, mc);
> +        reqData.setEncSymmAlgo(encSymAlgo);
>
> -        reqData.setEncSymmAlgo((String) getOption(WSHandlerConstants.ENC_SYM_ALGO));
> -        if (reqData.getEncSymmAlgo() == null) {
> -            reqData.setEncSymmAlgo((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_SYM_ALGO));
> -        }
> +        String encKeyTransport
> +           = getString(WSHandlerConstants.ENC_KEY_TRANSPORT, mc);
> +        reqData.setEncKeyTransport(encKeyTransport);
>
> -        reqData.setEncKeyTransport((String) getOption(WSHandlerConstants.ENC_KEY_TRANSPORT));
> -        if (reqData.getEncKeyTransport() == null) {
> -            reqData.setEncKeyTransport((String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_TRANSPORT));
> +        String encParts = getString(WSHandlerConstants.ENCRYPTION_PARTS, mc);
> +        if (encParts != null) {
> +            splitEncParts(encParts, reqData.getEncryptParts(), reqData);
>          }
> -        if ((tmpS = (String) getOption(WSHandlerConstants.ENCRYPTION_PARTS))
> -                == null) {
> -            tmpS =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.ENCRYPTION_PARTS);
> -        }
> -        if (tmpS != null) {
> -            splitEncParts(tmpS, reqData.getEncryptParts(), reqData);
> -        }
>      }
>
> -    protected boolean decodeMustUnderstand(RequestData reqData) throws WSSecurityException {
> -        boolean mu = true;
> -        String mustUnderstand = null;
> -        if ((mustUnderstand =
> -                (String) getOption(WSHandlerConstants.MUST_UNDERSTAND))
> -                == null) {
> -            mustUnderstand =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.MUST_UNDERSTAND);
> -        }
> -        if (mustUnderstand != null) {
> -            if (mustUnderstand.equals("0") || mustUnderstand.equals("false")) {
> -                mu = false;
> -            } else if (
> -                    mustUnderstand.equals("1") || mustUnderstand.equals("true")) {
> -                mu = true;
> -            } else {
> -                throw new WSSecurityException("WSHandler: illegal mustUnderstand parameter");
> -            }
> -        }
> -        return mu;
> +    protected boolean decodeMustUnderstand(RequestData reqData)
> +       throws WSSecurityException {
> +        String mu = getString(WSHandlerConstants.MUST_UNDERSTAND,
> +                             reqData.getMsgContext());
> +
> +        if (mu == null) {return true;}
> +
> +       if ("0".equals(mu) || "false".equals(mu)) {return false;}
> +       if ("1".equals(mu) || "true".equals(mu)) {return true;}
> +
> +       throw new WSSecurityException(
> +              "WSHandler: illegal mustUnderstand parameter");
>      }
>
>      public int decodeTimeToLive(RequestData reqData) {
> -        String ttl = null;
> -        if ((ttl =
> -                (String) getOption(WSHandlerConstants.TTL_TIMESTAMP))
> -                == null) {
> -            ttl =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.TTL_TIMESTAMP);
> -        }
> +        String ttl = getString(WSHandlerConstants.TTL_TIMESTAMP,
> +                              reqData.getMsgContext());
>          int ttl_i = 0;
>          if (ttl != null) {
>              try {
> @@ -518,26 +491,19 @@
>          return ttl_i;
>      }
>
> -    protected boolean decodeTimestampPrecision(RequestData reqData) throws WSSecurityException {
> +    protected boolean decodeTimestampPrecision(RequestData reqData)
> +       throws WSSecurityException {
>          boolean precisionInMilliSeconds = true;
> -        String value = null;
> -        if ((value =
> -                (String) getOption(WSHandlerConstants.TIMESTAMP_PRECISION))
> -                == null) {
> -            value =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.TIMESTAMP_PRECISION);
> -        }
> -        if (value != null) {
> -            if (value.equals("0") || value.equals("false")) {
> -                precisionInMilliSeconds = false;
> -            } else if (
> -                    value.equals("1") || value.equals("true")) {
> -                precisionInMilliSeconds = true;
> -            } else {
> -                throw new WSSecurityException("WSHandler: illegal precisionInMilliSeconds parameter");
> -            }
> -        }
> -        return precisionInMilliSeconds;
> +        String value = getString(WSHandlerConstants.TIMESTAMP_PRECISION,
> +                                reqData.getMsgContext());
> +
> +        if (value == null) {return true;}
> +
> +       if ("0".equals(value) || "false".equals(value)) {return false;}
> +       if ("1".equals(value) || "true".equals(value)) {return true;}
> +
> +       throw new WSSecurityException(
> +                  "WSHandler: illegal precisionInMilliSeconds parameter");
>      }
>
>      /**
> @@ -553,28 +519,27 @@
>              throws WSSecurityException {
>          WSPasswordCallback pwCb = null;
>          String password = null;
> -        String callback = null;
>          CallbackHandler cbHandler = null;
> -
> -        if ((callback = (String) getOption(clsProp)) == null) {
> -            callback = (String) getProperty(reqData.getMsgContext(), clsProp);
> -        }
> +       String err = "provided null or empty password";
> +       Object mc = reqData.getMsgContext();
> +        String callback = getString(clsProp, mc);
>          if (callback != null) { // we have a password callback class
>              pwCb = readPwViaCallbackClass(callback, username, doAction);
>              if ((pwCb.getPassword() == null) && (pwCb.getKey() == null)) {
> -                throw new WSSecurityException("WSHandler: password callback class provided null or empty password");
> +            throw new WSSecurityException("WSHandler: password callback class "
> +                                         +err);
>              }
> -        } else if (
> -                (cbHandler = (CallbackHandler) getProperty(reqData.getMsgContext(), refProp))
> -                != null) {
> +        } else if ((cbHandler = (CallbackHandler) getProperty(mc, refProp))
> +                  != null) {
>              pwCb = performCallback(cbHandler, username, doAction);
>              if ((pwCb.getPassword() == null) && (pwCb.getKey() == null)) {
> -                throw new WSSecurityException("WSHandler: password callback provided null or empty password");
> +                throw new WSSecurityException("WSHandler: password callback "
> +                                             +err);
>              }
> -        } else if ((password = getPassword(reqData.getMsgContext())) == null) {
> -            throw new WSSecurityException("WSHandler: application provided null or empty password");
> +        } else if ((password = getPassword(mc)) == null) {
> +            throw new WSSecurityException("WSHandler: application "+err);
>          } else {
> -            setPassword(reqData.getMsgContext(), null);
> +            setPassword(mc, null);
>              pwCb = new WSPasswordCallback("", WSPasswordCallback.UNKNOWN);
>              pwCb.setPassword(password);
>          }
> @@ -735,83 +700,84 @@
>      }
>
>      /**
> -     * Hook to allow subclasses to load their Decryption Crypto however they see
> -     * fit.
> +     * Hook to allow subclasses to load their Decryption Crypto however they
> +     * see fit.
>       */
> -    protected Crypto loadDecryptionCrypto(RequestData reqData) throws WSSecurityException {
> +    protected Crypto loadDecryptionCrypto(RequestData reqData)
> +       throws WSSecurityException {
> +
>          Crypto crypto = null;
> -        String decPropFile = null;
> -        if ((decPropFile = (String) getOption(WSHandlerConstants.DEC_PROP_FILE))
> -                == null) {
> -            decPropFile =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.DEC_PROP_FILE);
> -        }
> +        String decPropFile = getString(WSHandlerConstants.DEC_PROP_FILE,
> +                                    reqData.getMsgContext());
>          if (decPropFile != null) {
>              if ((crypto = (Crypto) cryptos.get(decPropFile)) == null) {
>                  crypto = CryptoFactory.getInstance(decPropFile);
>                  cryptos.put(decPropFile, crypto);
>              }
>          } else if ((crypto = reqData.getSigCrypto()) == null) {
> -            throw new WSSecurityException("WSHandler: Encryption: no crypto property file");
> +            throw new WSSecurityException(
> +                            "WSHandler: Encryption: no crypto property file");
>          }
>          return crypto;
>      }
>
> -    protected void decodeSignatureParameter2(RequestData reqData) throws WSSecurityException {
> +    protected void decodeSignatureParameter2(RequestData reqData)
> +       throws WSSecurityException {
>          reqData.setSigCrypto(loadSignatureCrypto(reqData));
> -        /* There are currently no other signature parameters that need to be handled
> -        * here, but we call the load crypto hook rather than just changing the visibility
> -        * of this method to maintain parity with WSDoAllSender.
> -        */
> +        /* There are currently no other signature parameters that need
> +        * to be handled here, but we call the load crypto hook rather
> +        * than just changing the visibility
> +        * of this method to maintain parity with WSDoAllSender.
> +        */
>      }
>
>      /*
> -    * Set and check the decryption specific parameters, if necessary
> -    * take over signatur crypto instance.
> -    */
> +     * Set and check the decryption specific parameters, if necessary
> +     * take over signatur crypto instance.
> +     */
>
> -    protected void decodeDecryptionParameter(RequestData reqData) throws WSSecurityException {
> +    protected void decodeDecryptionParameter(RequestData reqData)
> +       throws WSSecurityException {
>          reqData.setDecCrypto(loadDecryptionCrypto(reqData));
> -        /* There are currently no other decryption parameters that need to be handled
> -        * here, but we call the load crypto hook rather than just changing the visibility
> -        * of this method to maintain parity with WSDoAllSender.
> -        */
> +        /* There are currently no other decryption parameters that need
> +        * to be handled here, but we call the load crypto hook rather
> +        * than just changing the visibility
> +        * of this method to maintain parity with WSDoAllSender.
> +        */
>      }
>
>      /**
>       * Get the password callback class and get an instance
>       * <p/>
>       */
> -    protected CallbackHandler getPasswordCB(RequestData reqData) throws WSSecurityException {
> +    protected CallbackHandler getPasswordCB(RequestData reqData)
> +       throws WSSecurityException {
>
> -        String callback = null;
> +       Object mc = reqData.getMsgContext();
>          CallbackHandler cbHandler = null;
> -        if ((callback = (String) getOption(WSHandlerConstants.PW_CALLBACK_CLASS))
> -                == null) {
> -            callback =
> -                    (String) getProperty(reqData.getMsgContext(), WSHandlerConstants.PW_CALLBACK_CLASS);
> -        }
> +        String callback = getString(WSHandlerConstants.PW_CALLBACK_CLASS, mc);
>          if (callback != null) {
>              Class cbClass = null;
>              try {
>                  cbClass = Loader.loadClass(callback);
>              } catch (ClassNotFoundException e) {
> -                throw new WSSecurityException("WSHandler: cannot load password callback class: "
> -                        + callback,
> -                        e);
> +                throw new WSSecurityException(
> +                       "WSHandler: cannot load password callback class: "
> +                      + callback, e);
>              }
>              try {
>                  cbHandler = (CallbackHandler) cbClass.newInstance();
>              } catch (java.lang.Exception e) {
> -                throw new WSSecurityException("WSHandler: cannot create instance of password callback: "
> -                        + callback,
> -                        e);
> +                throw new WSSecurityException(
> +                     "WSHandler: cannot create instance of password callback: "
> +                    + callback, e);
>              }
>          } else {
> -            cbHandler =
> -                    (CallbackHandler) getProperty(reqData.getMsgContext(), WSHandlerConstants.PW_CALLBACK_REF);
> +            cbHandler = (CallbackHandler) getProperty(mc,
> +                                          WSHandlerConstants.PW_CALLBACK_REF);
>              if (cbHandler == null) {
> -                throw new WSSecurityException("WSHandler: no reference in callback property");
> +                throw new WSSecurityException(
> +                           "WSHandler: no reference in callback property");
>              }
>          }
>          return cbHandler;
> @@ -998,12 +964,53 @@
>          log.debug("Validation of Timestamp: Everything is ok");
>          return true;
>      }
> +
> +    /**
> +     * Looks up key first via {@link #getOption(String)} and if not found
> +     * there, via {@link #getProperty(Object, String)}
> +     *
> +     * @param key the key to search for. May not be null.
> +     * @param mc the message context to search.
> +     * @return the value found.
> +     * @throws IllegalArgumentException if <code>key</code> is null.
> +     */
> +    public String getString(String key, Object mc) {
> +       if (key == null) {
> +           throw new IllegalArgumentException("Key cannot be null");
> +       }
> +        String s = getStringOption(key);
> +       if (s != null) {
> +           return s;
> +       }
> +       if (mc == null) {
> +           throw new
> +               IllegalArgumentException("Message context cannot be null");
> +       }
> +       return (String) getProperty(mc, key);
> +    }
>
> +
> +    /**
> +     * Returns the option on <code>name</code>.
> +     *
> +     * @param key the non-null key of the option.
> +     * @return the option on <code>key</code> if <code>key</code>
> +     *  exists and is of type java.lang.String; otherwise null.
> +     */
> +    public String getStringOption(String key) {
> +        Object o = getOption(key);
> +       if (o instanceof String){
> +           return (String) o;
> +       } else {
> +           return null;
> +       }
> +    }
> +
>      public abstract Object getOption(String key);
> -
>      public abstract Object getProperty(Object msgContext, String key);
>
> -    public abstract void setProperty(Object msgContext, String key, Object value);
> +    public abstract void setProperty(Object msgContext, String key,
> +                                    Object value);
>
>
>      public abstract String getPassword(Object msgContext);
> Index: src/org/apache/ws/security/action/SAMLTokenSignedAction.java
> ===================================================================
> --- src/org/apache/ws/security/action/SAMLTokenSignedAction.java        (revision 291771)
> +++ src/org/apache/ws/security/action/SAMLTokenSignedAction.java        (working copy)
> @@ -97,15 +97,11 @@
>          }
>      }
>
> -    protected SAMLIssuer loadSamlIssuer(WSHandler handler, RequestData reqData) {
> -        String samlPropFile = null;
> -
> -        if ((samlPropFile =
> -                (String) handler.getOption(WSHandlerConstants.SAML_PROP_FILE))
> -                == null) {
> -            samlPropFile =
> -                    (String) handler.getProperty(reqData.getMsgContext(), WSHandlerConstants.SAML_PROP_FILE);
> -        }
> +    protected SAMLIssuer loadSamlIssuer(WSHandler handler,
> +                                       RequestData reqData) {
> +        String samlPropFile
> +           = handler.getString(WSHandlerConstants.SAML_PROP_FILE,
> +                               reqData.getMsgContext());
>          return SAMLIssuerFactory.getInstance(samlPropFile);
>      }
>
> Index: src/org/apache/ws/security/action/EncryptionAction.java
> ===================================================================
> --- src/org/apache/ws/security/action/EncryptionAction.java     (revision 291771)
> +++ src/org/apache/ws/security/action/EncryptionAction.java     (working copy)
> @@ -35,13 +35,9 @@
>              wsEncrypt.setKeyIdentifierType(reqData.getEncKeyId());
>          }
>          if (reqData.getEncKeyId() == WSConstants.EMBEDDED_KEYNAME) {
> -            String encKeyName = null;
> -            if ((encKeyName =
> -                    (String) handler.getOption(WSHandlerConstants.ENC_KEY_NAME))
> -                    == null) {
> -                encKeyName =
> -                        (String) handler.getProperty(reqData.getMsgContext(), WSHandlerConstants.ENC_KEY_NAME);
> -            }
> +            String encKeyName
> +               = handler.getString(WSHandlerConstants.ENC_KEY_NAME,
> +                                   reqData.getMsgContext());
>              wsEncrypt.setEmbeddedKeyName(encKeyName);
>              byte[] embeddedKey =
>                      handler.getPassword(reqData.getEncUser(),
> Index: src/org/apache/ws/sandbox/package.html
> ===================================================================
> --- src/org/apache/ws/sandbox/package.html      (revision 0)
> +++ src/org/apache/ws/sandbox/package.html      (revision 0)
> @@ -0,0 +1,5 @@
> +<html>
> +<! -- $Id$ -->
> +<body>
> +This package contains parts of WSS4J that are experimental.
> +</body>
> Index: build.xml
> ===================================================================
> --- build.xml   (revision 291771)
> +++ build.xml   (working copy)
> @@ -1,7 +1,7 @@
>  <?xml version="1.0"?>
>
>  <project name="Web Services Security (WSS4J)" default="usage" basedir=".">
> -    <!-- =================================================================== -->
> +    <!-- ================================================================== -->
>      <description>
>     Build file for WSS4J
>
> @@ -9,7 +9,7 @@
>     ANT is available from http://jakarta.apache.org/ant/index.html
>
>  Prerequisites:
> -       See the REAME file
> +       See the README file
>
>  Build Instructions:
>     To build, run
> @@ -28,9 +28,12 @@
>          <property name='product.version.major' value='1'/>
>          <property name='product.version.minor' value='1'/>
>          <property name='product.version.level' value='0'/>
> -        <property name='product.Version' value='${product.version.major}.${product.version.minor}.${product.version.level}'/>
> -        <property name='product.version' value='${product.version.major}.${product.version.minor}.${product.version.level}'/>
> -        <property name='product_version' value='${product.version.major}_${product.version.minor}_${product.version.level}'/>
> +        <property name='product.Version' value='${product.version.major}
> +             .${product.version.minor}.${product.version.level}'/>
> +        <property name='product.version' value='${product.version.major}
> +             .${product.version.minor}.${product.version.level}'/>
> +        <property name='product_version' value='${product.version.major}
> +             _${product.version.minor}_${product.version.level}'/>
>          <property name="year" value="2005"/>
>          <property name="copyright" value="Copyright &#169; ${year} Apache WS-Security Project. All Rights Reserved."/>
>
> @@ -103,8 +106,10 @@
>              <path refid="classpath.libraries"/>
>          </path>
>
> -        <taskdef resource="axis-tasks.properties" classpathref="classpath.library"/>
> -        <taskdef name="runaxisfunctionaltests" classname="org.apache.axis.tools.ant.axis.RunAxisFunctionalTestsTask"
> +        <taskdef resource="axis-tasks.properties" classpathref=
> +              "classpath.library"/>
> +        <taskdef name="runaxisfunctionaltests" classname=
> +              "org.apache.axis.tools.ant.axis.RunAxisFunctionalTestsTask"
>              loaderref="axis">
>              <classpath refid="classpath.library"/>
>          </taskdef>
> @@ -132,7 +137,7 @@
>          </patternset>
>
>          <patternset id="srcFiles">
> -            <!-- for some strange reasons, I can't use ${src} but must use src -->
> +         <!-- for some strange reasons, I can't use ${src} but must use src -->
>              <include name="src/**/*"/>
>          </patternset>
>
> @@ -161,54 +166,56 @@
>  org.apache.ws.axis.security.util
>  "/>
>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="-------------- ${product.Name} v${product.Version} [${year}] ----------------"/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="Building with ${ant.version}"/>
> -        <echo message="using build file ${ant.file}"/>
> -        <echo message="Java ${java.version} located at ${java.home} "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="--- Property values ---" />
> -        <echo message="sun.boot.class.path=${sun.boot.class.path}"/>
> -        <pathconvert targetos="windows" property="classpath.test.as.string" refid="classpath.test"/>
> -        <echo message="classpath.test: ${classpath.test.as.string}"/>
> -        <echo message="" />
> -
> +      <echo level="debug">
> +        -------------------------------------------------------------------
> +        ${product.Name} v${product.Version} [${year}]
> +        -------------------------------------------------------------------
> +        Building with ${ant.version}
> +        using build file ${ant.file}
> +        Java ${java.version} located at ${java.home}
> +        -------------------------------------------------------------------
> +        --- Property values ---
> +        sun.boot.class.path=${sun.boot.class.path}
> +      </echo>
> +      <pathconvert targetos="windows" property="classpath.test.as.string"
> +          refid="classpath.test"/>
> +      <echo level="debug">
> +        classpath.test: ${classpath.test.as.string}
> +      </echo>
>      </target>
>
>      <target name="usage" depends="init">
> -        <echo message="                                                                   "/>
> -        <echo message="                                                                   "/>
> -        <echo message=" Build instructions                                                "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="                                                                   "/>
> -        <echo message=" available targets are:                                            "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   compile         --> compiles everything                         "/>
> -        <echo message="   compile.library --> compiles the source code                    "/>
> -        <echo message="   compile.samples --> compiles the samples source code            "/>
> -        <echo message="   compile.tests   --> compiles the tests source code              "/>
> -        <echo message="   compile.interops--> compiles the interop source code            "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   javadoc         --> generates the API documentation             "/>
> -        <echo message="                       (needs Java > 1.2)                          "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   test            --> runs the defined JUnit tests                "/>
> -        <echo message="   report          --> generates html report of test results       "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   clean           --> cleans up all generated files and           "/>
> -        <echo message="                       directories                                 "/>
> -        <echo message="   jar             --> creates the JAR file                        "/>
> -        <echo message="   gump            --> includes javadoc, compile jar and test      "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   usage           --> provides help on using the build tool       "/>
> -        <echo message="                       (default)                                   "/>
> -        <echo message="                                                                   "/>
> -        <echo message="   changelog       --> generates changelog.html                    "/>
> -        <echo message="                                                                   "/>
> -        <echo message=" See comments inside the build.xml file for more details.          "/>
> -        <echo message="-------------------------------------------------------------------"/>
> -        <echo message="                                                                   "/>
> +      <echo>
> +         Build instructions
> +        -------------------------------------------------------------------
> +
> +         available targets are:
> +
> +           compile         --> compiles everything
> +           compile.library --> compiles the source code
> +           compile.samples --> compiles the samples source code
> +           compile.tests   --> compiles the tests source code
> +           compile.interops--> compiles the interop source code
> +
> +           javadoc         --> generates the API documentation
> +                               (needs Java > 1.2)
> +
> +           test            --> runs the defined JUnit tests
> +           report          --> generates html report of test results
> +
> +           clean           --> cleans up all generated files and
> +                               directories
> +           jar             --> creates the JAR file
> +           gump            --> includes javadoc, compile jar and test
> +
> +           usage           --> provides help on using the build tool
> +                               (default)
> +
> +           changelog       --> generates changelog.html
> +
> +         See comments inside the build.xml file for more details.
> +        -------------------------------------------------------------------
> +      </echo>
>      </target>
>
>      <target name="clean" depends="init"
> @@ -230,7 +237,8 @@
>          <delete dir="${build.dir}/test-reports"/>
>          <mkdir dir="${build.dir}/test-reports"/>
>
> -        <available property="junit.present" classname="junit.framework.TestCase">
> +        <available property="junit.present"
> +                classname="junit.framework.TestCase">
>              <!-- check whether JUnit is available -->
>              <classpath refid="classpath.test"/>
>          </available>
> @@ -259,20 +267,22 @@
>              <classpath refid="classpath.test"/>
>          </available>
>
> -        <echo message="--- Flags (Note: If the {property name} is displayed, "/>
> -        <echo message="           then the component is not present)"/>
> -        <echo message="jdk13.present=${jdk13.present}"/>
> -        <echo message="jdk14.present=${jdk14.present}"/>
> -        <echo message="jdk15.present=${jdk15.present}"/>
> -        <echo message="bc.present=${bc.present}"/>
> +        <echo level="debug">
> +        --- Flags (Note: If the {property name} is displayed,
> +                   then the component is not present)
> +        jdk13.present=${jdk13.present}
> +        jdk14.present=${jdk14.present}
> +        jdk15.present=${jdk15.present}
> +        bc.present=${bc.present}
> +        </echo>
>
>      </target>
>
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
> +    <!-- ################################################################## -->
>
>      <target name="prepare-src" depends="prepare"
>         description="This target copies the Java sources and brands the version information">
> @@ -300,7 +310,7 @@
>          </javadoc>
>      </target>
>
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
>
>      <!-- Aliases -->
>      <target name="javadocs" depends="javadoc"/>
> @@ -312,14 +322,14 @@
>              description="Target for the gump run"/>
>
>      <target name="compile"
> -            depends="compile.library, compile.samples, compile.tests, compile.interops, fix.properties"
> +     depends="compile.library,compile.samples, compile.tests, compile.interops"
>              description="compile everything"/>
>
>      <target name="test"
>              depends="unitTests, systemTests"
>              description="tests everything"/>
>
> -    <!-- #################################################################### -->
> +    <!-- ################################################################## -->
>
>      <target name="fix.properties" if="jdk13.present">
>          <replace dir="${build.dir}" value="org.apache.ws.security.components.crypto.BouncyCastle">
> @@ -403,7 +413,8 @@
>
>      <target name="start-functional-test-http-server" if="junit.present">
>          <echo message="Starting http server."/>
> -        <java classname="org.apache.axis.transport.http.SimpleAxisServer" fork="yes" dir="${build.dir}">
> +        <java classname="org.apache.axis.transport.http.SimpleAxisServer"
> +          fork="yes" dir="${build.dir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
>              <classpath refid="classpath.library"/>
>          </java>
> @@ -450,7 +461,8 @@
>          <java classname="org.apache.axis.utils.Admin" fork="true">
>              <classpath refid="classpath.library"/>
>              <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> +            <arg file=
> +               "${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
>          </java>
>
>             <junit printsummary="yes"
> @@ -500,14 +512,16 @@
>                  <fileset dir="${build.classes}">
>                      <include name="**/wssec/PackageTests.class"/>
>                      <include name="**/components/PackageTests.class"/>
> -                    <!--<include name="**/secconv/components/PackageTests.class"/> -->
> +             <!--<include name="**/secconv/components/PackageTests.class"/> -->
>                  </fileset>
>              </batchtest>
>          </junit>
>      </target>
>
> -    <target name="tcpmon" depends="init" description="Start standalone tcp monitor application (provided by axis)">
> -        <java dir="${basedir}" fork="yes" failOnError="true" className="org.apache.axis.utils.tcpmon">
> +    <target name="tcpmon" depends="init" description=
> +                "Start standalone tcp monitor application (provided by axis)">
> +        <java dir="${basedir}" fork="yes" failOnError="true"
> +                 className="org.apache.axis.utils.tcpmon">
>              <classpath refid="classpath.library" />
>               <arg value="9080" />
>               <arg value="localhost" />
> @@ -517,9 +531,11 @@
>
>         <!--
>         This runs the selected scenario with SimpleAxisServer locally.
> -       Before you start this target be sure you have started tcpmon too in a separate
> +       Before you start this target be sure you have started tcpmon too
> +        in a separate
>         "ant tcpmon" call.
> -       To run different scenarios use: "ant -DNumber=x scenarioTest" to run scenario x
> +       To run different scenarios use: "ant -DNumber=x scenarioTest"
> +        to run scenario x
>         -->
>      <target name="scenarioTest" depends="compile"
>          if="junit.present"
> @@ -532,11 +548,13 @@
>      </target>
>
>      <target name="scenario" if="junit.present">
> -        <echo message="Running interop test scenario ${Number} on SimpleAxisServer"/>
> +        <echo message=
> +          "Running interop test scenario ${Number} on SimpleAxisServer"/>
>
>         <antcall target="deployWSDD" />
>
> -        <java classname="interop.TestScenario${Number}" fork="yes" dir="${basedir}">
> +        <java classname="interop.TestScenario${Number}" fork="yes"
> +                 dir="${basedir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
>              <classpath refid="classpath.library"/>
>          </java>
> @@ -546,11 +564,14 @@
>      </target>
>
>         <!--
> -       This runs the selected scenario with SimpleAxisServer locally with perfomance
> +       This runs the selected scenario with SimpleAxisServer locally
> +        with perfomance
>         timing switched on.
> -       You may also emable the **.TIME entry in log4j.properties to get the internal
> +       You may also emable the **.TIME entry in log4j.properties to get
> +        the internal
>         timing.
> -       To run different scenarios use: "ant -DNumber=x scenarioTest" to run scenario x
> +       To run different scenarios use: "ant -DNumber=x scenarioTest"
> +        to run scenario x
>         -->
>      <target name="performanceTest" depends="compile"
>          if="junit.present"
> @@ -563,79 +584,82 @@
>      </target>
>
>      <target name="performance" if="junit.present">
> -        <echo message="Running performance test scenario ${Number} on SimpleAxisServer"/>
> +        <echo message=
> +           "Running performance test scenario ${Number} on SimpleAxisServer"/>
>
>         <antcall target="deployWSDD" />
> -        <java classname="interop.TestScenario${Number}" fork="yes" dir="${basedir}">
> +        <java classname="interop.TestScenario${Number}" fork="yes"
> +            dir="${basedir}">
>              <jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
> -               <arg value="-lhttp://localhost:8080/axis/services/Ping${Number}" />
> +       <arg value="-lhttp://localhost:8080/axis/services/Ping${Number}" />
>                 <arg value="-t" />
>              <classpath refid="classpath.library"/>
>          </java>
>         <antcall target="undeployWSDD" />
>      </target>
>
> -       <target name="deployWSDD">
> -        <path id="deploy_xml_files">
> -            <fileset dir="${build.work}">
> -                <include name="**/deploy.wsdd"/>
> -            </fileset>
> -        </path>
> +    <target name="deployWSDD">
> +      <path id="deploy_xml_files">
> +      <fileset dir="${build.work}">
> +        <include name="**/deploy.wsdd"/>
> +      </fileset>
> +      </path>
>
> -       <copy todir="${build.dir}/keys">
> -            <fileset dir="${dir.keys}" includes="**"/>
> -        </copy>
> -        <copy todir="${build.dir}/interop">
> -            <fileset dir="${dir.interop}" includes="*.jks"/>
> -        </copy>
> +      <copy todir="${build.dir}/keys">
> +        <fileset dir="${dir.keys}" includes="**"/>
> +      </copy>
> +      <copy todir="${build.dir}/interop">
> +        <fileset dir="${dir.interop}" includes="*.jks"/>
> +      </copy>
>
> -               <property name="deploy_xml_property" refid="deploy_xml_files"/>
> +      <property name="deploy_xml_property" refid="deploy_xml_files"/>
>
> -               <java classname="org.apache.axis.utils.Admin" fork="true">
> -            <classpath refid="classpath.library"/>
> -            <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/Client_deploy.wsdd"/>
> -        </java>
> +      <java classname="org.apache.axis.utils.Admin" fork="true">
> +        <classpath refid="classpath.library"/>
> +        <arg value="client"/>
> +        <arg file="${build.work}/org/apache/ws/axis/oasis/Client_deploy.wsdd"/>
> +      </java>
>
> -        <java classname="org.apache.axis.client.AdminClient" fork="yes">
> -            <classpath refid="classpath.library"/>
> -            <arg line="${deploy_xml_property}"/>
> -        </java>
> -
> -       </target>
> +      <java classname="org.apache.axis.client.AdminClient" fork="yes">
> +        <classpath refid="classpath.library"/>
> +        <arg line="${deploy_xml_property}"/>
> +      </java>
> +    </target>
>
> -       <target name="undeployWSDD">
> -        <path id="undeploy_xml_files">
> -            <fileset dir="${build.work}">
> -                <include name="**/undeploy.wsdd"/>
> -            </fileset>
> -        </path>
> +    <target name="undeployWSDD">
> +      <path id="undeploy_xml_files">
> +        <fileset dir="${build.work}">
> +          <include name="**/undeploy.wsdd"/>
> +        </fileset>
> +      </path>
>
> -        <property name="undeploy_xml_property" refid="undeploy_xml_files"/>
> +      <property name="undeploy_xml_property" refid="undeploy_xml_files"/>
>
> -       <java classname="org.apache.axis.utils.Admin" fork="true">
> +      <java classname="org.apache.axis.utils.Admin" fork="true">
>              <classpath refid="classpath.library"/>
>              <arg value="client"/>
> -            <arg file="${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> -        </java>
> +            <arg file=
> +                 "${build.work}/org/apache/ws/axis/oasis/ping/undeploy.wsdd"/>
> +      </java>
>
> -        <java classname="org.apache.axis.client.AdminClient" fork="yes">
> -            <classpath refid="classpath.library"/>
> -            <arg line="${undeploy_xml_property}"/>
> -        </java>
> -
> -       </target>
> +      <java classname="org.apache.axis.client.AdminClient" fork="yes">
> +        <classpath refid="classpath.library"/>
> +        <arg line="${undeploy_xml_property}"/>
> +      </java>
> +    </target>
>
>         <!-- generate a report from all the tests.
>             requires Xalan or other XSLT engine in ant\lib-->
> -    <target name="report" depends="init">
> +
> +   <target name="report" depends="init">
>          <junitreport todir="${build.dir}/test-reports">
>              <fileset dir="${build.dir}/test-reports">
>                  <include name="TEST-*.xml"/>
>              </fileset>
>              <report format="frames" todir="${build.dir}/test-reports/html"/>
>          </junitreport>
> -        <echo message="point your browser to ${build.dir}/test-reports/html/index.html"/>
> +        <echo message=
> +            "point your browser to ${build.dir}/test-reports/html/index.html"/>
>      </target>
>
>      <target name="jar"
> @@ -648,35 +672,43 @@
>              />
>      </target>
>
> -   <target name="bindist" depends="gump" description="Build zip file for distro">
> -               <delete dir="${dir.dist}"/>
> -        <mkdir dir="${dir.dist}"/>
> -        <jar jarfile="${dir.dist}/${jar.library}"
> -            basedir="${build.classes}"
> -            includes="**/apache/**/security/**"  />
> -        <zip destfile="${dir.dist}/${product.shortname}-bin-${product.version}.zip">
> -            <zipfileset prefix="wss4j" dir="."
> -                includes="keys/**, interop/**, interop2/**, test/**, samples/**,
> -                                         LICENSE.txt, README.txt legal/**, webapps/**"/>
> -            <zipfileset prefix="wss4j/classes" dir="${build.classes}"
> -                includes="*.properties, interop/**, wssec/**, org/**/oasis/**, org/**/samples/**"/>
> -            <zipfileset prefix="wss4j/doc/api" dir="${build.javadoc}"/>
> -            <zipfileset fullpath="wss4j/${jar.library}" dir="${dir.dist}" includes="${jar.library}"/>
> -        </zip>
> -         <delete file="${dir.dist}/${jar.library}" />
> +   <target name="bindist" depends="gump"
> +      description="Build zip file for distro">
> +     <delete dir="${dir.dist}"/>
> +     <mkdir dir="${dir.dist}"/>
> +     <jar jarfile="${dir.dist}/${jar.library}"
> +       basedir="${build.classes}"
> +       includes="**/apache/**/security/**"  />
> +     <zip destfile=
> +        "${dir.dist}/${product.shortname}-bin-${product.version}.zip">
> +        <zipfileset prefix="wss4j" dir="."
> +          includes="keys/**, interop/**, interop2/**, test/**, samples/**,
> +          LICENSE.txt, README.txt legal/**, webapps/**"/>
> +        <zipfileset prefix="wss4j/classes" dir="${build.classes}"
> +          includes=
> +     "*.properties, interop/**, wssec/**, org/**/oasis/**, org/**/samples/**"/>
> +        <zipfileset prefix="wss4j/doc/api" dir="${build.javadoc}"/>
> +        <zipfileset fullpath="wss4j/${jar.library}" dir="${dir.dist}"
> +          includes="${jar.library}"/>
> +      </zip>
> +      <delete file="${dir.dist}/${jar.library}" />
>      </target>
>
> -    <target name="otherdist" depends="init" description="Build zip for required jars">
> +    <target name="otherdist" depends="init"
> +             description="Build zip for required jars">
>              <mkdir dir="${dir.dist}"/>
> -            <zip destfile="${dir.dist}/${product.shortname}-otherjars-${product.version}.zip">
> +            <zip destfile=
> +           "${dir.dist}/${product.shortname}-otherjars-${product.version}.zip">
>                  <zipfileset prefix="wss4j" dir="."
>                      includes="lib/*.jar, endorsed/*.jar"/>
>              </zip>
>          </target>
>
> -       <target name="srcdist" depends="init" description="Build source zip file for distro">
> +       <target name="srcdist" depends="init" description=
> +               "Build source zip file for distro">
>          <mkdir dir="${dir.dist}"/>
> -        <zip destfile="${dir.dist}/${product.shortname}-src-${product.version}.zip">
> +        <zip destfile=
> +                 "${dir.dist}/${product.shortname}-src-${product.version}.zip">
>              <zipfileset prefix="wss4j" dir="."
>                  includes="src/** LICENSE.txt README.txt legal/** build.xml "/>
>          </zip>
> @@ -751,7 +783,8 @@
>          </fileset>
>      </path>
>      <property name="deploy_xml_property" refid="deploy_xml_files"/>
> -    <java classname="org.apache.axis.utils.Admin" fork="yes" dir="${build.webapp}/WEB-INF">
> +    <java classname="org.apache.axis.utils.Admin" fork="yes"
> +        dir="${build.webapp}/WEB-INF">
>          <classpath refid="classpath.library"/>
>          <arg line="server"/>
>          <arg line="${deploy_xml_property}"/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>


--
Davanum Srinivas : http://wso2.com/ - Oxygenating The Web Service Platform

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org