[Dev] [AS] Casting Objects which are loaded by two different classloaders

2014-06-01 Thread Rajkumar Rajaratnam
Hi all,

We are writing our own Servlet Context Initializer for new ProtoBufServices
(Binary Services). We have deployed a  ProtoBufService (HelloService). When
ServletContainerInitializer finds the annotation @ProtoBufService, the
onStartup() method is triggered. Everything works fine except one thing
which is explained here.


@HandlesTypes({ ProtoBufService.class })
public class ProtoBufServletContextInitializer implements
ServletContainerInitializer {

@Override
public void onStartup(SetClass? classes, ServletContext
servletContext)


throws ServletException {

if (classes == null || classes.size() == 0) {
return;
}

for (Class? clazz : classes) {

Method myMethod=null;
try {
myMethod =
clazz.getInterfaces()[0].getDeclaringClass().getMethod(newReflectiveBlockingService,
clazz.getInterfaces()[0]);
} catch (NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}


// get newReflectiveBlockingService() will return a
BlockingService object.
Object blockingServiceObj=null;
try {
blockingServiceObj = myMethod.invoke(null,
clazz.newInstance());
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException |
InstantiationException e) {
e.printStackTrace();
}


BlockingService blockingService = (BlockingService)
blockingServiceObj;
/*
 * Casting throws ClassCastException.
 */



System.out.println(blockingServiceObj.getClass().getClassLoader());
/*
 * Output :
 *
 * WebappClassLoader
  context: /org.wso2.carbon.binary.sample.hello
  delegate: false
  repositories:
/WEB-INF/classes/
-- Parent Classloader:
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5db01ad1

[org.wso2.carbon.tomcat.patch:4.3.0.SNAPSHOT(id=365)]
 */



System.out.println(BlockingService.class.getClassLoader());

/*
 * Output :
 *
 *
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@31887be4
[com.google.protobuf:2.5.0(id=30)]
 */

}
}

}


Now,

BlockingService blockingService= (BlockingService) obj;

throws following ClassCastExecption,

java.lang.ClassCastException:
org.wso2.carbon.binary.sample.Hello$HelloService$2 cannot be cast to
com.google.protobuf.BlockingService


But, HelloService  is type of BlockingService.

*Reason for this error.*

BlockingService is coming from an OSGi bundle (protobuf) and it is loaded
by a classloader,
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@31887be4
[com.google.protobuf:2.5.0(id=30)]

obj is obtained at run time within servlet context initializer and it is
loaded by another classloader,
WebappClassLoader
  context: /org.wso2.carbon.binary.sample.hello
  delegate: false
  repositories:
/WEB-INF/classes/
-- Parent Classloader:
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5db01ad1

[org.wso2.carbon.tomcat.patch:4.3.0.SNAPSHOT(id=365)]


Even though obj and BlockingService are of same type, they cannot be cast
because they are loaded by different class loaders.

How can I solve this problem?

Is there any way we can load protobuf OSGi using the same classloader as
servlet context initializer?

Thanks.


-- 
Rajkumar Rajaratnam
Software Engineer | WSO2, Inc.
Mobile +94777568639 | +94783498120
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Introducing JSR-223 into Jaggery along with Nashorn Support

2014-06-01 Thread Ruchira Wageesha
Hi All,

We have started the integration of JSR-223 i.e. javax.script API with
Jaggery. Sorry for the lengthy mail, but this is just to share the status
and get your all kinds of feedbacks. A Jaggery fork and a distribution with
the following improvements can be found at [1] and [2] respectively. In
case you want to try this out before sharing your feedbacks, you can
download a Jaggery distribution with all the above implementations at [2].
It consists of 5 demo apps. (At the moment, this has been tested only on
linux/mac and you will have to run this either on JDK 7 or 8. As JDK 6
supports only an older version of ECMAScript, this pack will not work. But
in order to get the support even on JDK 6, we will have to pack the JSR-223
rhino implementation with a rhino 1.7 version, following a similar way
described at [7])

With the integration with JSR-223, we had to and thought to do a few
changes and improvements to Jaggery which will be detailed below. BUT,
please note that, every existing Jaggery application will work as it is,
independent of those improvements. i.e. With a version field in
jaggery.conf, we internally decide, whether to go with the newer version.

