You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Sanjiva Weerawarana <sa...@opensource.lk> on 2005/11/26 02:16:44 UTC

Re: svn commit: r349031 - in /webservices/axis2/trunk/java/modules: addressing/test/org/apache/axis2/handlers/addressing/ core/src/org/apache/axis2/ core/src/org/apache/axis2/client/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/util/

On Fri, 2005-11-25 at 22:37 +0000, dims@apache.org wrote:
> Author: dims
> Date: Fri Nov 25 14:37:44 2005
> New Revision: 349031
> 
> URL: http://svn.apache.org/viewcvs?rev=349031&view=rev
> Log:
> Baby Step #1 for cleaning up Stub/Call
> 
> - Get rid of the MIH inside MEPClient, this was overriding for example the setWSAAction set in the messagecontext (inside the stub)
> - Keep the properties in a HashMap and copy them into MessageContext as soon as it is created.

FYI Eran and I are doing a careful review of the client side and expect
to propose a significant refactoring. We've found lots of places to
improve. It may take a couple of days (depending on how much we get done
over the weekend) but it'll be worth it. Along with refactoring
MEPClient downwards we also are looking at the Stub class.

>      /**
> +     * Copy the values into the respective fields.
> +     * 
>       * @param collection
>       */
> -    public void setMessageInformationHeaders(MessageInformationHeaders collection) {
> -        messageInformationHeaders = collection;
> +    public void setContextProperties(HashMap collection) {
> +        Iterator iterator = collection.entrySet().iterator();
> +        while(iterator.hasNext()){
> +            Map.Entry entry = (Map.Entry) iterator.next();
> +            String key = (String)entry.getKey();
> +            Object value = entry.getValue();
> +            if(value!= null){
> +                if(Constants.ADDRESSING_ACTION.equals(key)){
> +                    messageInformationHeaders.setAction((String) value);                        
> +                } else if (Constants.ADDRESSING_FAULT_TO.equals(key)){
> +                    messageInformationHeaders.setFaultTo((EndpointReference) value);                        
> +                } else if (Constants.ADDRESSING_FROM.equals(key)){
> +                    messageInformationHeaders.setFrom((EndpointReference) value);                        
> +                } else if (Constants.ADDRESSING_MESSAGE_ID.equals(key)){
> +                    messageInformationHeaders.setMessageId((String) value);                        
> +                } else if (Constants.ADDRESSING_RELATES_TO.equals(key)){
> +                    messageInformationHeaders.setRelatesTo((RelatesTo) value);                        
> +                } else if (Constants.ADDRESSING_REPLY_TO.equals(key)){
> +                    messageInformationHeaders.setReplyTo((EndpointReference) value);                        
> +                } else if (Constants.ADDRESSING_TO.equals(key)){
> +                    System.out.println("TO" + value);
> +                    messageInformationHeaders.setTo((EndpointReference) value);                        
> +                }
> +            }
> +        }
>      }

I hate this kind of code - the addressing properties are fundamental
concepts of a message and hence they should be stored directly IMO. Also
this is relatively inefficient for something that happens thru every
call.invoke*.

The problem (that the MIH was replacing stuff) can be dealt with in
another way too. Anyway, need a bit more time to sort this through.

Sanjiva.