Re: [Dev] Exception Handing Among JavaScript - Jaggery - Java

2016-03-29 Thread Tharik Kanaka
Hi Samitha,

Backend server should send a proper HTTP Error code instead of return a
value with error message. Here you can throw exception from Java and do the
log in jaggery level. In jaggery level you can detect exception type in
catch block by following approach in the code below.

if(e.javaException instanceof
org.wso2.carbon.apimgt.api.FaultGatewaysException){
 return {
error:true,
message:e.javaException.getFaultGateWayString()
};

 }

Regards,

On Wed, Mar 30, 2016 at 11:08 AM, Samitha Chathuranga 
wrote:

> Hi Sachith,
>
> So do you suppose to catch the error thrown from java, finally at the
> jaggery or even later at javascript?
> Anyway if we are printing the full stacktrace in Java side, what is the
> objective of throwing it to the jaggery ?
>
> Is it to indicate to the front end that an error was occurred in the back
> end? I guess this indication can also be done using a return value (boolean
> or something else) from java side function, but I'm afraid it is an
> accepted standard.
>
> Thanks,
> Samitha
>
> On Wed, Mar 30, 2016 at 10:45 AM, Sachith Withana 
> wrote:
>
>> Hi Samitha,
>>
>> From what I understand, you need to both print the full stack trace and
>> throw a proper message to the front end.
>>
>> If that so, you can catch the error, log it and throw a custom error from
>> the java side.
>>
>> Cheers,
>> Sachith
>>
>> On Wed, Mar 30, 2016 at 10:31 AM, Samitha Chathuranga 
>> wrote:
>>
>>> Hi,
>>>
>>> I am developing a feature in WSO2 PC and in it I have a JavaScript front
>>> end and a Java back end. To call java classes from the JavaScript I am
>>> using Jaggery in between the above two. So my question is what is the best
>>> practice in Exception handling and error logging in such a this scenario.
>>>
>>> As I understand I can come out with few options.
>>>
>>> Option 1- Catching the  exception in the Java class itself and log the
>>> complete error with an appropriate custom error message using 
>>> log.error(errMsg,
>>> e), without throwing exceptions from the method signature, using throws
>>> clause. (As we usually do in a sole java application). So here the
>>> exceptions are completely handled from the back end and doesn't come at
>>> least to the jaggery. And for the purpose of showing some error message to
>>> the front end user we can return a message or flag or something from the
>>> java function to the jaggery side. So at the jaggery side or even at the
>>> javascript, we can check that return value and show the error message as an
>>> alert and proceed depending conditionally on that return value.
>>>
>>> Option 2- We can throw the the exception in the catch block of java
>>> class using throw new ExceptionClassName("custom error message",e) and
>>> catch it in the jaggery file. But here I am getting the problem that we
>>> cannot log the complete long exception report using log.error(_ _) in
>>> jaggery. We can just print the custom error message set by us when throwing
>>> it from Java side. But I don't know is there any other way to trace that
>>> complete exception in jaggery. Anybody know something on it?
>>>
>>> Option 3- We can catch the error in the JavaScript, without catching in
>>> the Jaggery. But I don't think this is ok as we won't be able to print the
>>> exception in the server console if we do it so.
>>>
>>> I want to know what is the best practice in such a this scenario and if
>>> it is Option 2, what is the solution for the problem in it as mentioned
>>> there above. Appreciate support from somebody.
>>>
>>> Thanks,
>>> Samitha
>>>
>>> --
>>> Samitha Chathuranga
>>> Software Engineer, WSO2 Inc.
>>> lean.enterprise.middleware
>>> Mobile: +94715123761
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sachith Withana
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> E-mail: sachith AT wso2.com
>> M: +94715518127
>> Linked-In: 
>> https://lk.linkedin.com/in/sachithwithana
>>
>
>
>
> --
> Samitha Chathuranga
> Software Engineer, WSO2 Inc.
> lean.enterprise.middleware
> Mobile: +94715123761
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Tharik Kanaka*

WSO2, Inc |#20, Palm Grove, Colombo 03, Sri Lanka

Email: tha...@wso2.com | Web: www.wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [App Cloud] Exposing HTTPS in MSF4J Dockerfile

2016-03-29 Thread Afkham Azeez
0.0.0.0 will bind to all visible interfaces so it should solve the problem.

On Wed, Mar 30, 2016 at 11:10 AM, Sajith Kariyawasam 
wrote:

> Isn't it the "docker0" bridge ip should be used there? It defaults
> to 172.17.0.1
>
> On Wed, Mar 30, 2016 at 11:04 AM, Afkham Azeez  wrote:
>
>> What if you give the host as 0.0.0.0 ?
>>
>> On Wed, Mar 30, 2016 at 10:57 AM, Nishadi Kirielle 
>> wrote:
>>
>>> Hi all,
>>> I am trying to create a docker file for msf4j to be used in appcloud
>>> exposing https port. The current approach taken to expose https ports
>>> follows up the guidelines given in documentation to expose https in msf4j.
>>> [1]
>>>
>>> This approach uses a YAML configuration file to define the HTTPS
>>> transport. The problem with the taken approach is due to the configuration
>>> in the netty-transport.yml. [2] In that yaml configuration, the host
>>> provided is localhost and thus the exposed ports are only accessible within
>>> the docker container using localhost. These ports are not accessible even
>>> within the other containers in the cluster with pods IP.
>>> Since the pod IP is dynamic within the kubernetes cluster, it is not
>>> feasible to update the host with pod IP as well.
>>>
>>> Any suggestions as to how to expose the https ports will be highly
>>> appreciated.
>>>
>>> As additional information, when I'm trying to expose only the http port
>>> without using a configuration file, it exposes the http port.
>>>
>>> Thanks
>>> Regards
>>> Nishadi
>>>
>>> [1].
>>> https://docs.wso2.com/display/MSF4J100/Invoking+Your+Microservice+via+HTTPS
>>>
>>> [2].
>>> https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/msf4j/base/1.0.0/netty-transports.yaml
>>>
>>> --
>>> *Nishadi Kirielle*
>>> *Software Engineering Intern*
>>> Mobile : +94 (0) 714722148
>>> Blog : http://nishadikirielle.blogspot.com/
>>> nish...@wso2.com
>>>
>>
>>
>>
>> --
>> *Afkham Azeez*
>> Director of Architecture; WSO2, Inc.; http://wso2.com
>> Member; Apache Software Foundation; http://www.apache.org/
>> * *
>> *email: **az...@wso2.com* 
>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
>> *http://blog.afkham.org* 
>> *twitter: **http://twitter.com/afkham_azeez*
>> 
>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
>> *
>>
>> *Lean . Enterprise . Middleware*
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Sajith Kariyawasam
> *Committer and PMC member, Apache Stratos, *
> *WSO2 Inc.; http://wso2.com *
> *Mobile: 0772269575 <0772269575>*
>



-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* *
*email: **az...@wso2.com* 
* cell: +94 77 3320919blog: **http://blog.afkham.org*

*twitter: **http://twitter.com/afkham_azeez*

*linked-in: **http://lk.linkedin.com/in/afkhamazeez
*

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


Re: [Dev] [App Cloud] Exposing HTTPS in MSF4J Dockerfile

2016-03-29 Thread Nishadi Kirielle
Thanks a lot. Host 0.0.0.0 worked.
But the default "docker0" bridge ip did not work.



On Wed, Mar 30, 2016 at 11:10 AM, Sajith Kariyawasam 
wrote:

> Isn't it the "docker0" bridge ip should be used there? It defaults
> to 172.17.0.1
>
> On Wed, Mar 30, 2016 at 11:04 AM, Afkham Azeez  wrote:
>
>> What if you give the host as 0.0.0.0 ?
>>
>> On Wed, Mar 30, 2016 at 10:57 AM, Nishadi Kirielle 
>> wrote:
>>
>>> Hi all,
>>> I am trying to create a docker file for msf4j to be used in appcloud
>>> exposing https port. The current approach taken to expose https ports
>>> follows up the guidelines given in documentation to expose https in msf4j.
>>> [1]
>>>
>>> This approach uses a YAML configuration file to define the HTTPS
>>> transport. The problem with the taken approach is due to the configuration
>>> in the netty-transport.yml. [2] In that yaml configuration, the host
>>> provided is localhost and thus the exposed ports are only accessible within
>>> the docker container using localhost. These ports are not accessible even
>>> within the other containers in the cluster with pods IP.
>>> Since the pod IP is dynamic within the kubernetes cluster, it is not
>>> feasible to update the host with pod IP as well.
>>>
>>> Any suggestions as to how to expose the https ports will be highly
>>> appreciated.
>>>
>>> As additional information, when I'm trying to expose only the http port
>>> without using a configuration file, it exposes the http port.
>>>
>>> Thanks
>>> Regards
>>> Nishadi
>>>
>>> [1].
>>> https://docs.wso2.com/display/MSF4J100/Invoking+Your+Microservice+via+HTTPS
>>>
>>> [2].
>>> https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/msf4j/base/1.0.0/netty-transports.yaml
>>>
>>> --
>>> *Nishadi Kirielle*
>>> *Software Engineering Intern*
>>> Mobile : +94 (0) 714722148
>>> Blog : http://nishadikirielle.blogspot.com/
>>> nish...@wso2.com
>>>
>>
>>
>>
>> --
>> *Afkham Azeez*
>> Director of Architecture; WSO2, Inc.; http://wso2.com
>> Member; Apache Software Foundation; http://www.apache.org/
>> * *
>> *email: **az...@wso2.com* 
>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
>> *http://blog.afkham.org* 
>> *twitter: **http://twitter.com/afkham_azeez*
>> 
>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
>> *
>>
>> *Lean . Enterprise . Middleware*
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Sajith Kariyawasam
> *Committer and PMC member, Apache Stratos, *
> *WSO2 Inc.; http://wso2.com *
> *Mobile: 0772269575*
>



-- 
*Nishadi Kirielle*
*Software Engineering Intern*
Mobile : +94 (0) 714722148
Blog : http://nishadikirielle.blogspot.com/
nish...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [App Cloud] Exposing HTTPS in MSF4J Dockerfile

2016-03-29 Thread Sajith Kariyawasam
Isn't it the "docker0" bridge ip should be used there? It defaults
to 172.17.0.1

On Wed, Mar 30, 2016 at 11:04 AM, Afkham Azeez  wrote:

> What if you give the host as 0.0.0.0 ?
>
> On Wed, Mar 30, 2016 at 10:57 AM, Nishadi Kirielle 
> wrote:
>
>> Hi all,
>> I am trying to create a docker file for msf4j to be used in appcloud
>> exposing https port. The current approach taken to expose https ports
>> follows up the guidelines given in documentation to expose https in msf4j.
>> [1]
>>
>> This approach uses a YAML configuration file to define the HTTPS
>> transport. The problem with the taken approach is due to the configuration
>> in the netty-transport.yml. [2] In that yaml configuration, the host
>> provided is localhost and thus the exposed ports are only accessible within
>> the docker container using localhost. These ports are not accessible even
>> within the other containers in the cluster with pods IP.
>> Since the pod IP is dynamic within the kubernetes cluster, it is not
>> feasible to update the host with pod IP as well.
>>
>> Any suggestions as to how to expose the https ports will be highly
>> appreciated.
>>
>> As additional information, when I'm trying to expose only the http port
>> without using a configuration file, it exposes the http port.
>>
>> Thanks
>> Regards
>> Nishadi
>>
>> [1].
>> https://docs.wso2.com/display/MSF4J100/Invoking+Your+Microservice+via+HTTPS
>>
>> [2].
>> https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/msf4j/base/1.0.0/netty-transports.yaml
>>
>> --
>> *Nishadi Kirielle*
>> *Software Engineering Intern*
>> Mobile : +94 (0) 714722148
>> Blog : http://nishadikirielle.blogspot.com/
>> nish...@wso2.com
>>
>
>
>
> --
> *Afkham Azeez*
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> * *
> *email: **az...@wso2.com* 
> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
> *http://blog.afkham.org* 
> *twitter: **http://twitter.com/afkham_azeez*
> 
> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
> *
>
> *Lean . Enterprise . Middleware*
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Kariyawasam
*Committer and PMC member, Apache Stratos, *
*WSO2 Inc.; http://wso2.com *
*Mobile: 0772269575*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Exception Handing Among JavaScript - Jaggery - Java

2016-03-29 Thread Samitha Chathuranga
Hi Sachith,

So do you suppose to catch the error thrown from java, finally at the
jaggery or even later at javascript?
Anyway if we are printing the full stacktrace in Java side, what is the
objective of throwing it to the jaggery ?

Is it to indicate to the front end that an error was occurred in the back
end? I guess this indication can also be done using a return value (boolean
or something else) from java side function, but I'm afraid it is an
accepted standard.

Thanks,
Samitha

On Wed, Mar 30, 2016 at 10:45 AM, Sachith Withana  wrote:

> Hi Samitha,
>
> From what I understand, you need to both print the full stack trace and
> throw a proper message to the front end.
>
> If that so, you can catch the error, log it and throw a custom error from
> the java side.
>
> Cheers,
> Sachith
>
> On Wed, Mar 30, 2016 at 10:31 AM, Samitha Chathuranga 
> wrote:
>
>> Hi,
>>
>> I am developing a feature in WSO2 PC and in it I have a JavaScript front
>> end and a Java back end. To call java classes from the JavaScript I am
>> using Jaggery in between the above two. So my question is what is the best
>> practice in Exception handling and error logging in such a this scenario.
>>
>> As I understand I can come out with few options.
>>
>> Option 1- Catching the  exception in the Java class itself and log the
>> complete error with an appropriate custom error message using 
>> log.error(errMsg,
>> e), without throwing exceptions from the method signature, using throws
>> clause. (As we usually do in a sole java application). So here the
>> exceptions are completely handled from the back end and doesn't come at
>> least to the jaggery. And for the purpose of showing some error message to
>> the front end user we can return a message or flag or something from the
>> java function to the jaggery side. So at the jaggery side or even at the
>> javascript, we can check that return value and show the error message as an
>> alert and proceed depending conditionally on that return value.
>>
>> Option 2- We can throw the the exception in the catch block of java class
>> using throw new ExceptionClassName("custom error message",e) and catch
>> it in the jaggery file. But here I am getting the problem that we cannot
>> log the complete long exception report using log.error(_ _) in jaggery.
>> We can just print the custom error message set by us when throwing it from
>> Java side. But I don't know is there any other way to trace that complete
>> exception in jaggery. Anybody know something on it?
>>
>> Option 3- We can catch the error in the JavaScript, without catching in
>> the Jaggery. But I don't think this is ok as we won't be able to print the
>> exception in the server console if we do it so.
>>
>> I want to know what is the best practice in such a this scenario and if
>> it is Option 2, what is the solution for the problem in it as mentioned
>> there above. Appreciate support from somebody.
>>
>> Thanks,
>> Samitha
>>
>> --
>> Samitha Chathuranga
>> Software Engineer, WSO2 Inc.
>> lean.enterprise.middleware
>> Mobile: +94715123761
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Sachith Withana
> Software Engineer; WSO2 Inc.; http://wso2.com
> E-mail: sachith AT wso2.com
> M: +94715518127
> Linked-In: 
> https://lk.linkedin.com/in/sachithwithana
>



