From what I understood, the pattern attribute is optional. So, if we use that 
attribute in the configuration, we intend the mediator to behave as a pattern 
matcher. (In which case the 2nd option has the correct behavior.) Otherwise we 
do not have to use the attribute in the first place. 

If we go with the first option, it kills  the whole idea of supporting an 
optional pattern. Additionally it wont reliably show the distinction between 
the successful and unsuccessful pattern matches for certain cases. This will 
not be helpful in real integration scenarios  that use filtering etc.  

I felt that third approach is also not helpful because wont it be more like we 
purposely reassign if we define the property twice within the same scope. In 
this case as well the mediator must reassign the correct result after matching 
the pattern. 


Ishan Jayawardena

On 2013 ජූලි 17, at පෙ.ව. 12.36, Hiranya Jayathilaka <[email protected]> 
wrote:

> 
> On Jul 16, 2013, at 11:49 AM, Ishan Jayawardena <[email protected]> wrote:
> 
>> Hi Hiranya,
>> In my opinion, approach 2 suggests the correct behavior.
> 
> Could you please explain the reason? Does the current behavior break 
> anything? Is there any special use cases where the existing behavior doesn't 
> work out properly?
> 
> Thanks,
> Hiranya
> 
>> 
>> Thanks,
>> Ishan.
>> 
>> 
>> On Tue, Jul 16, 2013 at 11:46 PM, Hiranya Jayathilaka <[email protected]> 
>> wrote:
>>> Hi Folks,
>>> 
>>> The property mediator supports a pattern attribute which can be used to 
>>> specify a regular expression. When specified, the value of the XPath 
>>> expression is matched against this regex and the resulting group of the 
>>> match is what gets assigned to the property. If the regex doesn't match, 
>>> the mediator assigns the original value of the XPath expression to the 
>>> property. 
>>> 
>>> SYNAPSE-890 argues that this behavior is wrong, and the mediator must 
>>> assign the empty string to the property if the regex doesn't match. I'm not 
>>> quite sure what the right behavior should be. Does anybody have any ideas? 
>>> To me it's a contest between:
>>> 
>>> 1. Assign the value of the XPath expression (current behavior)
>>> 2. Assign the empty string (behavior proposed in SYNAPSE-890)
>>> 3. Not set the property value at all - leave the current property value 
>>> unmodified
>>> 
>>> Thanks,
>>> Hiranya
>>> 
>>> --
>>> Hiranya Jayathilaka
>>> Mayhem Lab/RACE Lab;
>>> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
>>> E-mail: [email protected];  Mobile: +1 (805) 895-7443
>>> Blog: http://techfeast-hiranya.blogspot.com
>> 
>> 
>> 
>> -- 
>> Regards,
>> Ishan Jayawardena.
> 
> --
> Hiranya Jayathilaka
> Mayhem Lab/RACE Lab;
> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
> E-mail: [email protected];  Mobile: +1 (805) 895-7443
> Blog: http://techfeast-hiranya.blogspot.com
> 

Reply via email to