*Key Decisions*

   1. JSR-223 support
  - With this, Jaggery will use Nashorn from JDK8 onwards and will
  fallback to JDK's embeded Rhino version with JDK7 or below.
   2. Saying good bye for hostobjects
   - Hostobjects are a concept of Rhino and it was needed to follow certain
  conventions when you write your hostobjects. With JSR-223, we cannot have
  it anymore. But, instead of that, you can refactor only the hostobject
  *.java class into *.js file which contains the Java code and plug it.
  3. Dropping E4X support
   - E4X was an extension to ECMAScripts and usage of E4X is being
  deprecated in many places. Also, AFAIK, there is no support for E4X in
  nashorn. This will be replaced by a Axiom/DOM like modules. i.e. without
  altering the spec.
  4. Except the bare minimal, everything else is separated into
   commonjs modules
   - This will give much more flexibility and extendability for Jaggery.
  i.e. In order to extend Jaggery, developers don't need to be Java
  developers anymore
  5. Introduction of app.server() method
   - In the current version, routing mechanism has been implemented by
  Jaggery core and there is no way to intercept that. This makes
it harder to
  write cooler modules for Jaggery, such as express, connect for
node. Using
  app.server(), Jaggery core delegates request serving to a single
callback.
  But, via that callback, users can call their own routing modules and do
  whatever they want. You can even implement the current *.jag
model, on top
  of app.server()[refer demo3]. Also, we have written an express
like routing
  framework which can be used to define REST APIs very easily through
  Jaggery. This will be a good alternative for JAX-RS developers too.
  6. Servlet 3.0 Async support
   - Another key feature is utilizing Async servlet support. So,
  concurrency will not be restricted by the available thread count anymore.
  7. CommonJS module system
  - At the moment, Jaggery has its own module system. Instead of that,
  we though of going ahead with commonjs module specification. With this,
  commonjs compliant modules will be able to use within Jaggery. i.e. Any
  node module which doesn't depend on node core APIs, can be used
in Jaggery
  as well, without doing any change.
  8. Module versioning and nested module support
  - Another improvement is, adding module versioning support for
  Jaggery modules. i.e. x app(or module) can use y1 version of y module,
  while another z app(or module) can use y2 without conflicting each other.
  For this too, we are also using package.json as per the commonjs
  specification
  9. Support for deploying directly on top of tomcat
  - With the above Jaggery core minimisations, a Jaggery app can be
  even deployed on top of tomcat, subjecting to a WEB-INF directory which
  contains jaggery core jars and web.xml
  10. Improved command line tool
  - clamshell-cli based command line tool with history support etc.
  With this, we expect people to write more command line tools
such as built
  tools, package managers etc. using Jaggery

*Demo Apps*

   1. https://github.com/ruchiraw/jaggery/tree/master/apps/demo1
   - this is the bare minimal with app.server()
  - can be accessed via http://localhost:9763/demo1
  2. https://github.com/ruchiraw/jaggery/tree/master/apps/demo2
   - this shows about module versioning and nested modules
  - can be accessed via http://localhost:9763/demo2
   3. https://github.com/ruchiraw/jaggery/tree/master/apps/demo3
  - this shows how you can implement *.jag support on top of app.serve()
  - can be accessed via http://localhost:9763/demo3/index.jag
  - 

Re: [Dev] [AS] Casting Objects which are loaded by two different classloaders

2014-06-01 Thread Kasun Gajasinghe
Hi Rajkumar,

You can get the webapp classloader instance via ServletContext [1]. Then
you could temporarily set the current thread context classloader just for
the casting operation [2]. After that, set it back to the previous
classloader. There might be better ways to do this though!


[1]
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getClassLoader()
[2]
http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html#setContextClassLoader(java.lang.ClassLoader)

Regards,
KasunG



On Sun, Jun 1, 2014 at 11:37 AM, Rajkumar Rajaratnam rajkum...@wso2.com
wrote:

 Hi all,

 We are writing our own Servlet Context Initializer for new
 ProtoBufServices (Binary Services). We have deployed a  ProtoBufService
 (HelloService). When ServletContainerInitializer finds the annotation
 @ProtoBufService, the onStartup() method is triggered. Everything works
 fine except one thing which is explained here.


 @HandlesTypes({ ProtoBufService.class })
 public class ProtoBufServletContextInitializer implements
 ServletContainerInitializer {

 @Override
 public void onStartup(SetClass? classes, ServletContext
 servletContext)


 throws ServletException {

 if (classes == null || classes.size() == 0) {
 return;
 }

 for (Class? clazz : classes) {

 Method myMethod=null;
 try {
 myMethod =
 clazz.getInterfaces()[0].getDeclaringClass().getMethod(newReflectiveBlockingService,
 clazz.getInterfaces()[0]);
 } catch (NoSuchMethodException | SecurityException e) {
 e.printStackTrace();
 }


 // get newReflectiveBlockingService() will return a
 BlockingService object.
 Object blockingServiceObj=null;
 try {
 blockingServiceObj = myMethod.invoke(null,
 clazz.newInstance());
 } catch (IllegalAccessException | IllegalArgumentException
 | InvocationTargetException |
 InstantiationException e) {
 e.printStackTrace();
 }


 BlockingService blockingService = (BlockingService)
 blockingServiceObj;
 /*
  * Casting throws ClassCastException.
  */



 System.out.println(blockingServiceObj.getClass().getClassLoader());
 /*
  * Output :
  *
  * WebappClassLoader
   context: /org.wso2.carbon.binary.sample.hello
   delegate: false
   repositories:
 /WEB-INF/classes/
 -- Parent Classloader:
 org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5db01ad1

 [org.wso2.carbon.tomcat.patch:4.3.0.SNAPSHOT(id=365)]
  */



 System.out.println(BlockingService.class.getClassLoader());

 /*
  * Output :
  *
  *
 org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@31887be4
 [com.google.protobuf:2.5.0(id=30)]
  */

 }
 }

 }


 Now,

 BlockingService blockingService= (BlockingService) obj;

 throws following ClassCastExecption,

 java.lang.ClassCastException:
 org.wso2.carbon.binary.sample.Hello$HelloService$2 cannot be cast to
 com.google.protobuf.BlockingService


 But, HelloService  is type of BlockingService.

 *Reason for this error.*

 BlockingService is coming from an OSGi bundle (protobuf) and it is loaded
 by a classloader,
 org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@31887be4
 [com.google.protobuf:2.5.0(id=30)]

 obj is obtained at run time within servlet context initializer and it is
 loaded by another classloader,
 WebappClassLoader
   context: /org.wso2.carbon.binary.sample.hello
   delegate: false
   repositories:
 /WEB-INF/classes/
 -- Parent Classloader:
 org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5db01ad1

 [org.wso2.carbon.tomcat.patch:4.3.0.SNAPSHOT(id=365)]


 Even though obj and BlockingService are of same type, they cannot be cast
 because they are loaded by different class loaders.

 How can I solve this problem?

 Is there any way we can load protobuf OSGi using the same classloader as
 servlet context initializer?

 Thanks.


 --
 Rajkumar Rajaratnam
 Software Engineer | WSO2, Inc.
 Mobile +94777568639 | +94783498120




-- 

*Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Sohani Weerasinghe

2014-06-01 Thread Dilini Muthumala
Congrats, Sohani!


On Sun, Jun 1, 2014 at 9:31 AM, Rajith Vitharana raji...@wso2.com wrote:

 congrats!!!


 On Sat, May 31, 2014 at 8:58 AM, Tania Mahanama ta...@wso2.com wrote:

 Congrats!!


 On Sat, May 31, 2014 at 7:58 AM, Thanuja Jayasinghe than...@wso2.com
 wrote:

 Congratz!!!
 On 30 May 2014 17:00, Lali Devamanthri l...@wso2.com wrote:

 Congratulations 


 On Fri, May 30, 2014 at 11:06 AM, Jasintha Dasanayake 
 jasin...@wso2.com wrote:

 Hi All,

 It's my distinct pleasure to welcome Sohani as a WSO2 Committer.

 Sohani has  been a valuable contributor for WSO2 Developer Studio
 since she joined WSO2. In recognition of her contributions to WSO2, she 
 has
 been voted as a WSO2 Committer.

 Sohani, Congratulations and Keep up the good work!

 Thanks and Regards,
 /Jasintha


 --

 *Jasintha Dasanayake *

 *Senior Software EngineerWSO2 Inc. | http://wso2.com
 http://wso2.com/ lean . enterprise . middleware*


 *mobile :- 0711368118 0711368118 *

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




 --
 *Lali Sudaththa Devamanthri*
 Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: +94 71 895 4922
  http://www.wso2.com

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


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




 --
 Tania Mahanama
 Senior Technical Writer

 Contact:
 Mob: +94 077 5129270

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




 --
 Rajith Vitharana


 Software Engineer,
 WSO2 Inc. : wso2.com
 Mobile : +94715883223
 Blog : http://lankavitharana.blogspot.com/

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




-- 
*Dilini Muthumala*
Software Engineer,
WSO2 Inc.

*E-mail :* dil...@wso2.com
*Mobile: *+94713 400 029
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Lali Devamanthri

2014-06-01 Thread Dilini Muthumala
Congrats!!


On Sat, May 31, 2014 at 8:59 AM, Tania Mahanama ta...@wso2.com wrote:

 Congrats!!


 On Sat, May 31, 2014 at 8:04 AM, Thanuja Jayasinghe than...@wso2.com
 wrote:

 Congratz!!!
 On 30 May 2014 20:15, Isuruwan Herath isuru...@wso2.com wrote:

 Congrats Lali!!!


 On Fri, May 30, 2014 at 7:01 AM, Waruna Jayaweera waru...@wso2.com
 wrote:

 Congratzz...:D


 On Fri, May 30, 2014 at 12:11 PM, Dinesh Bandara dine...@wso2.com
 wrote:

 Congratulations !


 On Fri, May 30, 2014 at 11:08 AM, Jasintha Dasanayake 
 jasin...@wso2.com wrote:

 Hi All,

 It's my distinct pleasure to welcome Lali as a WSO2 Committer.

 Lali has  been a valuable contributor for WSO2 Developer Studio since
 he joined WSO2. In recognition of his contributions to WSO2, he has been
 voted as a WSO2 Committer.

 Lali, Congratulations and Keep up the good work!

 Thanks and Regards,
 /Jasintha

 --

 *Jasintha Dasanayake *

 *Senior Software EngineerWSO2 Inc. | http://wso2.com
 http://wso2.com/ lean . enterprise . middleware*


 *mobile :- 0711368118*

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




 --
 *Dinesh Bandara*

 Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware


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




 --
 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




 --
 Isuruwan Herath
 Technical Lead

 Contact: +94 776 273 296

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


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




 --
 Tania Mahanama
 Senior Technical Writer

 Contact:
 Mob: +94 077 5129270

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




-- 
*Dilini Muthumala*
Software Engineer,
WSO2 Inc.

*E-mail :* dil...@wso2.com
*Mobile: *+94713 400 029
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-01 Thread Nipuni Perera
Hi,

I am working on the $subject. According to the current implementation users
has to put webapps inside repositro/depolment/server/webapss and access
them via host name localhost only. I have modified carbontomcat.java to
deploy webapps in a location defined inside appBase of virtualhosts. But
this needs to add an entry to component.xml to direct the name of webapps
directory to the relevent WebAppDeployer class. (Adding an entry to
component.xml each time a new appBase is created is not preferred)

I have tried following steps when adding deployers to deployment engine
without reading component.xml file. When reading component.xml file, the
Axis2DeployerRegistry class adds the deployers and relevant directory names
to a deploymentEngine. In order to skip reading component.xml, deployment
engine should be updated using the virtual host appBase values and deployer
names.

*Scenario 1*


   1. I created a new service component class inside
   /org/wso2/carbon/webapp/deployer/internal/ and added following,

 CarbonTomcatService carbonTomcatService =
DataHolder.getCarbonTomcatService();
 DeploymentEngine deploymentEngine =
(DeploymentEngine)(DataHolder.getServerConfigContext().getAxisConfiguration()).getConfigurator();

 This gave null values to both variables.
(serverConfigContext and carbonTomcatService variables initialize
inside service components in /org/wso2/carbon/webapp/mgt/internal. So it
seems the newly created service component classes executes first)

*Scenario 2*

   1.  I have created a new OSGI bundle which tries to read above two
   variables inside its Activator class and service component class. I could
   read proper values inside the service component class and update deployment
   engine. But according to logs, this executes after starting the wso2
   carbon.  But, the following statement does deploy the webapps inside the
   appBase.

deploymentEngine.addDeployer(deployer,
directory, extension);

But I am able to access webapps using host name localhost only,  What
could be the issue here?


Thanks,

Nipuni


-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680
http://wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] {BAM, AS]Service stat data publishing agent gives connection error

2014-06-01 Thread Vijayaratha Vijayasingam
Hi all;
AS 5.2.1/BAM 2.4.0

I have a set up AS to publish events to BAM. When i try TestSErver
option, it connects to BAM successfully.
But when i invoke a service(so, AS will publish events to BAM),
i get following error at AS end.[1]
What i'm doing wrong here?

[1]

TID: [0] [AS] [2014-06-01 16:31:23,100] ERROR
{org.wso2.carbon.databridge.agent.
thrift.AsyncDataPublisher} -  Reconnection failed for  tcp://
10.21.203.40:7611 {
org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher}
TID: [0] [AS] [2014-06-01 16:31:24,233] ERROR
{org.wso2.carbon.databridge.agent.
thrift.AsyncDataPublisher} -  Reconnection failed for  tcp://
10.21.203.40:7611 {
org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher}

thanks.
-- 
-Ratha
mobile: (+94)755906608
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] {BAM, AS]Service stat data publishing agent gives connection error

2014-06-01 Thread Vijayaratha Vijayasingam
looks like a infra issue..telnet seems not working..


On 1 June 2014 16:40, Vijayaratha Vijayasingam rat...@wso2.com wrote:


 Hi all;
 AS 5.2.1/BAM 2.4.0

 I have a set up AS to publish events to BAM. When i try TestSErver
 option, it connects to BAM successfully.
 But when i invoke a service(so, AS will publish events to BAM),
 i get following error at AS end.[1]
 What i'm doing wrong here?

 [1]

 TID: [0] [AS] [2014-06-01 16:31:23,100] ERROR
 {org.wso2.carbon.databridge.agent.
 thrift.AsyncDataPublisher} -  Reconnection failed for  tcp://
 10.21.203.40:7611 {
 org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher}
 TID: [0] [AS] [2014-06-01 16:31:24,233] ERROR
 {org.wso2.carbon.databridge.agent.
 thrift.AsyncDataPublisher} -  Reconnection failed for  tcp://
 10.21.203.40:7611 {
 org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher}

 thanks.
 --
 -Ratha
 mobile: (+94)755906608




-- 
-Ratha
mobile: (+94)755906608
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Architecture] Introducing JSR-223 into Jaggery along with Nashorn Support

2014-06-01 Thread Srinath Perera
Ruchira, did you already had a session with Sanjiva?

Let me know if we need to schedule.

Do you have an example how app.server() works?


On Sun, Jun 1, 2014 at 12:58 PM, Ruchira Wageesha ruch...@wso2.com wrote:

 Hi All,

 We have started the integration of JSR-223 i.e. javax.script API with
 Jaggery. Sorry for the lengthy mail, but this is just to share the status
 and get your all kinds of feedbacks. A Jaggery fork and a distribution with
 the following improvements can be found at [1] and [2] respectively. In
 case you want to try this out before sharing your feedbacks, you can
 download a Jaggery distribution with all the above implementations at [2].
 It consists of 5 demo apps. (At the moment, this has been tested only on
 linux/mac and you will have to run this either on JDK 7 or 8. As JDK 6
 supports only an older version of ECMAScript, this pack will not work. But
 in order to get the support even on JDK 6, we will have to pack the JSR-223
 rhino implementation with a rhino 1.7 version, following a similar way
 described at [7])

 With the integration with JSR-223, we had to and thought to do a few
 changes and improvements to Jaggery which will be detailed below. BUT,
 please note that, every existing Jaggery application will work as it is,
 independent of those improvements. i.e. With a version field in
 jaggery.conf, we internally decide, whether to go with the newer version.

 *Key Decisions*

1. JSR-223 support
   - With this, Jaggery will use Nashorn from JDK8 onwards and will
   fallback to JDK's embeded Rhino version with JDK7 or below.
2. Saying good bye for hostobjects
- Hostobjects are a concept of Rhino and it was needed to follow
   certain conventions when you write your hostobjects. With JSR-223, we
   cannot have it anymore. But, instead of that, you can refactor only the
   hostobject *.java class into *.js file which contains the Java code and
   plug it.
   3. Dropping E4X support
- E4X was an extension to ECMAScripts and usage of E4X is being
   deprecated in many places. Also, AFAIK, there is no support for E4X in
   nashorn. This will be replaced by a Axiom/DOM like modules. i.e. without
   altering the spec.
   4. Except the bare minimal, everything else is separated into
commonjs modules
- This will give much more flexibility and extendability for Jaggery.
   i.e. In order to extend Jaggery, developers don't need to be Java
   developers anymore
   5. Introduction of app.server() method
- In the current version, routing mechanism has been implemented by
   Jaggery core and there is no way to intercept that. This makes it 
 harder to
   write cooler modules for Jaggery, such as express, connect for node. 
 Using
   app.server(), Jaggery core delegates request serving to a single 
 callback.
   But, via that callback, users can call their own routing modules and do
   whatever they want. You can even implement the current *.jag model, on 
 top
   of app.server()[refer demo3]. Also, we have written an express like 
 routing
   framework which can be used to define REST APIs very easily through
   Jaggery. This will be a good alternative for JAX-RS developers too.
   6. Servlet 3.0 Async support
- Another key feature is utilizing Async servlet support. So,
   concurrency will not be restricted by the available thread count 
 anymore.
   7. CommonJS module system
   - At the moment, Jaggery has its own module system. Instead of
   that, we though of going ahead with commonjs module specification. With
   this, commonjs compliant modules will be able to use within Jaggery. 
 i.e.
   Any node module which doesn't depend on node core APIs, can be used in
   Jaggery as well, without doing any change.
   8. Module versioning and nested module support
   - Another improvement is, adding module versioning support for
   Jaggery modules. i.e. x app(or module) can use y1 version of y module,
   while another z app(or module) can use y2 without conflicting each 
 other.
   For this too, we are also using package.json as per the commonjs
   specification
   9. Support for deploying directly on top of tomcat
   - With the above Jaggery core minimisations, a Jaggery app can be
   even deployed on top of tomcat, subjecting to a WEB-INF directory which
   contains jaggery core jars and web.xml
   10. Improved command line tool
   - clamshell-cli based command line tool with history support etc.
   With this, we expect people to write more command line tools such as 
 built
   tools, package managers etc. using Jaggery

 *Demo Apps*

1. https://github.com/ruchiraw/jaggery/tree/master/apps/demo1
- this is the bare minimal with app.server()
   - can be accessed via http://localhost:9763/demo1
   2. https://github.com/ruchiraw/jaggery/tree/master/apps/demo2
- this shows 

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-01 Thread Nipuni Perera
Hi,

This is working. This was due to an ip address conflict.

Thanks,
Nipuni


On Sun, Jun 1, 2014 at 3:41 PM, Nipuni Perera nip...@wso2.com wrote:

 Hi,

 I am working on the $subject. According to the current implementation
 users has to put webapps inside repositro/depolment/server/webapss and
 access them via host name localhost only. I have modified
 carbontomcat.java to deploy webapps in a location defined inside appBase of
 virtualhosts. But this needs to add an entry to component.xml to direct the
 name of webapps directory to the relevent WebAppDeployer class. (Adding an
 entry to component.xml each time a new appBase is created is not preferred)

 I have tried following steps when adding deployers to deployment engine
 without reading component.xml file. When reading component.xml file, the
 Axis2DeployerRegistry class adds the deployers and relevant directory names
 to a deploymentEngine. In order to skip reading component.xml, deployment
 engine should be updated using the virtual host appBase values and deployer
 names.

 *Scenario 1*


1. I created a new service component class inside
/org/wso2/carbon/webapp/deployer/internal/ and added following,

  CarbonTomcatService carbonTomcatService =
 DataHolder.getCarbonTomcatService();
  DeploymentEngine deploymentEngine =
 (DeploymentEngine)(DataHolder.getServerConfigContext().getAxisConfiguration()).getConfigurator();

  This gave null values to both variables.
 (serverConfigContext and carbonTomcatService variables initialize
 inside service components in /org/wso2/carbon/webapp/mgt/internal. So it
 seems the newly created service component classes executes first)

 *Scenario 2*

1.  I have created a new OSGI bundle which tries to read above two
variables inside its Activator class and service component class. I could
read proper values inside the service component class and update deployment
engine. But according to logs, this executes after starting the wso2
carbon.  But, the following statement does deploy the webapps inside the
appBase.

 deploymentEngine.addDeployer(deployer,
 directory, extension);

 But I am able to access webapps using host name localhost only,  What
 could be the issue here?


 Thanks,

 Nipuni


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




-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680
http://wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] APIMANAGER-2158 hostobject issue, Do we need to fix it?

2014-06-01 Thread Chamil Jeewantha
Hi Ruchira,

The fix for the issue APIMANAGER-2158 [1] is related to hostobjects. The
mail on architecture group with the subject Introducing JSR-223 into
Jaggery along with Nashorn Support says, good bye for hostobjects. Is
there any point of fixing this issue further?

[1] https://wso2.org/jira/browse/APIMANAGER-2158

-- 
K.D. Chamil Jeewantha
Associate Technical Lead
WSO2, Inc.;  http://wso2.com
Mobile: +94716813892
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB] Class mediator - task scheduler error

2014-06-01 Thread Gayashan Amarasinghe
Hi Dushan,

Thanks for the suggestions. In fact i did remote debug the code and
couldn't yet identify what's causing the issue. I extracted a fresh ESB and
now the class mediator is working when it's put in to the main sequence and
invoked from a scheduled task. The same code is working as expected in this
case. I think i might have messed with the synapse configuration somehow.

This class mediator calls upon a REST api via HTTP POST and parses the xml
returned as the result. Then the contents of this xml is inserted to the
soap body of the MessageContext and sent to an aggregator mediator which
will aggregate similar soap messages. More info about the project can be
found at [1] in the architecture@.

Thanks.

[1] [Training Project] Monitoring WSO2 cloud with CEP and BAM - System
Overview - http://markmail.org/message/fka2zrb6qbq3b77i

/Gayashan


On Sat, May 31, 2014 at 8:30 PM, Dushan Abeyruwan dus...@wso2.com wrote:

  ute(MessageInjector.java:315)
 at
 org.apache.synapse.startup.quartz.SimpleQuartzJob.execute(SimpleQuartzJob.java:88)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
 at
 org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
 Caused by: java.lang.NullPointerException
 at
 org.wso2.cloud.monitor.agent.esb.mediators.icinga.IcingaAdapter.mediate(IcingaAdapter.java:89)


what this class mediator does ? its obvious theat error thrown from
 your class mediator, debug it.


  at
 org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
 ... 11 more
 [2014-05-30 15:16:12,137] ERROR - ErrorLogger Job
 (synapse.simple.quartz.TriggerSequence threw an exception.
 org.quartz.SchedulerException: Job threw an unhandled exception. [See
 nested exception: org.apache.synapse.SynapseException: Error occured in the
 mediation of the class mediator]
 at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
 at
 org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
 Caused by: org.apache.synapse.SynapseException: Error occured in the
 mediation of the class mediator
 at
 org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:82)
 at
 org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
 at
 org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
 at
 org.apache.synapse.mediators.filters.InMediator.mediate(InMediator.java:61)
 at
 org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
 at
 org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
 at
 org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
 at
 org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:228)
 at
 org.apache.synapse.startup.tasks.MessageInjector.execute(MessageInjector.java:315)
 at
 org.apache.synapse.startup.quartz.SimpleQuartzJob.execute(SimpleQuartzJob.java:88)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
 ... 1 more
 Caused by: java.lang.NullPointerException
 at
 org.wso2.cloud.monitor.agent.esb.mediators.icinga.IcingaAdapter.mediate(IcingaAdapter.java:89)
 at
 org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
 ... 11 more


 Any help would be much appreciated!

 Thanks.

 /Gayashan

 --
 Gayashan Amarasinghe
 Software Engineer
 WSO2, Inc. ; http://wso2.com
 lean. enterprise. middleware

 Mobile: +94718314517
 Blog: gayashan-a.blogspot.com

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




 --
 Dushan Abeyruwan | Associate Tech Lead
  Integration Technologies Team
 PMC Member Apache Synpase
 WSO2 Inc. http://wso2.com/
 Blog:http://dushansview.blogspot.com/
 Mobile:(0094)713942042




-- 
Gayashan Amarasinghe
Software Engineer
WSO2, Inc. ; http://wso2.com
lean. enterprise. middleware

Mobile: +94718314517
Blog: gayashan-a.blogspot.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev