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 <[email protected]>
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 <[email protected]> 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
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Lasantha Fernando*
> Software Engineer - Data Technologies Team
> WSO2 Inc. http://wso2.com
>
> email: [email protected]
> mobile: (+94) 71 5247551
>



-- 
*Lahiru Cooray*
Software Engineer
WSO2, Inc.;http://wso2.com/
lean.enterprise.middleware

Mobile: +94 715 654154

Attachment: AbsExtension.java
Description: Binary data

_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to