Re: [Dev] Why do we start C5 wso2servers by default in OSGI mode?

2019-03-06 Thread Sajith Ariyarathna
AFAIK, enabling OSGi console doesn't hurt runtime performance of the
product (at least in a significant way).
You can disable OSGi console via
/conf//osgi/launch.properties file. Set
osgi.console=none

Thanks.

On Wed, Mar 6, 2019 at 5:33 AM Ishara Cooray  wrote:

> Hi,
> I noticed that WSO2 APIM Analytics server by default starts with osgi
> profile.
> Is there any particular reason for this?
> Isn't there any performance impact due to this?
>
> Thanks & Regards,
> Ishara Cooray
> Associate Technical Lead
> Mobile : +9477 262 9512
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
Sajith Janaprasad Ariyarathna
Associate Technical Lead
WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] SP Analytics REST APIs

2019-01-03 Thread Sajith Ariyarathna
Hi Bernard,

Analytics profile of EI-6.4.0 is an instance of SP-4.3.0. Please refer doc
[1] on the REST APIs exposed by SP.

[1] https://docs.wso2.com/display/SP430/Stream+Processor+REST+API+Guide

Thanks.

On Thu, Jan 3, 2019 at 8:51 PM Bernard Paris 
wrote:

> Hi devs,
>
> before EI640 and previous Analytics version software we were using the
> REST API to query Analytics for its datas then build our own graphical web
> pages with results in a web application
>
>
>
>
> This doesn't work anymore with new Analytics now embedded into a
> StreamProcessor worker.  I read the doc
> "Analyzing Statistics for REST APIs" at
> https://docs.wso2.com/display/EI640/Analyzing+Statistics+for+REST+APIs
> but cannot find there any REST API URL we could use.
>
> Is it possible to query the dashboard worker as it is from external
> applications using REST APIs ?
>
>
> Thanks
> Bernard
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
Sajith Janaprasad Ariyarathna
WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Architecture] Streamproccessor - report in excel format

2018-11-27 Thread Sajith Ariyarathna
Hi Jørgen,

Yes, currently dashboard only support "export as PDF". Unfortunately there
are no workaround to export to other formats (e.g. excel, csv), we have to
implement that. We don't have immediate plans to introduce new export
types. Based on a quick glance, I think we can do CSV but Excel will be
tricky. Please note that I have created issue [1] to track this.

[1] https://github.com/wso2/carbon-dashboards/issues/1108

Thanks.

On Mon, Nov 26, 2018 at 5:01 PM Jørgen Østergaard  wrote:

> Hi Sajith,
>
>
>
> Yes, exactly – only option seems to be pdf
>
>
>
>
>
>
>
> Med venlig hilsen / best regards
>
>
>
> Jørgen Østergaard
> Phone:  +45 5363 6732
>
>
>
> [image: cid:31391d25-b727-4571-b9f2-a66d58180757]
>
> id connect A/S
> CVR 39611082
> Engager 8
> DK – 2605 Brøndbyvester
> Denmark
>
>
>
> *Fra:* Sajith Ariyarathna 
> *Sendt:* 26. november 2018 12:12
> *Til:* WSO2 Developers' List ; Jørgen Østergaard <
> j...@idconnect.dk>
> *Emne:* Re: [Architecture] Streamproccessor - report in excel format
>
>
>
> Hi Jørgen,
>
>
>
> Are you referring to the report generation feature in the Dashboard portal
> in WSO2 Stream Processor [1]?
>
>
>
> [1] https://docs.wso2.com/display/SP430/Generating+Reports
>
>
>
> Thanks.
>
>
>
> On Mon, Nov 26, 2018 at 3:24 PM Jørgen Østergaard 
> wrote:
>
> Hi,
>
>
>
> Are there any plans of extending the pdf report output in Stremprocessor
> to either Excel or CSV ?
>
>
>
> Any suggested workaround?
>
>
>
> Thanks,
>
>
>
> Med venlig hilsen / best regards
>
>
>
> Jørgen Østergaard
> Phone:  +45 5363 6732
>
>
>
> [image: cid:31391d25-b727-4571-b9f2-a66d58180757]
>
> id connect A/S
> CVR 39611082
> Engager 8
> DK – 2605 Brøndbyvester
> Denmark
>
>
>
> ___
> Architecture mailing list
> architect...@wso2.org
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
>
>
> --
>
> Sajith Janaprasad Ariyarathna
>
> WSO2, Inc.;  http://wso2.com/
>
> <https://wso2.com/signature>
>


-- 
Sajith Janaprasad Ariyarathna
WSO2, Inc.;  http://wso2.com/
<https://wso2.com/signature>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Architecture] Streamproccessor - report in excel format

2018-11-26 Thread Sajith Ariyarathna
Hi Jørgen,

Are you referring to the report generation feature in the Dashboard portal
in WSO2 Stream Processor [1]?

[1] https://docs.wso2.com/display/SP430/Generating+Reports

Thanks.

On Mon, Nov 26, 2018 at 3:24 PM Jørgen Østergaard  wrote:

> Hi,
>
>
>
> Are there any plans of extending the pdf report output in Stremprocessor
> to either Excel or CSV ?
>
>
>
> Any suggested workaround?
>
>
>
> Thanks,
>
>
>
> Med venlig hilsen / best regards
>
>
>
> Jørgen Østergaard
> Phone:  +45 5363 6732
>
>
>
> [image: cid:31391d25-b727-4571-b9f2-a66d58180757]
>
> id connect A/S
> CVR 39611082
> Engager 8
> DK – 2605 Brøndbyvester
> Denmark
>
>
> ___
> Architecture mailing list
> architect...@wso2.org
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>


-- 
Sajith Janaprasad Ariyarathna
WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV] Defining environment variables for C5 config based deployment

2018-10-24 Thread Sajith Ariyarathna
Hi Tharindu,

What if there are underscores in the variable name? How do we deal with
that?

Thanks.

On Wed, Oct 24, 2018 at 11:16 PM Danesh Kuruppu  wrote:

> +1 for the change.
>
> @Vidura Nanayakkara  Can you please review these
> changes.
>
> Thanks
> Danesh
>
> On Wed, Oct 24, 2018 at 10:52 PM Tharindu Dharmarathna 
> wrote:
>
>> Hi All,
>>
>> We had come across the following issue when configuring environment
>> variables for API Manager 3.0.
>>
>> We had the following type of deployment.yaml as default.
>>
>> wso2.configuration:
>>   complexBean:
>> name: default
>> Bean:
>>   name: default
>>
>>
>> in order to set the environment variable for *name *under complexBean,
>> we have to write environment variable as follows.
>>
>> WSO2.CONFIGURATION_COMPLEXTESTBEAN_NAME="default"
>>
>> Which is not supported to create an environment variable couldn't have a
>> dot (.) in the name.
>>
>> In order to fix this issue, I had come up with make Underscore ( _ )  in
>> namespace value. Once it fixed it looks like follows.
>>
>> WSO2_CONFIGURATION_COMPLEXTESTBEAN_NAME="default"
>>
>> Please find the git issue create [1] and pull request for fix [2].
>>
>> [1] - https://github.com/wso2/carbon-config/issues/66
>> [2]  - https://github.com/wso2/carbon-config/issues/66
>>
>>
>> Thanks
>>
>> *Tharindu Dharmarathna*Associate Technical Lead
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>
>
> --
>
> *Danesh Kuruppu*
> Associate Technical Lead | WSO2
>
> Email: dan...@wso2.com
> Mobile: +94 (77) 1690552
> Web: WSO2 Inc 
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
Sajith Janaprasad Ariyarathna
WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Permission handling in SP

2018-10-04 Thread Sajith Ariyarathna
You can only give permissions (by setting roles) for dashboards only.
Currently we don't support permissions for widgets.

Thanks.

On Thu, Oct 4, 2018 at 3:54 PM Sandalu Kalpanee  wrote:

> Hi all,
>
> I am working on my project to shift APIM Analytics in to SP in the coming
> APIM 3.0 version. The project involves in the initial process of designing
> the dashboards and widgets for the APIM analytics. When designing the
> dashboard view I have come up with a problem on permitting different views
> for different users in APIM. So I want to know how the permissions handled
> in SP. Whether I can grant permission per dashboards, widgets or pages. (I
> have found that we can grant permission for each dashboard.) It'd be great
> if i can know whether I can separately allow users to view pages/widgets.
>
> Thank you!
>
> --
> *Sandalu Kalpanee*
> *Software Engineer - Intern*
> *WSO2*
>


-- 
Sajith Janaprasad Ariyarathna
Senior Software Engineer; WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Using regex in Siddhi SQL queries

2018-08-08 Thread Sajith Ariyarathna
Can you share your Siddhi code block here?

I feel like what you have request here is similar to the functionality of
SQL IN operator, rather than a regex.

Also, have you tried to use the regexp function [1]?

[1]
https://wso2-extensions.github.io/siddhi-execution-string/api/4.0.19/#regexp-function

Thanks.

On Wed, Aug 8, 2018 at 5:16 PM Thisaru Guruge  wrote:

> Hi all,
>
> I have a use case where I need to retrieve data from an aggregation using
> regex.
>
> The exact scenario is that I have a comma separated string, where I need
> to retrieve data if one of the comma separated value is matching a string.
>
> I used String tokenizer to tokenize the comma separated values, but then
> it will create duplicate events, hence aggregate values can be misleading.
> If we can match regex this can be avoided.
>
> I had a discussion with @Niveathika Rajendran  about
> the matter, and what I learnt is that the "on" clause in siddhi matches the
> strings using "equals" function in Java, hence regex might not work.
>
> Can we enhance it to match regex ? Or is there any workaround for this ?
>
> As per my understanding, it will be a huge load in the front end, if we
> process this in the front-end side. Is it okay to process it in the front
> end?
>
> Please comment.
>
> --
> Thanks and Best Regards,
> Thisaru Guruge
> Software Engineer
> Mobile: +94 71 720 9720
>
>
> WSO2 Inc.: http://www.wso2.com
>
>
>

-- 
Sajith Janaprasad Ariyarathna
Senior Software Engineer; WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Siddhi][SDK] Update dependency versions

2018-07-04 Thread Sajith Ariyarathna
[+Analytics Team]

On Wed, Jul 4, 2018 at 11:10 PM Raveen Rathnayake 
wrote:

> Hi all,
>
> Please review and merge [1]. This PR updates the dependencies of the
> Siddhi SDK. After merging this PR please trigger a release build of SIddhi
> SDK 1.0.3.
>
> [1] https://github.com/wso2/siddhi-sdk/pull/13
>
> Thank you.
> Raveen.
>
> *Raveen Savinda Rathnayake*
> *Final Year Undergraduate, Informatics Institute of Technology*
> *+94 7711 44549 | raveen@gmail.com
>  | Blog: blog.raveen.me *
> *www.raveen.me* 
> 
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
Sajith Janaprasad Ariyarathna
Senior Software Engineer; WSO2, Inc.;  http://wso2.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV][JAGGERY] Getting Empty JSON when logging(log.info)

2016-02-08 Thread Sajith Ariyarathna
Hi Manu,

Logging full object might break existing code that has logs of Java object
> in other products. If a developer accidentally logs a circular references
> it might even crash the server.
>
 Point taken, logging circular objects is a problem. My concern is that,
logging Java objects details in "JSON string format" is not a good way to
do it. May be we can log details of the Java object without following the
JSON format. Like this,

