synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
Subject Re: svn commit: r997582 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml: TargetFactory.java TargetSerializer.java
Date Fri, 17 Sep 2010 16:36:52 GMT
Hi,

On Fri, Sep 17, 2010 at 9:39 PM, Hiranya Jayathilaka
<hiranya911@gmail.com> wrote:
> BTW why did you add the 'sequential' attribute to the target element?
> Shouldn't that be added to the iterate mediator configurations?

Just had another look at the implementation of the Target and now I
see the rationale behind this change. But I still think it is wrong to
allow the user to configure each target as being sync or async. It
should be part of the parent configuration and not the target
configuration itself. In other words the party that invokes the target
should decide whether it's a sync invocation or not.

For instance in case of the iterate mediator it should be an attribute
of the iterate mediator. Otherwise the configuration will look just
weird in situations where you have multiple target elements under the
same parent. For an example take the clone mediator. In that case one
can configure some targets to be sync and some to be async which
doesn't make much sense.

So what if we do this? We remove the public setter for the
asynchronous attribute in the Target class and add a constructor
parameter for it. We also change the TargetFactory#createTarget method
to take an asynchronous attribute. (Or to make things simple we can
introduce a new method TargetFactory#createSyncTarget which is only
used by the iterate mediator - for now) That way the parent can
specify whether a target should be sync or not at creation time.

Thanks,
Hiranya

>
> Thanks,
> Hiranya
>
> On Fri, Sep 17, 2010 at 9:36 PM, Hiranya Jayathilaka
> <hiranya911@gmail.com> wrote:
>> Supun,
>>
>> This change has broken some of the serialization tests. Hudson builds
>> have been failing. Please have a look. Usually when we change a
>> serializer it is bound to break some serialization tests.
>>
>> Thanks,
>> Hiranya
>>
>> On Thu, Sep 16, 2010 at 9:17 AM,  <supun@apache.org> wrote:
>>> Author: supun
>>> Date: Thu Sep 16 03:47:30 2010
>>> New Revision: 997582
>>>
>>> URL: http://svn.apache.org/viewvc?rev=997582&view=rev
>>> Log:
>>> giving capability to implement target in sequencial mode
>>>
>>> Modified:
>>>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
>>>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
>>>
>>> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
>>> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java?rev=997582&r1=997581&r2=997582&view=diff
>>> ==============================================================================
>>> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
(original)
>>> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
Thu Sep 16 03:47:30 2010
>>> @@ -87,6 +87,19 @@ public class TargetFactory {
>>>             target.setEndpointRef(endpointAttr.getAttributeValue());
>>>         }
>>>
>>> +        OMAttribute syncAttribute = elem.getAttribute(
>>> +                new QName(XMLConfigConstants.NULL_NAMESPACE, "sequencial"));
>>> +        if (syncAttribute != null) {
>>> +            if (syncAttribute.getAttributeValue().equals("true")) {
>>> +                target.setAsynchronous(false);
>>> +            } else if (syncAttribute.getAttributeValue().equals("false"))
{
>>> +                target.setAsynchronous(true);
>>> +            } else {
>>> +                handleException("Only true or false expected for Target
sequencial " +
>>> +                        "attribute, specified value is: " + syncAttribute.getAttributeValue());
>>> +            }
>>> +        }
>>> +
>>>         OMElement sequence = elem.getFirstChildWithName(
>>>                 new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "sequence"));
>>>         if (sequence != null) {
>>>
>>> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
>>> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java?rev=997582&r1=997581&r2=997582&view=diff
>>> ==============================================================================
>>> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
(original)
>>> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
Thu Sep 16 03:47:30 2010
>>> @@ -75,6 +75,10 @@ public class TargetSerializer {
>>>             targetElem.addAttribute("endpoint", target.getEndpointRef(),
nullNS);
>>>         }
>>>
>>> +        if (!target.isAsynchronous()) {
>>> +            targetElem.addAttribute("sequencial", "true", nullNS);
>>> +        }
>>> +
>>>         if (target.getSequence() != null) {
>>>             SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
>>>             serializer.serializeAnonymousSequence(targetElem, target.getSequence());
>>>
>>>
>>>
>>
>>
>>
>> --
>> Hiranya Jayathilaka
>> Senior Software Engineer;
>> WSO2 Inc.;  http://wso2.org
>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> Blog: http://techfeast-hiranya.blogspot.com
>>
>
>
>
> --
> Hiranya Jayathilaka
> Senior Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Hiranya Jayathilaka
Senior Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

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


Mime
View raw message