synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruwan Linton <ru...@apache.org>
Subject Re: svn commit: r762222 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: core/axis2/Axis2FlexibleMEPClient.java util/MessageHelper.java
Date Mon, 06 Apr 2009 07:52:02 GMT
Sorry, this is to fix SYNAPSE-531 not 525.

Thanks,
Ruwan

On Mon, Apr 6, 2009 at 12:22 PM, <ruwan@apache.org> wrote:

> Author: ruwan
> Date: Mon Apr  6 06:52:04 2009
> New Revision: 762222
>
> URL: http://svn.apache.org/viewvc?rev=762222&view=rev
> Log:
> Fixing issue SYNAPSE-525, copying the full options object not just the
> properties of options
>
> Modified:
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=762222&r1=762221&r2=762222&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
> Mon Apr  6 06:52:04 2009
> @@ -242,7 +242,7 @@
>                 new QName(AnonymousServiceFactory.OUT_ONLY_OPERATION) :
>                 new QName(AnonymousServiceFactory.OUT_IN_OPERATION));
>
> -        Options clientOptions = new Options();
> +        Options clientOptions =
> MessageHelper.cloneOptions(originalInMsgCtx.getOptions());
>         clientOptions.setUseSeparateListener(separateListener);
>         // if RM is requested,
>         if (wsRMEnabled) {
> @@ -252,6 +252,8 @@
>                     SynapseConstants.SANDESHA_POLICY,
>                         MessageHelper.getPolicy(synapseOutMessageContext,
> wsRMPolicyKey));
>             }
> +            // todo: this wont be required now because we copy the full
> options cloned copy with
> +            // todo: the parent of the options object as well
>             MessageHelper.copyRMOptions(originalInMsgCtx, clientOptions);
>         }
>
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java?rev=762222&r1=762221&r2=762222&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
> Mon Apr  6 06:52:04 2009
> @@ -121,6 +121,7 @@
>
>         org.apache.axis2.context.MessageContext newMC = clonePartially(mc);
>         newMC.setEnvelope(cloneSOAPEnvelope(mc.getEnvelope()));
> +        newMC.setOptions(cloneOptions(mc.getOptions()));
>
>         newMC.setServiceContext(mc.getServiceContext());
>         newMC.setOperationContext(mc.getOperationContext());
> @@ -199,11 +200,6 @@
>             }
>         }
>
> -        for (Object o : ori.getOptions().getProperties().keySet()) {
> -            String key = (String) o;
> -            newMC.getOptions().setProperty(key,
> ori.getOptions().getProperty(key));
> -        }
> -
>         Iterator itr = ori.getPropertyNames();
>         while (itr.hasNext()) {
>             String key = (String) itr.next();
> @@ -254,6 +250,55 @@
>     }
>
>     /**
> +     * Clones the given {@link org.apache.axis2.client.Options} object.
> This is not a deep copy
> +     * because this will be called for each and every message going out
> from synapse. The parent
> +     * of the cloning options object is kept as a reference.
> +     *
> +     * @param options clonning object
> +     * @return clonned Options object
> +     */
> +    public static Options cloneOptions(Options options) {
> +
> +        // create new options object and set the parent
> +        Options clonedOptions = new Options(options.getParent());
> +
> +        // copy general options
> +
>  clonedOptions.setCallTransportCleanup(options.isCallTransportCleanup());
> +
>  clonedOptions.setExceptionToBeThrownOnSOAPFault(options.isExceptionToBeThrownOnSOAPFault());
> +        clonedOptions.setManageSession(options.isManageSession());
> +        clonedOptions.setSoapVersionURI(options.getSoapVersionURI());
> +
>  clonedOptions.setTimeOutInMilliSeconds(options.getTimeOutInMilliSeconds());
> +
>  clonedOptions.setUseSeparateListener(options.isUseSeparateListener());
> +
> +        // copy addressing related options
> +        clonedOptions.setMessageId(options.getMessageId());
> +        clonedOptions.setTo(options.getTo());
> +        clonedOptions.setFrom(options.getFrom());
> +        clonedOptions.setAction(options.getAction());
> +        clonedOptions.setReplyTo(options.getReplyTo());
> +        clonedOptions.setFaultTo(options.getFaultTo());
> +        clonedOptions.setRelationships(options.getRelationships());
> +
> +        // copy transport related options
> +        clonedOptions.setListener(options.getListener());
> +        clonedOptions.setTransportIn(options.getTransportIn());
> +
>  clonedOptions.setTransportInProtocol(options.getTransportInProtocol());
> +        clonedOptions.setTransportOut(clonedOptions.getTransportOut());
> +
> +        // copy username and password options
> +        clonedOptions.setUserName(options.getUserName());
> +        clonedOptions.setPassword(options.getPassword());
> +
> +        // cloen the property set of the current options object
> +        for (Object o : options.getProperties().keySet()) {
> +            String key = (String) o;
> +            clonedOptions.setProperty(key, options.getProperty(key));
> +        }
> +
> +        return clonedOptions;
> +    }
> +
> +    /**
>      * Removes Submission and Final WS-Addressing headers and return the
> SOAPEnvelope from the given
>      * message context
>      *
>
>
>


-- 
Ruwan Linton
Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Mime
View raw message