(class: org.wso2.models.Student, toString: "name: Kamal, age: 25, city:
Colombo")


Thanks.

On Tue, Feb 9, 2016 at 12:29 PM, Manuranga Perera  wrote:

> Hi Sajith,
> +1 not longing full object. Logging full object might break existing code
> that has logs of Java object in other products. If a developer accidentally
> logs a circular references it might even crash the server. Logs are for
> getting a bit of information for debug or operational purposes, it
> shouldn't be heavy or have any side effects.
>
> A log should be something you should be able to put without worrying too
> much.
>
> On Thu, Feb 4, 2016 at 6:41 PM, Sajith Ariyarathna 
> wrote:
>
>> So I am planning to log in-case of Java object as below without logging
>>> whole object.
>>> { "javaObject" : true, "hashCode" : "39d92a", "class" :
>>> "org.wso2.apim.StoreHostObject"}
>>>
>> -1
>>
>>- Think from the JavaScript perspective. When you log an object in
>>Jaggery/JavaScript it gives you the JSON representation of that object.
>>That is the expected behavior. So if you outputs a JSON string as the 
>> above
>>suggestion, it gives a wrong impression that there are 3 properties
>>"javaObject", "hasCode" & "class".
>>- Most of the time we log an object to see what is inside that
>>object. Above suggestion does not help in that situation. See the 
>> beginning
>>of this mail thread. The original problem you had was 'Jaggery gives "{}"
>>when logging a POJO instead of the JSON representation of that POJO'.
>>
>> My suggestion is to just output the JSON string of the POJO, If you
>> really want to add the Java class name then you can try something like this.
>>  (org.wso2.models.Student){"name": "Kamal", "age": "26", "city":
>> "Colombo"}
>>
>> Thanks.
>>
>> On Wed, Feb 3, 2016 at 1:00 PM, Rajeenthini Satkunam <
>> rajeenth...@wso2.com> wrote:
>>
>>> HI all,
>>>
>>> The issue was solved by adding  for
>>> jackson-databind,jackson-annotations,jackson-core for POM[1] .
>>>
>>> By the Way I would like to discuss more regarding this mail.
>>>
>>> *Issue I am trying to solve*
>>>
>>>  - I am getting empty JSON string ("{}") when logging Java object.
>>>  - Empty JSON string("{}") will give wrong information to user.
>>>
>>> *Proposed solution*
>>>
>>>   - give the user proper understandable log message.
>>>   - the logging need to be fast and summarized.
>>>
>>> So I am planning to log in-case of Java object as below without logging
>>> whole object.
>>> { "javaObject" : true, "hashCode" : "39d92a", "class" :
>>> "org.wso2.apim.StoreHostObject"}
>>>
>>> You can find these links[2][3] as resources to get an idea.
>>>
>>> [1] -
>>> https://github.com/wso2/jaggery/blob/master/features/org.jaggeryjs.server.feature/pom.xml
>>> [2] -
>>> https://github.com/wso2/jaggery/blob/master/components/hostobjects/org.jaggeryjs.hostobjects.log/src/main/java/org/jaggeryjs/hostobjects/log/LogHostObject.java
>>> [3] -
>>> https://github.com/wso2/jaggery/blob/master/components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/util/HostObjectUtil.java
>>>
>>>
>>> On Wed, Feb 3, 2016 at 10:27 AM, Rajeenthini Satkunam <
>>> rajeenth...@wso2.com> wrote:
>>>
>>>> HI Niranjan,
>>>>
>>>> Ya sure.I will meet you today.
>>>>
>>>> On Wed, Feb 3, 2016 at 9:25 AM, Niranjan Karunanandham <
>>>> niran...@wso2.com> wrote:
>>>>
>>>>> Hi Rajeenthini,
>>>>>
>>>>>
>>>>> On Wed, Feb 3, 2016 at 9:19 AM, Rajeenthini Satkunam <
>>>>> rajeenth...@wso2.com> wrote:
>>

Re: [Dev] [DEV][JAGGERY] Getting Empty JSON when logging(log.info)

2016-02-04 Thread Sajith Ariyarathna
Jaggery and product-Jaggery
>>>> respectively.I can build Jaggery successfully But It has failed when
>>>> building product Jaggery at Jaggery - Profile Generation.
>>>>
>>>> As per offline discussion with Niranjan I have added 
>>>> and <*dependency*> for Jackson data-bind and annotation in POM.xml[
>>>> https://github.com/wso2/jaggery/blob/master/features/org.jaggeryjs.server.feature/pom.xml]
>>>> file as below.
>>>>
>>>> com.fasterxml.jackson.core:jackson-databind
>>>> com.fasterxml.jackson.core:jackson-annotations
>>>>
>>>>
>>>> 
>>>> com.fasterxml.jackson.core
>>>> jackson-databind
>>>> 
>>>> 
>>>> com.fasterxml.jackson.core
>>>> jackson-annotations
>>>> 
>>>>
>>>>
>>>> But Still I am getting product Jaggery build fail at the point Jaggery - 
>>>> Profile Generation,following error can be observe in the command line.
>>>>
>>>>
>>>> Installation failed.Cannot complete the install because one or more 
>>>> required items could not be found.
>>>>
>>>>  Software being installed: uuid Module - Feature 1.4.3 
>>>> (org.jaggeryjs.modules.uuid.feature.group 1.4.3)
>>>>  Missing requirement: jackson-databind 2.0.0 (jackson-databind 2.0.0) 
>>>> requires 'package com.fasterxml.jackson.core [2.0.0,3.0.0)' but it could 
>>>> not be found
>>>>  Cannot satisfy dependency:
>>>>   From: org.jaggeryjs.modules.uuid 1.4.3 (org.jaggeryjs.modules.uuid 1.4.3)
>>>>   To: package org.jaggeryjs.scriptengine.exceptions [0.11.0,1.0.0)
>>>>  Cannot satisfy dependency:
>>>>
>>>>   From: uuid Module - Feature 1.4.3 
>>>> (org.jaggeryjs.modules.uuid.feature.group 1.4.3)
>>>>   To: org.jaggeryjs.modules.uuid [1.4.3]
>>>>  Cannot satisfy dependency:
>>>>   From: org.jaggeryjs.scriptengine 0.12.1.SNAPSHOT 
>>>> (org.jaggeryjs.scriptengine 0.12.1.SNAPSHOT)
>>>>   To: package com.fasterxml.jackson.databind [2.0.0,3.0.0)
>>>> Application failed, log file location: 
>>>> /home/rajee/.m2/repository/org/eclipse/tycho/tycho-p2-runtime/0.13.0/eclipse/configuration/1454469448601.log
>>>>
>>>>
>>>> Can anyone help me to figure out the cause of build fail.Hope I have 
>>>> included all the steps I have followed.Your help would be appreciated.
>>>>
>>>> As per the error, the build is failing because jackson-databind
>>> requires com.fasterxml.jackson.core within the range 2.0.0 and 3.0.0. If
>>> this is required by the feature then you need to bundle it in the feature.
>>> Shall we have a look at this today?
>>>
>>>>
>>>>
>>>>
>>>> On Tue, Feb 2, 2016 at 10:23 AM, Rajeenthini Satkunam <
>>>> rajeenth...@wso2.com> wrote:
>>>>
>>>>> Hi sajith,
>>>>>
>>>>> Noted and thank you for the suggestions.
>>>>>
>>>>> On Mon, Feb 1, 2016 at 11:53 PM, Sajith Ariyarathna >>>> > wrote:
>>>>>
>>>>>> Hi Rajeenthini,
>>>>>>
>>>>>> You are hoping to add the following code snippet to the serializeJSON
>>>>>> method [1] of the org.jaggeryjs.scriptengine.util.HostObjectUtil
>>>>>> class.
>>>>>>
>>>>>>> String JsonString = null;
>>>>>>> try{
>>>>>>> ObjectMapper mapper = new ObjectMapper();
>>>>>>> JsonString = mapper.writeValueAsString(obj);
>>>>>>> }catch (Exception e){
>>>>>>> System.out.println(e.getMessage());
>>>>>>> }
>>>>>>>
>>>>>>> return "{\"javaObject\":\"true\",\"object\":\"" + JsonString + 
>>>>>>> "\"}";
>>>>>>>
>>>>>>> There are few issue in this code snippet.
>>>>>>
>>>>>>- Don't catch generic Exception, always catch a specific
>>>>>>exception. In here you should catch JsonProcessingException [2].
>>>>>>- Don't use System.out.println to log exceptions. Instead use a
>>>>>>proper logger. HostObjectUtil class has a log object def

Re: [Dev] [DEV][JAGGERY] Getting Empty JSON when logging(log.info)

2016-02-01 Thread Sajith Ariyarathna
Hi Rajeenthini,

You are hoping to add the following code snippet to the serializeJSON
method [1] of the org.jaggeryjs.scriptengine.util.HostObjectUtil class.

> String JsonString = null;
> try{
> ObjectMapper mapper = new ObjectMapper();
> JsonString = mapper.writeValueAsString(obj);
> }catch (Exception e){
> System.out.println(e.getMessage());
> }
>
> return "{\"javaObject\":\"true\",\"object\":\"" + JsonString + "\"}";
>
> There are few issue in this code snippet.

   - Don't catch generic Exception, always catch a specific exception. In
   here you should catch JsonProcessingException [2].
   - Don't use System.out.println to log exceptions. Instead use a proper
   logger. HostObjectUtil class has a log object defined in line 30 [3],
   you can use that.
   - Returning '{"javaObject": "true", "object": "{ ... }"}' string gives a
   wrong impression that there are two attributes called 'javaObject' &
   'object' in the logged object. I think just returning the JSON string will
   be enough.

After corrections (I also took the liberty to reduce no of lines):

try {

return (new ObjectMapper()).writeValueAsString(obj);

} catch (JsonProcessingException e) {

log.debug("Object " + obj.toString() + " of class " + obj.getClassName() +
" cannot be converted to JSON");

}

return "{}";


[1]
https://github.com/wso2/jaggery/blob/master/components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/util/HostObjectUtil.java#L78
[2]
https://static.javadoc.io/com.fasterxml.jackson.core/jackson-databind/2.6.3/com/fasterxml/jackson/databind/ObjectMapper.html#writeValueAsString(java.lang.Object)
[3]
https://github.com/wso2/jaggery/blob/master/components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/util/HostObjectUtil.java#L30

Thanks.


On Mon, Feb 1, 2016 at 8:13 PM, Rajeenthini Satkunam 
wrote:

> Hi sajith,
>
> i have added this Student class for example.As for current implementation
> goes like this way in Jaggery below.
>
> public static String serializeJSON(Object obj) {
> if (obj instanceof Wrapper) {
> obj = ((Wrapper) obj).unwrap();
> }
> if (obj == null) {
> return "null";
> }
> if (obj instanceof Undefined) {
> return "null";
> }
> if (obj instanceof Boolean) {
> return Boolean.toString((Boolean) obj);
> }
> if (obj instanceof String) {
> return serializeString((String) obj);
> }
> if (obj instanceof ConsString) {
> return serializeString(obj.toString());
> }
> if (obj instanceof Number) {
> return obj.toString();
> }
> if (obj instanceof XMLObject) {
> return serializeString(serializeXML((ScriptableObject) obj));
> }
> if (obj instanceof NativeObject) {
> return serializeNativeObject((NativeObject) obj);
> }
> if (obj instanceof NativeArray) {
> return serializeNativeArray((NativeArray) obj);
> }
> if (obj instanceof Object[]) {
> return serializeObjectArray((Object[]) obj);
> }
> if (obj instanceof Scriptable) {
> Scriptable object = (Scriptable) obj;
> String jsClass = object.getClassName();
> if ("Date".equals(jsClass)) {
> return serializeString(serializeNativeDate(object));
> } else if ("Error".equals(jsClass)) {
> return serializeString(serializeNativeError(object));
> }
> }
> String JsonString = null;
> try{
> ObjectMapper mapper = new ObjectMapper();
>     JsonString = mapper.writeValueAsString(obj);
> }catch (Exception e){
> System.out.println(e.getMessage());
> }
>
> return "{\"javaObject\":\"true\",\"object\":\"" + JsonString + "\"}";
> }
>
> AFAIU since we are parsing Object type of argument It is better we can use
> ObjectMapper.Correct me If I am wrong.Your suggestion would be more
> appreciated.
>
> On Sun, Jan 31, 2016 at 10:23 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi Rajeenthini,
>>
>> AFAIK ability to convert a POJO into JSON object does nor affect the
>> output of a Jaggery Log of that POJO.
>> To get a proper log output for a Java object, you need to implement the
>> "toString" method in that Java class. For example in your case,
>>
>> public class Student {
>>
>> ...
>>
>> public String toString() {
>&

Re: [Dev] [DEV][JAGGERY] Getting Empty JSON when logging(log.info)

2016-01-30 Thread Sajith Ariyarathna
Hi Rajeenthini,

AFAIK ability to convert a POJO into JSON object does nor affect the output
of a Jaggery Log of that POJO.
To get a proper log output for a Java object, you need to implement the
"toString" method in that Java class. For example in your case,

public class Student {

...

public String toString() {

return "{name: " + this.name + ", age: " + this.age + ", indexNo: " +
this.indexNo + "}";

}

}

Now you can log a Student object in your Jaggery code as following.

log.info(studentObj.toString());


Thanks.



On Sat, Jan 30, 2016 at 9:28 PM, Rajeenthini Satkunam 
wrote:

> Hi,
>
> I have worked on writing Jaggery test for Jaggery-Product.I can observe
> when we tried to log the object it always gives us empty JSON
> ({}).Currently the implementation goes this way when we try to log java
> object.
>
> So I was trying to get rid of this observed behavior of Jaggery.I have
> gone through a solution.
>
> *using Jackson[1] *
>
> We can convert java object to JSON[2] and can log it.
>
> I have shared the piece of code I have tried out with Jackson below.
>
> *Simple POJO Student class*
>
> public class Student {
> private int age;
> private String name;
> private String indexNo;
>
> public int getAge() {
> return age;
> }
>
> public void setAge(int age) {
> this.age = age;
> }
>
> public String getName() {
> return name;
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> public String getIndexNo() {
> return indexNo;
> }
>
> public void setIndexNo(String indexNo) {
> this.indexNo = indexNo;
> }
> }
>
> *Simple class to test Jackson*
>
> import com.fasterxml.jackson.databind.ObjectMapper;
> import util.Student;
> public class MyTest {
> public static void main(String args[]){
> Student st = new Student();
> st.setIndexNo("DS001");
> st.setAge(12);
> st.setName("kareena");
> try{
> ObjectMapper mapper = new ObjectMapper();
> String jsonInString = mapper.writeValueAsString(st);
> 
> System.out.println("");
> System.out.println(jsonInString);
> 
> System.out.println("");
>
> }catch(Exception e){
> System.out.print("Exception caught  "+ e);
> }
>
> }
> }
>
> Actual output by above code.
> 
> {"age":12,"name":"kareena","indexNo":"DS001"}
> 
>
> I have added a dependency in the POM.xml
>
> 
> com.fasterxml.jackson.core
> jackson-databind
> 2.6.3
> 
>
>
> IMHO we can use the same scenario in case of log JAVA object.Your help and
> suggestions are more appreciated and guide me if I am wrong or I can have
> better solution than this.
>
> [1] - https://github.com/FasterXML/jackson-databind
> [2] -
> http://www.mkyong.com/java/how-to-convert-java-object-to-from-json-jackson/
> --
>
> *Thank You.*
>
> *Rajeenthini Satkunam*
>
> *Associate Software Engineer | WSO2*
>
>
> *E:rajeenth...@wso2.com *
>
> *M :+94770832823 <%2B94770832823>   *
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Random errors from UUF

2016-01-12 Thread Sajith Ariyarathna
Hi Sumedha,

Seems like this is a concurrency problem. That's why the issue appears
randomly. According to this [1] email thread, issue is in the Handlebars
library (in UUF we use handlebars-v2.0.0.js library). Seems like
handlebars.js library is not thread-safe [2].

In UUF, a separate Handlebars environment is created from a shared root
Handlebars environment [3] for each HTTP request. Hence, the root
Handlebars environment is shared between threads (HTTP requests). However
the 'Handlebars.compile()' function is not thread-safe. That is the reason
behind  this issue.

I have fixed this problem by eliminating the shared root Handlebars
environment. See PR [4].

[1] http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-May/004482.html
[2] https://github.com/wycats/handlebars.js/issues/1031
[3]
https://github.com/wso2-incubator/uuf-template-app/blob/IoTS-1.0.0-M1/base-ui/org.wso2.carbon.uuf.ui.feature/src/main/resources/jaggeryapps/uuf-app/lib/modules/handlebars/handlebars.js#L658-L665
[4] https://github.com/wso2-incubator/uuf-template-app/pull/17

Thanks.

On Tue, Jan 12, 2016 at 11:46 AM, Sajith Ariyarathna 
wrote:

> will look into this
>
> On Tue, Jan 12, 2016 at 11:29 AM, Sumedha Rubasinghe 
> wrote:
>
>> Sajith/Manu,
>> Experiencing some random UI errors from UUF/template App.
>> Attached some screenshots @ https://wso2.org/jira/browse/IOTS-13.
>>
>> Could you please check?
>>
>>
>>
>> --
>> /sumedha
>>
>>
>
>
> --
> Sajith Ariyarathna
> Software Engineer; WSO2, Inc.;  http://wso2.com/
> mobile: +94 77 6602284, +94 71 3951048
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Random errors from UUF

2016-01-11 Thread Sajith Ariyarathna
will look into this

On Tue, Jan 12, 2016 at 11:29 AM, Sumedha Rubasinghe 
wrote:

> Sajith/Manu,
> Experiencing some random UI errors from UUF/template App.
> Attached some screenshots @ https://wso2.org/jira/browse/IOTS-13.
>
> Could you please check?
>
>
>
> --
> /sumedha
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Governance Registry - Where to define a new handlebars helper ?

2016-01-06 Thread Sajith Ariyarathna
Hi Arnaud,

You can register custom Handlebars helpers in "theme.js" file. In your
case, it should be in
"/wso2greg-5.1.0/repository/deployment/server/jaggeryapps/publisher/themes/default/theme.js"
path. Refer [1] as an example.

[1]
https://github.com/wso2/carbon-appmgt/blob/80839ee805c72cc6b2c6d1a39f0ecfecbf81/features/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/theme.js#L6

Thanks.

On Wed, Jan 6, 2016 at 9:08 PM, Arnaud Charpentier <
arnaud.charpent...@student.ecp.fr> wrote:

> Hi,
>
> We are working on the publisher of governance registry.
>
> We are trying to internationalize some text chains with jaggery and the
> Handlebars template engine.
> We understood that we have to define a new helper with the function
> registerHelper of the template engine Handlebars but we can't figure out in
> which Javascript file we should use this function ?
>
> We tried to do it in caramel.handlebars.client.js (path
> : 
> /wso2greg-5.1.0/repository/deployment/server/jaggeryapps/publisher/themes/default/js/caramel.handlebars.client.js
> ) and some others js files but it didn't work.
>
>
> Regards
>
> Arnaud Charpentier
>
>
> _______
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] UUF/Jaggery - unformatted error

2015-12-18 Thread Sajith Ariyarathna
tImpl.registerService(BundleContextImpl.java:433)
>  at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)_
>  at
> org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)_
>  at
> org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)_
>  at
> org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:91)_
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)_ at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)_
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)_
>  at
> java.lang.reflect.Method.invoke(Method.java:606)_ at
> org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)_
>  at
> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)_
>  at
> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)_
>  at
> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)_
>  at
> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)_
>  at
> org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)_ at
> org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)_
>  at
> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)_
>  at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)_
>  at
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)_
>  at
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)_
>  at
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)_
>  at
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)_
>  at
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)_
>  at
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)_
>  at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)_
>  at
> org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)_
>  at
> org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)_
>  at
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)_
>  at
> org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)_
>  at
> org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)_
>  at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)_
>  at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)_ at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5262)_
>  at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5550)_
>  at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)_ at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)_
>  at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)_
>  at
> java.util.concurrent.FutureTask.run(FutureTask.java:262)_ at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)_
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)_
>  at
> java.lang.Thread.run(Thread.java:745)_Caused by:
> java.lang.ArrayIndexOutOfBoundsException: 1_ at
> org.jaggeryjs.hostobjects.db.DatabaseHostObject.jsConstructor(DatabaseHostObject.java:94)_
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)_ at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)_
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)_
>  at
> java.lang.reflect.Method.invoke(Method.java:606)_ at
> org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)_ ... 184
> more_ (Sanitized)
>
>
> --
> /sumedha
> m: +94 773017743
> b :  bit.ly/sumedha
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Chalitha Kulathunga

2015-12-06 Thread Sajith Ariyarathna
Congratz Chalitha!


On Mon, Dec 7, 2015 at 12:26 PM, Amila Maha Arachchi 
wrote:

> Hi all,
>
> Its my pleasure to welcome Chalitha Kulathunga as a WSO2 Committer.
> Chalitha is a member of WSO2 Cloud Dev team and has been contributing to
> the team in development, integration and deployment work. In recognition of
> his contribution, he has been voted as a WSO2 Committer.
>
> Chalitha, welcome aboard and keep up the good work..
>
> Regards,
> Amila.
>
> --
> *Amila Maharachchi*
> Senior Technical Lead
> WSO2, Inc.; http://wso2.com
>
> Blog: http://maharachchi.blogspot.com
> Mobile: +94719371446
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [IS] Retrieve all permissions and actions of a user using admin services

2015-11-23 Thread Sajith Ariyarathna
Hi Tharindu,

Thanks for the info. Since I'm implementing this using Jaggery, I'll use
the 'RemoteAuthorizationManagerService' admin service.

Cheers.

On Tue, Nov 24, 2015 at 4:30 AM, Tharindu Edirisinghe 
wrote:

> Hi Sajith,
>
> You can take a look at *RemoteAuthorizationManagerService* [1]. There we
> have the following method.
>
> *isUserAuthorized* (username, resourceId, action)
>
> From this you can check if the user is authorized to perform some action
> on a particular resource.
>
> similarly you can check the same for a role using the following method.
>
> *isRoleAuthorized* (rolename, resourceId, action)
>
> However AFAIK it is not possible to retrieve all the permissions granted
> for a user through an admin service.
>
> If it is needed, one way is to query the* UM_ROLE_PERMISSION* table [2]
> (of the internal database) and find out what are the associated permissions
> (of *UM_PERMISSION* table) for each role. Then you will have to map the
> user with the roles that the user has been assigned.
>
> Hope this will be helpful.
>
> [1] https://localhost:9443/services/RemoteAuthorizationManagerService?wsdl
> [2]
> http://tharindue.blogspot.com/2015/04/wso2-identity-server-data-dictionary.html
>
> Thanks,
> TharinduE
>
> On Mon, Nov 23, 2015 at 6:58 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi IS team,
>>
>> Is it possible to do $subject? I have the username, domain and tenant ID
>> of the user.
>>
>> Thanks.
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Tharindu Edirisinghe
> Software Engineer | WSO2 Inc
> Identity Server Team
> Blog : tharindue.blogspot.com
> mobile : 408-714-8437
>
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Thilini Cooray

2015-11-23 Thread Sajith Ariyarathna
Congratz Thilini!

On Mon, Nov 23, 2015 at 9:52 PM, Nuwan Dias  wrote:

> Hi,
>
> It is with great pleasure we welcome Thilini Cooray as a WSO2 Committer. @
> Thilini, congratulations and keep up the good work!
>
> Thanks,
> NuwanD.
>
> --
> Nuwan Dias
>
> Technical Lead - WSO2, Inc. http://wso2.com
> email : nuw...@wso2.com
> Phone : +94 777 775 729
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [IS] Retrieve all permissions and actions of a user using admin services

2015-11-23 Thread Sajith Ariyarathna
Hi IS team,

Is it possible to do $subject? I have the username, domain and tenant ID of
the user.

Thanks.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [IS] Possible bug in SPInitLogoutRequestProcessor class

2015-11-20 Thread Sajith Ariyarathna
Hi IS team,

When looking at the
"org.wso2.carbon.identity.sso.saml.processors.SPInitLogoutRequestProcessor"
class, I noticed that the same condition is checked twice in line 71 [1],
and line 79 [2]. According to the error message in line 80 [3], checked
if-condition in line 79 is incorrect.

Suggesting Fix: change the if-condition in line 79 to
StringUtils.isBlank(sessionIndex)

[1]
https://github.com/wso2/carbon-identity/blob/master/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/processors/SPInitLogoutRequestProcessor.java#L71
[2]
https://github.com/wso2/carbon-identity/blob/master/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/processors/SPInitLogoutRequestProcessor.java#L79
[3]
https://github.com/wso2/carbon-identity/blob/master/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/processors/SPInitLogoutRequestProcessor.java#L80

Thanks.
-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV][Jaggery][javascript] jagg.post() returns to the error function while post fuction implements properly.

2015-11-20 Thread Sajith Ariyarathna
Hi Ishara,

Can you share the exception log here? So we can look into it and figure out
whats happening.

Thanks.

On Fri, Nov 20, 2015 at 12:23 PM, Ishara Cooray  wrote:

> I have the following code implemented in a jaggery app. In the reInvite
> function sends an email and returns email. The issue is though the email is
> sent successfully it throws an error.
>
>
> jagg.post("../blocks/tenant/register/invite/ajax/invite.jag", {
> action:"reInvite",
> email:email
> },
> function (result) {
>   //do something
> },
> function (jqXHR, textStatus, errorThrown) {
> //handle error
> });
>
> What could be the possible reason for this error?
> Appreciate your inputs.
>
> Thanks.
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> _______
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Issue in carbon logs after changing carbon.kernel.version from 4.4.1 to 4.4.2

2015-11-19 Thread Sajith Ariyarathna
Hi Malithi,

Seems that when you log.error(message, e); the stack trace does not get
sanitized, but if you do log.error(e); then the stack trace get sanitized.

Currently we are developing Jaggery app; when an exception occurred in
Jaggery code, Rhino engine logs the stack trace and that stack trace is
sanitized. Looks like our issue goes to Jaggery.

I also notices that in Jaggery, logging exceptions like log.error(e);
outputs a sanitized stack trace. One can avoid that by logging
exceptions log.error(message,
e); like this.

Hoping to discuss this with the Jaggery team. Thank you very much for your
assistance regarding this matter.


On Thu, Nov 19, 2015 at 12:26 PM, Malithi Edirisinghe 
wrote:

> Hi Sajith,
>
> Actually the stack trace does not get sanitized. Could you please give
> some example.
> I have tried a simple test as below
>
> try {
> log.info("XACML policy schema loaded \n successfully.");
> throw new Exception("Test \n Exception");
> } catch (Exception e) {
> log.error("Logging Test \n Exception", e);
> }
>
> But this prints the log properly and here the stack trace is not
> sanitized. Only the message that you log as an error or debug log gets
> sanitized. Even if you refer the code line that I have pointed above you
> will see it.
>
> So the output of the above code segment will be something like below.
>
> [2015-11-19 01:02:07,246]  INFO
> {org.wso2.carbon.identity.entitlement.internal.SchemaBuilder} -  XACML
> policy schema loaded _ successfully. (Sanitized)
>
> [2015-11-19 01:02:07,246] ERROR
> {org.wso2.carbon.identity.entitlement.internal.SchemaBuilder} -  Logging
> Test _ Exception (Sanitized)
>
> java.lang.Exception: Test
>
>  Exception
>
> at
> org.wso2.carbon.identity.entitlement.internal.SchemaBuilder.run(SchemaBuilder.java:46)
>
> at java.lang.Thread.run(Thread.java:722)
>
> Here you can clearly see that the stack trace is not sanitized. It prints
> the new line character in the exception as it is in the stack trace.
>
> Thanks,
>
> Malithi.
>
> On Thu, Nov 19, 2015 at 11:59 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi Malithi,
>>
>> My concern is that current fix sanitizing stack traces even though stack
>> trace does not have CRLF injections in it. I believe sanitizing log
>> messages (e.g. log.error(message) , excaption.getMessage() )
>> is sufficient to prevent  CRLF injections in logs.
>>
>> I think we can overcome this problem with the my earlier proposed
>> approach (extending log4j PatternLayout class and overriding the format
>>  method).
>>
>> Thanks.
>>
>>
>> On Thu, Nov 19, 2015 at 1:07 AM, Malithi Edirisinghe 
>> wrote:
>>
>>> Hi Sajith,
>>>
>>> With the present fix there's no way that stack traces could be sanitized
>>> unless e.getMessage is explicitly used as the log message.
>>>
>>> As you can see at [1] only the logging message is sanitized here.
>>> Could you please elaborate more in case i'm misunderstanding your
>>> concern.
>>>
>>> [1]
>>> https://github.com/wso2/carbon-kernel/pull/278/files#diff-5859ce33cfadc4c7933a6a08a605f8d1R72
>>>
>>> Thanks,
>>> Malithi.
>>>
>>> On Wed, Nov 18, 2015 at 6:42 PM, Sajith Ariyarathna 
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Me and RasikaP dig a little deep to find a solution to this problem.
>>>>
>>>> Instead of sanitizing final log message, you can sanitize when it is
>>>> formatted by extending the PatternLayout [1] class. Refer this code [2],
>>>> where public String format(LoggingEvent event) method is overridden to
>>>> achieve a custom log message formatting.  You can configure log4j
>>>> (log4j.xml) to use your extended Pattern Layout class by adding >>> class="org.apache.log4j.MyPatternLayout"> in your  .
>>>>
>>>> WDYT?
>>>>
>>>> [1]
>>>> http://grepcode.com/file/repo1.maven.org/maven2/log4j/log4j/1.2.17/org/apache/log4j/PatternLayout.java?av=f
>>>>
>>>> [2]
>>>> http://apache-logging.6191.n7.nabble.com/how-to-search-and-replace-message-text-in-outgoing-log-messages-td35625.html#a35919
>>>>
>>>> Thanks.
>>>>
>>>> On Wed, Nov 18, 2015 at 4:18 PM, Sajith Ariyarathna 
>>>> wrote:
>>>>
>>>>> Hi Malithi,
>>>>>
>>>>> The problem with the given fix is that, even stack traces are
>>>>> sanitized. IMO, you don't need to 

Re: [Dev] Issue in carbon logs after changing carbon.kernel.version from 4.4.1 to 4.4.2

2015-11-18 Thread Sajith Ariyarathna
Hi Malithi,

My concern is that current fix sanitizing stack traces even though stack
trace does not have CRLF injections in it. I believe sanitizing log
messages (e.g. log.error(message) , excaption.getMessage() ) is sufficient
to prevent  CRLF injections in logs.

I think we can overcome this problem with the my earlier proposed approach
(extending log4j PatternLayout class and overriding the format method).

Thanks.


On Thu, Nov 19, 2015 at 1:07 AM, Malithi Edirisinghe 
wrote:

