+1 Ruwan
On Fri, Sep 17, 2010 at 10:06 PM, Hiranya Jayathilaka <[email protected]>wrote: > Hi, > > On Fri, Sep 17, 2010 at 9:39 PM, Hiranya Jayathilaka > <[email protected]> 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 > > <[email protected]> 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, <[email protected]> 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: [email protected]; Mobile: +94 77 633 3491 > >> Blog: http://techfeast-hiranya.blogspot.com > >> > > > > > > > > -- > > Hiranya Jayathilaka > > Senior Software Engineer; > > WSO2 Inc.; http://wso2.org > > E-mail: [email protected]; Mobile: +94 77 633 3491 > > Blog: http://techfeast-hiranya.blogspot.com > > > > > > -- > Hiranya Jayathilaka > Senior Software Engineer; > WSO2 Inc.; http://wso2.org > E-mail: [email protected]; Mobile: +94 77 633 3491 > Blog: http://techfeast-hiranya.blogspot.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Ruwan Linton Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org Lean . Enterprise . Middleware phone: +1 408 754 7388 ext 51789 email: [email protected]; cell: +94 77 341 3097 blog: http://blog.ruwan.org linkedin: http://www.linkedin.com/in/ruwanlinton google: http://www.google.com/profiles/ruwan.linton tweet: http://twitter.com/ruwanlinton