-- 
Samitha Chathuranga
Software Engineer, WSO2 Inc.
lean.enterprise.middleware
Mobile: +94715123761
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [App Cloud] Exposing HTTPS in MSF4J Dockerfile

2016-03-29 Thread Afkham Azeez
What if you give the host as 0.0.0.0 ?

On Wed, Mar 30, 2016 at 10:57 AM, Nishadi Kirielle  wrote:

> Hi all,
> I am trying to create a docker file for msf4j to be used in appcloud
> exposing https port. The current approach taken to expose https ports
> follows up the guidelines given in documentation to expose https in msf4j.
> [1]
>
> This approach uses a YAML configuration file to define the HTTPS
> transport. The problem with the taken approach is due to the configuration
> in the netty-transport.yml. [2] In that yaml configuration, the host
> provided is localhost and thus the exposed ports are only accessible within
> the docker container using localhost. These ports are not accessible even
> within the other containers in the cluster with pods IP.
> Since the pod IP is dynamic within the kubernetes cluster, it is not
> feasible to update the host with pod IP as well.
>
> Any suggestions as to how to expose the https ports will be highly
> appreciated.
>
> As additional information, when I'm trying to expose only the http port
> without using a configuration file, it exposes the http port.
>
> Thanks
> Regards
> Nishadi
>
> [1].
> https://docs.wso2.com/display/MSF4J100/Invoking+Your+Microservice+via+HTTPS
>
> [2].
> https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/msf4j/base/1.0.0/netty-transports.yaml
>
> --
> *Nishadi Kirielle*
> *Software Engineering Intern*
> Mobile : +94 (0) 714722148
> Blog : http://nishadikirielle.blogspot.com/
> nish...@wso2.com
>



-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* *
*email: **az...@wso2.com* 
* cell: +94 77 3320919blog: **http://blog.afkham.org*

*twitter: **http://twitter.com/afkham_azeez*

*linked-in: **http://lk.linkedin.com/in/afkhamazeez
*

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


[Dev] Secure vault for C5 ?

2016-03-29 Thread Hasitha Aravinda
Hi team,

How are we going to use $Subject in C5. Can we use existing secure vault
implementation for this.

Thanks,
Hasitha.

-- 
--
Hasitha Aravinda,
Senior Software Engineer,
WSO2 Inc.
Email: hasi...@wso2.com
Mobile : +94 718 210 200
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [App Cloud] Exposing HTTPS in MSF4J Dockerfile

2016-03-29 Thread Nishadi Kirielle
Hi all,
I am trying to create a docker file for msf4j to be used in appcloud
exposing https port. The current approach taken to expose https ports
follows up the guidelines given in documentation to expose https in msf4j.
[1]

This approach uses a YAML configuration file to define the HTTPS
transport. The problem with the taken approach is due to the configuration
in the netty-transport.yml. [2] In that yaml configuration, the host
provided is localhost and thus the exposed ports are only accessible within
the docker container using localhost. These ports are not accessible even
within the other containers in the cluster with pods IP.
Since the pod IP is dynamic within the kubernetes cluster, it is not
feasible to update the host with pod IP as well.

Any suggestions as to how to expose the https ports will be highly
appreciated.

As additional information, when I'm trying to expose only the http port
without using a configuration file, it exposes the http port.

Thanks
Regards
Nishadi

[1].
https://docs.wso2.com/display/MSF4J100/Invoking+Your+Microservice+via+HTTPS
[2].
https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/msf4j/base/1.0.0/netty-transports.yaml

-- 
*Nishadi Kirielle*
*Software Engineering Intern*
Mobile : +94 (0) 714722148
Blog : http://nishadikirielle.blogspot.com/
nish...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Is there a way to enforce a dependency between 2 AbstractAxis2ConfigurationContextObserver implementations?

2016-03-29 Thread Bhathiya Jayasekara
Hi all,

I have 2 questions regarding AbstractAxis2ConfigurationContextObservers.

1) $subject. Let me explain the real problem we're trying to solve here.
Synapse has an AbstractAxis2ConfigurationContextObserver implementation
which creates synapse directory structure for a new tenant. APIM also has
such an implementation to copy a synapse sequence to a new tenant, which *must
happen after* the synapse one. It doesn't work properly unless the synapse
one runs first, because the synapse one creates the directory structure.

2) If above 1 is not possible, we can let APIM one wait until the synapse
one completes, *if* AbstractAxis2ConfigurationContextObservers run in
parallel. So can you tell me whether they run in parallel or sequentially?

Thanks,
-- 
*Bhathiya Jayasekara*
*Senior Software Engineer,*
*WSO2 inc., http://wso2.com *

*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
*
*Twitter: https://twitter.com/bhathiyax *
*Blog: http://movingaheadblog.blogspot.com
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Exception Handing Among JavaScript - Jaggery - Java

2016-03-29 Thread Sachith Withana
Hi Samitha,

>From what I understand, you need to both print the full stack trace and
throw a proper message to the front end.

If that so, you can catch the error, log it and throw a custom error from
the java side.

Cheers,
Sachith

On Wed, Mar 30, 2016 at 10:31 AM, Samitha Chathuranga 
wrote:

> Hi,
>
> I am developing a feature in WSO2 PC and in it I have a JavaScript front
> end and a Java back end. To call java classes from the JavaScript I am
> using Jaggery in between the above two. So my question is what is the best
> practice in Exception handling and error logging in such a this scenario.
>
> As I understand I can come out with few options.
>
> Option 1- Catching the  exception in the Java class itself and log the
> complete error with an appropriate custom error message using 
> log.error(errMsg,
> e), without throwing exceptions from the method signature, using throws
> clause. (As we usually do in a sole java application). So here the
> exceptions are completely handled from the back end and doesn't come at
> least to the jaggery. And for the purpose of showing some error message to
> the front end user we can return a message or flag or something from the
> java function to the jaggery side. So at the jaggery side or even at the
> javascript, we can check that return value and show the error message as an
> alert and proceed depending conditionally on that return value.
>
> Option 2- We can throw the the exception in the catch block of java class
> using throw new ExceptionClassName("custom error message",e) and catch it
> in the jaggery file. But here I am getting the problem that we cannot log
> the complete long exception report using log.error(_ _) in jaggery. We
> can just print the custom error message set by us when throwing it from
> Java side. But I don't know is there any other way to trace that complete
> exception in jaggery. Anybody know something on it?
>
> Option 3- We can catch the error in the JavaScript, without catching in
> the Jaggery. But I don't think this is ok as we won't be able to print the
> exception in the server console if we do it so.
>
> I want to know what is the best practice in such a this scenario and if it
> is Option 2, what is the solution for the problem in it as mentioned there
> above. Appreciate support from somebody.
>
> Thanks,
> Samitha
>
> --
> Samitha Chathuranga
> Software Engineer, WSO2 Inc.
> lean.enterprise.middleware
> Mobile: +94715123761
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sachith Withana
Software Engineer; WSO2 Inc.; http://wso2.com
E-mail: sachith AT wso2.com
M: +94715518127
Linked-In: https://lk.linkedin.com/in/sachithwithana
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Exception Handing Among JavaScript - Jaggery - Java

2016-03-29 Thread Samitha Chathuranga
Hi,

I am developing a feature in WSO2 PC and in it I have a JavaScript front
end and a Java back end. To call java classes from the JavaScript I am
using Jaggery in between the above two. So my question is what is the best
practice in Exception handling and error logging in such a this scenario.

As I understand I can come out with few options.

Option 1- Catching the  exception in the Java class itself and log the
complete error with an appropriate custom error message using log.error(errMsg,
e), without throwing exceptions from the method signature, using throws
clause. (As we usually do in a sole java application). So here the
exceptions are completely handled from the back end and doesn't come at
least to the jaggery. And for the purpose of showing some error message to
the front end user we can return a message or flag or something from the
java function to the jaggery side. So at the jaggery side or even at the
javascript, we can check that return value and show the error message as an
alert and proceed depending conditionally on that return value.

Option 2- We can throw the the exception in the catch block of java class
using throw new ExceptionClassName("custom error message",e) and catch it
in the jaggery file. But here I am getting the problem that we cannot log
the complete long exception report using log.error(_ _) in jaggery. We can
just print the custom error message set by us when throwing it from Java
side. But I don't know is there any other way to trace that complete
exception in jaggery. Anybody know something on it?

Option 3- We can catch the error in the JavaScript, without catching in the
Jaggery. But I don't think this is ok as we won't be able to print the
exception in the server console if we do it so.

I want to know what is the best practice in such a this scenario and if it
is Option 2, what is the solution for the problem in it as mentioned there
above. Appreciate support from somebody.

Thanks,
Samitha

-- 
Samitha Chathuranga
Software Engineer, WSO2 Inc.
lean.enterprise.middleware
Mobile: +94715123761
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB][ScriptMediator] Can't convert a javaScript date in to ISO date format

2016-03-29 Thread Rajkumar Rajaratnam
Following script does what you need;



function pad(number) {
var r = String(number);
if ( r.length === 1 ) {
r = '0' + r;
}
return r;
   }

now = new Date();
  isoString =   now.getUTCFullYear()
   + '-' + pad( now.getUTCMonth() + 1 )
   + '-' + pad( now.getUTCDate() )
   + 'T' + pad( now.getUTCHours() )
   + ':' + pad( now.getUTCMinutes() )
   + ':' + pad( now.getUTCSeconds() )
   + '.' + String( (now.getUTCMilliseconds()/1000).toFixed(3) ).slice( 2, 5
)
   + 'Z';
print(isoString);



This is based on the answer from [1].

[1] https://community.oracle.com/thread/2607436?start=0=0

Thanks,
Raj.

On Tue, Mar 29, 2016 at 5:16 PM, Lakmini Chathurika 
wrote:

> Hi Nirodha
>
> Thanks for the quick response. I'll try using it.
>
> Thanks & Regards
> Lakmini.
>
>
> On Tue, Mar 29, 2016 at 9:36 PM, Nirodha Gallage  wrote:
>
>> Hi Lakmini,
>>
>> Javascript library comes with WSO2 ESB does not support all the
>> functions, only a limited set of basic functions are supported. That's what
>> causing this error. But I think you can use some of the functions as
>> mentioned in [1] to read elements of the date and then construct the date
>> as the way you want.
>>
>> [1] http://javascript.info/tutorial/datetime-functions
>>
>> Thanks
>>
>> On Tue, Mar 29, 2016 at 9:15 PM, Lakmini Chathurika 
>> wrote:
>>
>>> Hi All,
>>>
>>> I'm trying to convert a javaScript  date (Eg: Tue Mar 29 2016 20:48:38
>>> GMT+0530 (IST)) in to ISO date format (Eg:2016-03-29T15:21:09.701Z) using
>>> ESB Script mediator. For the conversion I used  "toISOString()" [1] method.
>>> But I got the following error.
>>>
>>> [2016-03-29 20:38:56,681] ERROR - ScriptMediator The script engine
>>> returned an error executing the inlined js script function mediate
>>> com.sun.phobos.script.util.ExtendedScriptException:
>>> org.mozilla.javascript.EcmaError: TypeError: Cannot find function
>>> toISOString. (#2) in  at line number 2
>>> at
>>> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:68)
>>> at javax.script.CompiledScript.eval(CompiledScript.java:92)
>>> at
>>> org.apache.synapse.mediators.bsf.ScriptMediator.mediateForInlineScript(ScriptMediator.java:300)
>>> at
>>> org.apache.synapse.mediators.bsf.ScriptMediator.invokeScript(ScriptMediator.java:239)
>>> at
>>> org.apache.synapse.mediators.bsf.ScriptMediator.mediate(ScriptMediator.java:207)
>>> at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>>> at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
>>> at
>>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
>>> at
>>> org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>> at
>>> org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
>>> at
>>> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
>>> at
>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>>> 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: org.mozilla.javascript.EcmaError: TypeError: Cannot find
>>> function toISOString. (#2)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
>>> at
>>> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
>>> at org.mozilla.javascript.gen.c6028._c0(:2)
>>> at org.mozilla.javascript.gen.c6028.call()
>>> at
>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
>>> at org.mozilla.javascript.gen.c6028.call()
>>> at org.mozilla.javascript.gen.c6028.exec()
>>> at
>>> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55)
>>> ... 15 more
>>>
>>> Proxy:
>>>
>>> 
>>> http://ws.apache.org/ns/synapse;
>>>name="testproxy"
>>>transports="https,http"
>>>statistics="disable"
>>>trace="disable"
>>>

Re: [Dev] [ESB][ScriptMediator] Can't convert a javaScript date in to ISO date format

2016-03-29 Thread Lakmini Chathurika
Hi Nirodha

Thanks for the quick response. I'll try using it.

Thanks & Regards
Lakmini.


On Tue, Mar 29, 2016 at 9:36 PM, Nirodha Gallage  wrote:

> Hi Lakmini,
>
> Javascript library comes with WSO2 ESB does not support all the functions,
> only a limited set of basic functions are supported. That's what causing
> this error. But I think you can use some of the functions as mentioned in
> [1] to read elements of the date and then construct the date as the way you
> want.
>
> [1] http://javascript.info/tutorial/datetime-functions
>
> Thanks
>
> On Tue, Mar 29, 2016 at 9:15 PM, Lakmini Chathurika 
> wrote:
>
>> Hi All,
>>
>> I'm trying to convert a javaScript  date (Eg: Tue Mar 29 2016 20:48:38
>> GMT+0530 (IST)) in to ISO date format (Eg:2016-03-29T15:21:09.701Z) using
>> ESB Script mediator. For the conversion I used  "toISOString()" [1] method.
>> But I got the following error.
>>
>> [2016-03-29 20:38:56,681] ERROR - ScriptMediator The script engine
>> returned an error executing the inlined js script function mediate
>> com.sun.phobos.script.util.ExtendedScriptException:
>> org.mozilla.javascript.EcmaError: TypeError: Cannot find function
>> toISOString. (#2) in  at line number 2
>> at
>> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:68)
>> at javax.script.CompiledScript.eval(CompiledScript.java:92)
>> at
>> org.apache.synapse.mediators.bsf.ScriptMediator.mediateForInlineScript(ScriptMediator.java:300)
>> at
>> org.apache.synapse.mediators.bsf.ScriptMediator.invokeScript(ScriptMediator.java:239)
>> at
>> org.apache.synapse.mediators.bsf.ScriptMediator.mediate(ScriptMediator.java:207)
>> at
>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>> at
>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
>> at
>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
>> at
>> org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>> at
>> org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
>> at
>> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
>> at
>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>> 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: org.mozilla.javascript.EcmaError: TypeError: Cannot find
>> function toISOString. (#2)
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
>> at
>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
>> at
>> org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
>> at
>> org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
>> at
>> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
>> at
>> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
>> at org.mozilla.javascript.gen.c6028._c0(:2)
>> at org.mozilla.javascript.gen.c6028.call()
>> at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
>> at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
>> at org.mozilla.javascript.gen.c6028.call()
>> at org.mozilla.javascript.gen.c6028.exec()
>> at
>> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55)
>> ... 15 more
>>
>> Proxy:
>>
>> 
>> http://ws.apache.org/ns/synapse;
>>name="testproxy"
>>transports="https,http"
>>statistics="disable"
>>trace="disable"
>>startOnLoad="true">
>>
>>   
>>  var d=new Date();
>> var isoFormat = d.toISOString();
>> print(isoFormat);
>>   
>>
>>
>> 
>>
>> Are there any limitations in ESB Script Mediator or am I doing something
>> wrong here?
>> Any help is greatly appreciated.
>>
>> [1].http://www.w3schools.com/jsref/jsref_toisostring.asp
>>
>> Thanks & Regards
>> Lakmini.
>>
>
>
>
> --
>
> *Nirodha Gallage*
> Associate Technical Lead, QA.
> WSO2 Inc.: http://wso2.com/
> Mobile: +94716429078
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB][ScriptMediator] Can't convert a javaScript date in to ISO date format

2016-03-29 Thread Nirodha Gallage
Hi Lakmini,

Javascript library comes with WSO2 ESB does not support all the functions,
only a limited set of basic functions are supported. That's what causing
this error. But I think you can use some of the functions as mentioned in
[1] to read elements of the date and then construct the date as the way you
want.

[1] http://javascript.info/tutorial/datetime-functions

Thanks

On Tue, Mar 29, 2016 at 9:15 PM, Lakmini Chathurika 
wrote:

> Hi All,
>
> I'm trying to convert a javaScript  date (Eg: Tue Mar 29 2016 20:48:38
> GMT+0530 (IST)) in to ISO date format (Eg:2016-03-29T15:21:09.701Z) using
> ESB Script mediator. For the conversion I used  "toISOString()" [1] method.
> But I got the following error.
>
> [2016-03-29 20:38:56,681] ERROR - ScriptMediator The script engine
> returned an error executing the inlined js script function mediate
> com.sun.phobos.script.util.ExtendedScriptException:
> org.mozilla.javascript.EcmaError: TypeError: Cannot find function
> toISOString. (#2) in  at line number 2
> at
> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:68)
> at javax.script.CompiledScript.eval(CompiledScript.java:92)
> at
> org.apache.synapse.mediators.bsf.ScriptMediator.mediateForInlineScript(ScriptMediator.java:300)
> at
> org.apache.synapse.mediators.bsf.ScriptMediator.invokeScript(ScriptMediator.java:239)
> at
> org.apache.synapse.mediators.bsf.ScriptMediator.mediate(ScriptMediator.java:207)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
> at
> org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
> at
> org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
> at
> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
> at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
> 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: org.mozilla.javascript.EcmaError: TypeError: Cannot find
> function toISOString. (#2)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
> at
> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
> at
> org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
> at
> org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
> at
> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
> at org.mozilla.javascript.gen.c6028._c0(:2)
> at org.mozilla.javascript.gen.c6028.call()
> at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
> at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
> at org.mozilla.javascript.gen.c6028.call()
> at org.mozilla.javascript.gen.c6028.exec()
> at
> com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55)
> ... 15 more
>
> Proxy:
>
> 
> http://ws.apache.org/ns/synapse;
>name="testproxy"
>transports="https,http"
>statistics="disable"
>trace="disable"
>startOnLoad="true">
>
>   
>  var d=new Date();
> var isoFormat = d.toISOString();
> print(isoFormat);
>   
>
>
> 
>
> Are there any limitations in ESB Script Mediator or am I doing something
> wrong here?
> Any help is greatly appreciated.
>
> [1].http://www.w3schools.com/jsref/jsref_toisostring.asp
>
> Thanks & Regards
> Lakmini.
>



-- 

*Nirodha Gallage*
Associate Technical Lead, QA.
WSO2 Inc.: http://wso2.com/
Mobile: +94716429078
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [ESB][ScriptMediator] Can't convert a javaScript date in to ISO date format

2016-03-29 Thread Lakmini Chathurika
Hi All,

I'm trying to convert a javaScript  date (Eg: Tue Mar 29 2016 20:48:38
GMT+0530 (IST)) in to ISO date format (Eg:2016-03-29T15:21:09.701Z) using
ESB Script mediator. For the conversion I used  "toISOString()" [1] method.
But I got the following error.

[2016-03-29 20:38:56,681] ERROR - ScriptMediator The script engine returned
an error executing the inlined js script function mediate
com.sun.phobos.script.util.ExtendedScriptException:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function
toISOString. (#2) in  at line number 2
at
com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:68)
at javax.script.CompiledScript.eval(CompiledScript.java:92)
at
org.apache.synapse.mediators.bsf.ScriptMediator.mediateForInlineScript(ScriptMediator.java:300)
at
org.apache.synapse.mediators.bsf.ScriptMediator.invokeScript(ScriptMediator.java:239)
at
org.apache.synapse.mediators.bsf.ScriptMediator.mediate(ScriptMediator.java:207)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
at
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
at
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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: org.mozilla.javascript.EcmaError: TypeError: Cannot find
function toISOString. (#2)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
at
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
at
org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
at
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
at
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
at org.mozilla.javascript.gen.c6028._c0(:2)
at org.mozilla.javascript.gen.c6028.call()
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c6028.call()
at org.mozilla.javascript.gen.c6028.exec()
at
com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55)
... 15 more

Proxy:


http://ws.apache.org/ns/synapse;
   name="testproxy"
   transports="https,http"
   statistics="disable"
   trace="disable"
   startOnLoad="true">
   
  
 var d=new Date();
var isoFormat = d.toISOString();
print(isoFormat);
  
   
   


Are there any limitations in ESB Script Mediator or am I doing something
wrong here?
Any help is greatly appreciated.

[1].http://www.w3schools.com/jsref/jsref_toisostring.asp

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


Re: [Dev] [EMM][Android] OTA firmware upgrade support

2016-03-29 Thread Kasun Dananjaya Delgolla
Hi Gayan,

Seems like OTA process downloads the firmware package. After this, did you
see logs when the system app tries to trigger the build?

Thanks

On Tue, Mar 29, 2016 at 7:38 PM, Gayan Yalpathwala  wrote:

> Hi Kasun et al,
>
> I have implemented this operation and tested on a rooted device with the
> system app in place.
>
> OTA Server
> =
> A file server which serves build.prop and the particular upgrade pack was
> used as the OTA server. These files need to be added under a sub-directory
> in the name of the device.
> Ex:-
> Device name: c1ktt
> Files: http://10.10.10.227:8000/c1ktt/build.prop and
> http://10.10.10.227:8000/c1ktt/c1ktt.ota.zip
>
> build.prop
> 
> Attached is a sample build.prop. Key field to be changed is as follows.
> ro.build.version.release=x.x.x (This version has to be greater than the
> previous version of the firmware for an upgrade to happen)
>
> Server side configurations
> 
> Following constants need to be changed accordingly
> in org/wso2/emm/system/service/utils/Constants.java. These configs which
> are related to the OTA server, will be moved out to an external config file.
>   public static final String DEFAULT_OTA_SERVER_ADDRESS = "10.10.10.227";
> public static final String DEFAULT_OTA_SERVER_PROTOCOL = "http";
> public static final int DEFAULT_OTA_SERVER_PORT = 8000;
>
> Logs from system app
> =
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> D/EMMSystemService: Entered onHandleIntent of the Command Runner Service.
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> D/EMMSystemService: EMM agent has sent a command.
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> D/EMMSystemService: The operation code is: UPGRADE_FIRMWARE
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> I/EMMSystemService: Will now executing the command ...UPGRADE_FIRMWARE
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> D/EMMSystemService: Do task triggered. Code = UPGRADE_FIRMWARE
> 03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
> I/EMMSystemService: An upgrade has been requested
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/Toast:
>  checkMirrorLinkEnabled returns : false
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/Toast:
> showing allowed
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC:
> Loading configuration from file /data/system/ota.conf for product c1ktt
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service E/OTA_SC: Build
> property file does not meet required
> specification.java.io.FileNotFoundException: /data/system/ota.conf: open
> failed: ENOENT (No such file or directory)
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service I/OTA_SC:
> Loading default configuration for product c1ktt.
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC:
> create a new server config: package url
> http://10.10.10.227:8000/c1ktt/c1ktt.ota.zip:8000
> 03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC:
> build.prop URL:http://10.10.10.227:8000/c1ktt/build.prop
> 03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: Start
> download: http://10.10.10.227:8000/c1ktt/build.prop to buffer
> 03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
> 1024 into byte output stream
> 03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
> 1024 into byte output stream
> 03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
> 1024 into byte output stream
> 03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
> 166 into byte output stream
> 03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_SM:
> Download finished: 3238 bytes downloaded
> 03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_BPP:
> tmpDir:/data/data/org.wso2.emm.system.service/files
>
> Thanks,
>
>
>
>
> On Wed, Feb 10, 2016 at 7:22 PM, Kasun Dananjaya Delgolla  > wrote:
>
>> Hi,
>>
>> I have implemented the android layer implementation of the above
>> functionality. How it works is, when the admin sends the upgrade command
>> from the UI/REST API, android agent app talks to the system service
>> (implemented as a separate component, since these features require system
>> level/root access). Then, the system service will invoke the firmware
>> upgrade following the below steps.
>>
>> 1. System app will first downloads the OTA upgrade package's
>> configuration file "ota.conf" from the OTA server (server URL and ports
>> have to be configured in the system app)
>> 2. Then it parses the config file downloaded to read the necessary
>> configs (ex: upgrade package version, size etc)
>> 3. System app compares the upgrade package version with the device
>> existing firmware version.
>> 4. If the firmware version is greater than the available version, it
>> downloads 

Re: [Dev] REST-API: Fine Grained resources vs Coarse Grained resources

2016-03-29 Thread Thamali Wijewardhana
Thanks all for the quick response and I will continue with those comments.

On Tue, Mar 29, 2016 at 4:17 PM, Joseph Fonseka  wrote:

> Hi
>
> Having different ways to retrieve the configs of the resource will affect
> the intuitiveness of the API so IMO having a uniform way of retrieving the
> configs will be more beneficial.
>
> Alternate solutions for the given problem.
> 1. You always return the configs as part of the specific resource. Ex. /
> analysis/{analysis_id} and give the option of turning off configs as a
> query parameter Ex /analysis/{analysis_id}?configs=false.
> 2. Further more you can filter configs with /analysis/{
> analysis_id}?configs=attribute.
> 3. If you want to do a partial update of configs you can use sub resource
> or a controller resource. Ex. /analysis/{analysis_id}/configs,  /
> analysis/update-config
>
> Regards
> Jo
>
> On Tue, Mar 29, 2016 at 3:31 PM, Udara Liyanage  wrote:
>
>> Hi,
>>
>> When designing API, we need to let the clients know the API endpoints so
>> they can invoke relevant  endpoint to fetch expected resource. Assuming
>> size of the configuration/analytic object payload is a dynamic thing, how
>> can the client know which endpoints to invoke to fetch the required
>> resource. How does the client know the size of the analytic payload. In
>> this case how does a client know which API endpoint to invoke if he want to
>> get configs. It may be GET /analysis if analysis size is low, otherwise GET
>> /analysis/configs .
>>
>> Yes, we can not go extreme in fine grain or coarse grain. IMO best
>> approach is to go in middle path, define a reasonable set of endpoints to
>> fetch resources.
>>
>> On Tue, Mar 29, 2016 at 3:08 PM, Thamali Wijewardhana 
>> wrote:
>>
>>> Hi,
>>>
>>> When creating a REST API to WSO2 machine learner, one of the important
>>> problems I faced was selection among fine grained resources and coarse
>>> grained resources. In other words, whether to define something as a
>>> separate resource or a part of a large resource.
>>>
>>> Fine grained Resources are low complex and easy to maintain. But it can
>>> make data become an inconsistent state and the server will end up receiving
>>> higher number of HTTP requests possibly impacting its ability to serve
>>> multiple API consumers.
>>>
>>> In using coarse grained resources, the data inconsistency and higher
>>> load on the server is reduced. But it may be difficult to maintain and
>>> higher JSON payload may be returned.
>>>
>>> For example, we have an API GET api/analysis/analysis_id/configs which
>>> retrieves configurations of an API. The problem is whether to use a
>>> separate resource for configs or return configs with the analysis resource.
>>> If we consider configuration as a separate resource, we have to define an
>>> API, GET api/analysis/analysis_id/configs. But if we return configs with
>>> analysis resource, then it may be only the API GET
>>> api/analysis/analysis_id  and the configuration should be added to analysis
>>> resource and returned with it.
>>>
>>> I have found an approach to solve the problem and given below is what I
>>> have understood.
>>>
>>> The decision should be taken considering the situation.
>>>
>>> Here, the decision is based on the size of the configuration object. If
>>> it has a large size, then if we return it with analysis resource, it may be
>>> a large JSON payload and time wastage because every time an analysis
>>> resource is returned configuration also have to be returned even not
>>> necessary. Therefore, if configuration is large, it is better to use a
>>> separate resource for configurations and use a separate API as
>>> api/analysis/analysis_id/configs
>>>
>>> But, when we have to access a simple property such as algorithm-name of
>>> the analysis, then it is better to return it with algorithm resource.
>>>
>>> This is the approach I have decided and highly appreciate your
>>> suggestions on this.
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>> ___
>>> 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
>>
>
>
>
> --
>
> --
> *Joseph Fonseka*
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 772 512 430
> skype: jpfonseka
>
> * *
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [EMM][Android] OTA firmware upgrade support

2016-03-29 Thread Gayan Yalpathwala
Hi Kasun et al,

I have implemented this operation and tested on a rooted device with the
system app in place.

OTA Server
=
A file server which serves build.prop and the particular upgrade pack was
used as the OTA server. These files need to be added under a sub-directory
in the name of the device.
Ex:-
Device name: c1ktt
Files: http://10.10.10.227:8000/c1ktt/build.prop and
http://10.10.10.227:8000/c1ktt/c1ktt.ota.zip

build.prop

Attached is a sample build.prop. Key field to be changed is as follows.
ro.build.version.release=x.x.x (This version has to be greater than the
previous version of the firmware for an upgrade to happen)

Server side configurations

Following constants need to be changed accordingly
in org/wso2/emm/system/service/utils/Constants.java. These configs which
are related to the OTA server, will be moved out to an external config file.
  public static final String DEFAULT_OTA_SERVER_ADDRESS = "10.10.10.227";
public static final String DEFAULT_OTA_SERVER_PROTOCOL = "http";
public static final int DEFAULT_OTA_SERVER_PORT = 8000;

Logs from system app
=
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
D/EMMSystemService: Entered onHandleIntent of the Command Runner Service.
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
D/EMMSystemService: EMM agent has sent a command.
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
D/EMMSystemService: The operation code is: UPGRADE_FIRMWARE
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
I/EMMSystemService: Will now executing the command ...UPGRADE_FIRMWARE
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
D/EMMSystemService: Do task triggered. Code = UPGRADE_FIRMWARE
03-29 18:46:40.114 23424-17321/org.wso2.emm.system.service
I/EMMSystemService: An upgrade has been requested
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/Toast:
 checkMirrorLinkEnabled returns : false
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/Toast: showing
allowed
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC:
Loading configuration from file /data/system/ota.conf for product c1ktt
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service E/OTA_SC: Build
property file does not meet required
specification.java.io.FileNotFoundException: /data/system/ota.conf: open
failed: ENOENT (No such file or directory)
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service I/OTA_SC:
Loading default configuration for product c1ktt.
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC: create
a new server config: package url
http://10.10.10.227:8000/c1ktt/c1ktt.ota.zip:8000
03-29 18:46:40.119 23424-17321/org.wso2.emm.system.service D/OTA_SC:
build.prop URL:http://10.10.10.227:8000/c1ktt/build.prop
03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: Start
download: http://10.10.10.227:8000/c1ktt/build.prop to buffer
03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
1024 into byte output stream
03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
1024 into byte output stream
03-29 18:46:40.214 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
1024 into byte output stream
03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_SM: wrote
166 into byte output stream
03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_SM:
Download finished: 3238 bytes downloaded
03-29 18:46:40.219 23424-17321/org.wso2.emm.system.service D/OTA_BPP:
tmpDir:/data/data/org.wso2.emm.system.service/files

Thanks,




On Wed, Feb 10, 2016 at 7:22 PM, Kasun Dananjaya Delgolla 
wrote:

> Hi,
>
> I have implemented the android layer implementation of the above
> functionality. How it works is, when the admin sends the upgrade command
> from the UI/REST API, android agent app talks to the system service
> (implemented as a separate component, since these features require system
> level/root access). Then, the system service will invoke the firmware
> upgrade following the below steps.
>
> 1. System app will first downloads the OTA upgrade package's configuration
> file "ota.conf" from the OTA server (server URL and ports have to be
> configured in the system app)
> 2. Then it parses the config file downloaded to read the necessary configs
> (ex: upgrade package version, size etc)
> 3. System app compares the upgrade package version with the device
> existing firmware version.
> 4. If the firmware version is greater than the available version, it
> downloads the upgrade package from the server.
> 5. System app triggers the OTA upgrade.
>
> Thanks
>
> On Wed, Feb 10, 2016 at 6:41 PM, Gayan Yalpathwala 
> wrote:
>
>> Hi,
>>
>> I am adding the above function to the REST API layer and to the jaggery
>> UI of EMM. With the introduction of this, a privileged user can remotely
>> force a firmware upgrade on the device. This facility will only be

Re: [Dev] Getting Build failure on product-apim repo

2016-03-29 Thread Bhathiya Jayasekara
Hi Asanka,

This is strange. We are building APIM with java 8 everyday[1]. But we've
never seen this before. May be something was wrong in your system. Can you
try again?

[1] https://wso2.org/jenkins/view/product-builds/job/product-apim__java8/

Thanks,
Bhathiya

On Tue, Mar 29, 2016 at 6:08 PM, Asanka Vithanage  wrote:

> Hi All,
>
> We are trying to build API Manager master branch using locally deployed
> jenkins server.
>
> We are having following configuration on the jenkins machine
> mvn version =Apache Maven 3.0.5
> Java version=1.8.0_77
>
> When building we are getting below stack trace. when checked the
>
> /home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/carbontmp1459253504310/wso2am-2.0.0-SNAPSHOT
>  folder,
> We see only repository folder there. Unzipped Product Build distribution( 
> modules/distribution/product/target/wso2am-2.0.0-SNAPSHOT) also has 
> repository folder only.
>
> Appreciate any help to identify a solution.
>
>
> [INFO] *--- maven-surefire-plugin:2.18:test (default-test) @ 
> org.wso2.carbon.am.integration.backend.test ---
> *[INFO] Surefire report directory: 
> /home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/surefire-reports
>
> ---
>  T E S T S
> ---
>
> Running TestSuite
>
> INFO  
> [org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager]
>  - Extracting carbon zip file..
>
> ERROR 
> [org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension]
>  - Fail to start carbon server
> java.io.FileNotFoundException: Server startup script not found at 
> /home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/carbontmp1459253504310/wso2am-2.0.0-SNAPSHOT/bin
>   at 
> org.wso2.carbon.automation.engine.frameworkutils.TestFrameworkUtils.getStartupScriptFileName(TestFrameworkUtils.java:78)
>   at 
> org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager.instrumentForCoverage(CarbonServerManager.java:427)
>   at 
> org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager.setUpCarbonHome(CarbonServerManager.java:212)
>   at 
> org.wso2.carbon.automation.extensions.servers.carbonserver.TestServerManager.startServer(TestServerManager.java:107)
>   at 
> org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension.onExecutionStart(CarbonServerExtension.java:50)
>   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.wso2.carbon.automation.engine.extensions.TestNGExtensionExecutor.executeExtensible(TestNGExtensionExecutor.java:75)
>   at 
> org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener.onExecutionStart(TestExecutionListener.java:47)
>   at org.testng.TestNG.runExecutionListeners(TestNG.java:1032)
>   at org.testng.TestNG.run(TestNG.java:983)
>   at 
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
>   at 
> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
>   at 
> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
>   at 
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
>   at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
>   at 
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
> ERROR [org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener] 
> - Execution error occurred in TestExecutionListener:-
> java.lang.reflect.InvocationTargetException
>   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.wso2.carbon.automation.engine.extensions.TestNGExtensionExecutor.executeExtensible(TestNGExtensionExecutor.java:75)
>   at 
> org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener.onExecutionStart(TestExecutionListener.java:47)
>   at org.testng.TestNG.runExecutionListeners(TestNG.java:1032)
>   at org.testng.TestNG.run(TestNG.java:983)
>   at 
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
>   at 
> 

Re: [Dev] [DEV] [IS] Change the nameid-format in SAML Response

2016-03-29 Thread Tharindu Edirisinghe
Hi Waruna,

One thing you can try out is setting the "Subject Claim URI" in Claim
Configuration of Service Provider. For example if you set the Subject Claim
URI to "http://wso2.org/claims.givenname;, then in the SAML response you
will not receive the tenant for the username.

*admin*


However if the Service Provider is SAAS enabled, you won't receive the
tenant domain of the logged in user.

Regards,
TharinduE

On Tue, Mar 29, 2016 at 4:42 PM, Waruna Jayaweera  wrote:

> Hi,
> I have configured SAML SSO for API manager store ( 1.10.0) with IS 5.1.0.
> It seems SAML response nameid  contains the full username for super tenant
> users as [1]. Is there any way to configure Identity server to send the
> SAML response name ID without carbon.super domain [2].
>
> [1] Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">admin@carbon.super
> 
> [2]  Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">admin
> Thanks,
> Waruna
>
>
>
>
> --
> Regards,
>
> Waruna Lakshitha Jayaweera
> Software Engineer
> WSO2 Inc; http://wso2.com
> phone: +94713255198
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Tharindu Edirisinghe
Software Engineer | WSO2 Inc
Platform Security Team
Blog : tharindue.blogspot.com
mobile : +94 775181586
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Getting Build failure on product-apim repo

2016-03-29 Thread Asanka Vithanage
Hi All,

We are trying to build API Manager master branch using locally deployed
jenkins server.

We are having following configuration on the jenkins machine
mvn version =Apache Maven 3.0.5
Java version=1.8.0_77

When building we are getting below stack trace. when checked the

/home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/carbontmp1459253504310/wso2am-2.0.0-SNAPSHOT
folder,
We see only repository folder there. Unzipped Product Build
distribution( modules/distribution/product/target/wso2am-2.0.0-SNAPSHOT)
also has repository folder only.

Appreciate any help to identify a solution.


[INFO] *--- maven-surefire-plugin:2.18:test (default-test) @
org.wso2.carbon.am.integration.backend.test ---
*[INFO] Surefire report directory:
/home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/surefire-reports

---
 T E S T S
---

Running TestSuite

INFO  
[org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager]
- Extracting carbon zip file..

ERROR 
[org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension]
- Fail to start carbon server
java.io.FileNotFoundException: Server startup script not found at
/home/ubuntu/.jenkins/jobs/APIManager110BuildConfig/workspace/modules/integration/tests-integration/tests-backend/target/carbontmp1459253504310/wso2am-2.0.0-SNAPSHOT/bin
at 
org.wso2.carbon.automation.engine.frameworkutils.TestFrameworkUtils.getStartupScriptFileName(TestFrameworkUtils.java:78)
at 
org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager.instrumentForCoverage(CarbonServerManager.java:427)
at 
org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager.setUpCarbonHome(CarbonServerManager.java:212)
at 
org.wso2.carbon.automation.extensions.servers.carbonserver.TestServerManager.startServer(TestServerManager.java:107)
at 
org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension.onExecutionStart(CarbonServerExtension.java:50)
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.wso2.carbon.automation.engine.extensions.TestNGExtensionExecutor.executeExtensible(TestNGExtensionExecutor.java:75)
at 
org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener.onExecutionStart(TestExecutionListener.java:47)
at org.testng.TestNG.runExecutionListeners(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:983)
at 
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
at 
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
at 
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
ERROR [org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener]
- Execution error occurred in TestExecutionListener:-
java.lang.reflect.InvocationTargetException
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.wso2.carbon.automation.engine.extensions.TestNGExtensionExecutor.executeExtensible(TestNGExtensionExecutor.java:75)
at 
org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener.onExecutionStart(TestExecutionListener.java:47)
at org.testng.TestNG.runExecutionListeners(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:983)
at 
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
at 
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
at 
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: 

Re: [Dev] [APIM] Response Body is missing In tenant mode

2016-03-29 Thread Sam Sivayogam
Thanks Kasun

On Tue, Mar 29, 2016 at 5:20 PM, Nuwan Wimalasekara  wrote:

> Hi
>
> The issue[1] is fixed now. Problem was that the pull request[2] was not
> merged in to wso2-synapse. The pull request[2] was supposed to fix the
> issue[3] which was introduced by the fix done for issue[4]. Missing the
> fix[1] in synapse-nhttp-transport with carbon kernel 4.4.4 having the
> fix[4],  led to this issue.
>
> PR[1] is merged and now APIs are working fine for tenant as well.
>
> [1] https://wso2.org/jira/browse/ESBJAVA-4512
> [2] https://github.com/wso2/wso2-synapse/pull/450
> [3] https://wso2.org/jira/browse/ESBJAVA-4386
> [4] https://wso2.org/jira/browse/CARBON-15759
>
> Thanks,
> Nuwanw
>
> On Tue, Mar 22, 2016 at 5:26 PM, Sam Sivayogam  wrote:
>
>> No i tried with 404, 503 but its the same
>>
>> On Tue, Mar 22, 2016 at 11:51 AM, Viraj Senevirathne 
>> wrote:
>>
>>> Hi Sam,
>>> Is it working for other status code?
>>>
>>> On Mon, Mar 21, 2016 at 8:07 PM, Sam Sivayogam  wrote:
>>>
 Hi All,

 After doing the following upgrades in APIM, Response Body is missing
 when invoking the REST API[1] In tenant mode.

 Carbon kernel 4.4.3 to 4.4.4
 Carbon mediation   4.6.1-ALPHA to 4.6.1-BETA
 Carbon multi-tenancy  4.5.0 to 4.5.1

 I was also able to reproduce the same issue in the latest build which I
 got from [2]. I added the REST API[1] in super tenant mode and tenant mode.
 when I invoke the API in super tenant mode it works perfectly and I get a
 JSON response with HTTP Response code 200. But when I Invoke the same API
 in tenant mode the response body is missing and the HTTP Response code is
 200 . In the attached wire logs you can see that response body is coming
 from backend service and its dropped when sending back the response to
 client. Is this a known issue ?

 [1]
 http://ws.apache.org/ns/synapse;
  name="testapi"
  context="/testapi">

   
  
 
https://httpbin.org/"/>
 
  
   
   
  
   

 

 [2]
 https://wso2.org/jenkins/view/product-builds/job/product-esb/lastStableBuild/org.wso2.esb$wso2esb/

 Thanks,
 Sam
 --
 *Sam Sivayogam*

 Software Engineer
 Mobile  : +94 772 906 439
 Office   : +94 112 145 345
 *WSO2, Inc. :** wso2.com *
 lean.enterprise.middleware.

>>>
>>>
>>>
>>> --
>>> Viraj Senevirathne
>>> Software Engineer; WSO2, Inc.
>>>
>>> Mobile : +94 71 958 0269
>>> Email : vir...@wso2.com
>>>
>>
>>
>>
>> --
>> *Sam Sivayogam*
>>
>> Software Engineer
>> Mobile  : +94 772 906 439
>> Office   : +94 112 145 345
>> *WSO2, Inc. :** wso2.com *
>> lean.enterprise.middleware.
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Nuwan Wimalasekara
> Senior Software Engineer - Test Automation
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> phone: +94 71 668 4620
>
>
>
>


-- 
*Sam Sivayogam*

Software Engineer
Mobile  : +94 772 906 439
Office   : +94 112 145 345
*WSO2, Inc. :** wso2.com *
lean.enterprise.middleware.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] Response Body is missing In tenant mode

2016-03-29 Thread Nuwan Wimalasekara
Hi

The issue[1] is fixed now. Problem was that the pull request[2] was not
merged in to wso2-synapse. The pull request[2] was supposed to fix the
issue[3] which was introduced by the fix done for issue[4]. Missing the
fix[1] in synapse-nhttp-transport with carbon kernel 4.4.4 having the
fix[4],  led to this issue.

PR[1] is merged and now APIs are working fine for tenant as well.

[1] https://wso2.org/jira/browse/ESBJAVA-4512
[2] https://github.com/wso2/wso2-synapse/pull/450
[3] https://wso2.org/jira/browse/ESBJAVA-4386
[4] https://wso2.org/jira/browse/CARBON-15759

Thanks,
Nuwanw

On Tue, Mar 22, 2016 at 5:26 PM, Sam Sivayogam  wrote:

> No i tried with 404, 503 but its the same
>
> On Tue, Mar 22, 2016 at 11:51 AM, Viraj Senevirathne 
> wrote:
>
>> Hi Sam,
>> Is it working for other status code?
>>
>> On Mon, Mar 21, 2016 at 8:07 PM, Sam Sivayogam  wrote:
>>
>>> Hi All,
>>>
>>> After doing the following upgrades in APIM, Response Body is missing
>>> when invoking the REST API[1] In tenant mode.
>>>
>>> Carbon kernel 4.4.3 to 4.4.4
>>> Carbon mediation   4.6.1-ALPHA to 4.6.1-BETA
>>> Carbon multi-tenancy  4.5.0 to 4.5.1
>>>
>>> I was also able to reproduce the same issue in the latest build which I
>>> got from [2]. I added the REST API[1] in super tenant mode and tenant mode.
>>> when I invoke the API in super tenant mode it works perfectly and I get a
>>> JSON response with HTTP Response code 200. But when I Invoke the same API
>>> in tenant mode the response body is missing and the HTTP Response code is
>>> 200 . In the attached wire logs you can see that response body is coming
>>> from backend service and its dropped when sending back the response to
>>> client. Is this a known issue ?
>>>
>>> [1]
>>> http://ws.apache.org/ns/synapse;
>>>  name="testapi"
>>>  context="/testapi">
>>>
>>>   
>>>  
>>> 
>>>https://httpbin.org/"/>
>>> 
>>>  
>>>   
>>>   
>>>  
>>>   
>>>
>>> 
>>>
>>> [2]
>>> https://wso2.org/jenkins/view/product-builds/job/product-esb/lastStableBuild/org.wso2.esb$wso2esb/
>>>
>>> Thanks,
>>> Sam
>>> --
>>> *Sam Sivayogam*
>>>
>>> Software Engineer
>>> Mobile  : +94 772 906 439
>>> Office   : +94 112 145 345
>>> *WSO2, Inc. :** wso2.com *
>>> lean.enterprise.middleware.
>>>
>>
>>
>>
>> --
>> Viraj Senevirathne
>> Software Engineer; WSO2, Inc.
>>
>> Mobile : +94 71 958 0269
>> Email : vir...@wso2.com
>>
>
>
>
> --
> *Sam Sivayogam*
>
> Software Engineer
> Mobile  : +94 772 906 439
> Office   : +94 112 145 345
> *WSO2, Inc. :** wso2.com *
> lean.enterprise.middleware.
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nuwan Wimalasekara
Senior Software Engineer - Test Automation
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

phone: +94 71 668 4620
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [DEV] [IS] Change the nameid-format in SAML Response

2016-03-29 Thread Waruna Jayaweera
Hi,
I have configured SAML SSO for API manager store ( 1.10.0) with IS 5.1.0.
It seems SAML response nameid  contains the full username for super tenant
users as [1]. Is there any way to configure Identity server to send the
SAML response name ID without carbon.super domain [2].

[1]admin@carbon.super

[2] adminhttp://wso2.com
phone: +94713255198
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Including editable Spark scripts in APIM analytics pack

2016-03-29 Thread Rajeev Sampath
Hi,

For APIM Analytics product, we need to include some spark scripts in the
pack which should also be editable by the user (through the execution
manager).
Hence we can't include these in a CApp since it will be redeployed when the
server restarts and any changes done will be overwritten.

For CEP execution plans and streams, we handled this by including them in
the deployments directory in the pack instead of capp. But for spark
scripts, file system deployment doesn't seem to be supported.

Any way to include editable spark scripts with the pack?


Thanks
Rajeev

-- 
Rajeev Sampath
Senior Software Engineer
WSO2, Inc.; http://www.wso2.com.

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


Re: [Dev] REST-API: Fine Grained resources vs Coarse Grained resources

2016-03-29 Thread Joseph Fonseka
Hi

Having different ways to retrieve the configs of the resource will affect
the intuitiveness of the API so IMO having a uniform way of retrieving the
configs will be more beneficial.

Alternate solutions for the given problem.
1. You always return the configs as part of the specific resource. Ex. /
analysis/{analysis_id} and give the option of turning off configs as a
query parameter Ex /analysis/{analysis_id}?configs=false.
2. Further more you can filter configs with /analysis/{
analysis_id}?configs=attribute.
3. If you want to do a partial update of configs you can use sub resource
or a controller resource. Ex. /analysis/{analysis_id}/configs,  /
analysis/update-config

Regards
Jo

On Tue, Mar 29, 2016 at 3:31 PM, Udara Liyanage  wrote:

> Hi,
>
> When designing API, we need to let the clients know the API endpoints so
> they can invoke relevant  endpoint to fetch expected resource. Assuming
> size of the configuration/analytic object payload is a dynamic thing, how
> can the client know which endpoints to invoke to fetch the required
> resource. How does the client know the size of the analytic payload. In
> this case how does a client know which API endpoint to invoke if he want to
> get configs. It may be GET /analysis if analysis size is low, otherwise GET
> /analysis/configs .
>
> Yes, we can not go extreme in fine grain or coarse grain. IMO best
> approach is to go in middle path, define a reasonable set of endpoints to
> fetch resources.
>
> On Tue, Mar 29, 2016 at 3:08 PM, Thamali Wijewardhana 
> wrote:
>
>> Hi,
>>
>> When creating a REST API to WSO2 machine learner, one of the important
>> problems I faced was selection among fine grained resources and coarse
>> grained resources. In other words, whether to define something as a
>> separate resource or a part of a large resource.
>>
>> Fine grained Resources are low complex and easy to maintain. But it can
>> make data become an inconsistent state and the server will end up receiving
>> higher number of HTTP requests possibly impacting its ability to serve
>> multiple API consumers.
>>
>> In using coarse grained resources, the data inconsistency and higher load
>> on the server is reduced. But it may be difficult to maintain and higher
>> JSON payload may be returned.
>>
>> For example, we have an API GET api/analysis/analysis_id/configs which
>> retrieves configurations of an API. The problem is whether to use a
>> separate resource for configs or return configs with the analysis resource.
>> If we consider configuration as a separate resource, we have to define an
>> API, GET api/analysis/analysis_id/configs. But if we return configs with
>> analysis resource, then it may be only the API GET
>> api/analysis/analysis_id  and the configuration should be added to analysis
>> resource and returned with it.
>>
>> I have found an approach to solve the problem and given below is what I
>> have understood.
>>
>> The decision should be taken considering the situation.
>>
>> Here, the decision is based on the size of the configuration object. If
>> it has a large size, then if we return it with analysis resource, it may be
>> a large JSON payload and time wastage because every time an analysis
>> resource is returned configuration also have to be returned even not
>> necessary. Therefore, if configuration is large, it is better to use a
>> separate resource for configurations and use a separate API as
>> api/analysis/analysis_id/configs
>>
>> But, when we have to access a simple property such as algorithm-name of
>> the analysis, then it is better to return it with algorithm resource.
>>
>> This is the approach I have decided and highly appreciate your
>> suggestions on this.
>>
>>
>> Thanks
>>
>>
>>
>> ___
>> 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
>



-- 

-- 
*Joseph Fonseka*
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 772 512 430
skype: jpfonseka

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


Re: [Dev] REST-API: Fine Grained resources vs Coarse Grained resources

2016-03-29 Thread Udara Liyanage
Hi,

When designing API, we need to let the clients know the API endpoints so
they can invoke relevant  endpoint to fetch expected resource. Assuming
size of the configuration/analytic object payload is a dynamic thing, how
can the client know which endpoints to invoke to fetch the required
resource. How does the client know the size of the analytic payload. In
this case how does a client know which API endpoint to invoke if he want to
get configs. It may be GET /analysis if analysis size is low, otherwise GET
/analysis/configs .

Yes, we can not go extreme in fine grain or coarse grain. IMO best approach
is to go in middle path, define a reasonable set of endpoints to fetch
resources.

On Tue, Mar 29, 2016 at 3:08 PM, Thamali Wijewardhana 
wrote:

> Hi,
>
> When creating a REST API to WSO2 machine learner, one of the important
> problems I faced was selection among fine grained resources and coarse
> grained resources. In other words, whether to define something as a
> separate resource or a part of a large resource.
>
> Fine grained Resources are low complex and easy to maintain. But it can
> make data become an inconsistent state and the server will end up receiving
> higher number of HTTP requests possibly impacting its ability to serve
> multiple API consumers.
>
> In using coarse grained resources, the data inconsistency and higher load
> on the server is reduced. But it may be difficult to maintain and higher
> JSON payload may be returned.
>
> For example, we have an API GET api/analysis/analysis_id/configs which
> retrieves configurations of an API. The problem is whether to use a
> separate resource for configs or return configs with the analysis resource.
> If we consider configuration as a separate resource, we have to define an
> API, GET api/analysis/analysis_id/configs. But if we return configs with
> analysis resource, then it may be only the API GET
> api/analysis/analysis_id  and the configuration should be added to analysis
> resource and returned with it.
>
> I have found an approach to solve the problem and given below is what I
> have understood.
>
> The decision should be taken considering the situation.
>
> Here, the decision is based on the size of the configuration object. If it
> has a large size, then if we return it with analysis resource, it may be a
> large JSON payload and time wastage because every time an analysis resource
> is returned configuration also have to be returned even not necessary.
> Therefore, if configuration is large, it is better to use a separate
> resource for configurations and use a separate API as
> api/analysis/analysis_id/configs
>
> But, when we have to access a simple property such as algorithm-name of
> the analysis, then it is better to return it with algorithm resource.
>
> This is the approach I have decided and highly appreciate your suggestions
> on this.
>
>
> Thanks
>
>
>
> ___
> 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


Re: [Dev] [DAS]Abnormal behavior of data after purging a table

2016-03-29 Thread Anjana Fernando
Good stuff in finding the issue Sachith! .. make sure a JIRA is created for
this and resolved.

Cheers,
Anjana.

On Tue, Mar 29, 2016 at 11:06 AM, Sachith Withana  wrote:

> Hi all,
>
> This happened due to the tmp folder getting deleted when running the
> backup tool.
> This is fixed now.
>
> Thanks,
> Sachith
>
> On Wed, Mar 23, 2016 at 11:40 AM, Sachith Withana 
> wrote:
>
>> Nirmal: I'm looking into this.
>>
>> On Wed, Mar 23, 2016 at 11:20 AM, Nirmal Fernando 
>> wrote:
>>
>>> Hi, Anyone looking into this?
>>>
>>> On Mon, Mar 21, 2016 at 11:23 AM, Nirmal Fernando 
>>> wrote:
>>>
 Hi All,

 Any thoughts on this? This seems to be a L1.

 On Fri, Mar 18, 2016 at 3:27 PM, Sachith Withana 
 wrote:

> [+Gimantha]
>
> On Fri, Mar 18, 2016 at 3:26 PM, Sachith Withana 
> wrote:
>
>> Hi all,
>>
>> We reproduced the issue, but if we take out the spark script step, it
>> works fine.
>> (by using the simulator to get the data in to the table).
>>
>> @Niranda:
>> Any thoughts on why this might be happening?
>>
>> Thanks,
>> Sachith
>>
>> On Fri, Mar 18, 2016 at 2:28 PM, Vithulan Vijayanandan <
>> vithu...@wso2.com> wrote:
>>
>>> Hi,
>>>
>>> We are encountering an abnormal behavior of data after purging DAS
>>> table using analytics backup tool kit [1], -purge command.
>>>
>>> To reproduce this issue,
>>>
>>>1. Generate a table (x) from spark script using y table.
>>>2. Purge all the data in x using analytics backup tool command
>>>-purge.
>>>3. Re-populate the table x as in 1.
>>>4. Send events to stream y (Execution plan will refer to table x
>>>when you send events to y)
>>>5. Now if you see the table x, it will be empty.
>>>
>>> [1] https://docs.wso2.com/pages/viewpage.action?pageId=45957285
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Vithulan.
>>> --
>>> *Vithulan MV*
>>>
>>> Intern-Software Engineering
>>> WSO2, Inc : wso2.com
>>> Mobile: +94712540524
>>>
>>
>>
>>
>> --
>> Sachith Withana
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> E-mail: sachith AT wso2.com
>> M: +94715518127
>> Linked-In: 
>> https://lk.linkedin.com/in/sachithwithana
>>
>
>
>
> --
> Sachith Withana
> Software Engineer; WSO2 Inc.; http://wso2.com
> E-mail: sachith AT wso2.com
> M: +94715518127
> Linked-In: 
> https://lk.linkedin.com/in/sachithwithana
>



 --

 Thanks & regards,
 Nirmal

 Team Lead - WSO2 Machine Learner
 Associate Technical Lead - Data Technologies Team, WSO2 Inc.
 Mobile: +94715779733
 Blog: http://nirmalfdo.blogspot.com/



>>>
>>>
>>> --
>>>
>>> Thanks & regards,
>>> Nirmal
>>>
>>> Team Lead - WSO2 Machine Learner
>>> Associate Technical Lead - Data Technologies Team, WSO2 Inc.
>>> Mobile: +94715779733
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>>
>>>
>>
>>
>> --
>> Sachith Withana
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> E-mail: sachith AT wso2.com
>> M: +94715518127
>> Linked-In: 
>> https://lk.linkedin.com/in/sachithwithana
>>
>
>
>
> --
> Sachith Withana
> Software Engineer; WSO2 Inc.; http://wso2.com
> E-mail: sachith AT wso2.com
> M: +94715518127
> Linked-In: 
> https://lk.linkedin.com/in/sachithwithana
>



-- 
*Anjana Fernando*
Senior Technical Lead
WSO2 Inc. | http://wso2.com
lean . enterprise . middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] REST-API: Fine Grained resources vs Coarse Grained resources

2016-03-29 Thread Thamali Wijewardhana
Hi,

When creating a REST API to WSO2 machine learner, one of the important
problems I faced was selection among fine grained resources and coarse
grained resources. In other words, whether to define something as a
separate resource or a part of a large resource.

Fine grained Resources are low complex and easy to maintain. But it can
make data become an inconsistent state and the server will end up receiving
higher number of HTTP requests possibly impacting its ability to serve
multiple API consumers.

In using coarse grained resources, the data inconsistency and higher load
on the server is reduced. But it may be difficult to maintain and higher
JSON payload may be returned.

For example, we have an API GET api/analysis/analysis_id/configs which
retrieves configurations of an API. The problem is whether to use a
separate resource for configs or return configs with the analysis resource.
If we consider configuration as a separate resource, we have to define an
API, GET api/analysis/analysis_id/configs. But if we return configs with
analysis resource, then it may be only the API GET
api/analysis/analysis_id  and the configuration should be added to analysis
resource and returned with it.

I have found an approach to solve the problem and given below is what I
have understood.

The decision should be taken considering the situation.

Here, the decision is based on the size of the configuration object. If it
has a large size, then if we return it with analysis resource, it may be a
large JSON payload and time wastage because every time an analysis resource
is returned configuration also have to be returned even not necessary.
Therefore, if configuration is large, it is better to use a separate
resource for configurations and use a separate API as
api/analysis/analysis_id/configs

But, when we have to access a simple property such as algorithm-name of the
analysis, then it is better to return it with algorithm resource.

This is the approach I have decided and highly appreciate your suggestions
on this.


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


Re: [Dev] Apply modified configuration files with feature installation

2016-03-29 Thread Lakshani Gamage
Thanks Niranjan.

On Tue, Mar 29, 2016 at 1:52 PM, Niranjan Karunanandham 
wrote:

> Hi Lakshani,
>
> This depends on how the feature is defined. AFAIK currently we do not have
> a way to update configuration files (which are owned by one feature) when a
> feature is being installed, i.e., say feature, F1, requires the
> configuration file, C1, to be modified, but the C1 is packed in feature,
> F2, that is already installed in the product.
>
> IMO defining where the configuration should reside, needs to be decided
> when creating a feature. It would be better if the feature contains its own
> configuration files and gets copied to required location as defined in the
> p2.inf of the feature. IMO for datasources, this can be handled by having a
> separate file to have the datasources, such as abc-datasources.xml and this
> file needs to be packed with the core feature for the product.
>
> Regards,
> Nira
>
> On Tue, Mar 29, 2016 at 1:36 PM, Charitha Goonetilleke  > wrote:
>
>> Hi All,
>>
>> AFAIK, only option we have is to make sure our custom configs are updated
>> accordingly when we are bumping version of particular component or feature
>> which provide that config. Anyway if we could write tool to execute during
>> the build time to generate relevant config files, with our customization by
>> referring the original one, above problem can be sorted out. WDYT?
>>
>>
>>
>> On Tue, Mar 29, 2016 at 12:16 PM, Lakshani Gamage 
>> wrote:
>>
>>> Hi all,
>>>
>>> Some products have done modifications to some configuration files (
>>> carbon.xml, registry xml etc). If the features of those product are
>>> installed from p2-repo, features are not working properly as customization 
>>> in
>>> config files are missing.
>>>
>>> For example, according to product app manager repo, there are some
>>> customized configuration files (master-datasource.xml, carbon.xml,
>>> registry.xml, sso-idp-cofig.xml etc).
>>>
>>> App manager has packed all customized files, as those files are copied
>>> to pack from bin.xml.
>>>
>>> But If we are going to install app manager features from p2-repo, those
>>> customization go missing. Therefore installed app manager features are
>>> not working properly.  However we can't  bundle those modified
>>> configuration files with app manager features as those configuration files
>>> are coming from several other features. ( carbon, registry, identity
>>> features etc)
>>>
>>> What is the best option to apply those modification with feature
>>>  installations from p2-repo? Thoughts?
>>>
>>> Thanks,
>>> Lakshani.
>>>
>>> --
>>> Lakshani Gamage
>>>
>>> *Software Engineer, WSO2*
>>>
>>> *Mobile : +94 71 5478184 <%2B94%20%280%29%20773%20451194>*
>>> *Blog : http://lakshanigamage.blogspot.com/
>>> *
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Charitha Goonetilleke*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 77 751 3669 <%2B94777513669>
>> Twitter:@CharithaWs , fb: charithag
>> , linkedin: charithag
>> 
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> *Niranjan Karunanandham*
> Senior Software Engineer - WSO2 Inc.
> WSO2 Inc.: http://www.wso2.com
>



-- 
Lakshani Gamage

*Software Engineer, WSO2*

*Mobile : +94 71 5478184 <%2B94%20%280%29%20773%20451194>*
*Blog : http://lakshanigamage.blogspot.com/
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Apply modified configuration files with feature installation

2016-03-29 Thread Niranjan Karunanandham
Hi Lakshani,

This depends on how the feature is defined. AFAIK currently we do not have
a way to update configuration files (which are owned by one feature) when a
feature is being installed, i.e., say feature, F1, requires the
configuration file, C1, to be modified, but the C1 is packed in feature,
F2, that is already installed in the product.

IMO defining where the configuration should reside, needs to be decided
when creating a feature. It would be better if the feature contains its own
configuration files and gets copied to required location as defined in the
p2.inf of the feature. IMO for datasources, this can be handled by having a
separate file to have the datasources, such as abc-datasources.xml and this
file needs to be packed with the core feature for the product.

Regards,
Nira

On Tue, Mar 29, 2016 at 1:36 PM, Charitha Goonetilleke 
wrote:

> Hi All,
>
> AFAIK, only option we have is to make sure our custom configs are updated
> accordingly when we are bumping version of particular component or feature
> which provide that config. Anyway if we could write tool to execute during
> the build time to generate relevant config files, with our customization by
> referring the original one, above problem can be sorted out. WDYT?
>
>
>
> On Tue, Mar 29, 2016 at 12:16 PM, Lakshani Gamage 
> wrote:
>
>> Hi all,
>>
>> Some products have done modifications to some configuration files (
>> carbon.xml, registry xml etc). If the features of those product are
>> installed from p2-repo, features are not working properly as customization in
>> config files are missing.
>>
>> For example, according to product app manager repo, there are some
>> customized configuration files (master-datasource.xml, carbon.xml,
>> registry.xml, sso-idp-cofig.xml etc).
>>
>> App manager has packed all customized files, as those files are copied to
>> pack from bin.xml.
>>
>> But If we are going to install app manager features from p2-repo, those
>> customization go missing. Therefore installed app manager features are
>> not working properly.  However we can't  bundle those modified
>> configuration files with app manager features as those configuration files
>> are coming from several other features. ( carbon, registry, identity
>> features etc)
>>
>> What is the best option to apply those modification with feature
>>  installations from p2-repo? Thoughts?
>>
>> Thanks,
>> Lakshani.
>>
>> --
>> Lakshani Gamage
>>
>> *Software Engineer, WSO2*
>>
>> *Mobile : +94 71 5478184 <%2B94%20%280%29%20773%20451194>*
>> *Blog : http://lakshanigamage.blogspot.com/
>> *
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Charitha Goonetilleke*
> Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 77 751 3669 <%2B94777513669>
> Twitter:@CharithaWs , fb: charithag
> , linkedin: charithag
> 
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Niranjan Karunanandham*
Senior Software Engineer - WSO2 Inc.
WSO2 Inc.: http://www.wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Apply modified configuration files with feature installation

2016-03-29 Thread Charitha Goonetilleke
Hi All,

AFAIK, only option we have is to make sure our custom configs are updated
accordingly when we are bumping version of particular component or feature
which provide that config. Anyway if we could write tool to execute during
the build time to generate relevant config files, with our customization by
referring the original one, above problem can be sorted out. WDYT?



On Tue, Mar 29, 2016 at 12:16 PM, Lakshani Gamage  wrote:

> Hi all,
>
> Some products have done modifications to some configuration files (
> carbon.xml, registry xml etc). If the features of those product are
> installed from p2-repo, features are not working properly as customization in
> config files are missing.
>
> For example, according to product app manager repo, there are some
> customized configuration files (master-datasource.xml, carbon.xml,
> registry.xml, sso-idp-cofig.xml etc).
>
> App manager has packed all customized files, as those files are copied to
> pack from bin.xml.
>
> But If we are going to install app manager features from p2-repo, those
> customization go missing. Therefore installed app manager features are
> not working properly.  However we can't  bundle those modified
> configuration files with app manager features as those configuration files
> are coming from several other features. ( carbon, registry, identity
> features etc)
>
> What is the best option to apply those modification with feature
>  installations from p2-repo? Thoughts?
>
> Thanks,
> Lakshani.
>
> --
> Lakshani Gamage
>
> *Software Engineer, WSO2*
>
> *Mobile : +94 71 5478184 <%2B94%20%280%29%20773%20451194>*
> *Blog : http://lakshanigamage.blogspot.com/
> *
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Charitha Goonetilleke*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 77 751 3669 <%2B94777513669>
Twitter:@CharithaWs , fb: charithag
, linkedin: charithag

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


Re: [Dev] Configuring java.util.logging in C5 - CARBON-15745

2016-03-29 Thread Aruna Karunarathna
On Tue, Mar 29, 2016 at 12:19 PM, Nipuni Perera  wrote:

> Hi all,
>
> In C5 we use java.util.logging as the logging framework in launcher
> module. Java util logging uses a configuration file in
> JRE/lib/logging.properties file as the default configuration. In order to
> use a custom configuration file we need to set a system property
> (java.util.logging.config.file) as mentioned in the description in [1].
> After setting this property we can change the log level of root logger by
> setting
> ".level = "
>
> Or we can specify handlers and change the log level of each handler as
> below,
>
> handlers= org.wso2.carbon.launcher.bootstrap.logging.ConsoleLogHandler,
> org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler
>
> org.wso2.carbon.launcher.bootstrap.logging.ConsoleLogHandler.level = FINE
>
> org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler.level = INFO
>
>
> (Log level of the root logger need to be lower than that of handlers to
> control the log level of handlers. eg: If we need to log the FINE logs to
> console, log level of root logger has to be FINE or lower level than FINE)
> Hence if need to control the log level of java util logging, we need to
> have a separate configuration file. (We had maintained a similar
> configuration in carbon 4  in
> repository/conf/etc/logging-bridge.properties).
>
> There are few other issues that we need to fix at code level even after
> adding the above configuration file:
>
>1.  We need to add the BootstrapLogger to LogManager. PR[2].
>(LogManager read the logging configuration from file described above.)
>2.  We need to change the access modifiers of handler constructors to
>public, else trying to configure handlers log level via configuration will
>cause error[3]
>
> I could configure the java.util.logging log levels after doing the changes
> mentioned above.
> Shall we add this logging.properties configuration to C5?
>
>
To enable the asynchronous logging with log4j2 in c5, we need to add some
properties, see [1] so I also think we need to finalize and add those
logging related configurations to a centralized file.

[1].
http://arunasujith.blogspot.com/2016/03/how-to-enable-asynchronous-logging-with.html


> [1] https://wso2.org/jira/browse/CARBON-1574
> 
> [2] https://github.com/wso2/carbon-kernel/pull/902
> [3] Can't load log handler
> "org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler"
> java.lang.IllegalAccessException: Class java.util.logging.LogManager$5 can
> not access a member of class
> org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler with modifiers
> "private"5 
>
> Thanks,
> Nipuni
> --
> Nipuni Perera
> Software Engineer; WSO2 Inc.; http://wso2.com
> Email: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Blog : http://nipunipererablog.blogspot.com/
> Mobile: +94 (71) 5626680
> 
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Aruna Sujith Karunarathna *
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


Re: [Dev] Unable to send SOAP call.

2016-03-29 Thread Shakila Sivagnanarajah
Hi,

I already imported org.apache.axis2.saaj.* package. Earlier I used the
version as *1.6.1.wso2v10*. As Niranjan suggested, I changed the version as
*1.6.1.wso2v16* (IS 5.1.0 uses axis2_1.6.1.wso2v16). Still getting the same
issue. Please find the implementation [1] and documentation [2] to
reproduce.

[1] https://github.com/Shakila/vip
[2]
https://docs.wso2.com/display/ISCONNECTORS/Configuring+Symantec+VIP+Authenticator

Thanks

On Mon, Mar 21, 2016 at 12:10 PM, Malaka Silva  wrote:

> Hi Shakila,
>
> I had a offline discussion with Kishanthan.
>
> You need to import the org.apache.axis2.saaj.* package to
> your authenticator jar.
>
> On Thu, Mar 17, 2016 at 1:39 PM, Shakila Sivagnanarajah 
> wrote:
>
>> Hi Chiranga,
>>
>> Please find the info below.
>>
>> Provider org.apache.axis2.saaj.SOAPConnectionFactoryImpl not found
>> org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException:
>> Error occurred while sending SOAP Request to Server: Unable to create SOAP
>> connection factory: Provider
>> org.apache.axis2.saaj.SOAPConnectionFactoryImpl not found
>> at
>> org.wso2.carbon.identity.authenticator.semanticvip.VIPManager.invokeSOAP(VIPManager.java:120)
>> at
>> org.wso2.carbon.identity.authenticator.semanticvip.SemanticVIPAuthenticator.processAuthenticationResponse(SemanticVIPAuthenticator.java:134)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.AbstractApplicationAuthenticator.process(AbstractApplicationAuthenticator.java:66)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.doAuthentication(DefaultStepHandler.java:432)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.handleResponse(DefaultStepHandler.java:406)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.handle(DefaultStepHandler.java:117)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler.handle(DefaultStepBasedSequenceHandler.java:171)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultAuthenticationRequestHandler.handle(DefaultAuthenticationRequestHandler.java:115)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultRequestCoordinator.handle(DefaultRequestCoordinator.java:135)
>> at
>> org.wso2.carbon.identity.application.authentication.framework.servlet.CommonAuthenticationServlet.doPost(CommonAuthenticationServlet.java:53)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>> at
>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
>> at
>> org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
>> at
>> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
>> at
>> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>> at
>> org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> at
>> org.wso2.carbon.ui.filters.CSRFPreventionFilter.doFilter(CSRFPreventionFilter.java:88)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> at
>> org.wso2.carbon.ui.filters.CRLFPreventionFilter.doFilter(CRLFPreventionFilter.java:59)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>> at
>> org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
>> 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
>> 

Re: [Dev] [BPS] Error when passing parameters to a SOAP operation with Apache CXF

2016-03-29 Thread Natasha Wijesekara
Hi,

Thank you very much for the quick response. I will look into these
approaches and keep you posted regarding the progress.

Best Regards,
Natasha Wijesekare

On Tue, Mar 29, 2016 at 12:19 PM, Nandika Jayawardana 
wrote:

> That approach looks promising. Another option is to use the membrane SOA
> library we used human task rendering implementation to construct the soap
> payload. Also take a look into the existing activiti web services task. If
> we can take the existing web services task from activiti and make it
> production ready, that should also be fine.
>
> Regards
> Nandika
>
> On Tue, Mar 29, 2016 at 10:57 AM, Hasitha Aravinda 
> wrote:
>
>> Yes, IMO this approach is very complicated and we will face more
>> issues when we are going to integrate with WebService Task. Can you have a
>> look at [1] and try that ?
>>
>> ​[1] -
>> http://stackoverflow.com/questions/6849892/whats-a-good-java-library-for-dynamic-soap-client-operations
>> ​
>>
>> Thanks,
>> Hasitha.
>>
>> On Mon, Mar 28, 2016 at 12:07 PM, Natasha Wijesekara 
>> wrote:
>>
>>>  Hi,
>>>
>>> There are many complexities when trying to implement a SOAP client using
>>> the dynamic client capability of Apache CXF. I was able to provide a
>>> workaround for the error which occurred when passing parameters to a SOAP
>>> operation with Apache CXF .
>>>
>>> The workaround provided does not work with WSDLs which have complex
>>> types as the request or response message type  i.e. the request/response
>>> message parts of the WSDL can be primitive or complex, so 2 different
>>> approaches should be followed to get/set the values of the primitive and
>>> complex types respectively. When having complex types, the message part is
>>> iterated over multiple times, which will take more processing time and
>>> reduce the performance.
>>>
>>> The approach I used is described below. By using this approach the
>>> JaxWsDynamicClientFactory takes care of generating Java classes for complex
>>> types :
>>>
>>> Create a new instance of the Client using the JaxWsDynamicClientFactory by
>>> passing the wsdl url. The url of the WSDL, operation name and the input
>>> variables is provided by the user.
>>>
>>>
>>>
>>>
>>>
>>> *JaxWsDynamicClientFactory factory =
>>> JaxWsDynamicClientFactory.newInstance();URL wsdlURL = new
>>> URL("http://localhost:9763/services/DivisionProcessService?wsdl
>>> ");String
>>> operationName = "process";Client client =
>>> factory.createClient(wsdlURL.toExternalForm());ClientImpl clientImpl =
>>> (ClientImpl) client;*
>>>
>>> Get the endpoint i.e. the URL where the web service can be accessed by a
>>> client application using the cilent.
>>>
>>> *Endpoint endpoint = clientImpl.getEndpoint();*
>>>
>>> Get the target namespace of the WSDL by creating a ServiceInfo object
>>> which walks over the CXF service model
>>>
>>> *ServiceInfo serviceInfo =
>>> endpoint.getService().getServiceInfos().get(0);*
>>> *String targetNameSpace = serviceInfo.getTargetNamespace();*
>>>
>>> Get the binding name of the WSDL by creating a BindingInfo object which
>>> gets the name of the binding.
>>>
>>> *BindingInfo bindingInfo = serviceInfo.getBindings().iterator().next();*
>>> *String bName = bindingInfo.getName().getLocalPart();*
>>>
>>> Create a Qname by passing the namespace and the binding name as
>>> parameters and get the binding which has the specified QName.
>>>
>>> *QName bindingName = new QName(targetNameSpace, bName);*
>>> *BindingInfo binding = serviceInfo.getBinding(bindingName);*
>>>
>>> Get details about the soap operation which is to be invoked by creating
>>> a QName with the namespace and the operation name.
>>>
>>> *QName opName = new QName(targetNameSpace, operationName);*
>>> *BindingOperationInfo boi = binding.getOperation(opName);*
>>>
>>> Get the input/request message type
>>> *BindingMessageInfo inputMessageInfo = boi.getInput();*
>>> *List parts = inputMessageInfo.getMessageParts();*
>>> *MessagePartInfo partInfo = parts.get(0);*
>>>
>>> Get the  class type of the request/input message and dynamically create
>>> an instance of it
>>> *Class partClass = partInfo.getTypeClass();*
>>> *Object obj = partClass.newInstance();*
>>>
>>> The input variables provided by the user is stored inside a  HashTable
>>> which will hold the variable name and its value as a key-value pair
>>>
>>> *Hashtable table = new Hashtable();*
>>> *table.put("dividend", 40);*
>>> *table.put("divisor", 10);*
>>>
>>> Get the methods from the generated request class. This class will have
>>> getter and setter methods for the variables taken as the input/request.
>>>
>>> *Method [] methods = obj.getClass().getDeclaredMethods();*
>>> *for(Method m : methods){*
>>> * if(m.getName().contains("set")){*
>>> * String methodName = m.getName(); *
>>> * Class paramType = m.getParameterTypes()[0];*
>>> * String[] output = methodName.split("set");*
>>> * 

Re: [Dev] [BPS] Error when passing parameters to a SOAP operation with Apache CXF

2016-03-29 Thread Nandika Jayawardana
That approach looks promising. Another option is to use the membrane SOA
library we used human task rendering implementation to construct the soap
payload. Also take a look into the existing activiti web services task. If
we can take the existing web services task from activiti and make it
production ready, that should also be fine.

Regards
Nandika

On Tue, Mar 29, 2016 at 10:57 AM, Hasitha Aravinda  wrote:

> Yes, IMO this approach is very complicated and we will face more
> issues when we are going to integrate with WebService Task. Can you have a
> look at [1] and try that ?
>
> ​[1] -
> http://stackoverflow.com/questions/6849892/whats-a-good-java-library-for-dynamic-soap-client-operations
> ​
>
> Thanks,
> Hasitha.
>
> On Mon, Mar 28, 2016 at 12:07 PM, Natasha Wijesekara 
> wrote:
>
>>  Hi,
>>
>> There are many complexities when trying to implement a SOAP client using
>> the dynamic client capability of Apache CXF. I was able to provide a
>> workaround for the error which occurred when passing parameters to a SOAP
>> operation with Apache CXF .
>>
>> The workaround provided does not work with WSDLs which have complex types
>> as the request or response message type  i.e. the request/response message
>> parts of the WSDL can be primitive or complex, so 2 different approaches
>> should be followed to get/set the values of the primitive and complex types
>> respectively. When having complex types, the message part is iterated over
>> multiple times, which will take more processing time and reduce the
>> performance.
>>
>> The approach I used is described below. By using this approach the
>> JaxWsDynamicClientFactory takes care of generating Java classes for complex
>> types :
>>
>> Create a new instance of the Client using the JaxWsDynamicClientFactory by
>> passing the wsdl url. The url of the WSDL, operation name and the input
>> variables is provided by the user.
>>
>>
>>
>>
>>
>> *JaxWsDynamicClientFactory factory =
>> JaxWsDynamicClientFactory.newInstance();URL wsdlURL = new
>> URL("http://localhost:9763/services/DivisionProcessService?wsdl
>> ");String
>> operationName = "process";Client client =
>> factory.createClient(wsdlURL.toExternalForm());ClientImpl clientImpl =
>> (ClientImpl) client;*
>>
>> Get the endpoint i.e. the URL where the web service can be accessed by a
>> client application using the cilent.
>>
>> *Endpoint endpoint = clientImpl.getEndpoint();*
>>
>> Get the target namespace of the WSDL by creating a ServiceInfo object
>> which walks over the CXF service model
>>
>> *ServiceInfo serviceInfo =
>> endpoint.getService().getServiceInfos().get(0);*
>> *String targetNameSpace = serviceInfo.getTargetNamespace();*
>>
>> Get the binding name of the WSDL by creating a BindingInfo object which
>> gets the name of the binding.
>>
>> *BindingInfo bindingInfo = serviceInfo.getBindings().iterator().next();*
>> *String bName = bindingInfo.getName().getLocalPart();*
>>
>> Create a Qname by passing the namespace and the binding name as
>> parameters and get the binding which has the specified QName.
>>
>> *QName bindingName = new QName(targetNameSpace, bName);*
>> *BindingInfo binding = serviceInfo.getBinding(bindingName);*
>>
>> Get details about the soap operation which is to be invoked by creating a
>> QName with the namespace and the operation name.
>>
>> *QName opName = new QName(targetNameSpace, operationName);*
>> *BindingOperationInfo boi = binding.getOperation(opName);*
>>
>> Get the input/request message type
>> *BindingMessageInfo inputMessageInfo = boi.getInput();*
>> *List parts = inputMessageInfo.getMessageParts();*
>> *MessagePartInfo partInfo = parts.get(0);*
>>
>> Get the  class type of the request/input message and dynamically create
>> an instance of it
>> *Class partClass = partInfo.getTypeClass();*
>> *Object obj = partClass.newInstance();*
>>
>> The input variables provided by the user is stored inside a  HashTable
>> which will hold the variable name and its value as a key-value pair
>>
>> *Hashtable table = new Hashtable();*
>> *table.put("dividend", 40);*
>> *table.put("divisor", 10);*
>>
>> Get the methods from the generated request class. This class will have
>> getter and setter methods for the variables taken as the input/request.
>>
>> *Method [] methods = obj.getClass().getDeclaredMethods();*
>> *for(Method m : methods){*
>> * if(m.getName().contains("set")){*
>> * String methodName = m.getName(); *
>> * Class paramType = m.getParameterTypes()[0];*
>> * String[] output = methodName.split("set");*
>> * String varName = output[1].toLowerCase(); *
>> * Object value = table.get(varName); *
>> * Method m1 = obj.getClass().getMethod(methodName, paramType); *
>> * m1.invoke(obj, value);*
>> * } else {*
>> * }*
>> *}*
>>
>> Invoking the operation
>> *Object[] response = client.invoke(operationName, obj);*
>>
>> Get the methods from the generated response class. This class will 

[Dev] Configuring java.util.logging in C5 - CARBON-15745

2016-03-29 Thread Nipuni Perera
Hi all,

In C5 we use java.util.logging as the logging framework in launcher module.
Java util logging uses a configuration file in JRE/lib/logging.properties
file as the default configuration. In order to use a custom configuration
file we need to set a system property (java.util.logging.config.file) as
mentioned in the description in [1].
After setting this property we can change the log level of root logger by
setting
".level = "

Or we can specify handlers and change the log level of each handler as
below,

handlers= org.wso2.carbon.launcher.bootstrap.logging.ConsoleLogHandler,
org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler

org.wso2.carbon.launcher.bootstrap.logging.ConsoleLogHandler.level = FINE

org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler.level = INFO


(Log level of the root logger need to be lower than that of handlers to
control the log level of handlers. eg: If we need to log the FINE logs to
console, log level of root logger has to be FINE or lower level than FINE)
Hence if need to control the log level of java util logging, we need to
have a separate configuration file. (We had maintained a similar
configuration in carbon 4  in
repository/conf/etc/logging-bridge.properties).

There are few other issues that we need to fix at code level even after
adding the above configuration file:

   1.  We need to add the BootstrapLogger to LogManager. PR[2]. (LogManager
   read the logging configuration from file described above.)
   2.  We need to change the access modifiers of handler constructors to
   public, else trying to configure handlers log level via configuration will
   cause error[3]

I could configure the java.util.logging log levels after doing the changes
mentioned above.
Shall we add this logging.properties configuration to C5?

[1] https://wso2.org/jira/browse/CARBON-1574

[2] https://github.com/wso2/carbon-kernel/pull/902
[3] Can't load log handler
"org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler"
java.lang.IllegalAccessException: Class java.util.logging.LogManager$5 can
not access a member of class
org.wso2.carbon.launcher.bootstrap.logging.FileLogHandler with modifiers
"private"5 

Thanks,
Nipuni
-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Blog : http://nipunipererablog.blogspot.com/
Mobile: +94 (71) 5626680

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


[Dev] Apply modified configuration files with feature installation

2016-03-29 Thread Lakshani Gamage
Hi all,

Some products have done modifications to some configuration files (
carbon.xml, registry xml etc). If the features of those product are
installed from p2-repo, features are not working properly as customization in
config files are missing.

For example, according to product app manager repo, there are some
customized configuration files (master-datasource.xml, carbon.xml,
registry.xml, sso-idp-cofig.xml etc).

App manager has packed all customized files, as those files are copied to
pack from bin.xml.

But If we are going to install app manager features from p2-repo, those
customization go missing. Therefore installed app manager features are not
working properly.  However we can't  bundle those modified configuration
files with app manager features as those configuration files are coming
from several other features. ( carbon, registry, identity features etc)

What is the best option to apply those modification with feature
 installations from p2-repo? Thoughts?

Thanks,
Lakshani.

-- 
Lakshani Gamage

*Software Engineer, WSO2*

*Mobile : +94 71 5478184 <%2B94%20%280%29%20773%20451194>*
*Blog : http://lakshanigamage.blogspot.com/
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] wso2emm enroll agent problem

2016-03-29 Thread Dilshan Edirisuriya
Are you working on EMM 1.1.0 or 2.0? I suggest you to go for 2.0.1 which is
the latest release. Above configurations I have given are for 2.0

Regards,

Dilshan

On Tue, Mar 29, 2016 at 12:09 PM, kaouther kais 
wrote:

> Good morning,
>
> I worked with wso2emm-1.1.0 so in the tutorial i have to modify only
> cdm-config.xml . I tried to modify config.json in
> EMM_HOME>/repository/deployment/server/jaggeryapps/emm/config but doesn't
> work
> PS:we haven't this directory
> EMM_HOME>/repository/deployment/server/jaggeryapps/emm-web-agent/config
>
> Thank you.
> Regards.
>



-- 
Dilshan Edirisuriya
Senior Software Engineer - WSO2
Mob: + 94 777878905
http://wso2.com/
https://www.linkedin.com/profile/view?id=50486426
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] API Requirements for IoT Snapshot Dashboard

2016-03-29 Thread Grainier Perera
Hi all,
As per offline discussion, following are the finalized request-response
structures for IoT snapshot dashboard API;

1. Retrieve security concerns for the given filters.

>
> *Request: *POST /securityConcerns
> *[*
> {
> "*filteringContext*":"connectivityStatus",
> "*filteringGroups*":*[*"active"*]*
> },
> {
> "filteringContext":"alerts",
> "filteringGroups":["high"]
> }
> *]*
>
> *Response:**[*
> {
> "*context*": "securityConcerns",
> "*data*": *[*
> {
> "*group*": "non-compliant",
> "*label*": "Non Compliant",
> "*count*": 5
> },
> {
> "group": "no-passcode",
> "label": "No Passcode",
> "count": 18
> },
> {
> "group": "no-encryption",
> "label": "Non encrypted",
> "count": 23
> },
> {
> "group": "unmonitored",
> "label": "Unmonitored",
> "count": 12
> }
> *]*
> }
> *]*


2. Retrieve all devices.

>
> *Request:*POST /devices
> *[]*
>
> *Response:**[*
> {
> "*context*": "devices",
> "*data*": *[*
> {
> "*id*": "001",
> "*label*": "Nexus P",
> "*status*": "Blocked",
> "*platform*": "Android",
> "*model*": "HNP001",
> "*actions*": URL,
> },
> {
> "id": "002",
> "label": "iPad Mini",
> "status": "Inactive",
> "platform": "iOS",
> "model": "IPM005",
> "actions": URL,
> }
> *]*
> }
> *]*


3. Retrieve devices count for the given filters.

>
> *Request:*POST /devicesCount
> *[*
> {
> "*filteringContext*":"connectivityStatus",
> "*filteringGroups*":*[*"active"*]*
> },
> {
> "filteringContext":"alerts",
> "filteringGroups":["high"]
> }
> *]*
>
> *Response:**[*
> {
> "*context*": "deviceCount",
> "*data*": *[*
> {
> "*group*": "totalCount",
> "*label*": "Total Count",
> "*count*": 210
> },
> {
> "group": "filteredCount",
> "label": "Filtered Count",
> "count": 57
> }
>* ]*
> }
> *]*


Regards,

On Fri, Mar 11, 2016 at 2:02 PM, Grainier Perera  wrote:

> Hi all,
>
> I'm in the process of implementing the first phase of IoT Snapshot
> Dashboard. So far I have managed to create generic bar (both vertical &
> horizontal), stack charts (with inter gadget communication) and a LeafletJS
> based OSM map gadget to be used with the IoT Snapshot Dashboard.
>
> However, there ain't any API to get required data to populate gadgets. [1]
> describes the API requirements for the IoT Snapshot Dashboard. Furthermore,
> as per offline discussion had with DilanA, we decided to use following
> request/response structure and implement the required APIs.
>
> WDYT?
>
> i.e. : all security concerns for the given filters.
> *Request:*
>
>> POST /iot-analytics/securityConcerns
>> {
>> "filters": [
>> {
>> "filter": "platform",
>> "selections" : ["Android", "iOS"]
>> },
>> {
>> "filter": "ownership",
>> "selections" : ["BYOD"]
>> }
>> ],
>> }
>
>
> *Response:*
>
>> {
>> "status": "success",
>> "message": null,
>>   "data": {
>> [
>>{
>>"filter_id":"non-compliant",
>>"name":"Non Compliant Devices",
>>"count":12
>>},
>>{
>>"filter_id":"unmonitored",
>>"name":"Unmonitored Devices",
>>"count":15
>>}
>> ]
>>   },
>> }
>
>
>
> [1]
> https://docs.google.com/a/wso2.com/spreadsheets/d/1EjGCgMvo8Hgi8HQC9AjHxKVdfYYYMwwQ9Rxugk7lwIE/edit?usp=sharing
>
> Regards,
> --
> Grainier Perera
> Software Engineer
> Mobile : +94716122384
> WSO2 Inc. | http://wso2.com
> lean.enterprise.middleware
>



-- 
Grainier Perera
Software Engineer
Mobile : +94716122384
WSO2 Inc. | http://wso2.com
lean.enterprise.middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to create database tables with -Dsetup in Carbon 5?

2016-03-29 Thread Asitha Nanayakkara
+1 for having this as a common feature. MB will also be using this feature
to create the database schema based on the database vendor.

On Tue, Mar 29, 2016 at 11:09 AM, Isuru Perera  wrote:

> Hi Aruna,
>
> I think this feature will be important for other products as most of the
> products will eventually need to create the database schema based on the
> database vendor.
>
> I hope MB team will also need this feature soon and it would be good if
> this feature can be supported in next platform release.
>
> Thanks!
>
> On Fri, Mar 25, 2016 at 2:03 PM, Aruna Karunarathna 
> wrote:
>
>>
>>
>> On Fri, Mar 25, 2016 at 1:45 PM, Isuru Perera  wrote:
>>
>>> Hi,
>>>
>>> In Carbon 4.x.x, we extend [1]
>>> org.wso2.carbon.utils.dbcreator.DatabaseCreator [2]. How can we do the same
>>> in Carbon 5?
>>>
>>
>> Hi Isuru,
>>
>> There is no such feature planned or available ATM for hamming platform
>> release.
>> Regards,
>> Aruna
>>
>>>
>>> Thanks!
>>>
>>> [1]
>>> https://github.com/search?l==DatabaseCreator++user%3Awso2=advsearch=Code=%E2%9C%93
>>> [2]
>>> https://github.com/wso2/carbon-kernel/blob/4.4.x/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/dbcreator/DatabaseCreator.java
>>>
>>> --
>>> Isuru Perera
>>> Associate Technical Lead | WSO2, Inc. | http://wso2.com/
>>> Lean . Enterprise . Middleware
>>>
>>> about.me/chrishantha
>>> Contact: +IsuruPereraWSO2
>>> 
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> *Aruna Sujith Karunarathna *
>> 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
>>
>>
>
>
>
> --
> Isuru Perera
> Associate Technical Lead | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> about.me/chrishantha
> Contact: +IsuruPereraWSO2 
>



-- 
*Asitha Nanayakkara*
Software Engineer
WSO2, Inc. http://wso2.com/
Mob: +94 77 853 0682
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DAS]Abnormal behavior of data after purging a table

2016-03-29 Thread Vithulan Vijayanandan
Hi all,

I tried to repopulate the issue and test with the new fix.
Its working in the expected way! Thanks.

On Tue, Mar 29, 2016 at 11:25 AM, Nirmal Fernando  wrote:

> Great work ! :)
>
> On Tue, Mar 29, 2016 at 11:06 AM, Sachith Withana 
> wrote:
>
>> Hi all,
>>
>> This happened due to the tmp folder getting deleted when running the
>> backup tool.
>> This is fixed now.
>>
>> Thanks,
>> Sachith
>>
>> On Wed, Mar 23, 2016 at 11:40 AM, Sachith Withana 
>> wrote:
>>
>>> Nirmal: I'm looking into this.
>>>
>>> On Wed, Mar 23, 2016 at 11:20 AM, Nirmal Fernando 
>>> wrote:
>>>
 Hi, Anyone looking into this?

 On Mon, Mar 21, 2016 at 11:23 AM, Nirmal Fernando 
 wrote:

> Hi All,
>
> Any thoughts on this? This seems to be a L1.
>
> On Fri, Mar 18, 2016 at 3:27 PM, Sachith Withana 
> wrote:
>
>> [+Gimantha]
>>
>> On Fri, Mar 18, 2016 at 3:26 PM, Sachith Withana 
>> wrote:
>>
>>> Hi all,
>>>
>>> We reproduced the issue, but if we take out the spark script step,
>>> it works fine.
>>> (by using the simulator to get the data in to the table).
>>>
>>> @Niranda:
>>> Any thoughts on why this might be happening?
>>>
>>> Thanks,
>>> Sachith
>>>
>>> On Fri, Mar 18, 2016 at 2:28 PM, Vithulan Vijayanandan <
>>> vithu...@wso2.com> wrote:
>>>
 Hi,

 We are encountering an abnormal behavior of data after purging DAS
 table using analytics backup tool kit [1], -purge command.

 To reproduce this issue,

1. Generate a table (x) from spark script using y table.
2. Purge all the data in x using analytics backup tool command
-purge.
3. Re-populate the table x as in 1.
4. Send events to stream y (Execution plan will refer to table
x when you send events to y)
5. Now if you see the table x, it will be empty.

 [1] https://docs.wso2.com/pages/viewpage.action?pageId=45957285

 Thanks.

 Regards,
 Vithulan.
 --
 *Vithulan MV*

 Intern-Software Engineering
 WSO2, Inc : wso2.com
 Mobile: +94712540524

>>>
>>>
>>>
>>> --
>>> Sachith Withana
>>> Software Engineer; WSO2 Inc.; http://wso2.com
>>> E-mail: sachith AT wso2.com
>>> M: +94715518127
>>> Linked-In: 
>>> https://lk.linkedin.com/in/sachithwithana
>>>
>>
>>
>>
>> --
>> Sachith Withana
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> E-mail: sachith AT wso2.com
>> M: +94715518127
>> Linked-In: 
>> https://lk.linkedin.com/in/sachithwithana
>>
>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Team Lead - WSO2 Machine Learner
> Associate Technical Lead - Data Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
>


 --

 Thanks & regards,
 Nirmal

 Team Lead - WSO2 Machine Learner
 Associate Technical Lead - Data Technologies Team, WSO2 Inc.
 Mobile: +94715779733
 Blog: http://nirmalfdo.blogspot.com/



>>>
>>>
>>> --
>>> Sachith Withana
>>> Software Engineer; WSO2 Inc.; http://wso2.com
>>> E-mail: sachith AT wso2.com
>>> M: +94715518127
>>> Linked-In: 
>>> https://lk.linkedin.com/in/sachithwithana
>>>
>>
>>
>>
>> --
>> Sachith Withana
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> E-mail: sachith AT wso2.com
>> M: +94715518127
>> Linked-In: 
>> https://lk.linkedin.com/in/sachithwithana
>>
>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Team Lead - WSO2 Machine Learner
> Associate Technical Lead - Data Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
>


-- 
*Vithulan MV*

Intern-Software Engineering
WSO2, Inc : wso2.com
Mobile: +94712540524
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Praminda Jayawardana

2016-03-29 Thread Ashen Weerathunga
Congratulations Praminda!!! :)

On Tue, Mar 29, 2016 at 11:26 AM, Janaka Ranabahu  wrote:

> Hi,
>
> It is with great pleasure we welcome Praminda Jayawardana as a
> WSO2 Committer. Congratulations Praminda and keep up the good work!
>
> ​Thanks,
> Janaka​
>
> --
> *Janaka Ranabahu*
> Associate Technical Lead, WSO2 Inc.
> http://wso2.com
>
>
> *E-mail: jan...@wso2.com **M: **+94 718370861
> <%2B94%20718370861>*
>
> Lean . Enterprise . Middleware
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Ashen Weerathunga*
Software Engineer
WSO2 Inc.: http://wso2.com
lean.enterprise.middleware

Email: as...@wso2.com
Mobile: +94 716042995 <94716042995>
LinkedIn: *http://lk.linkedin.com/in/ashenweerathunga
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev