Hi Lahiru,

Looks like, Its default attribute type is set to LONG if no parameter
passed, That's why even if you don't pass any value its assigning the
default attribute type and returns that.

Even i got the same case.



Thanks & Regards,
S.A.Rajeevan
Software Engineer WSO2 Inc
E-Mail: rajeev...@wso2.com | Mobile : +94776411636

On Wed, Oct 15, 2014 at 5:17 PM, Lahiru Cooray <lahi...@wso2.com> wrote:

> Hi,
>
> Please refer the attached java class. And the siddhi query is as follows:
>
> from InputStream1
> select custom:abs(para1) as p1
> insert into OutStream1
>
> As per the code, when we call abs() function with no parameters it should
> fire the validation.
> But it wont give the expected result.
>
> Thanks..
>
> On Wed, Oct 15, 2014 at 4:41 PM, Lasantha Fernando <lasan...@wso2.com>
> wrote:
>
>> Hi Lahiru,
>>
>> Looking at the code segment given above, everything seems correct. Can
>> you attach the complete class of the Siddhi extension and the exact query
>> used, so that we can dig into it deeper?
>>
>> Thanks,
>> Lasantha
>>
>> On 14 October 2014 21:54, Lahiru Cooray <lahi...@wso2.com> wrote:
>>
>>> Hi,
>>>
>>> When writing a custom function as a Siddhi Extension I faced an issue in
>>> validating the parameter count passed.
>>>
>>> Eg:
>>> from InputStream1
>>> select *custom:cos(para1)*
>>> insert into OutputSream1
>>>
>>> I tried to validate the custom function '*cos*' where user should be
>>> able to pass only one parameter.I used the below code in my function:
>>>
>>>  @Override
>>>
>>> public void init(Attribute.Type[] types, SiddhiContext siddhiContext) {
>>>
>>> if (types.length  !=1 ) {
>>>
>>>  //validation message
>>>
>>> }
>>>
>>> ………
>>>
>>> }
>>> Here even when the user doesn't pass any parameter, it returns the
>>> types.length as '1' and the data type as LONG.
>>>
>>> Can somebody please help me to figure out the reason for this??
>>>
>>> Thanks...
>>> --
>>> *Lahiru Cooray*
>>> Software Engineer
>>> WSO2, Inc.;http://wso2.com/
>>> lean.enterprise.middleware
>>>
>>> Mobile: +94 715 654154
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Lasantha Fernando*
>> Software Engineer - Data Technologies Team
>> WSO2 Inc. http://wso2.com
>>
>> email: lasan...@wso2.com
>> mobile: (+94) 71 5247551
>>
>
>
>
> --
> *Lahiru Cooray*
> Software Engineer
> WSO2, Inc.;http://wso2.com/
> lean.enterprise.middleware
>
> Mobile: +94 715 654154
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to