> Hi Sajith,
>
> With the present fix there's no way that stack traces could be sanitized
> unless e.getMessage is explicitly used as the log message.
>
> As you can see at [1] only the logging message is sanitized here.
> Could you please elaborate more in case i'm misunderstanding your concern.
>
> [1]
> https://github.com/wso2/carbon-kernel/pull/278/files#diff-5859ce33cfadc4c7933a6a08a605f8d1R72
>
> Thanks,
> Malithi.
>
> On Wed, Nov 18, 2015 at 6:42 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi All,
>>
>> Me and RasikaP dig a little deep to find a solution to this problem.
>>
>> Instead of sanitizing final log message, you can sanitize when it is
>> formatted by extending the PatternLayout [1] class. Refer this code [2],
>> where public String format(LoggingEvent event) method is overridden to
>> achieve a custom log message formatting.  You can configure log4j
>> (log4j.xml) to use your extended Pattern Layout class by adding > class="org.apache.log4j.MyPatternLayout"> in your  .
>>
>> WDYT?
>>
>> [1]
>> http://grepcode.com/file/repo1.maven.org/maven2/log4j/log4j/1.2.17/org/apache/log4j/PatternLayout.java?av=f
>>
>> [2]
>> http://apache-logging.6191.n7.nabble.com/how-to-search-and-replace-message-text-in-outgoing-log-messages-td35625.html#a35919
>>
>> Thanks.
>>
>> On Wed, Nov 18, 2015 at 4:18 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi Malithi,
>>>
>>> The problem with the given fix is that, even stack traces are sanitized.
>>> IMO, you don't need to sanitize stack traces. Sanitizing log messages (
>>> log.error("message"), exception.getMessage() ) is sufficient to prevent
>>> log forging.
>>>
>>> This problem affects to all products. I think we have to fix this ASAP.
>>>
>>> Thanks.
>>>
>>> On Wed, Nov 18, 2015 at 3:24 PM, Malithi Edirisinghe 
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> This was added for a security fix [1] and was discussed at
>>>> security-leads@ [2]. So the present fix affects to the existing
>>>> appenders (CarbonConsoleAppender, CarbonDailyRollingFileAppender,
>>>> MemoryAppender).
>>>> The other option that we could have done is to extend the existing
>>>> appenders and introduce a Secured set of appenders such that only those
>>>> will sanitize the logging message. But, with the present fix I'm afraid
>>>> that other than configuring the appender at log4j.properties to some in
>>>> built log4j appender we won't be able to get rid of this sanitization logic
>>>> at logging.
>>>>
>>>> [1] https://support.wso2.com/jira/browse/SECINTDEV-5
>>>> [2] 'Preventing CRLF Injection when logging'
>>>>
>>>> Thanks,
>>>> Malithi.
>>>>
>>>> On Wed, Nov 18, 2015 at 3:05 PM, Viraj Senevirathne 
>>>> wrote:
>>>>
>>>>> Hi Krishantha,
>>>>>
>>>>> We have observed that* Log Mediator in ESB* is affected due to this
>>>>> change. If there are new lines in the message payload it very inconvenient
>>>>> and hard to read the logs. And user cannot see actual payload as it is,
>>>>> because this functionality change the message log.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> On Wed, Nov 18, 2015 at 2:58 PM, Sajith Ariyarathna >>>> > wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> We are using carbon.kernel.version 4.4.2 in MDM 2.0.0 SNAPSHOT and we
>>>>>> face the same problem (new lines are replaced with underscores in logs).
>>>>>> Because of this behavior, it is very hard to debug/find problems by 
>>>>>> reading
>>>>>> error logs. Is there any way to by pass/stop this behavior without 
>>>>>> patching
>>>>>> the carbon kernel?
>>>>>>
>>>>>> Thanks.

Re: [Dev] Issue in carbon logs after changing carbon.kernel.version from 4.4.1 to 4.4.2

2015-11-18 Thread Sajith Ariyarathna
Hi All,

Me and RasikaP dig a little deep to find a solution to this problem.

Instead of sanitizing final log message, you can sanitize when it is
formatted by extending the PatternLayout [1] class. Refer this code [2],
where public String format(LoggingEvent event) method is overridden to
achieve a custom log message formatting.  You can configure log4j
(log4j.xml) to use your extended Pattern Layout class by adding  in your  .

WDYT?

[1]
http://grepcode.com/file/repo1.maven.org/maven2/log4j/log4j/1.2.17/org/apache/log4j/PatternLayout.java?av=f

[2]
http://apache-logging.6191.n7.nabble.com/how-to-search-and-replace-message-text-in-outgoing-log-messages-td35625.html#a35919

Thanks.

On Wed, Nov 18, 2015 at 4:18 PM, Sajith Ariyarathna 
wrote:

> Hi Malithi,
>
> The problem with the given fix is that, even stack traces are sanitized.
> IMO, you don't need to sanitize stack traces. Sanitizing log messages (
> log.error("message"), exception.getMessage() ) is sufficient to prevent
> log forging.
>
> This problem affects to all products. I think we have to fix this ASAP.
>
> Thanks.
>
> On Wed, Nov 18, 2015 at 3:24 PM, Malithi Edirisinghe 
> wrote:
>
>> Hi All,
>>
>> This was added for a security fix [1] and was discussed at security-leads@
>> [2]. So the present fix affects to the existing appenders
>> (CarbonConsoleAppender, CarbonDailyRollingFileAppender, MemoryAppender).
>> The other option that we could have done is to extend the existing
>> appenders and introduce a Secured set of appenders such that only those
>> will sanitize the logging message. But, with the present fix I'm afraid
>> that other than configuring the appender at log4j.properties to some in
>> built log4j appender we won't be able to get rid of this sanitization logic
>> at logging.
>>
>> [1] https://support.wso2.com/jira/browse/SECINTDEV-5
>> [2] 'Preventing CRLF Injection when logging'
>>
>> Thanks,
>> Malithi.
>>
>> On Wed, Nov 18, 2015 at 3:05 PM, Viraj Senevirathne 
>> wrote:
>>
>>> Hi Krishantha,
>>>
>>> We have observed that* Log Mediator in ESB* is affected due to this
>>> change. If there are new lines in the message payload it very inconvenient
>>> and hard to read the logs. And user cannot see actual payload as it is,
>>> because this functionality change the message log.
>>>
>>> Thanks,
>>>
>>> On Wed, Nov 18, 2015 at 2:58 PM, Sajith Ariyarathna 
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> We are using carbon.kernel.version 4.4.2 in MDM 2.0.0 SNAPSHOT and we
>>>> face the same problem (new lines are replaced with underscores in logs).
>>>> Because of this behavior, it is very hard to debug/find problems by reading
>>>> error logs. Is there any way to by pass/stop this behavior without patching
>>>> the carbon kernel?
>>>>
>>>> Thanks.
>>>>
>>>> On Fri, Oct 30, 2015 at 11:57 AM, Viraj Senevirathne 
>>>> wrote:
>>>>
>>>>> Hi Kasun,
>>>>>
>>>>> It seems that it has happened due to this commit
>>>>> https://github.com/wso2/carbon-kernel/commit/e0b6ae7d9f4cdee2f0bf3744b2a3ce02c3b808bf
>>>>> . We removed it and patched the kernel then issue was resolved. What can 
>>>>> we
>>>>> do about this?
>>>>>
>>>>> Thank You,
>>>>>
>>>>> On Fri, Oct 30, 2015 at 9:15 AM, Kasun Gajasinghe 
>>>>> wrote:
>>>>>
>>>>>> Can you guys go through recent commits to org.wso2.carbon.logging
>>>>>> component and find out if any of those caused this issue?
>>>>>>
>>>>>> On Oct 29, 2015, at 9:23 PM, Jagath Sisirakumara Ariyarathne <
>>>>>> jaga...@wso2.com> wrote:
>>>>>>
>>>>>> Hi Carbon Team,
>>>>>>
>>>>>> Any thought to figure out the issue is much appreciated.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Wed, Oct 28, 2015 at 3:42 PM, Viraj Senevirathne 
>>>>>> wrote:
>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> We have upgraded the carbon version in ESB from 4.4.1 to 4.4.2. Then
>>>>>>> we have encountered following issue.
>>>>>>>
>>>>>>> *In carbon.kernel.version 4.4.1 and earlier carbon versions*
>>>

Re: [Dev] Issue in carbon logs after changing carbon.kernel.version from 4.4.1 to 4.4.2

2015-11-18 Thread Sajith Ariyarathna
Hi Malithi,

The problem with the given fix is that, even stack traces are sanitized.
IMO, you don't need to sanitize stack traces. Sanitizing log messages (
log.error("message"), exception.getMessage() ) is sufficient to prevent log
forging.

This problem affects to all products. I think we have to fix this ASAP.

Thanks.

On Wed, Nov 18, 2015 at 3:24 PM, Malithi Edirisinghe 
wrote:

> Hi All,
>
> This was added for a security fix [1] and was discussed at security-leads@
> [2]. So the present fix affects to the existing appenders
> (CarbonConsoleAppender, CarbonDailyRollingFileAppender, MemoryAppender).
> The other option that we could have done is to extend the existing
> appenders and introduce a Secured set of appenders such that only those
> will sanitize the logging message. But, with the present fix I'm afraid
> that other than configuring the appender at log4j.properties to some in
> built log4j appender we won't be able to get rid of this sanitization logic
> at logging.
>
> [1] https://support.wso2.com/jira/browse/SECINTDEV-5
> [2] 'Preventing CRLF Injection when logging'
>
> Thanks,
> Malithi.
>
> On Wed, Nov 18, 2015 at 3:05 PM, Viraj Senevirathne 
> wrote:
>
>> Hi Krishantha,
>>
>> We have observed that* Log Mediator in ESB* is affected due to this
>> change. If there are new lines in the message payload it very inconvenient
>> and hard to read the logs. And user cannot see actual payload as it is,
>> because this functionality change the message log.
>>
>> Thanks,
>>
>> On Wed, Nov 18, 2015 at 2:58 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi All,
>>>
>>> We are using carbon.kernel.version 4.4.2 in MDM 2.0.0 SNAPSHOT and we
>>> face the same problem (new lines are replaced with underscores in logs).
>>> Because of this behavior, it is very hard to debug/find problems by reading
>>> error logs. Is there any way to by pass/stop this behavior without patching
>>> the carbon kernel?
>>>
>>> Thanks.
>>>
>>> On Fri, Oct 30, 2015 at 11:57 AM, Viraj Senevirathne 
>>> wrote:
>>>
>>>> Hi Kasun,
>>>>
>>>> It seems that it has happened due to this commit
>>>> https://github.com/wso2/carbon-kernel/commit/e0b6ae7d9f4cdee2f0bf3744b2a3ce02c3b808bf
>>>> . We removed it and patched the kernel then issue was resolved. What can we
>>>> do about this?
>>>>
>>>> Thank You,
>>>>
>>>> On Fri, Oct 30, 2015 at 9:15 AM, Kasun Gajasinghe 
>>>> wrote:
>>>>
>>>>> Can you guys go through recent commits to org.wso2.carbon.logging
>>>>> component and find out if any of those caused this issue?
>>>>>
>>>>> On Oct 29, 2015, at 9:23 PM, Jagath Sisirakumara Ariyarathne <
>>>>> jaga...@wso2.com> wrote:
>>>>>
>>>>> Hi Carbon Team,
>>>>>
>>>>> Any thought to figure out the issue is much appreciated.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> On Wed, Oct 28, 2015 at 3:42 PM, Viraj Senevirathne 
>>>>> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> We have upgraded the carbon version in ESB from 4.4.1 to 4.4.2. Then
>>>>>> we have encountered following issue.
>>>>>>
>>>>>> *In carbon.kernel.version 4.4.1 and earlier carbon versions*
>>>>>>
>>>>>> TID: [-1234] [] [2015-10-23 16:43:26,614]  INFO
>>>>>> {org.apache.synapse.mediators.builtin.LogMediator} -  To:
>>>>>> /services/sendReciveProxy.sendReciveProxyHttpSoap11Endpoint, WSAction:
>>>>>> urn:getQuote, SOAPAction: urn:getQuote, MessageID:
>>>>>> urn:uuid:333b6811-04aa-4c6a-94fb-3edc4d56065d, Direction: request,
>>>>>> Envelope: >>>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="
>>>>>> http://services.samples/xsd"; xmlns:ser="http://services.samples
>>>>>> ">
>>>>>>   
>>>>>>  
>>>>>>  
>>>>>> 
>>>>>> IBM
>>>>>>  
>>>>>>   
>>>>>>
>>>>>> {org.apache.synapse.mediators.builtin.LogMediator}
>>>>>>
>>>>>> *Same log in carbon.kernel.version 4.4.2

Re: [Dev] Issue in carbon logs after changing carbon.kernel.version from 4.4.1 to 4.4.2

2015-11-18 Thread Sajith Ariyarathna
Hi All,

We are using carbon.kernel.version 4.4.2 in MDM 2.0.0 SNAPSHOT and we face
the same problem (new lines are replaced with underscores in logs). Because
of this behavior, it is very hard to debug/find problems by reading error
logs. Is there any way to by pass/stop this behavior without patching the
carbon kernel?

Thanks.

On Fri, Oct 30, 2015 at 11:57 AM, Viraj Senevirathne 
wrote:

> Hi Kasun,
>
> It seems that it has happened due to this commit
> https://github.com/wso2/carbon-kernel/commit/e0b6ae7d9f4cdee2f0bf3744b2a3ce02c3b808bf
> . We removed it and patched the kernel then issue was resolved. What can we
> do about this?
>
> Thank You,
>
> On Fri, Oct 30, 2015 at 9:15 AM, Kasun Gajasinghe  wrote:
>
>> Can you guys go through recent commits to org.wso2.carbon.logging
>> component and find out if any of those caused this issue?
>>
>> On Oct 29, 2015, at 9:23 PM, Jagath Sisirakumara Ariyarathne <
>> jaga...@wso2.com> wrote:
>>
>> Hi Carbon Team,
>>
>> Any thought to figure out the issue is much appreciated.
>>
>> Thanks.
>>
>> On Wed, Oct 28, 2015 at 3:42 PM, Viraj Senevirathne 
>> wrote:
>>
>>> Hi All,
>>>
>>> We have upgraded the carbon version in ESB from 4.4.1 to 4.4.2. Then we
>>> have encountered following issue.
>>>
>>> *In carbon.kernel.version 4.4.1 and earlier carbon versions*
>>>
>>> TID: [-1234] [] [2015-10-23 16:43:26,614]  INFO
>>> {org.apache.synapse.mediators.builtin.LogMediator} -  To:
>>> /services/sendReciveProxy.sendReciveProxyHttpSoap11Endpoint, WSAction:
>>> urn:getQuote, SOAPAction: urn:getQuote, MessageID:
>>> urn:uuid:333b6811-04aa-4c6a-94fb-3edc4d56065d, Direction: request,
>>> Envelope: >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="
>>> http://services.samples/xsd"; xmlns:ser="http://services.samples
>>> ">
>>>   
>>>  
>>>  
>>> 
>>> IBM
>>>  
>>>   
>>>
>>> {org.apache.synapse.mediators.builtin.LogMediator}
>>>
>>> *Same log in carbon.kernel.version 4.4.2 *
>>>
>>> [2015-10-28 15:38:36,027]  INFO - LogMediator To:
>>> /services/callOutOnly.callOutOnlyHttpSoap11Endpoint, WSAction: urn:mediate,
>>> SOAPAction: urn:mediate, MessageID:
>>> urn:uuid:61f4b04c-0906-4228-975e-1b8f1be7450d, Direction: request,
>>> Envelope: >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:wsa="
>>> http://www.w3.org/2005/08/addressing";>_
>>> http://services.samples";>__
>>>3.141593E0_
>>>  4_IBM_
>>>  __
>>>   (Sanitized)
>>>
>>>
>>> As you can see all the new lines are replaced with _ .
>>>
>>> What could be the issue here?
>>>
>>> Thank you,
>>>
>>> --
>>> Viraj Senevirathne
>>> Software Engineer; WSO2, Inc.
>>>
>>> Mobile : +94 71 958 0269
>>> Email : vir...@wso2.com
>>>
>>
>>
>>
>> --
>> Jagath Ariyarathne
>> Technical Lead
>> WSO2 Inc.  http://wso2.com/
>> Email: jaga...@wso2.com
>> Mob  : +94 77 386 7048
>>
>>
>
>
> --
> Viraj Senevirathne
> Software Engineer; WSO2, Inc.
>
> Mobile : +94 71 958 0269
> Email : vir...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Jaggery] response.sendError() not working for PUT and DELETE

2015-10-20 Thread Sajith Ariyarathna
H Thilini,

Seems that I made a mistake here.

> I tested with your code snippet and it works fine to me. Please check &
> compare your *jaggery.conf* file with the given below.
>
> {
>   "displayName": "test",
>   "logLevel": "debug",
>   "urlMappings": [
> {
>   "url": "/debug/*",
>   "path": "/lib/debugging.jag"
> }
>   ],
>   "errorPages": {
> "404": "/app/error.html"
>   }
> }
>
> I forgot to test above config for PUT & DELETE requested before posting.
When I ran a full test, I was able to produce 403 Forbidden for PUT and
DELETE requests..

I looked into the problem and looks like it goes all the way to Tomcat.
Jaggery error pages are implemented via Tomcat "custom error pages" option
[1]. When you call response.sendError function in Jaggery, it ultimately
calls HttpServletResponse.sendError [2] method. In Tomcat's implementation,
sendError method restarts the entire request routing/dispatching process.
So when sendError is called for a PUT or DELETE request, whole dispatching
process restarts and try to serve the configured custom error page (
*error.html*) [3]. Since *error.html* is a static resource, now the request
is handled by the DefaultServlet [4]. Now for the DefaultServlet, the HTTP
request looks like "*apply PUT/DELETE operation on error.html*". Here,
DefaultServlet's *readonly* property comes to play [5]. Default value of
the *readonly* property is true which means clients cannot modify or delete
static resources in the server. Hence "*appying PUT/DELETE operation on
error.html*" is forbidden. Therefore the 403 Forbidden is sent to the
client.

[1] http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q6
[2]
https://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletResponse.html#sendError(int)
[3] http://stackoverflow.com/a/23177116/1577286
[4] https://tomcat.apache.org/tomcat-7.0-doc/default-servlet.html#what
[5] https://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#web.xml

Thanks.

On Tue, Oct 20, 2015 at 3:10 PM, Dakshika Jayathilaka 
wrote:

> Hi,
>
> Can you check the jaggery version that your using. AFAIK there are several
> changes done in latest version.
>
> Regards,
>
> *Dakshika Jayathilaka*
> PMC Member & Committer of Apache Stratos
> Senior Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
> 0771100911
>
> On Tue, Oct 20, 2015 at 2:58 PM, Thilini Cooray  wrote:
>
>> Hi,
>>
>> Our jaggery.conf file is like this [1].
>> Since HTTP GET and POST are working fine.
>> I doubt whether this can be an issue with the conf file.
>>
>> [1]
>> https://github.com/wso2/carbon-apimgt/blob/release-1.9.0/features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/store/jaggery.conf
>>
>> Thanks.
>>
>> On Tue, Oct 20, 2015 at 2:38 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi Thilini,
>>>
>>> I tested with your code snippet and it works fine to me. Please check &
>>> compare your *jaggery.conf* file with the given below.
>>>
>>> {
>>>   "displayName": "test",
>>>   "logLevel": "debug",
>>>   "urlMappings": [
>>> {
>>>   "url": "/debug/*",
>>>   "path": "/lib/debugging.jag"
>>> }
>>>   ],
>>>   "errorPages": {
>>> "404": "/app/error.html"
>>>   }
>>> }
>>>
>>>
>>> Thanks.
>>>
>>> On Tue, Oct 20, 2015 at 10:54 AM, Thilini Cooray 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> This is the source.
>>>>
>>>> var uri = request.getRequestURI();
>>>>
>>>> var callPath=uri.replace("/store","");
>>>>
>>>> var action = "list"; // default action list the topics
>>>> if(uri != null) {
>>>> var uriMatcher = new URIMatcher(callPath);
>>>> if (uriMatcher.match("/forum") || uriMatcher.match("/forum/")) {
>>>> action = "list";
>>>> }
>>>> else if (uriMatcher.match("/forum/new")) {
>>>> action = "new"; // create topic
>>>> }
>>>> else if (uriMatcher.match("/forum/new/{id}")) {
>>>> action = "new"; // create topic
>>>> }
>>>>

Re: [Dev] [Jaggery] response.sendError() not working for PUT and DELETE

2015-10-20 Thread Sajith Ariyarathna
Hi Thilini,

I tested with your code snippet and it works fine to me. Please check &
compare your *jaggery.conf* file with the given below.

{
  "displayName": "test",
  "logLevel": "debug",
  "urlMappings": [
{
  "url": "/debug/*",
  "path": "/lib/debugging.jag"
}
  ],
  "errorPages": {
"404": "/app/error.html"
  }
}


Thanks.

On Tue, Oct 20, 2015 at 10:54 AM, Thilini Cooray  wrote:

> Hi,
>
> This is the source.
>
> var uri = request.getRequestURI();
>
> var callPath=uri.replace("/store","");
>
> var action = "list"; // default action list the topics
> if(uri != null) {
> var uriMatcher = new URIMatcher(callPath);
> if (uriMatcher.match("/forum") || uriMatcher.match("/forum/")) {
> action = "list";
> }
> else if (uriMatcher.match("/forum/new")) {
> action = "new"; // create topic
> }
> else if (uriMatcher.match("/forum/new/{id}")) {
> action = "new"; // create topic
> }
> else if (uriMatcher.match("/forum/topic/{id}")) {
> var topic = uriMatcher.elements().id;
> action = "topic";
> } else {
> action = "exit";
> }
> }
>
> if(action == "exit"){
> *response.sendError(404);*
> } else {
>
> // Logic comes here
>
> }
>
> 404 will refer to 
> /repository/deployment/server/jaggeryapps/store/pages/error-pages/404.html
>
>
> Thanks.
>
>
>
> On Tue, Oct 20, 2015 at 10:39 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi Thilini,
>>
>> Can you share your code here?
>>
>> I tested following Jaggery code. (Test was executed in* AppM 1.0.0* pack
>> and *Advanced Rest Client* was used as the HTTP client)
>>
>> *URL Mapping in jaggery.conf: *
>>
>> {
>>
>> "url": "/test/*",
>>
>> "path": "/lib/test.jag"
>>
>> }
>>
>>
>> *File*: *test.jag*
>>
>> *Code:*
>>
>> var log = new Log("[testing]");
>>
>> log.info("Hit for HTTP method " + request.getMethod());
>>
>> response.sendError(404, "Testing page not found.");
>>
>>
>> *Terminal Output:*
>>
>> [2015-10-20 10:26:52,885]  INFO - [testing] Hit for HTTP method GET
>>
>> [2015-10-20 10:26:57,499]  INFO - [testing] Hit for HTTP method POST
>>
>> [2015-10-20 10:27:02,045]  INFO - [testing] Hit for HTTP method PUT
>>
>> [2015-10-20 10:27:06,011]  INFO - [testing] Hit for HTTP method DELETE
>>
>> [2015-10-20 10:27:08,491]  INFO - [testing] Hit for HTTP method HEAD
>>
>> [2015-10-20 10:27:10,860]  INFO - [testing] Hit for HTTP method OPTIONS
>>
>>
>> *HTTP Output:*
>>
>> 404 Not Found
>>
>> 404 Not Found
>>
>> 404 Not Found
>>
>> 404 Not Found
>>
>> 404 Not Found
>>
>> 404 Not Found
>>
>>
>> Since the expected output was received in above, I believe the issue is
>> on your side, not in Jaggery.
>>
>> Thanks.
>>
>> On Mon, Oct 19, 2015 at 2:04 PM, Thilini Cooray 
>> wrote:
>>
>>> Hi,
>>>
>>> I want to send error messages for invalid URLs from API Manager Store
>>> jaggery layer.
>>>
>>> I use response.sendError(404) for this purpose.
>>> For HTTP POST and GET this method returns the correct error page while
>>> it doesn't return any message for PUT and DELETE.
>>>
>>> I debugged [1] and found out that the errors send in all HTTP methods
>>> gets hit in
>>>
>>> rho.response.sendError((Integer) args[0]);
>>>
>>> Output stream of rho.response also contains the correct error page in
>>> all HTTP methods.
>>> Yet it doesn't get returned in HTTP PUT and DELETE methods.
>>>
>>> I am unable to figure out the reason for this behaviour.
>>> Any help is appreciated.
>>>
>>> Thanks.
>>>
>>> [1]
>>> http://svn.wso2.org/repos/wso2/carbon/platform/tags/turing-chunk04/components/jaggery/0.9.0.ALPHA4.wso2v1/hostobjects/org.jaggeryjs.hostobjects.web/src/main/java/org/jaggeryjs/hostobjects/web/ResponseHostObject.java
>>>
>>> --
>>> Best Regards,
>>>
>>> *Thilini Cooray*
>>> Software Engineer
>>> Mobile : +94 (0) 774 570 112 <%2B94%20%280%29%20773%20451194>
>>> E-mail : thili...@wso2.com
>>>
>>> WSO2 Inc. www.wso2.com
>>> lean.enterprise.middleware
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>
>
>
> --
> Best Regards,
>
> *Thilini Cooray*
> Software Engineer
> Mobile : +94 (0) 774 570 112 <%2B94%20%280%29%20773%20451194>
> E-mail : thili...@wso2.com
>
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Jaggery] response.sendError() not working for PUT and DELETE

2015-10-19 Thread Sajith Ariyarathna
Hi Thilini,

Can you share your code here?

I tested following Jaggery code. (Test was executed in* AppM 1.0.0* pack
and *Advanced Rest Client* was used as the HTTP client)

*URL Mapping in jaggery.conf: *

{

"url": "/test/*",

"path": "/lib/test.jag"

}


*File*: *test.jag*

*Code:*

var log = new Log("[testing]");

log.info("Hit for HTTP method " + request.getMethod());

response.sendError(404, "Testing page not found.");


*Terminal Output:*

[2015-10-20 10:26:52,885]  INFO - [testing] Hit for HTTP method GET

[2015-10-20 10:26:57,499]  INFO - [testing] Hit for HTTP method POST

[2015-10-20 10:27:02,045]  INFO - [testing] Hit for HTTP method PUT

[2015-10-20 10:27:06,011]  INFO - [testing] Hit for HTTP method DELETE

[2015-10-20 10:27:08,491]  INFO - [testing] Hit for HTTP method HEAD

[2015-10-20 10:27:10,860]  INFO - [testing] Hit for HTTP method OPTIONS


*HTTP Output:*

404 Not Found

404 Not Found

404 Not Found

404 Not Found

404 Not Found

404 Not Found


Since the expected output was received in above, I believe the issue is on
your side, not in Jaggery.

Thanks.

On Mon, Oct 19, 2015 at 2:04 PM, Thilini Cooray  wrote:

> Hi,
>
> I want to send error messages for invalid URLs from API Manager Store
> jaggery layer.
>
> I use response.sendError(404) for this purpose.
> For HTTP POST and GET this method returns the correct error page while it
> doesn't return any message for PUT and DELETE.
>
> I debugged [1] and found out that the errors send in all HTTP methods gets
> hit in
>
> rho.response.sendError((Integer) args[0]);
>
> Output stream of rho.response also contains the correct error page in all
> HTTP methods.
> Yet it doesn't get returned in HTTP PUT and DELETE methods.
>
> I am unable to figure out the reason for this behaviour.
> Any help is appreciated.
>
> Thanks.
>
> [1]
> http://svn.wso2.org/repos/wso2/carbon/platform/tags/turing-chunk04/components/jaggery/0.9.0.ALPHA4.wso2v1/hostobjects/org.jaggeryjs.hostobjects.web/src/main/java/org/jaggeryjs/hostobjects/web/ResponseHostObject.java
>
> --
> Best Regards,
>
> *Thilini Cooray*
> Software Engineer
> Mobile : +94 (0) 774 570 112 <%2B94%20%280%29%20773%20451194>
> E-mail : thili...@wso2.com
>
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha,

Please find my comments inline.


> As sajith said can read certificate file using Jaggery File object. But
> is there a way to get public key from that way??
>
You cannot get the public key using Jaggery File object since File object
represent a file, not a security certificate.

*code*
> inputStream = new Packages.java.io.FileInputStream(certificatePath);
> var key =
> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>
This Java code should work. Set certificatePath =
"/repository/deployment/server/jaggeryapps/Parkingapp/resources/wso2defaultpub.ce"
.

Thanks.

On Thu, Oct 1, 2015 at 7:29 AM, Lasantha Dharmakeerthi 
wrote:

> Hi
> All
>
> I use java inside my jaggery app to read certificate file and get public
> key.
>
> *code*
> inputStream = new Packages.java.io.FileInputStream(certificatePath);
> var key =
> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>
> As sajith said can read certificate file using Jaggery File object. But
> is there a way to get public key from that way??
>
> Can't I read certificate file in my application context by giving path
> likewise in my local app ?
>
> If it is possible to read file as in local app how can I get absolute path
> to my certificate file in cloud app??
>
> *url*
>
> https://appserver.dev.cloud.wso2.com/t/dlpds3331/jaggeryapps/wso2parkingapp-default-SNAPSHOT
>
> Thanks
> Lasantha.
>
>
>
>
> On Wed, Sep 30, 2015 at 7:50 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi Lasantha,
>>
>> Jaggery server runs on top of Carbon. So Java libraries which are added
>> to Carbon are also available in Jaggery. External Java libraries can be
>> added to Carbon by dropping them into 
>> /repository/components/lib directory (more details [1]). Don't forget to
>> restart the server.
>>
>> [1]
>> http://wso2.com/library/knowledgebase/add-external-jar-libraries-wso2-carbon-based-products/
>>
>>
>> On Wed, Sep 30, 2015 at 4:40 PM, Lasantha Dharmakeerthi <
>> lasant...@wso2.com> wrote:
>>
>>> hi
>>> Sajitha
>>>
>>> I use some .jar files and I have included them into components/lib
>>> folder. Can I add those .jar files inside the jagerry app and use to get
>>> same functionalities?
>>>
>>> Above code is working well when I give absolute path.
>>>
>>> Thanks
>>>
>>> Lasantha
>>>
>>> On Wed, Sep 30, 2015 at 4:38 PM, Lasantha Dharmakeerthi <
>>> lasant...@wso2.com> wrote:
>>>
>>>> Hi
>>>> Sajith
>>>>
>>>> Can I get public key of certificate using this way. I tried this one
>>>> but couldn't get public key.
>>>>
>>>> this is the my code
>>>>
>>>>   function getPublicKey(certificatePath){
>>>>
>>>> var inputStream = null;
>>>>
>>>> try{
>>>>
>>>>   log.debug("Reading certificate from ");
>>>>   inputStream = new
>>>> Packages.java.io.FileInputStream(certificatePath);
>>>>
>>>>   var key =
>>>> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>>>>
>>>>   return key;
>>>> }catch(e){
>>>>   log.error("Error while getting the public key. " + e);
>>>>   throw e;
>>>> }finally{
>>>>
>>>>   if(inputStream){
>>>> inputStream.close();
>>>>   }
>>>> }
>>>>
>>>> return null;
>>>>
>>>>   }
>>>>
>>>> Thanks
>>>> Lasantha
>>>>
>>>> On Wed, Sep 30, 2015 at 4:23 PM, Sajith Ariyarathna 
>>>> wrote:
>>>>
>>>>> Hi Lasantha,
>>>>>
>>>>> Assuming,
>>>>>
>>>>> You are reading the certificate file using Jaggery.
>>>>>
>>>>> In your Jaggery app, certificate file is in '
>>>>> *resources/wso2defaultpub.cer*' path
>>>>>
>>>>> You can read your file using Jaggery File [1] object. Refer following
>>>>> code snippet.
>>>>>
>>>>> var certFile = new File("/resources/wso2defaultpub.cer");
>&g

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha,

Jaggery server runs on top of Carbon. So Java libraries which are added to
Carbon are also available in Jaggery. External Java libraries can be added
to Carbon by dropping them into 
/repository/components/lib directory (more details [1]). Don't forget to
restart the server.

[1]
http://wso2.com/library/knowledgebase/add-external-jar-libraries-wso2-carbon-based-products/


On Wed, Sep 30, 2015 at 4:40 PM, Lasantha Dharmakeerthi 
wrote:

> hi
> Sajitha
>
> I use some .jar files and I have included them into components/lib folder.
> Can I add those .jar files inside the jagerry app and use to get same
> functionalities?
>
> Above code is working well when I give absolute path.
>
> Thanks
>
> Lasantha
>
> On Wed, Sep 30, 2015 at 4:38 PM, Lasantha Dharmakeerthi <
> lasant...@wso2.com> wrote:
>
>> Hi
>> Sajith
>>
>> Can I get public key of certificate using this way. I tried this one but
>> couldn't get public key.
>>
>> this is the my code
>>
>>   function getPublicKey(certificatePath){
>>
>> var inputStream = null;
>>
>> try{
>>
>>   log.debug("Reading certificate from ");
>>   inputStream = new Packages.java.io.FileInputStream(certificatePath);
>>
>>   var key =
>> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>>
>>   return key;
>> }catch(e){
>>   log.error("Error while getting the public key. " + e);
>>   throw e;
>> }finally{
>>
>>   if(inputStream){
>> inputStream.close();
>>   }
>> }
>>
>> return null;
>>
>>   }
>>
>> Thanks
>> Lasantha
>>
>> On Wed, Sep 30, 2015 at 4:23 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi Lasantha,
>>>
>>> Assuming,
>>>
>>> You are reading the certificate file using Jaggery.
>>>
>>> In your Jaggery app, certificate file is in '
>>> *resources/wso2defaultpub.cer*' path
>>>
>>> You can read your file using Jaggery File [1] object. Refer following
>>> code snippet.
>>>
>>> var certFile = new File("/resources/wso2defaultpub.cer");
>>> var content = certFile.readAll();
>>>
>>> [1] http://jaggeryjs.org/documentation.jag?api=file
>>>
>>> Thanks.
>>>
>>> On Wed, Sep 30, 2015 at 3:11 PM, Lasantha Dharmakeerthi <
>>> lasant...@wso2.com> wrote:
>>>
>>>> Hi
>>>> Devs
>>>>
>>>> I have created jaggery app and deployed it in wso2 app cloud. I have
>>>> method to read a certificate file and certificate is in the jaggery
>>>>  app.
>>>>
>>>> In local Aplication Server I used file path like wise “
>>>> repository/deployment/server/jaggeryapps/Parkingapp
>>>> /resources/wso2defaultpub.cer”
>>>>
>>>> So how can I get path to my certificate file in WSO2 App Cloud? Is it
>>>> same structure?
>>>>
>>>> Thanks
>>>> Lasantha.
>>>>
>>>> --
>>>> Dharmakeerthi Lasantha
>>>> Software Engineer Trainee, WSO2
>>>> Mobile 0774928852
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Sajith Ariyarathna
>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>> mobile: +94 77 6602284, +94 71 3951048
>>>
>>
>>
>>
>> --
>> Dharmakeerthi Lasantha
>> Software Engineer Trainee, WSO2
>> Mobile 0774928852
>>
>
>
>
> --
> Dharmakeerthi Lasantha
> Software Engineer Trainee, WSO2
> Mobile 0774928852
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha,

For Jaggery, working directory is your app directory which is in
/repository/deployment/server/jaggeryapps/ .
However if you are using Java inside Jaggery, for those Java codes working
directory is carbon product directory .

Hence variable certificatePath should be
repository/deployment/server/jaggeryapps/Parkingapp/resources/wso2defaultpub.ce

Thanks.

On Wed, Sep 30, 2015 at 4:38 PM, Lasantha Dharmakeerthi 
wrote:

> Hi
> Sajith
>
> Can I get public key of certificate using this way. I tried this one but
> couldn't get public key.
>
> this is the my code
>
>   function getPublicKey(certificatePath){
>
> var inputStream = null;
>
> try{
>
>   log.debug("Reading certificate from ");
>   inputStream = new Packages.java.io.FileInputStream(certificatePath);
>
>   var key =
> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>
>   return key;
> }catch(e){
>   log.error("Error while getting the public key. " + e);
>   throw e;
> }finally{
>
>   if(inputStream){
> inputStream.close();
>   }
> }
>
> return null;
>
>   }
>
> Thanks
> Lasantha
>
> On Wed, Sep 30, 2015 at 4:23 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi Lasantha,
>>
>> Assuming,
>>
>> You are reading the certificate file using Jaggery.
>>
>> In your Jaggery app, certificate file is in '
>> *resources/wso2defaultpub.cer*' path
>>
>> You can read your file using Jaggery File [1] object. Refer following
>> code snippet.
>>
>> var certFile = new File("/resources/wso2defaultpub.cer");
>> var content = certFile.readAll();
>>
>> [1] http://jaggeryjs.org/documentation.jag?api=file
>>
>> Thanks.
>>
>> On Wed, Sep 30, 2015 at 3:11 PM, Lasantha Dharmakeerthi <
>> lasant...@wso2.com> wrote:
>>
>>> Hi
>>> Devs
>>>
>>> I have created jaggery app and deployed it in wso2 app cloud. I have
>>> method to read a certificate file and certificate is in the jaggery app.
>>>
>>> In local Aplication Server I used file path like wise “
>>> repository/deployment/server/jaggeryapps/Parkingapp
>>> /resources/wso2defaultpub.cer”
>>>
>>> So how can I get path to my certificate file in WSO2 App Cloud? Is it
>>> same structure?
>>>
>>> Thanks
>>> Lasantha.
>>>
>>> --
>>> Dharmakeerthi Lasantha
>>> Software Engineer Trainee, WSO2
>>> Mobile 0774928852
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>
>
>
> --
> Dharmakeerthi Lasantha
> Software Engineer Trainee, WSO2
> Mobile 0774928852
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha,

Assuming,

You are reading the certificate file using Jaggery.

In your Jaggery app, certificate file is in '*resources/wso2defaultpub.cer*'
path

You can read your file using Jaggery File [1] object. Refer following
code snippet.

var certFile = new File("/resources/wso2defaultpub.cer");
var content = certFile.readAll();

[1] http://jaggeryjs.org/documentation.jag?api=file

Thanks.

On Wed, Sep 30, 2015 at 3:11 PM, Lasantha Dharmakeerthi 
wrote:

> Hi
> Devs
>
> I have created jaggery app and deployed it in wso2 app cloud. I have
> method to read a certificate file and certificate is in the jaggery app.
>
> In local Aplication Server I used file path like wise “
> repository/deployment/server/jaggeryapps/Parkingapp
> /resources/wso2defaultpub.cer”
>
> So how can I get path to my certificate file in WSO2 App Cloud? Is it same
> structure?
>
> Thanks
> Lasantha.
>
> --
> Dharmakeerthi Lasantha
> Software Engineer Trainee, WSO2
> Mobile 0774928852
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Writing binary data to a file with Jaggery

2015-09-23 Thread Sajith Ariyarathna
Hi Danushka,

As per our chat you are sending base64 encoded string though a POST form
submission and read it inside Jaggery as request.getParameter("imageData")
. I believe following code snippet can help you.

var log = new Log();

// POST param 'imageData' should contain only base64 encoded string

var encodedImageString = request.getParameter("imageData"); //
encodedImageString is a string
try {

// decodedImageData is a byte array

var decodedImageData = Packages.javax.xml.bind.DatatypeConverter.
parseBase64Binary(encodedImageString);

} catch(e) {

log.error("Invalid base64 string");
log.error(e);
return;

}


try {

// file is written in {CARBON_PRODUCT_HOME}/myimage.png

var ofStream = new Packages.java.io.FileOutputStream("myimage.png"); //
assuming image type is PNG
ofStream.write(decodedImageData);
ofStream.close();

log.info("Content written successfully.");

} catch (e) {

log.error("Could not write to file.");

log.error(e);

}


Above, base64 encoded string is decoded using JABX package [1] (assuming
you are using Java6). Some other options can be found here [2].

[1]
http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/DatatypeConverter.html#parseBase64Binary%28java.lang.String%29
[2] http://stackoverflow.com/questions/469695/decode-base64-data-in-java

Thanks.

On Wed, Sep 23, 2015 at 2:46 PM, Danushka Fernando 
wrote:

> Hi All
> Appreciate answers. Any way what I am looking for in write base64 encoded
> image binary data to a file. And these answers won't satisfy my answers.
> Initially I checked for the options available in jaggery to cater my
> requirement.  But after the chat had with Manu it seems that Jaggery have
> some problem with the requirement and they are working on it.
> Any way I tried to do it from the java script and I used the following
> code. Still I have no idea how to write this blob to a File with jaggery.
> Manu can you check this?
>
> var data = atob(imageData.replace(/^data:image\/\w+;base64,/, ""));
> console.log(data);
> var uint8Array = new Uint8Array(data.length);
> for( var i = 0, len = data.length; i < len; ++i ) {
> uint8Array[i] = data.charCodeAt(i);
> }
> var blob = new Blob( [ uint8Array.buffer ], {type: "image/jpg"} );
>
> Thanks & Regards
> Danushka Fernando
> Senior Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Wed, Sep 23, 2015 at 11:17 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi Madusanka,
>>
>> The code snippet you mentioned [1] *does not work* in Jaggery as it
>> meant to be run in the client-side.
>>
>> [1]
>> https://github.com/wso2/carbon-apimgt/blob/carbon-apimgt-v1.9.0/features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/site/themes/default/templates/item-design/js/api-design.js#L681
>>
>>
>> Hi Dhanushka,
>>
>> You can use File object [2] in Jaggery to read, write files. If you are
>> not satisfied with it, you can always use Java classes in your Jaggery code.
>>
>> var log = new Log();
>>
>> var content = "This is the content to write into file";
>> try {
>> var file = new Packages.java.io.File("myfile.txt"); // path to
>> file
>> if (!file.exists()) {
>> log.info("File '" + file.getAbsolutePath() + "' does not
>> exists.");
>> file.createNewFile();
>> log.info("File '" + file.getAbsolutePath() + "' created.");
>> }
>>
>> var fw = new Packages.java.io.FileWriter(file);
>> var bw = new Packages.java.io.BufferedWriter(fw);
>> bw.write(content);
>> bw.close();
>>
>> log.info("Content written successfully.");
>> } catch (e) {
>> log.error("Could not write to file.");
>> log.error(e);
>> }
>>
>>
>> [2] http://jaggeryjs.org/documentation.jag?api=file
>>
>> Thanks.
>>
>> On Tue, Sep 22, 2015 at 12:17 PM, Madusanka Premaratne <
>> madusan...@wso2.com> wrote:
>>
>>> Hi Dhanushka,
>>> In APIM we used FileReader[1] to read imported file from file system. I
>>> think you can use the file writer[2] in your case.
>>>
>>> [1] -
>>> https://github.com/wso2/carbon-apimgt/blob/carbon-apimgt-v1.9.0/features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/site/themes/default/templates/item-design/js/api-design.js#L681
>>> [2] - http://www.w3.org/TR/file-writer-api/
>>>
>

Re: [Dev] Writing binary data to a file with Jaggery

2015-09-22 Thread Sajith Ariyarathna
Hi Madusanka,

The code snippet you mentioned [1] *does not work* in Jaggery as it meant
to be run in the client-side.

[1]
https://github.com/wso2/carbon-apimgt/blob/carbon-apimgt-v1.9.0/features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/site/themes/default/templates/item-design/js/api-design.js#L681


Hi Dhanushka,

You can use File object [2] in Jaggery to read, write files. If you are not
satisfied with it, you can always use Java classes in your Jaggery code.

var log = new Log();

var content = "This is the content to write into file";
try {
var file = new Packages.java.io.File("myfile.txt"); // path to file
if (!file.exists()) {
log.info("File '" + file.getAbsolutePath() + "' does not
exists.");
file.createNewFile();
log.info("File '" + file.getAbsolutePath() + "' created.");
}

var fw = new Packages.java.io.FileWriter(file);
var bw = new Packages.java.io.BufferedWriter(fw);
bw.write(content);
bw.close();

log.info("Content written successfully.");
} catch (e) {
log.error("Could not write to file.");
log.error(e);
}


[2] http://jaggeryjs.org/documentation.jag?api=file

Thanks.

On Tue, Sep 22, 2015 at 12:17 PM, Madusanka Premaratne 
wrote:

> Hi Dhanushka,
> In APIM we used FileReader[1] to read imported file from file system. I
> think you can use the file writer[2] in your case.
>
> [1] -
> https://github.com/wso2/carbon-apimgt/blob/carbon-apimgt-v1.9.0/features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/site/themes/default/templates/item-design/js/api-design.js#L681
> [2] - http://www.w3.org/TR/file-writer-api/
>
> Thanks,
> Madusanka
>
> On Tue, Sep 22, 2015 at 11:55 AM, Danushka Fernando 
> wrote:
>
>> BTW I tried using Blob and Uint8Array interfaces but jaggery says they
>> are not identified.
>>
>> Thanks & Regards
>> Danushka Fernando
>> Senior Software Engineer
>> WSO2 inc. http://wso2.com/
>> Mobile : +94716332729
>>
>> On Tue, Sep 22, 2015 at 11:50 AM, Danushka Fernando 
>> wrote:
>>
>>> Hi All
>>> How we can do $subject? Any ideas would be appreciated.
>>>
>>> Thanks & Regards
>>> Danushka Fernando
>>> Senior Software Engineer
>>> WSO2 inc. http://wso2.com/
>>> Mobile : +94716332729
>>>
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Madusanka Premaratne* | Associate Software Engineer
> WSO2, Inc | lean. enterprise. middleware.
> #20, Palm Grove, Colombo 03, Sri Lanka
> Mobile: +94 71 835 70 73| Work: +94 112 145 345
> Email: madusan...@wso2.com | Web: www.wso2.com
>
> [image: Facebook] <https://www.facebook.com/maduzanka> [image: Twitter]
> <https://twitter.com/rmmpremaratne> [image: Google Plus]
> <https://plus.google.com/u/0/+MadusankaPremaratnemaduz/about/p/pub> [image:
> Linkedin] <http://lk.linkedin.com/in/madusanka/> [image: Instagram]
> <http://instagram.com/madusankapremaratne> [image: Skype]
> <http://@rmmpremaratne>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Do we have direct way to upload images?

2015-09-20 Thread Sajith Ariyarathna
Hi Nifras,

If you want more control over file uploading (chunking, pause/resume,
progress etc.) use a file upload plugin such as JQuery File Upload [1].

[1] https://github.com/blueimp/jQuery-File-Upload

Thanks.

On Sun, Sep 20, 2015 at 8:51 PM, Ruwan Abeykoon  wrote:

> Hi Nifras,
> >>We need to speed up the image kind of upload in faster manner.
> I do not quite understand what is the slowness, perhaps you might have
> seen some interesting behaviour.
>
> As for my understanding, the most efficient upload is the stream based
> upload. Upload single large file as single stream
>
>- cost less processing,
>- less bandwidth,
>- less memory in both client and server,
>- less negotiations in application layer.
>
> We can speedup upload time when it comes to uploading multiple
> files simultaneously with different connections. Thus is something image
> sharing sites do.
>
> If you thinking in line of download accelerators or torrents being faster,
> I would not agree. They really consume far more bandwidth and cpu/memory
> resources either in server side or client side. Just compare any of
> the accelerator/torrent client with simple wget command.
>
> Cheers,
> Ruwan
>
> On Sun, Sep 20, 2015 at 7:09 PM, NIFRAS ISMAIL 
> wrote:
>
>> Hi Sajith,
>> Yes, There are lots of issues behind the seen. So uploading image in
>> binary and put in a folder is the good way up to now. But Still I am not
>> satisfy that method. We need to speed up the image kind of upload in faster
>> manner.
>>
>> I have some abstracts.
>> why can't we split the images into small set of chunks and upload in
>> parallel way? If there is a efficient machanism available to split the
>> images into small chunks and join the server its very much useful for any
>> size of image uploads.
>>
>> Thank you for the great dig on base64 encoding.
>>
>> Nifras Ismail
>>
>> Regards.
>> *M. Nifras Ismail*
>> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>>
>>
>>
>> On Fri, Sep 18, 2015 at 10:40 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi Nifras,
>>>
>>> Uploading base64 encoded string rather than the binary file has some
>>> disadvantages.
>>>
>>>- Encoding to base64 is not a light-weight task. Especially for
>>>mobile devices it can be very painful. Also for large files, web browser
>>>might freeze or even crash [1].
>>>- Usually base64 encoded string is larger than its binary file about
>>>33% [2] [3]. So uploading base64 encoded string consumes more bandwidth
>>>than uploading the binary file.
>>>- In the server-side, reading a file as a base64 encoded string
>>>loads the whole file to the memory (RAM) once which is a bad practice. 
>>> But
>>>if you upload a binary file, then you can get a file stream to that (
>>>uploadedFile.getStream()) and can read the file from that stream
>>>safely.
>>>- Web browsers are optimized to handle uploading large files, but
>>>not base64 strings.
>>>
>>>
>>> I also took the liberty to answer your StackOverflow question [4].
>>>
>>> [1]
>>> http://stackoverflow.com/questions/16761927/aw-snap-when-data-uri-is-too-large
>>> [2]
>>> http://stackoverflow.com/questions/16331215/can-i-make-image-upload-faster-using-base64-encoding-in-android
>>> [3]
>>> http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/
>>> [4] http://stackoverflow.com/a/32657419/1577286
>>>
>>> Thanks.
>>>
>>> On Fri, Sep 18, 2015 at 7:37 PM, NIFRAS ISMAIL 
>>> wrote:
>>>
>>>> Ya sajith, but in my assumption if we convert the image into base64
>>>> encoding and post as string is take some how efficient way for direct image
>>>> upload rather than file upload.
>>>>
>>>> Does this make any seance?
>>>> On Sep 18, 2015 10:40 AM, "Sajith Ariyarathna" 
>>>> wrote:
>>>>
>>>>> Hi Nifras,
>>>>>
>>>>> You can get multiple uploaded-files inside your Jaggery code using
>>>>> request.getAllFiles() function. e.g.
>>>>>
>>>>> var files = request.getAllFiles();   // returns  map
>>>>> for(var name in files) {
>>>>>
>>>>> if(files.hasOwnProperty(name)) {
>>>>>
>>>>> var file = files[name];
>>>>>
>>>>&g

Re: [Dev] Do we have direct way to upload images?

2015-09-18 Thread Sajith Ariyarathna
Hi Nifras,

Uploading base64 encoded string rather than the binary file has some
disadvantages.

   - Encoding to base64 is not a light-weight task. Especially for mobile
   devices it can be very painful. Also for large files, web browser
   might freeze or even crash [1].
   - Usually base64 encoded string is larger than its binary file about 33%
   [2] [3]. So uploading base64 encoded string consumes more bandwidth than
   uploading the binary file.
   - In the server-side, reading a file as a base64 encoded string loads
   the whole file to the memory (RAM) once which is a bad practice. But if you
   upload a binary file, then you can get a file stream to that (
   uploadedFile.getStream()) and can read the file from that stream safely.
   - Web browsers are optimized to handle uploading large files, but not
   base64 strings.


I also took the liberty to answer your StackOverflow question [4].

[1]
http://stackoverflow.com/questions/16761927/aw-snap-when-data-uri-is-too-large
[2]
http://stackoverflow.com/questions/16331215/can-i-make-image-upload-faster-using-base64-encoding-in-android
[3]
http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/
[4] http://stackoverflow.com/a/32657419/1577286

Thanks.

On Fri, Sep 18, 2015 at 7:37 PM, NIFRAS ISMAIL 
wrote:

> Ya sajith, but in my assumption if we convert the image into base64
> encoding and post as string is take some how efficient way for direct image
> upload rather than file upload.
>
> Does this make any seance?
> On Sep 18, 2015 10:40 AM, "Sajith Ariyarathna"  wrote:
>
>> Hi Nifras,
>>
>> You can get multiple uploaded-files inside your Jaggery code using
>> request.getAllFiles() function. e.g.
>>
>> var files = request.getAllFiles();   // returns  map
>> for(var name in files) {
>>
>> if(files.hasOwnProperty(name)) {
>>
>> var file = files[name];
>>
>> // do something with file
>>
>> }
>>
>> }
>>
>>
>> Thanks.
>>
>> On Fri, Sep 18, 2015 at 7:08 AM, NIFRAS ISMAIL 
>> wrote:
>>
>>> Hi Sajith,
>>> Thank you for the guide.
>>> So we can add multiple files upload from this stream.
>>>
>>> Regards.
>>> *M. Nifras Ismail*
>>> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>>>
>>>
>>>
>>> On Fri, Sep 18, 2015 at 12:32 AM, Sajith Ariyarathna 
>>> wrote:
>>>
>>>> Hi Nifras,
>>>>
>>>> request.getFile("myFile") does not represent a physical file, rather
>>>> it represent a stream to the uploaded file. Hence you cannot "move" it
>>>> using .move("...") function. If you want to save the uploaded file,
>>>> then use the following code snippet.
>>>>
>>>> var uploadedFile = request.getFile("myFile");
>>>> var savedFile = new File("/path/to/save/location/" +
>>>> uploadedFile.getName());
>>>> savedFile.open('w');
>>>> savedFile.write(uploadedFile.getStream());
>>>> savedFile.close();
>>>>
>>>>
>>>> Thanks.
>>>>
>>>> On Thu, Sep 10, 2015 at 2:41 PM, NIFRAS ISMAIL 
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>> Do we upload images to the server directly using Jaggery JS?
>>>>> http://stackoverflow.com/a/32497617/2672566
>>>>>
>>>>> Regards.
>>>>> *M. Nifras Ismail*
>>>>> [image: LinkedIn]
>>>>> <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>>>>>
>>>>>
>>>>>
>>>>> ___
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Sajith Ariyarathna
>>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>>> mobile: +94 77 6602284, +94 71 3951048
>>>>
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Do we have direct way to upload images?

2015-09-17 Thread Sajith Ariyarathna
Hi Nifras,

You can get multiple uploaded-files inside your Jaggery code using
request.getAllFiles() function. e.g.

var files = request.getAllFiles();   // returns  map
for(var name in files) {

if(files.hasOwnProperty(name)) {

var file = files[name];

// do something with file

}

}


Thanks.

On Fri, Sep 18, 2015 at 7:08 AM, NIFRAS ISMAIL 
wrote:

> Hi Sajith,
> Thank you for the guide.
> So we can add multiple files upload from this stream.
>
> Regards.
> *M. Nifras Ismail*
> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>
>
>
> On Fri, Sep 18, 2015 at 12:32 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi Nifras,
>>
>> request.getFile("myFile") does not represent a physical file, rather it
>> represent a stream to the uploaded file. Hence you cannot "move" it using
>> .move("...") function. If you want to save the uploaded file, then use
>> the following code snippet.
>>
>> var uploadedFile = request.getFile("myFile");
>> var savedFile = new File("/path/to/save/location/" +
>> uploadedFile.getName());
>> savedFile.open('w');
>> savedFile.write(uploadedFile.getStream());
>> savedFile.close();
>>
>>
>> Thanks.
>>
>> On Thu, Sep 10, 2015 at 2:41 PM, NIFRAS ISMAIL 
>> wrote:
>>
>>> Hi All,
>>> Do we upload images to the server directly using Jaggery JS?
>>> http://stackoverflow.com/a/32497617/2672566
>>>
>>> Regards.
>>> *M. Nifras Ismail*
>>> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>>>
>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Do we have direct way to upload images?

2015-09-17 Thread Sajith Ariyarathna
Hi Nifras,

request.getFile("myFile") does not represent a physical file, rather it
represent a stream to the uploaded file. Hence you cannot "move" it using
.move("...") function. If you want to save the uploaded file, then use the
following code snippet.

var uploadedFile = request.getFile("myFile");
var savedFile = new File("/path/to/save/location/" +
uploadedFile.getName());
savedFile.open('w');
savedFile.write(uploadedFile.getStream());
savedFile.close();


Thanks.

On Thu, Sep 10, 2015 at 2:41 PM, NIFRAS ISMAIL 
wrote:

> Hi All,
> Do we upload images to the server directly using Jaggery JS?
> http://stackoverflow.com/a/32497617/2672566
>
> Regards.
> *M. Nifras Ismail*
> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b>
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Caramel] Adding more custom Handlebars helpers to Caramel

2015-08-12 Thread Sajith Ariyarathna
[attaching image]

[image: Inline image 1]


On Thu, Aug 13, 2015 at 11:04 AM, Sajith Ariyarathna 
wrote:

> Hi Manu,
>
> Please find my comments inline.
>
> -1 *ifCond* and *selectIf*
>
>  I agree with your view. Since Mustache and Handlebars follow the *logic-less
> template* approach, Caramel should also follow it.
>
> However there are some circumstances where you have to put some logic in
> the template. For example, in [1] we have used selectIf helper to
> determine the proper CSS class for some action buttons. Before introducing
> selectIf helper, these CSS classes were hard-coded in this [2] .js file
> (which is in the server-side). Hard-coding CSS classes is acceptable in
> HTML templates and client-side JavaScripts, but not for other server-side
> .js or .jsg files. That's why we introduced the selectIf helper.
>
> +1 for *for*
>>
> The {{index}} expression has been introduced to the {{#each}} block
> helper in Handlebars 3.0.3 version. However startIndex, endIndex and jump 
> optional
> parameters of the proposed for helper can be helpful. For example,
> displaying only certain number of items based on a user input (see below
> image). So, adding for helper will be helpful.
> [image: Inline image 1]
>
>
> [1]
> https://github.com/sajithar/carbon-appmgt/blob/047b7831886f50f6e656ca9d56739d08003c7240/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/partials/list-assets-row.hbs#L50
> [2]
> https://github.com/sajithar/carbon-appmgt/blob/2d362df789eadc1b67e0edf41209380aa82bf7c1/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/renderers/controllers/assets_router.js#L39
>
> Thanks.
>
>
> On Wed, Aug 12, 2015 at 6:40 PM, Manuranga Perera  wrote:
>
>> -1 *ifCond* and *selectIf*
>> the reason we have separate *logic-less* temperating is to remove logic
>> out of ui representation. this helper defeats whole purpose of having
>> handlebars.
>> different people have different opinions on this, see the discussion on
>> https://github.com/wycats/handlebars.js/issues/616 . I personally don't
>> like putting it in templates.
>>
>> It is better to do the necessary logic in the js/jag file and use the
>> built in Helpers. is there any reason to not to do it this way?
>>
>> +1 for *for*
>> but think it's there in new version anyway. is this one any different? if
>> not we should just update to new Handlebars instead.
>>
>> On Wed, Aug 12, 2015 at 3:28 PM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi All,
>>>
>>> For AppM we have implemented few custom Handlebars helpers [1]. Since
>>> they are very helpful, we like to suggest them to add to the Caramel
>>> framework. We suggest following 03 helpers.
>>>
>>> *ifCond*
>>>
>>> Conditional if block which can be used with a single logical expression.
>>> ifCond helper supports ==, !=, ===, !==, <, <=, >, >=, &&, || and typeof 
>>> operators.
>>> (see [2])
>>>
>>> *for*
>>>
>>> Iterates over an array and iteration manner can be customized. Also,
>>> index of the current iteration can be access as {{index}}. (see [3])
>>>
>>> *selectIf*
>>>
>>> For the given value, outputs the result based on the specified
>>> 'value-result' map. Very similar to the switch-case clause. (see [4])
>>>
>>>
>>> Thanks.
>>>
>>> [1]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js
>>> [2]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L92
>>> [3]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L143
>>> [4]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L250
>>>
>>> --
>>> Sajith Ariyarathna
>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>> mobile: +94 77 6602284, +94 71 3951048
>>>
>>
>>
>>
>> --
>> With regards,
>> *Manu*ranga Perera.
>>
>> phone : 071 7 70 20 50
>> mail : m...@wso2.com
>>
>
>
>
> --
> Sajith Ariyarathna
> Software Engineer; WSO2, Inc.;  http://wso2.com/
> mobile: +94 77 6602284, +94 71 3951048
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Caramel] Adding more custom Handlebars helpers to Caramel

2015-08-12 Thread Sajith Ariyarathna
Hi Manu,

Please find my comments inline.

-1 *ifCond* and *selectIf*

 I agree with your view. Since Mustache and Handlebars follow the *logic-less
template* approach, Caramel should also follow it.

However there are some circumstances where you have to put some logic in
the template. For example, in [1] we have used selectIf helper to determine
the proper CSS class for some action buttons. Before introducing
selectIf helper,
these CSS classes were hard-coded in this [2] .js file (which is in the
server-side). Hard-coding CSS classes is acceptable in HTML templates and
client-side JavaScripts, but not for other server-side .js or .jsg files.
That's why we introduced the selectIf helper.

+1 for *for*
>
The {{index}} expression has been introduced to the {{#each}} block helper
in Handlebars 3.0.3 version. However startIndex, endIndex and jump optional
parameters of the proposed for helper can be helpful. For example,
displaying only certain number of items based on a user input (see below
image). So, adding for helper will be helpful.
[image: Inline image 1]


[1]
https://github.com/sajithar/carbon-appmgt/blob/047b7831886f50f6e656ca9d56739d08003c7240/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/partials/list-assets-row.hbs#L50
[2]
https://github.com/sajithar/carbon-appmgt/blob/2d362df789eadc1b67e0edf41209380aa82bf7c1/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/renderers/controllers/assets_router.js#L39

Thanks.


On Wed, Aug 12, 2015 at 6:40 PM, Manuranga Perera  wrote:

> -1 *ifCond* and *selectIf*
> the reason we have separate *logic-less* temperating is to remove logic
> out of ui representation. this helper defeats whole purpose of having
> handlebars.
> different people have different opinions on this, see the discussion on
> https://github.com/wycats/handlebars.js/issues/616 . I personally don't
> like putting it in templates.
>
> It is better to do the necessary logic in the js/jag file and use the
> built in Helpers. is there any reason to not to do it this way?
>
> +1 for *for*
> but think it's there in new version anyway. is this one any different? if
> not we should just update to new Handlebars instead.
>
> On Wed, Aug 12, 2015 at 3:28 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi All,
>>
>> For AppM we have implemented few custom Handlebars helpers [1]. Since
>> they are very helpful, we like to suggest them to add to the Caramel
>> framework. We suggest following 03 helpers.
>>
>> *ifCond*
>>
>> Conditional if block which can be used with a single logical expression.
>> ifCond helper supports ==, !=, ===, !==, <, <=, >, >=, &&, || and typeof 
>> operators.
>> (see [2])
>>
>> *for*
>>
>> Iterates over an array and iteration manner can be customized. Also,
>> index of the current iteration can be access as {{index}}. (see [3])
>>
>> *selectIf*
>>
>> For the given value, outputs the result based on the specified
>> 'value-result' map. Very similar to the switch-case clause. (see [4])
>>
>>
>> Thanks.
>>
>> [1]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js
>> [2]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L92
>> [3]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L143
>> [4]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L250
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>
>
>
> --
> With regards,
> *Manu*ranga Perera.
>
> phone : 071 7 70 20 50
> mail : m...@wso2.com
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Caramel] Rendering HTML using Caramel in client side

2015-08-12 Thread Sajith Ariyarathna
Hi Rajith,

It seems like Caramel client library has a dependency that I don't know
about. I have found out that following scripts (libraries) are required to
run Caramel in the client-side.


async.min.js
caramel-client.js
caramel.handlebars.client.js


Can we add about these dependencies to the README [1] file in the Caramel
repo, so that everyone can see it.

[1] https://github.com/wso2/caramel/blob/master/README.md

Thanks.

On Fri, Aug 7, 2015 at 12:36 PM, Rajith Roshan  wrote:

> Hi Sajith,
>
> You can write a new partial hbs file (for ex: update.hbs) inside the
> publisher/themes/appm/partials with the content you want to display. The
> display content should be set to a variable (for ex : output)  with the
> content you have in your JSON object. Then add these values to caramel
> renderer as follows.
>
> caramel.render(output);
>
> Then in the main hbs file you can refer the partial page as follows.
>
> {{>update }}
>
>
> Please refer the following doc [1] for the additional information. (Read 
> "Overriding part of a view")
>
> [1] - 
> https://docs.google.com/a/wso2.com/document/d/1_blb4u8aFn-6jTpHx6fynTgohAI4KQgUaEE-so5IxSg/edit?usp=sharing
>
>
> Thanks,
>
> Rajith
>
>
>
> On Fri, Aug 7, 2015 at 8:19 AM, Sajith Ariyarathna 
> wrote:
>
>> Hi All,
>>
>> I want to update a portion of the web page using Caramel. Necessary data
>> (JSON) is obtained through an AJAX call. How do I accomplish this task? Any
>> examples will be very helpful.
>>
>> PS: caramel.handlebars.client.js [1] and handlebars-1.1.2.js [2] acripts
>> are included in the page.
>>
>> Thanks.
>>
>> [1]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js
>> [2]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/appm/js/handlebars-1.1.2.js
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>> _______
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Rajith Roshan
> Software Engineer, WSO2 Inc.
> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [Caramel] Adding more custom Handlebars helpers to Caramel

2015-08-12 Thread Sajith Ariyarathna
Hi All,

For AppM we have implemented few custom Handlebars helpers [1]. Since they
are very helpful, we like to suggest them to add to the Caramel framework.
We suggest following 03 helpers.

*ifCond*

Conditional if block which can be used with a single logical expression.
ifCond helper supports ==, !=, ===, !==, <, <=, >, >=, &&, || and
typeof operators.
(see [2])

*for*

Iterates over an array and iteration manner can be customized. Also, index
of the current iteration can be access as {{index}}. (see [3])

*selectIf*

For the given value, outputs the result based on the specified
'value-result' map. Very similar to the switch-case clause. (see [4])


Thanks.

[1]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js
[2]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L92
[3]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L143
[4]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/lib/handlebars/custom.handlebars.helpers.js#L250

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [ES] [AppM] Back-porting "Per Version App Commenting and Rating" from ES 2.0 to AppM 1.1

2015-08-12 Thread Sajith Ariyarathna
Hi ES Team,

For the upcoming AppM release we are hoping to implement "Per Version App
Commenting and Rating" feature. Following are the basic requirements of
this feature.

   - In the Store, user should be able to comment and rate a published
   version of an app.
   - However, comments of older versions should be displayed under newer
   versions as "For a previous version: ".
   - When calculating the overall rating of an app, ratings from all
   versions of that app should be considered.

We are hoping to back-port this feature form ES 2.0 to AppM 1.1 . Does ES
2.0 has this feature (or similar one) in the social plugin?


PS: If two assets are two versions of the same app, then their 'name'
attribute and 'provider' attribute are equal and 'version' is different.

Thanks.
-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Caramel] Rendering HTML using Caramel in client side

2015-08-08 Thread Sajith Ariyarathna
Hi Rasika,

I added the async.min.js and it works without any issues. Thanks for your
help.


On Sat, Aug 8, 2015 at 7:51 PM, Rasika Perera  wrote:

> Hi Sajith,
>
> The reason you are getting "Uncaught ReferenceError: async is not defined"
> seems you are missing a "async.min.js" library. Try adding it.
>
> Thank you
>
> On Sat, Aug 8, 2015 at 7:09 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi Dakshika,
>>
>> I followed your example (see [1]) and implemented my solution. Here is my
>> code. Here updateTableColumns function is called when the AJAX call is
>> completed successfully.
>>
>> /**
>>  * Updates table cells using Caramel engine.
>>  * @param assetData {Object} asset
>>  * @param statusTd {jQuery} table cell to be updated in the STATUS column
>>  * @param actionsTd {jQuery} table cell to be updated in the ACTIONS
>> column
>>  */
>> function updateTableColumns(assetData, statusTd, actionsTd){
>> console.log(assetData);
>>
>> caramel.render ('list-assets.status', assetData, function(info,
>> content){
>> console.log(content);
>> statusTd.find('span').html(content);
>> });
>> caramel.render ('list-assets.lc-actions', assetData, function(info,
>> content){
>> console.log(content);
>> actionsTd.find('span').html(content);
>> });
>> }
>>
>>
>> But now I get a "*Uncaught ReferenceError: async is not defined*" error
>> in the browser console. This error is thrown from the
>> 'caramel.handlebars.client.js' file (line 107 [2]). How can I resolve this
>> issue?
>>
>> PS: 'handlebars.js', 'caramel.handlebars.client.js', 'caramel-client.js'
>> scripts are included in the web page in this order.
>>
>> [1]
>> https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js#L85
>> [2]
>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js#L107
>>
>> Thanks.
>>
>> On Fri, Aug 7, 2015 at 2:12 PM, Dakshika Jayathilaka 
>> wrote:
>>
>>> Hi Sajith,
>>>
>>> If your want to see real implementation check below code carbon store
>>> publisher app.[1] search for  caramel.render
>>>
>>> [1]
>>> https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js
>>>
>>> Regards,
>>>
>>> *Dakshika Jayathilaka*
>>> PMC Member & Committer of Apache Stratos
>>> Senior Software Engineer
>>> WSO2, Inc.
>>> lean.enterprise.middleware
>>> 0771100911
>>>
>>> On Fri, Aug 7, 2015 at 12:36 PM, Rajith Roshan  wrote:
>>>
>>>> Hi Sajith,
>>>>
>>>> You can write a new partial hbs file (for ex: update.hbs) inside the
>>>> publisher/themes/appm/partials with the content you want to display. The
>>>> display content should be set to a variable (for ex : output)  with the
>>>> content you have in your JSON object. Then add these values to caramel
>>>> renderer as follows.
>>>>
>>>> caramel.render(output);
>>>>
>>>> Then in the main hbs file you can refer the partial page as follows.
>>>>
>>>> {{>update }}
>>>>
>>>>
>>>> Please refer the following doc [1] for the additional information. (Read 
>>>> "Overriding part of a view")
>>>>
>>>> [1] - 
>>>> https://docs.google.com/a/wso2.com/document/d/1_blb4u8aFn-6jTpHx6fynTgohAI4KQgUaEE-so5IxSg/edit?usp=sharing
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Rajith
>>>>
>>>>
>>>>
>>>> On Fri, Aug 7, 2015 at 8:19 AM, Sajith Ariyarathna 
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I want to update a portion of the web page using Caramel. Necessary
>>>>> data (JSON) is obtained through an AJAX call. How do I accomplish this
>>>>> task? Any examples will be very helpful.
>>>>>
>>>>> PS: caramel.handlebars.client.js [1] and handlebars-1.1.2.js [2]
>>>>> acripts are included in the page.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> [1]
>&

Re: [Dev] [Caramel] Rendering HTML using Caramel in client side

2015-08-08 Thread Sajith Ariyarathna
Hi Dakshika,

I followed your example (see [1]) and implemented my solution. Here is my
code. Here updateTableColumns function is called when the AJAX call is
completed successfully.

/**
 * Updates table cells using Caramel engine.
 * @param assetData {Object} asset
 * @param statusTd {jQuery} table cell to be updated in the STATUS column
 * @param actionsTd {jQuery} table cell to be updated in the ACTIONS column
 */
function updateTableColumns(assetData, statusTd, actionsTd){
console.log(assetData);

caramel.render ('list-assets.status', assetData, function(info,
content){
console.log(content);
statusTd.find('span').html(content);
});
caramel.render ('list-assets.lc-actions', assetData, function(info,
content){
console.log(content);
actionsTd.find('span').html(content);
});
}


But now I get a "*Uncaught ReferenceError: async is not defined*" error in
the browser console. This error is thrown from the
'caramel.handlebars.client.js' file (line 107 [2]). How can I resolve this
issue?

PS: 'handlebars.js', 'caramel.handlebars.client.js', 'caramel-client.js'
scripts are included in the web page in this order.

[1]
https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js#L85
[2]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js#L107

Thanks.

On Fri, Aug 7, 2015 at 2:12 PM, Dakshika Jayathilaka 
wrote:

> Hi Sajith,
>
> If your want to see real implementation check below code carbon store
> publisher app.[1] search for  caramel.render
>
> [1]
> https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js
>
> Regards,
>
> *Dakshika Jayathilaka*
> PMC Member & Committer of Apache Stratos
> Senior Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
> 0771100911
>
> On Fri, Aug 7, 2015 at 12:36 PM, Rajith Roshan  wrote:
>
>> Hi Sajith,
>>
>> You can write a new partial hbs file (for ex: update.hbs) inside the
>> publisher/themes/appm/partials with the content you want to display. The
>> display content should be set to a variable (for ex : output)  with the
>> content you have in your JSON object. Then add these values to caramel
>> renderer as follows.
>>
>> caramel.render(output);
>>
>> Then in the main hbs file you can refer the partial page as follows.
>>
>> {{>update }}
>>
>>
>> Please refer the following doc [1] for the additional information. (Read 
>> "Overriding part of a view")
>>
>> [1] - 
>> https://docs.google.com/a/wso2.com/document/d/1_blb4u8aFn-6jTpHx6fynTgohAI4KQgUaEE-so5IxSg/edit?usp=sharing
>>
>>
>> Thanks,
>>
>> Rajith
>>
>>
>>
>> On Fri, Aug 7, 2015 at 8:19 AM, Sajith Ariyarathna 
>> wrote:
>>
>>> Hi All,
>>>
>>> I want to update a portion of the web page using Caramel. Necessary data
>>> (JSON) is obtained through an AJAX call. How do I accomplish this task? Any
>>> examples will be very helpful.
>>>
>>> PS: caramel.handlebars.client.js [1] and handlebars-1.1.2.js [2]
>>> acripts are included in the page.
>>>
>>> Thanks.
>>>
>>> [1]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js
>>> [2]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/appm/js/handlebars-1.1.2.js
>>> --
>>> Sajith Ariyarathna
>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>> mobile: +94 77 6602284, +94 71 3951048
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Rajith Roshan
>> Software Engineer, WSO2 Inc.
>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [Caramel] Rendering HTML using Caramel in client side

2015-08-06 Thread Sajith Ariyarathna
Hi All,

I want to update a portion of the web page using Caramel. Necessary data
(JSON) is obtained through an AJAX call. How do I accomplish this task? Any
examples will be very helpful.

PS: caramel.handlebars.client.js [1] and handlebars-1.1.2.js [2] acripts
are included in the page.

Thanks.

[1]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js
[2]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/appm/js/handlebars-1.1.2.js
-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Java] StackOverflowError when serializing a deeply nested object

2015-07-30 Thread Sajith Ariyarathna
Hi Ramindu,

I think you are talking about this [1] StreamEvent class.

StackOverflowError can happen when serializing large linked-list type
objects. This [2] answer may shed some light on your problem. In the last
part of the answer, quote

... But serialization is vulnerable to stack overflow for certain kinds of
> structures; for example, a long linked list with no special writeObject()
> methods will be serialized by recursively writing each link. If you've got
> a 100,000 links (nodes), you're going to try to use 100,000 stack frames,
> and quite likely fail with a StackOverflowError.
>
It's possible to define a writeObject() method for such a list class that,
> when the first link (node) is serialized, simply walks the list and
> serializes each link (node) iteratively; this will prevent the default
> recursive mechanism from being used.


So, implementing writeObject() method for the linked-list (which has
StreamEvent nodes) will solve your problem.

[1]
https://github.com/wso2/siddhi/blob/master/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/event/stream/StreamEvent.java
[2] http://stackoverflow.com/a/439016/1577286

Thanks.

On Thu, Jul 30, 2015 at 6:29 PM, Ramindu De Silva  wrote:

> Hi All,
>
> Currently we are using StreamEvents of the following structure in Siddhi
> when processing events within a Window.
>
> StreamEvent{
>StreamEvent next
>Object[] beforeWindowData
>Object[] onAfterWindowData
>etc.
> }
>
> Each event is linked to the next event by the attribute 'next' so that a
> chain of events is available for doing complex operations on the set of
> events within a window. However, because of this, as the window size grows,
> a very large nested object is created similar to a LinkedList.
>
> This causes StackOverflowErrors when serializing this particular deeply
> nested object. (Serializing of this object is needed for synching state
> between CEP servers, persisting/saving state etc.) This seems to be
> occurring because Java ObjectOutputStream serializes nested objects in a
> recursive manner by using the Java stack.
>
> Is there a way to serialize a deeply nested object, while preserving the
> chain of objects?
>
> Any suggestion resolving this issue will be greatly appreciated.
>
> Best Regards,
>
> --
> *Ramindu De Silva*
> Software Engineer
> WSO2 Inc.: http://wso2.com
> lean.enterprise.middleware
>
> email: ramin...@wso2.com 
> mob: +94 772339350
> mob: +94 782731766
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] API Manager associating a new version of an API with its previous version

2015-07-22 Thread Sajith Ariyarathna
Hi Uvindra,

As pointed out by RuwanA, AppM had a similar problem when creating a new
version of a web app based on an existing version. In AppM, when
'Publish'ing version *2.0.0* of web app *Foo* (which was created from *Foo*
version *1.0.0*), version *1.0.0* is 'Un-publish'ed (because only one
version of a web app is shown to end-users in the store) and subscriptions
from version *1.0.0* are moved to version *2.0.0*. This is not exactly your
situation in APIM, but you can see that subscriptions are moved to the new
version when it is 'Publish'ed.

Suggestion: you should give the option to the Publisher to decide whether
to copy or move subscriptions to the new version. You can give 03 options,
"Copy Subscriptions to v2.0.0", "Move Subscriptions to v2.0.0" and "Do
Nothing". I believe it will improve the user experience for API Publisher.

As suggested by RuwanA, keeping the 'parentID' in the asset or in the DB
will also help to maintain a version hierarchy and in future releases you
can use that data to do API grouping or to show a versioning tree.

Thanks and Regards.


On Wed, Jul 22, 2015 at 1:00 PM, Ruwan Abeykoon  wrote:

> Hi Uvindra,
> What if we keep the "parent" apiID in the asset itself, rather than in
> new DB column. (by adding the field to api.rxt)
>
> Cheers,
> Ruwan
>
> On Wed, Jul 22, 2015 at 12:44 PM, Uvindra Dias Jayasinha  > wrote:
>
>> The correct way I can think of solving this is to store the apiID of the
>> version that is being copied from in the newly created api object so that
>> we can make the association later on when we are publishing the new api
>> version.
>>
>> This means we will need to add a new column to the AM_API table to store
>> this, hence Im trying to see if  there is an alternative.
>>
>>
>>
>> On 22 July 2015 at 12:38, Uvindra Dias Jayasinha 
>> wrote:
>>
>>> Thanks for the suggestion Ruwan, but we are not on ES yet and wont be
>>> for sometime so we wont be able to exploit that feature.
>>>
>>> On 22 July 2015 at 12:32, Ruwan Abeykoon  wrote:
>>>
>>>> Hi Uvindra,
>>>> We are having same issue and being solved in AppM 1.1.0. We were
>>>> informed that ES 2.0 has grouping capability. So we may be exploit that to
>>>> correlate versions. We plan to back-port some ES 2.0 functions to ES 1
>>>> branch to get this done.
>>>>
>>>> SajithAR working on this.
>>>>
>>>> Cheers,
>>>> Ruwan
>>>>
>>>>
>>>> On Wed, Jul 22, 2015 at 12:21 PM, Uvindra Dias Jayasinha <
>>>> uvin...@wso2.com> wrote:
>>>>
>>>>> This applies to API Manager 1.9.0, but this is true for previous
>>>>> versions as well. When trying to fix the following ticket[1] I came across
>>>>> this scenario,
>>>>>
>>>>>1. API named *"foo"* with versions *"1.0.0"* and *"2.0.0"* has
>>>>>existing subscriptions.
>>>>>2. Create a new version of the same API *"3.0.0"* from *"2.0.0"*.
>>>>>3. Publish API *"foo:3.0.0"* with the "Require  Re-Subscription"
>>>>>option disabled.
>>>>>4. What should happen is that the subscriptions of *"foo:2.0.0"*
>>>>>should be applied to *"foo:3.0.0" *automatically
>>>>>
>>>>>
>>>>> The problem is step *2 *and *3* above are separate so there is
>>>>> currently no association between *"foo:2.0.0"* and *"foo:3.0.0"*.
>>>>>
>>>>> So how do we determine which API version *"foo:3.0.0"* was created
>>>>> from so that we can transfer that APIs subscriptions at the time of
>>>>> publishing?
>>>>>
>>>>> Is there a way to do this without adding a new attribute to the newly
>>>>> created API to indicate whihc version it was copied from?
>>>>>
>>>>> [1] https://wso2.org/jira/browse/APIMANAGER-3971
>>>>> --
>>>>> Regards,
>>>>> Uvindra
>>>>>
>>>>> Mobile: 33962
>>>>>
>>>>> ___
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> *Ruwan Abeykoon*
>>>> *Architect,*
>>>> *WSO2, Inc. http://wso2.com <http://wso2.com/> *
>>>> *lean.enterprise.middleware.*
>>>>
>>>> email: ruw...@wso2.com
>>>> phone:(+94) 39736
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Uvindra
>>>
>>> Mobile: 33962
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> *Ruwan Abeykoon*
> *Architect,*
> *WSO2, Inc. http://wso2.com <http://wso2.com/> *
> *lean.enterprise.middleware.*
>
> email: ruw...@wso2.com
> phone:(+94) 39736
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Get values from javascript or html into jaggery

2015-07-10 Thread Sajith Ariyarathna
Hi Aaquibah,

You cannot use 'document.getElementById()' function in Jaggery, because
'the document' (HTML page) is in the client-side and Jaggery runs in the
server-side. If you want to access a value from a HTML page, then you have
to do a form submission (POST request) or a AJAX call from client-side.

We can help you further if you can elaborate your use-case and code.

Thanks.

On Fri, Jul 10, 2015 at 1:45 PM, Aaquibah Nashry  wrote:

> //my code is:
> where YEAR(Date__c)=*"+year+" *AND ...
>
> i get the following error:
>
> *message* *org.mozilla.javascript.EcmaError: ReferenceError: "year" is
> not defined. (/ProductJaggery//PipelineGraph.jag#64)*
>
> Regards,
>
> M.R.Aaquibah Nashry
> *Intern, Engineering**| **WSO2, Inc.*
> Mobile : +94 773946123
> Tel  : +94 112662541
> Email : nas...@wso2.com 
>
> On Fri, Jul 10, 2015 at 1:25 PM, Chamalee De Silva 
> wrote:
>
>> Hi Nashry,
>>
>> You can use the variables you create in JavaScript same in Jaggery code.
>> Becuase Jaggery is all about Javascript.
>>
>> *"As a pure Javascript server-side scripting engine, Jaggery combines all
>> the strengths of Javascript with flexibility and freedom at both the
>> development and deployment stages. Most JavaScript webapp development
>> mechanisms restrict developers to a framework-specific structure or
>> patterns, which demand an additional learning curve. By contrast, with
>> Jaggery, any developers who are versed in Javascript have everything they
>> need to get going."*
>>
>>
>> On Fri, Jul 10, 2015 at 1:16 PM, Lakshani Gamage 
>> wrote:
>>
>>> Hi Aaquibah,
>>>
>>> Please follow the link[1]. It'll help to solve your problem.
>>>
>>> [1]
>>> http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html
>>>
>>> Thanks,
>>> Lakshani
>>>
>>> On Fri, Jul 10, 2015 at 1:09 PM, Aaquibah Nashry 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I need to get the values of javascript variables or values of html
>>>> elements into jaggery code.
>>>>
>>>> What i am doing is, i am getting values from html elements and i need
>>>> to send them inside the query in jaggery.
>>>> That is,
>>>> in html i have a dropdown as *Year*, i want to pass the value
>>>> selected. Below is the javascript code with the jaggery code:
>>>>
>>>> function DrawGraph(){
>>>> var year=document.getElementById("Year").value;
>>>>
>>>> <%
>>>> var query =  "select sum(Best_Case__c) as 'Best' FROM Opp WHERE
>>>> YEAR(Date__c)=*year*
>>>> %>
>>>>
>>>> }
>>>>
>>>> How can i do this?
>>>> Any example? Tutorials?
>>>>
>>>> Thanks in advance.
>>>> Regards,
>>>>
>>>> M.R.Aaquibah Nashry
>>>> *Intern, Engineering**| **WSO2, Inc.*
>>>> Mobile : +94 773946123
>>>> Tel  : +94 112662541
>>>> Email : nas...@wso2.com 
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Lakshani Gamage
>>>
>>> *Software Engineer*
>>> Mobile : +94 (0) 71 5478184 <%2B94%20%280%29%20773%20451194>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks & Regards,
>>
>> *Chamalee De Silva*
>> Software Engineer
>> *WS**O2* Inc. .:http://wso2.com
>> lean *.* enterprise *.* middleware
>>
>> Office   :- *+94 11 2145345 <%2B94%2011%202145345>*
>> mobile  :- *+94 7 <%2B94%2077%202782039>1 4315942*
>>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Jaggery] Download files from URL

2015-07-09 Thread Sajith Ariyarathna
Hi Vinod,

Can you use Java in the scenario? If so, then you can implement this task
in Java and call that Java method inside your Jaggery code. I think
implementing this task using Java will be lot easier.

Thanks.


On Thu, Jul 9, 2015 at 3:36 PM, Nirmal Fernando  wrote:

> Where are you reading the chunked incoming data? I can't find it in the
> code you pasted.
>
> So, the data is chunked and you have to read the data correctly. Spec:
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1
>
> On Thu, Jul 9, 2015 at 3:28 PM, Vinod Kavinda  wrote:
>
>> Hi,
>> Thanks Inshaf. But this won't solve my problem. I have already done the
>> downloading directly from browser, option. What I'm expecting is to get it
>> to backend and then pass back to browser.
>> This chunking is the problem.
>>
>> Regards,
>> Vinod
>>
>> On Thu, Jul 9, 2015 at 3:18 PM, Inshaf Mahath  wrote:
>>
>>> Hi Vinod,
>>>
>>> Since you are using Jaggery, you can use JavaScript to create and
>>> download a file. You can have a look on [1], but not sure whether it aligns
>>> with your requirement.
>>>
>>> [1] -
>>> http://blog.eliacontini.info/post/79860720828/export-to-csv-using-javascript-and-the-download
>>>
>>> Thanks,
>>> Inshaf
>>>
>>>
>>>
>>> On Thu, Jul 9, 2015 at 1:49 PM, Vinod Kavinda  wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm trying to download a file from a given URL (File get downloaded if
>>>> we directly go to the link via browser), in a jaggery app.
>>>>
>>>> I need to get the file to the Jaggery backend and send it to the
>>>> browser so that file should get downloaded. I tried this by sending a get
>>>> request to the relevant URL, setting all the headers received from get
>>>> response to the jaggery response and printing the payload as shown below.
>>>>
>>>> var httpClient = new XMLHttpRequest();
>>>> httpClient.open('GET', url, true);
>>>> httpClient.setRequestHeader('COOKIE',
>>>> session.get('MGT_SESSION'));
>>>>
>>>>  //copy header details
>>>> var contentType =
>>>> httpClient.getResponseHeader("Content-Type");
>>>> var transferEncoding =
>>>> httpClient.getResponseHeader("Transfer-Encoding");
>>>> var vary = httpClient.getResponseHeader("Vary");
>>>> var date = httpClient.getResponseHeader("Date");
>>>> var server = httpClient.getResponseHeader("Server");
>>>> var contentDisposition =
>>>> httpClient.getResponseHeader("Content-Disposition");
>>>>
>>>> response.addHeader('Content-Type', contentType);
>>>> response.addHeader('Transfer-Encoding', transferEncoding);
>>>> response.addHeader('Vary', vary);
>>>> response.addHeader('Date', date);
>>>> response.addHeader('Server', server);
>>>> response.addHeader('Content-Disposition', contentDisposition);
>>>>
>>>> print(httpClient.responseText);
>>>>
>>>> A file get downloaded as expected. But is is a corrupted file with less
>>>> size than actual size of the file.
>>>>
>>>> I think the reason for this is the data is coming as chunked data
>>>> packets. The 'Transfer-Encoding' header value is 'chunked'.
>>>>
>>>> Any hint on resolving this is much appreciated.
>>>>
>>>> Thank You,
>>>> Vinod
>>>>
>>>>
>>>> --
>>>> Vinod Kavinda
>>>> Software Engineer
>>>> *WSO2 Inc. - lean . enterprise . middleware <http://www.wso2.com>.*
>>>> Mobile : +94 (0) 712 415544
>>>> Blog : http://soatechflicks.blogspot.com/
>>>>
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Inshaf Mahath
>>>
>>>
>>
>>
>> --
>> Vinod Kavinda
>> Software Engineer
>> *WSO2 Inc. - lean . enterprise . middleware <http://www.wso2.com>.*
>> Mobile : +94 (0) 712 415544
>> Blog : http://soatechflicks.blogspot.com/
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Associate Technical Lead - Data Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ES] [AppM] 'Name' and 'Display Name' field in App Manager

2015-07-08 Thread Sajith Ariyarathna
Hi Chathura,

IMO naming an unique attribute as "Name" is a bad practice. I think naming
it as "App ID" or "Asset ID"or some other name which indicates attribute's
uniqueness will be a better approach.

Also name would give an incorrect message to the user since the value of
> the name is visible to the user.
>
Instead of "Name, "Display Name" is always shown to the end-user in AppM
store for both web apps and mobile apps. (see also [1]).

Thanks & Regards.

[1] https://wso2.org/jira/browse/APPM-1007


On Wed, Jul 8, 2015 at 6:28 PM, Chathura Dilan  wrote:

> Hi All,
>
> Default name field of an ES artifact is unique to the artifact. Once it is
> added it cannot be edited. Since it is a name it should have edit
> capability.
>
> Because of this limitation we had to introduced 'Display Name' to the
> artifact in App Manager which can be edited.
>
> Name field is also part of the artifact identifier and it is used to
> identify the different versions of artifacts.
>
> Problem here is if the DisplayName of the app completely change in a new
> version, there will be a big difference between Name and the DisplayName
> fields. Also name would give an incorrect message to the user since the
> value of the name is visible to the user.
>
> Any ideas on that?
>
> Thanks,
>
> --
> Regards,
>
> Chatura Dilan Perera
> *(Senior Software Engineer** - WSO2 Inc.**)*
> www.dilan.me
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Jaggery debugging issue

2015-06-28 Thread Sajith Ariyarathna
Hi Vinod,

I tried to debug Jaggery in several WSO2 products (APIM, APPM) using both
Eclipse and IntelliJ IDEA, but failed to do so. Somehow, "-DjsDebug"
parameter is not passed to the Jaggery server when running via
'wso2server.sh' script.

Thanks & Regards.


On Thu, Jun 25, 2015 at 3:06 PM, Vinod Kavinda  wrote:

> Hi Sajith,
>
> Could you debug jaggery apps in wso2 products using this Intellij plugin.
> can you please elaborate on how.
>
> Regards,
> Vinod
>
> On Thu, Jun 25, 2015 at 1:08 PM, Sajith Ariyarathna 
> wrote:
>
>> Hi Dinusha,
>>
>> AFAIK debugging Jaggery in Eclipse has some known issues. I suggest to
>> use the exact versions of jars as specified in the documentation [1]. Also,
>> you can try to debug Jaggery in IntelliJ IDEA by using this [2] plugin.
>>
>> [1] http://jaggeryjs.org/debugger.jag
>> [2] https://plugins.jetbrains.com/plugin/1613?pr=
>>
>> Thanks.
>>
>> On Thu, Jun 25, 2015 at 12:09 PM, Dinusha Boteju 
>> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to debug a jaggery app by following the instruction given in
>>> [1]. I followed all the steps mentioned in [1]. However, when I start the
>>> jaggery server in debug mode and browse a deployed application I'm getting
>>> following error in the browser;
>>>
>>> *exception*
>>>
>>> javax.servlet.ServletException: Filter execution threw an exception
>>>
>>> *root cause*
>>>
>>> java.lang.NoClassDefFoundError: Could not initialize class 
>>> org.jaggeryjs.jaggery.core.manager.WebAppManager
>>> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:17)
>>>
>>> I'm pretty sure I followed the instructions correctly. Only difference
>>> is the versions of the 2 jar files which I copied from eclipse/plugins
>>> folder to JAGGERY_HOME/carbon/repository/components/dropins folder. How can
>>> I resolve this?
>>>
>>> [1] - http://jaggeryjs.org/debugger.jag
>>>
>>> Thanks,
>>> Dinusha
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Vinod Kavinda
> Software Engineer
> *WSO2 Inc. - lean . enterprise . middleware <http://www.wso2.com>.*
> Mobile : +94 (0) 712 415544
> Blog : http://soatechflicks.blogspot.com/
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Jaggery debugging issue

2015-06-25 Thread Sajith Ariyarathna
Hi Dinusha,

AFAIK debugging Jaggery in Eclipse has some known issues. I suggest to use
the exact versions of jars as specified in the documentation [1]. Also, you
can try to debug Jaggery in IntelliJ IDEA by using this [2] plugin.

[1] http://jaggeryjs.org/debugger.jag
[2] https://plugins.jetbrains.com/plugin/1613?pr=

Thanks.

On Thu, Jun 25, 2015 at 12:09 PM, Dinusha Boteju  wrote:

> Hi,
>
> I'm trying to debug a jaggery app by following the instruction given in
> [1]. I followed all the steps mentioned in [1]. However, when I start the
> jaggery server in debug mode and browse a deployed application I'm getting
> following error in the browser;
>
> *exception*
>
> javax.servlet.ServletException: Filter execution threw an exception
>
> *root cause*
>
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.jaggeryjs.jaggery.core.manager.WebAppManager
>   org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:17)
>
> I'm pretty sure I followed the instructions correctly. Only difference is
> the versions of the 2 jar files which I copied from eclipse/plugins folder
> to JAGGERY_HOME/carbon/repository/components/dropins folder. How can I
> resolve this?
>
> [1] - http://jaggeryjs.org/debugger.jag
>
> Thanks,
> Dinusha
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-23 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1] which should fix JIRA issue [2].

[1] https://github.com/wso2/carbon-appmgt/pull/83
[2] https://wso2.org/jira/browse/APPM-1010

Thanks & Regards.


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-18 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1], [2]. They should fix JIRA issue [3].

[1] https://github.com/wso2/carbon-appmgt/pull/77
[2] https://github.com/wso2/product-app-manager/pull/241
[3] https://wso2.org/jira/browse/APPM-1007

Thanks and Regards.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-11 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1] which should fix JIRA issue [2]

[1] https://github.com/wso2/product-app-manager/pull/240
[2] https://wso2.org/jira/browse/APPM-1002

Thanks & Regards.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-11 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1], [2]. They should fix JIRA issue [3].

[1] https://github.com/wso2/carbon-appmgt/pull/72
[2] https://github.com/wso2/product-app-manager/pull/239
[3] https://wso2.org/jira/browse/APPM-1001

Thanks & Regards.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-09 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1] which should fix JIRA issue [2].

[1] https://github.com/wso2/carbon-appmgt/pull/70
[2] https://wso2.org/jira/browse/APPM-997

Thanks & Regards.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please review and merge PR

2015-06-04 Thread Sajith Ariyarathna
Hi Team,

Please review and merge PR [1], which should fix JIRA issue [2].

[1] https://github.com/wso2/product-app-manager/pull/235
[2] https://wso2.org/jira/browse/APPM-946


Thanks & Regards

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [AppM] Please Review and Merge PR

2015-06-04 Thread Sajith Ariyarathna
Hi Team,

I have implemented the feature "Improving app versioning support in App
Manager" [1] and following pull requests [2], [3] have been created. Please
review and merge.



[1] [Architecture] Improving app versioning support in App Manager - (Next
release)
[2] https://github.com/wso2/carbon-appmgt/pull/63
[3] https://github.com/wso2/product-app-manager/pull/234

Thanks & Regards.

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Jaggery] Calling javascript function from .Jag file

2015-05-25 Thread Sajith Ariyarathna
Hi Himasha,

Jaggery scripts runs in the server-side. Hence, you cannot use client-side
JavaScript functions such as 'alert'. Please make sure that "/js/actions.js"
have only server-side functions.

Thank you.

On Mon, May 25, 2015 at 10:57 AM, Himasha Guruge  wrote:

> Hi All,
>
> I have a .jag file(startProcess.jag) that needs to call a javascript
> function (showStatus()). In the .jag, I have added a require statement to
> get the .js file and calling the function through that like below.
>
>
> var process = require("/js/actions.js");
> process.showStatus(id);
>
> In the controller all the jags are included, and jquery/bootstrap
> references are added in footer.jag. My controller looks like below.
>
> include("/template/startProcess.jag");
>   ...
> include("/template/partials/footer.jag");
> But at the execution of the process, it gives undefined error for methods
> such as 'alert'. (Methods that are used within showStatus()). What could be
> the reason for this? I came across [1] , so if this is the same issue in
> this scenario as well, is there any workaround?
>
> [1]
> http://stackoverflow.com/questions/1125/referenceerror-alert-is-not-defined
>
> Thanks,
>
> Himasha Guruge
> *Software Engineer*
> WS*O2* *Inc.*
> Mobile: +94 777459299
> himas...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [AppM] Issue with clustering AppM with large mobile apps

2015-05-20 Thread Sajith Ariyarathna
Hi Chathura,

My suggestion is to give the capability of specifying a location (path) to
the admin user.

Admin user can specify a location in the configuration file
(app-manager.xml). Then he can mount that location to all nodes in the
cluster. So, in Java we can access that location.

This approach have several advantages:

   - High fault tolerance. Because we can safely assume that admin user
   will choose a secured location with a low downtime.
   - No extra effort to read/write data, because location will be mounted
   to every node.
   - Less implementation burden as we don't have to use any extra libraries.


Cheers.

On Wed, May 20, 2015 at 5:07 PM, Chathura Dilan  wrote:

> Hi All,
>
> In App Manager users can upload mobile applications though publisher
> Jaggery app and others can download them from that app.
>
> Uploaded mobile applications are currently saved in
> /repository/resources/mobileapps folder in the server home.
>
> We have a issue in clustering AppM, since /repository/resources/mobileapps
> not synced in all nodes of the cluster.
>
> Mobile apps can be large files and we can neither store them in the
> registry nor move it to  /repository/deployment folder for dep sync. If we
> take uploaded mobile apps all together sometimes it could exceed 10GB.
>
> Only way is to store them in a central location. Do we have any solution
> to address it? or is there any better approach to save those binaries to a
> central location.
>
>
> Thank you,
>
> --
> Regards,
>
> Chatura Dilan Perera
> *(Senior Software Engineer** - WSO2 Inc.**)*
> www.dilan.me
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Use of wso2carbon-version.txt

2015-05-12 Thread Sajith Ariyarathna
Hi Kalpa,

AFAIK *wso2carbon-version.txt* file is used in following scripts.

bin/wso2server.bat
bin/wso2server.sh
bin/carbondump.sh
bin/carbondump.bat

As you mentioned, *wso2carbon-version.txt* is used in above files just to
print/echo carbon framework version.
You can use grep -r 'wso2carbon-version.txt' * command in CARBON_HOME
directory to find usage of *wso2carbon-version.txt* file.

thanks and regards.

On Tue, May 12, 2015 at 10:37 PM, Kalpa Welivitigoda 
wrote:

> Hi,
>
> wso2carbon-version.txt is used in wso2server.sh and carbondump.sh to print
> the version of the Carbon framework. Are there any other usages of
> wso2carbon-version.txt?
>
> --
> Best Regards,
>
> Kalpa Welivitigoda
> Software Engineer, WSO2 Inc. http://wso2.com
> Email: kal...@wso2.com
> Mobile: +94776509215
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Carbon][AppM] Calling OSGi service in Jaggery gives a NullPointerException

2015-05-07 Thread Sajith Ariyarathna
I tried different approaches with
org.wso2.carbon.user.api.UserStoreManager OSGi
service, however I couldn't overcome the NullPointerException. I think one
must initialize the UserStoreManager service before using it, but couldn't
find an initializing method.

*Solution:*
Instead of using UserStoreManager OSGi service, I used
org.wso2.carbon.user.core.service.RealmService OSGi service. Using the
RealmService you can get TenantUserRealm object for a given tenant ID. From
that you can get an UserStoreManager object. This object (usManager) has
all functionality of UserStoreManager OSGi service. Refer following sample
code.


var carbon = require('carbon');
var store = require('store');
var server = store.server;

function test(role){
var realmService =
carbon.server.osgiService('org.wso2.carbon.user.core.service.RealmService');
var tenantId = server.current(session).tenantId;
var usManager =
realmService.getTenantUserRealm(tenantId).getUserStoreManager();
return usManager.getUserListOfRole(role);
}



Thanks & regards.

On Tue, Apr 21, 2015 at 10:52 AM, Sajith Ariyarathna 
wrote:

> I'm developing a web app for AppM and I want to do some user management
> tasks.
>
> - retrieving all users for a given role
> - retrieving claims of a given user
>
> To accomplish above tasks, I want to call getUserListOfRole() method &
> getUserClaimValues() method in the org.wso2.carbon.user.api.UserStoreManager
> OSGi service. I wrote my Jaggery code as following based on [1] & [2].
>
> routeManager.register('GET', 'publisher',
> '/publisher/api/provisioning/users/{role}', function (context) {
>  log.info("### in API call");
> var role = context.params.role;
> var carbon = require('carbon');
> var userService =
> carbon.server.osgiService('org.wso2.carbon.user.api.UserStoreManager');
> log.info("### acquired OSGi service");
> *#30* var usrs = userService.getUserListOfRole(role);
>
> print(usrs);
> });
>
> Above code gives me a NullPointerException.
>
> [2015-04-21 10:40:02,575]  INFO - provisioning_api_router:jag ### in API
> call
> [2015-04-21 10:40:02,579]  INFO - provisioning_api_router:jag ### acquired
> OSGi service
> [2015-04-21 10:40:02,583] ERROR - WebAppManager
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException
> (/publisher/apis/v1/provisioning_api_router.jag#30)
> org.jaggeryjs.scriptengine.exceptions.ScriptException:
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException
> (/publisher/apis/v1/provisioning_api_router.jag#30)
> at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
> at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
> at
> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:536)
> at
> org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
> at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
> at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:378)
> at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
> at
> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
> at
> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
> at
> org.wso2.carbon.tomcat.ext.valves

[Dev] [AppM] Sample Documentation for Outbound Provisioning with Salesfroce

2015-04-28 Thread Sajith Ariyarathna
Hi,
I have created this doc [1] for $subject. Please review and comment.

[1] 
*https://docs.google.com/a/wso2.com/document/d/15t0ihN1ETpUcrJDm5DuYzjJuDLGGpGm3iIde0hOFRFo/edit?usp=sharing
<https://docs.google.com/a/wso2.com/document/d/15t0ihN1ETpUcrJDm5DuYzjJuDLGGpGm3iIde0hOFRFo/edit?usp=sharing>*


Thanks & Regards.
​​

-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [Carbon][AppM] Calling OSGi service in Jaggery gives a NullPointerException

2015-04-20 Thread Sajith Ariyarathna
1.c1.call(/publisher/apis/v1/provisioning_api_router.jag)
at
org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
at
org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at
org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at
org.jaggeryjs.rhino.publisher.modules.c6._c_anonymous_17(/publisher/modules/publisher.js:438)
at
org.jaggeryjs.rhino.publisher.modules.c6.call(/publisher/modules/publisher.js)
at
org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
at
org.mozilla.javascript.gen._store__server_js_18._c_anonymous_17([store]/server.js:271)
at
org.mozilla.javascript.gen._store__server_js_18.call([store]/server.js)
at
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at
org.jaggeryjs.rhino.publisher.modules.c6._c_anonymous_16(/publisher/modules/publisher.js:433)
at
org.jaggeryjs.rhino.publisher.modules.c6.call(/publisher/modules/publisher.js)
at
org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at
org.jaggeryjs.rhino.publisher.apis.v_1.c1._c_script_0(/publisher/apis/v1/provisioning_api_router.jag:4)
at
org.jaggeryjs.rhino.publisher.apis.v_1.c1.call(/publisher/apis/v1/provisioning_api_router.jag)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at
org.jaggeryjs.rhino.publisher.apis.v_1.c1.call(/publisher/apis/v1/provisioning_api_router.jag)
at
org.jaggeryjs.rhino.publisher.apis.v_1.c1.exec(/publisher/apis/v1/provisioning_api_router.jag)
at
org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
... 37 more
Caused by: java.lang.NullPointerException
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2555)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2489)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2482)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
... 67 more


Any help on this matter is greatly appreciated.

[1]
https://github.com/wso2/product-app-manager/blob/master/modules/jaggery-apps/app-publisher-web/apis/v1/lifecycle_api_router.jag#L306
<https://github.com/sajithar/product-app-manager/blob/provisioning/modules/jaggery-apps/app-publisher-web/apis/v1/lifecycle_api_router.jag#L325>
[2]
http://supunsetunga.blogspot.com/2014/12/calling-osgi-services-from-jaggery-app.html

Thanks & Regards.
-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Dilan Ariyaratne

2015-04-17 Thread Sajith Ariyarathna
congratulations !!!

On Fri, Apr 17, 2015 at 11:03 AM, Dimuthu De Lanerolle 
wrote:

> Congtraz Dilan ... !!!
>
> On Fri, Apr 17, 2015 at 10:03 AM, Sajith Abeywardhana 
> wrote:
>
>> Congratulations ...!
>>
>> *Sajith Abeywardhana* | Software Engineer
>> WSO2, Inc | lean. enterprise. middleware.
>> #20, Palm Grove, Colombo 03, Sri Lanka.
>> Mobile: +94772260485
>> Email: saji...@wso2.com  | Web: www.wso2.com
>>
>> On Thu, Apr 16, 2015 at 3:35 PM, Inshaf Mahath  wrote:
>>
>>> Congrats Dilan..!!!
>>>
>>> On Thu, Apr 16, 2015 at 3:22 PM, Damith Wickramasinghe >> > wrote:
>>>
>>>> Congrats Dilan 
>>>>
>>>> On Thu, Apr 16, 2015 at 3:18 PM, Darshana Gunawardana <
>>>> darsh...@wso2.com> wrote:
>>>>
>>>>> Congratulations Dilan..!!
>>>>>
>>>>> On Thu, Apr 16, 2015 at 2:21 PM, Inosh Perera  wrote:
>>>>>
>>>>>> Congrats Dilan!!
>>>>>>
>>>>>> On Thu, Apr 16, 2015 at 2:06 PM, Sandamal Weerasinghe <
>>>>>> sanda...@wso2.com> wrote:
>>>>>>
>>>>>>> Congratulations Dilan!
>>>>>>>
>>>>>>> Sandamal Weerasinghe | Software Engineer | WSO2 Lanka (Pvt) Ltd
>>>>>>>
>>>>>>> Mobile - +94-77-144-9640
>>>>>>>
>>>>>>> On Thu, Apr 16, 2015 at 2:05 PM, Shiva Balachandran 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Congrats Dilan :)
>>>>>>>>
>>>>>>>> On Fri, Apr 10, 2015 at 3:44 PM, Prabath Abeysekera <
>>>>>>>> praba...@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Everyone,
>>>>>>>>>
>>>>>>>>> It's my pleasure to welcome Dilan Ariyaratne as a WSO2 Committer.
>>>>>>>>> Dilan has been part of some key development efforts of MDM as well as 
>>>>>>>>> EMM
>>>>>>>>> over the last couple of months. In recognition of all his 
>>>>>>>>> contributions,
>>>>>>>>> he's been voted as a WSO2 comitter.
>>>>>>>>>
>>>>>>>>> Dilan, Welcome aboard and keep up the good work!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Prabath
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Prabath Abeysekara
>>>>>>>>> Associate Technical Lead, Data TG.
>>>>>>>>> WSO2 Inc.
>>>>>>>>> Email: praba...@wso2.com
>>>>>>>>> Mobile: +94774171471
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ___
>>>>>>>>> Dev mailing list
>>>>>>>>> Dev@wso2.org
>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Shiva Balachandran
>>>>>>>> Software Engineer
>>>>>>>> WSO2 Inc.
>>>>>>>>
>>>>>>>> Mobile - +94 774445788
>>>>>>>> Blog - https://shivabalachandran.wordpress.com/
>>>>>>>>
>>>>>>>> ___
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Inosh Perera
>>>>>> Software Engineer, WSO2 Inc.
>>>>>> Tel: 0785293686
>>>>>>
>>>>>> ___
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>>
>>>>>
>>>>> *Darshana Gunawardana*Software Engineer
>>>>> WSO2 Inc.; http://wso2.com
>>>>>
>>>>> *E-mail: darsh...@wso2.com *
>>>>> *Mobile: +94718566859 <%2B94718566859>*Lean . Enterprise . Middleware
>>>>>
>>>>> ___
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: *+94728671315 <%2B94728671315>*
>>>>
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Inshaf Mahath
>>> Associate Software Engineer
>>> Mobile: +94775907181
>>> WSO2 Inc.
>>> Lean . Enterprise . Middleware
>>>
>>>
>>> ___
>>> 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
>>
>>
>
>
> --
> Dimuthu De Lanerolle
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middlewear.
> http://wso2.com/
> Tel. : +94 11 2145345  Fax : +94 11 2145300  email : dimut...@wso2.com
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Malithi Edirisinghe

2015-03-22 Thread Sajith Ariyarathna
t;>>>>>>>>>>>>> contribution to
>>>>>>>>>>>>>>>> WSO2, she has been voted as a WSO2 Committer.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Malithi, congratulations and keep up the good work!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks & Regards.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *Johann Dilantha Nallathamby*
>>>>>>>>>>>>>>>> Associate Technical Lead & Product Lead of WSO2 Identity
>>>>>>>>>>>>>>>> Server
>>>>>>>>>>>>>>>> Integration Technologies Team
>>>>>>>>>>>>>>>> WSO2, Inc.
>>>>>>>>>>>>>>>> lean.enterprise.middleware
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Mobile - *+9476950*
>>>>>>>>>>>>>>>> Blog - *http://nallaa.wordpress.com
>>>>>>>>>>>>>>>> <http://nallaa.wordpress.com>*
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> *Thanuja Lakmal*
>>>>>>>>>>>>>>> Software Engineer
>>>>>>>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>>>>>>>> *lean.enterprise.middleware*
>>>>>>>>>>>>>>> Mobile: +94715979891 +94758009992
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Himasha Guruge
>>>>>>>>>>>>>> *Software Engineer*
>>>>>>>>>>>>>> WS*O2* *Inc.*
>>>>>>>>>>>>>> Mobile: +94 777459299
>>>>>>>>>>>>>> himas...@wso2.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> *Dinithi De Silva*
>>>>>>>>>>>>> Associate Software Engineer, WSO2 Inc.
>>>>>>>>>>>>> m:+94716667655 | e:dinit...@wso2.com | w: www.wso2.com
>>>>>>>>>>>>> | a: #20, Palm Grove, Colombo 03
>>>>>>>>>>>>>
>>>>>>>>>>>>> ___
>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> *Madusanka Premaratne* | Associate Software Engineer
>>>>>>>>>>>> WSO2, Inc | lean. enterprise. middleware.
>>>>>>>>>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>>>>>>>>>> Mobile: +94 71 835 70 73| Work: +94 112 145 345
>>>>>>>>>>>> Email: madusan...@wso2.com | Web: www.wso2.com
>>>>>>>>>>>>
>>>>>>>>>>>> [image: Facebook] <https://www.facebook.com/maduzanka> [image:
>>>>>>>>>>>> Twitter] <https://twitter.com/rmmpremaratne> [image: Google
>>>>>>>>>>>> Plus]
>>>>>>>>>>>> <https://plus.google.com/u/0/+MadusankaPremaratnemaduz/about/p/pub>
>>>>>>>>>>>>  [image: Linkedin] <http://lk.linkedin.com/in/madusanka/> [image:
>>>>>>>>>>>> Instagram] <http://instagram.com/madusankapremaratne> [image:
>>>>>>>>>>>> Skype] <http://@rmmpremaratne>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ___
>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> *S.Elilmatha*
>>>>>>>>>>> Associate  Software Engineer,
>>>>>>>>>>>
>>>>>>>>>>> WSO2 Inc.; http://wso2.com
>>>>>>>>>>> lean.enterprise.middleware
>>>>>>>>>>>
>>>>>>>>>>> Mobile 0779842221.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ___
>>>>>>>>>>> Dev mailing list
>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> 
>>>>>>>>>> Keerthika Mahendralingam
>>>>>>>>>> Associate Software Engineer
>>>>>>>>>> Mobile :+94 (0) 776 121144
>>>>>>>>>> keerth...@wso2.com
>>>>>>>>>> WSO2, Inc.
>>>>>>>>>> lean . enterprise . middleware
>>>>>>>>>>
>>>>>>>>>> ___
>>>>>>>>>> Dev mailing list
>>>>>>>>>> Dev@wso2.org
>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Gayan Gunawardana
>>>>>>>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>>>>>>>> Email: ga...@wso2.com
>>>>>>>>> Mobile: +94 (71) 8020933
>>>>>>>>>
>>>>>>>>> ___
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Hasintha Indrajee
>>>>>>> Software Engineer
>>>>>>> WSO2, Inc.
>>>>>>> Mobile:+94 771892453
>>>>>>>
>>>>>>>
>>>>>>> ___
>>>>>>> Dev mailing list
>>>>>>> Dev@wso2.org
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Isura Dilhara Karunaratne
>>>>>> Software Engineer
>>>>>>
>>>>>> Mob +94 772 254 810
>>>>>>
>>>>>>
>>>>>> ___
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> With Regards,
>>>>>
>>>>> *Rasika Perera*
>>>>> Software Engineer
>>>>> M: +94 71 680 9060 E: rasi...@wso2.com
>>>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>>>
>>>>> WSO2 Inc. www.wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>> ___
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Milan Harindu Perera
>>>> Software Engineer
>>>> *WSO2, Inc*
>>>> (+94) 77 309 7088
>>>> lean . enterprise . middleware
>>>> <http://lk.linkedin.com/in/milanharinduperera>
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Milinda Perera
>>> Software Engineer;
>>> WSO2 Inc. http://wso2.com ,
>>> Mobile: (+94) 714 115 032
>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Jagath Ariyarathne
>> Technical Lead
>> WSO2 Inc.  http://wso2.com/
>> Email: jaga...@wso2.com
>> Mob  : +94 77 386 7048
>>
>>
>
>
> --
>
> *Malithi Edirisinghe*
> Senior Software Engineer
> WSO2 Inc.
>
> Mobile : +94 (0) 718176807
> malit...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Amila Godwin Shrimal

2015-03-21 Thread Sajith Ariyarathna
t;>>>>>>>>>>>>>>> *Johann Dilantha Nallathamby*
>>>>>>>>>>>>>>>>>>>> Associate Technical Lead & Product Lead of WSO2
>>>>>>>>>>>>>>>>>>>> Identity Server
>>>>>>>>>>>>>>>>>>>> Integration Technologies Team
>>>>>>>>>>>>>>>>>>>> WSO2, Inc.
>>>>>>>>>>>>>>>>>>>> lean.enterprise.middleware
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Mobile - *+9476950*
>>>>>>>>>>>>>>>>>>>> Blog - *http://nallaa.wordpress.com
>>>>>>>>>>>>>>>>>>>> <http://nallaa.wordpress.com>*
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>> *Thanuja Lakmal*
>>>>>>>>>>>>>>>>>>> Software Engineer
>>>>>>>>>>>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>>>>>>>>>>>> *lean.enterprise.middleware*
>>>>>>>>>>>>>>>>>>> Mobile: +94715979891 +94758009992
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>>>>>> 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
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>> Inshaf Mahath
>>>>>>>>>>>>>>>>> Associate Software Engineer
>>>>>>>>>>>>>>>>> Mobile: +94775907181
>>>>>>>>>>>>>>>>> WSO2 Inc.
>>>>>>>>>>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>> *Dinithi De Silva*
>>>>>>>>>>>>>>>> Associate Software Engineer, WSO2 Inc.
>>>>>>>>>>>>>>>> m:+94716667655 | e:dinit...@wso2.com | w: www.wso2.com
>>>>>>>>>>>>>>>> | a: #20, Palm Grove, Colombo 03
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> *Madusanka Premaratne* | Associate Software Engineer
>>>>>>>>>>>>>>> WSO2, Inc | lean. enterprise. middleware.
>>>>>>>>>>>>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>>>>>>>>>>>>> Mobile: +94 71 835 70 73| Work: +94 112 145 345
>>>>>>>>>>>>>>> Email: madusan...@wso2.com | Web: www.wso2.com
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> [image: Facebook] <https://www.facebook.com/maduzanka> [image:
>>>>>>>>>>>>>>> Twitter] <https://twitter.com/rmmpremaratne> [image: Google
>>>>>>>>>>>>>>> Plus]
>>>>>>>>>>>>>>> <https://plus.google.com/u/0/+MadusankaPremaratnemaduz/about/p/pub>
>>>>>>>>>>>>>>>  [image: Linkedin] <http://lk.linkedin.com/in/madusanka/> 
>>>>>>>>>>>>>>> [image:
>>>>>>>>>>>>>>> Instagram] <http://instagram.com/madusankapremaratne> [image:
>>>>>>>>>>>>>>> Skype] <http://@rmmpremaratne>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Gayan Gunawardana
>>>>>>>>>>>>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>>>>>>>>>>>>> Email: ga...@wso2.com
>>>>>>>>>>>>>> Mobile: +94 (71) 8020933
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ___
>>>>>>>>>>>>>> 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
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Hasintha Indrajee
>>>>>>>>>>>> Software Engineer
>>>>>>>>>>>> WSO2, Inc.
>>>>>>>>>>>> Mobile:+94 771892453
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ___
>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Isura Dilhara Karunaratne
>>>>>>>>>>> Software Engineer
>>>>>>>>>>>
>>>>>>>>>>> Mob +94 772 254 810
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ___
>>>>>>>>>>> Dev mailing list
>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Isuruwan Herath
>>>>>>>>>> Technical Lead
>>>>>>>>>>
>>>>>>>>>> Contact: +94 776 273 296
>>>>>>>>>>
>>>>>>>>>> ___
>>>>>>>>>> Dev mailing list
>>>>>>>>>> Dev@wso2.org
>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> *Bhathiya Jayasekara*
>>>>>>>>> *Software Engineer,*
>>>>>>>>> *WSO2 inc., http://wso2.com <http://wso2.com>*
>>>>>>>>>
>>>>>>>>> *Phone: +94715478185 <%2B94715478185>*
>>>>>>>>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
>>>>>>>>> <http://www.linkedin.com/in/bhathiyaj>*
>>>>>>>>> *Twitter: https://twitter.com/bhathiyax
>>>>>>>>> <https://twitter.com/bhathiyax>*
>>>>>>>>> *Blog: http://movingaheadblog.blogspot.com
>>>>>>>>> <http://movingaheadblog.blogspot.com/>*
>>>>>>>>>
>>>>>>>>> ___
>>>>>>>>> Dev mailing list
>>>>>>>>> Dev@wso2.org
>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> *Prabath Ariyarathna*
>>>>>>>>
>>>>>>>> *Associate Technical Lead*
>>>>>>>>
>>>>>>>> *WSO2, Inc. *
>>>>>>>>
>>>>>>>> *lean . enterprise . middleware *
>>>>>>>>
>>>>>>>>
>>>>>>>> *Email: prabat...@wso2.com *
>>>>>>>>
>>>>>>>> *Blog: http://prabu-lk.blogspot.com <http://prabu-lk.blogspot.com>*
>>>>>>>>
>>>>>>>> *Flicker : https://www.flickr.com/photos/47759189@N08
>>>>>>>> <https://www.flickr.com/photos/47759189@N08>*
>>>>>>>>
>>>>>>>> *Mobile: +94 77 699 4730 *
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ___
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> With Regards,
>>>>>>
>>>>>> *Rasika Perera*
>>>>>> Software Engineer
>>>>>> M: +94 71 680 9060 E: rasi...@wso2.com
>>>>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>>>>
>>>>>> WSO2 Inc. www.wso2.com
>>>>>> lean.enterprise.middleware
>>>>>>
>>>>>> ___
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Malintha Adikari*
>>>>>  Software Engineer
>>>>> WSO2 Inc.; http://wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>> Mobile: +94 71 2312958
>>>>> Blog:http://malinthas.blogspot.com
>>>>> Page:   http://about.me/malintha
>>>>>
>>>>> ___
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> *Aruna Sujith Karunarathna* | Software Engineer
>>>> WSO2, Inc | lean. enterprise. middleware.
>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>> Mobile: +94 71 9040362 | Work: +94 112145345
>>>> Email: ar...@wso2.com | Web: www.wso2.com
>>>>
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>
>>
>> --
>> *Godwin Amila Shrimal*
>> Senior Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94772264165*
>> linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>*
>> twitter: https://twitter.com/godwinamila
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Niranda Perera*
> Software Engineer, WSO2 Inc.
> Mobile: +94-71-554-8430
> Twitter: @n1r44 <https://twitter.com/N1R44>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Hemika Kodikara

2015-03-18 Thread Sajith Ariyarathna
Congrats Hemika!!!

On Wed, Mar 18, 2015 at 12:59 PM, Maheeka Jayasuriya 
wrote:

> Congrats Hemika !
>
> Maheeka Jayasuriya
> Software Engineer
> Mobile : +9450661
>
> On Wed, Mar 18, 2015 at 12:57 PM, Chamalee De Silva 
> wrote:
>
>> Congratz Hemika !!
>>
>> On Tue, Mar 17, 2015 at 1:41 PM, Ramith Jayasinghe 
>> wrote:
>>
>>> Hi Hemika,
>>> Congratulations!
>>> It is with great pleasure that we welcome you as a WSO2 committer. Keep
>>> up the good work!
>>> regards,
>>>
>>> --
>>> Ramith Jayasinghe
>>> Technical Lead
>>> WSO2 Inc., http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> E: ram...@wso2.com
>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> Chamalee De Silva
>>
>> Software Engineer | WSO2
>>
>> E:chama...@wso2.com 
>> M :0711540738| http://wso2.com <http://wso2.com/>
>>
>> ___
>> 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
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Cross database pagination

2015-03-03 Thread Sajith Ariyarathna
IMO, I don't think you can have an universal solution. Paging is not
included as a standard feature in SQL specifications (see SQL
standardization <http://en.wikipedia.org/wiki/SQL#Standardization>). Hence,
pagination is an extension for DBMS. So different vendors have implemented
it in different manners. Therefore you cannot have an universal solution.
You have to tackle different DBMS manually.

Even though you cannot have RDBMS universal solution, you can use JPA and
it will handle different DBMS for you. E.g.
   Query q = ...;
   q.setFirstResult (0);

  q.setMaxResults (10);





On Mon, Mar 2, 2015 at 8:31 AM, Dulitha Wijewantha  wrote:

> Hi guys,
> I am working on creating a device listing API that supports pagination. In
> the SQL world, LIMIT and OFFSET seems to be the standard way of doing
> pagination in MySQL and PostgreSQL. Below is an example,
>
> SELECT Device.id, Device.name FROM Device
> LIMIT 10 OFFSET 10
>
>
> But Oracle seems to be using rownum. What's the recommended approach in
> doing this?
>
> Cheers~
>
> --
> Dulitha Wijewantha (Chan)
> Software Engineer - Mobile Development
> WSO2 Inc
> Lean.Enterprise.Middleware
>  * ~Email   duli...@wso2.com *
> *  ~Mobile +94712112165 <%2B94712112165>*
> *  ~Website   dulitha.me <http://dulitha.me>*
> *  ~Twitter @dulitharw <https://twitter.com/dulitharw>*
>   *~Github @dulichan <https://github.com/dulichan>*
>   *~SO @chan <http://stackoverflow.com/users/813471/chan>*
>
> _______
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Sajith Ariyarathna
Hi Tharindu,

I think this is caused by "chunking" in input streams. It might happen
because of HTTP protocol or a bug in Java, I'm not sure.

As an alternative solution you can run the MD5 command and compare its
output. Like this,


public String getMd5Checksum(String filePath) throws IOException {

final String md5Command = "md5sum "; // Linux 'md5sum', MacOS 'md5'

Process p = Runtime.getRuntime().exec(md5Command + filePath);
Scanner scn = new Scanner(p.getInputStream());
String rv = scn.nextLine();
scn.close();
return rv;
}





On Sun, Mar 1, 2015 at 2:28 PM, Tharindu Dharmarathna 
wrote:

> Hi Iqbal,
>
> I checked those two files manually I got same hash value to two files.
> This happens in random manner when running the tests
>
>
> On Sun, Mar 1, 2015 at 1:48 PM, Rasika Perera  wrote:
>
>> Hi Tharindu,
>>
>> I checked your `readMD5(InputStream inputStream)` method and it is
>> working as expected. The problem is with the inputStream you are passing
>> into the method.
>>
>> Please verify that you are not passing the *same inputStream* on the
>> second time. Because once it is utilized pos has reached the end. So, the
>> second time you are creating a hash of an empty stream.
>>
>> On Sun, Mar 1, 2015 at 1:41 PM, Irham Iqbal  wrote:
>>
>>> Hi Tharindu
>>>
>>> Did you try to hash those files manually ?
>>> If not try to hash those files manually(i.e *md5sum file.txt) *and
>>> check hash values are same
>>>
>>> Thanks,
>>> Iqbal
>>>
>>>
>>>
>>> On Sun, Mar 1, 2015 at 12:30 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I wrote test case on APIDocDownload for the API Manager .When I Run the
>>>> tests It gives me two md5sums for equal files .
>>>>
>>>> here's the code sample I write to get md5 value from the files
>>>>
>>>> private String readMD5(InputStream inputStream) throws
>>>>> NoSuchAlgorithmException, IOException {
>>>>> MessageDigest md = MessageDigest.getInstance("MD5");
>>>>> byte[] dataBytes = new byte[1024];
>>>>> int read;
>>>>> try {
>>>>> while ((read = inputStream.read(dataBytes)) != -1) {
>>>>> md.update(dataBytes, 0, read);
>>>>> }
>>>>> } catch (IOException e) {
>>>>> log.error("File couldn't found to read md5", e);
>>>>> throw e;
>>>>> } finally {
>>>>> inputStream.close();
>>>>> }
>>>>> byte[] mdBytes = md.digest();
>>>>> //convert the byte to hex format
>>>>> StringBuilder sb = new StringBuilder();
>>>>> for (byte mdByte : mdBytes) {
>>>>> sb.append(Integer.toString((mdByte & 0xff) + 0x100, 16).substring(1));
>>>>> }
>>>>> return sb.toString();
>>>>> }
>>>>
>>>> Is there any best way to get two files are identical ?.
>>>>
>>>> Thanks
>>>>
>>>> --
>>>>
>>>> *Tharindu Dharmarathna*Associate Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: *+94779109091 <%2B94779109091>*
>>>>
>>>> ___
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Irham Iqbal
>>> Software Engineer - Test Automation
>>>  WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>> phone: +94 777888452
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> With Regards,
>>
>> *Rasika Perera*
>> Software Engineer
>> M: +94 71 680 9060 E: rasi...@wso2.com
>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>
>> WSO2 Inc. www.wso2.com
>> lean.enterprise.middleware
>>
>
>
>
> --
>
> *Tharindu Dharmarathna*Associate Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <%2B94779109091>*
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Handling Throwable in catch block

2015-02-20 Thread Sajith Ariyarathna
I think I have found a bug in JDBCUserStoreManager class at persistUser
<https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java#L1159>
 method.

In line 1166
<https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java#L1166>
a
database connection is created by calling the getDBConnection()
<https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java#L976>
method which throws SQLException and UserStoreException. If it throws an
exception, catch clause [ catch (Throwable e) ] in line 1263
<https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java#L1263>
will catch it and tries to rollback the database connection.
But dbConnection is null at this moment, and it will result a
NullPointerException; which is not handled.

My suggestion to fix this bug is to handle the exceptions of creating the
database connection (at line 1166
<https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java#L1166>)
in a separate try-catch block.


On Fri, Feb 20, 2015 at 10:39 AM, Udara Liyanage  wrote:

> +1 for fixing, catching Throwable is not a good practice unless it is
> highly needed
>
> On Thu, Feb 19, 2015 at 6:07 PM, Johann Nallathamby 
> wrote:
>
>> I can't see any particular reason. +1 to fix it.
>>
>> On Thu, Feb 19, 2015 at 4:28 PM, Gayan Gunawardana 
>> wrote:
>>
>>> Hi,
>>>
>>> In user core [1] JDBCUserStoreManager,  persistUser user method
>>> contains catching Throwable. In general catching Throwable is not a
>>> good practice because there may be some run time Errors like 
>>> OutOfMemoryError
>>> which are not be able to handle. Is there any particular reason to catch
>>> Throwable?
>>>
>>> [1]
>>> https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java
>>> --
>>> Gayan Gunawardana
>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>> Email: ga...@wso2.com
>>> Mobile: +94 (71) 8020933
>>>
>>
>>
>>
>> --
>> Thanks & Regards,
>>
>> *Johann Dilantha Nallathamby*
>> Associate Technical Lead & Product Lead of WSO2 Identity Server
>> Integration Technologies Team
>> WSO2, Inc.
>> lean.enterprise.middleware
>>
>> Mobile - *+9476950*
>> Blog - *http://nallaa.wordpress.com <http://nallaa.wordpress.com>*
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev