You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Morten <mo...@yahoo.dk> on 2010/04/26 01:52:53 UTC

Problem: OSGI modules and services in javax.scripting (JRuby/Grovvy scripts etc) ?

I am new to OSGI and felix but strongly considering moving to both and have some related questions about javax.scripting and OSGI services.

My situation: 
I am developing a web based framework with a service interface that can be implemented in java or in most JVM based languages that support the javax.scripting api in JDK 6. The app can be run standalone using an embedded webserver or inside a modern webserver such as Glassfish 3.

Currently I use a homegrown plugin scheme with an xml file describe the service implementation module and a script file (f.x. *.rb for jruby) or jar file with the implementation. The plugin manager just scans the classpath and load all plugins in any language. 

I am currently exploring the possibility to move to a OSGI based platform and felix in particular since it is used by Glassfish also. 

Question:
Moving to OSGI+Felix would give me some benefits regarding isolation+versioning but also complicate matters and apparently limit functionality I already have. Most importantly, I can't find any information about easily supporting scripting languages in OSGI modules (as implementers of services in particular).

Easy is the key word as I would not expect f.x. jruby suppliers to know about OSGI and they would properly not like to deal with activators, osgi lifecycle, multithreading (*), jar files just etc. Also, for jruby I would like users just to be able to supply a *.rb file + an xml file + an osgi manifest file, so some kind of support for exploded "jars" with script code in it would be nice.

Unfortunately, none of this seems to be supported directly by OSGi and/or Felix. I guess I could write some kind of bridge/proxy module in Java that delegates to the script code but then I would have collect scripts in one module and do my own custom scanning for scripts or have multiple instances which is not allowed in OSGI (both of which seems quite unattractive) ? 

(*) Ideally, I would like to force a single-threaded, restricted lifecycle running environment on the scripts. 

Any pointers/help much appreciated?

/Morten Christensen

  




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem: OSGI modules and services in javax.scripting (JRuby/Grovvy scripts etc) ?

Posted by Morten <mo...@yahoo.dk>.
Hi Manuel,

Thank you very much. I will look at Clerezza. You will hear from me if I have any questions or improvements to contribute.

Thanks!!!

Cheers,
Morten

--- Den man 26/4/10 skrev Manuel Innerhofer <ma...@trialox.org>:

> Fra: Manuel Innerhofer <ma...@trialox.org>
> Emne: Re: Problem: OSGI modules and services in javax.scripting (JRuby/Grovvy scripts etc) ?
> Til: users@felix.apache.org
> Dato: mandag 26. april 2010 02.47
> Hi,
> 
> On the Clerezza platform [1] we also support scripting [2].
> 
> ScriptEngineFactoryS which are specified through a
> "META-INF/services/javax.script.ScriptEngineFactory" file
> are registered
> as OSGi services. The registration is done by our
> ScriptEngineFactoryManager.
> Further we implemented the ScriptExecution service which
> provides an api
> for executing scripts. It binds all ScriptEngineFactoryS
> services. 
> 
> We also bundelized JRuby [3].
> 
> The scripting project has a dependency that requires a
> large portion of
> our platform, therefore it is probably not what you are
> looking for. But
> maybe you can get some inspiration for your project.
> 
> Cheers,
> Manuel
> 
> [1] http://incubator.apache.org/clerezza/
> [2] https://svn.apache.org/repos/asf/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.scripting/
> [3] https://svn.apache.org/repos/asf/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.ext.org.jruby/
> 
> On Sun, 2010-04-25 at 23:52 +0000, Morten wrote:
> > I am new to OSGI and felix but strongly considering
> moving to both and have some related questions about
> javax.scripting and OSGI services.
> > 
> > My situation: 
> > I am developing a web based framework with a service
> interface that can be implemented in java or in most JVM
> based languages that support the javax.scripting api in JDK
> 6. The app can be run standalone using an embedded webserver
> or inside a modern webserver such as Glassfish 3.
> > 
> > Currently I use a homegrown plugin scheme with an xml
> file describe the service implementation module and a script
> file (f.x. *.rb for jruby) or jar file with the
> implementation. The plugin manager just scans the classpath
> and load all plugins in any language. 
> > 
> > I am currently exploring the possibility to move to a
> OSGI based platform and felix in particular since it is used
> by Glassfish also. 
> > 
> > Question:
> > Moving to OSGI+Felix would give me some benefits
> regarding isolation+versioning but also complicate matters
> and apparently limit functionality I already have. Most
> importantly, I can't find any information about easily
> supporting scripting languages in OSGI modules (as
> implementers of services in particular).
> > 
> > Easy is the key word as I would not expect f.x. jruby
> suppliers to know about OSGI and they would properly not
> like to deal with activators, osgi lifecycle, multithreading
> (*), jar files just etc. Also, for jruby I would like users
> just to be able to supply a *.rb file + an xml file + an
> osgi manifest file, so some kind of support for exploded
> "jars" with script code in it would be nice.
> > 
> > Unfortunately, none of this seems to be supported
> directly by OSGi and/or Felix. I guess I could write some
> kind of bridge/proxy module in Java that delegates to the
> script code but then I would have collect scripts in one
> module and do my own custom scanning for scripts or have
> multiple instances which is not allowed in OSGI (both of
> which seems quite unattractive) ? 
> > 
> > (*) Ideally, I would like to force a single-threaded,
> restricted lifecycle running environment on the scripts. 
> > 
> > Any pointers/help much appreciated?
> > 
> > /Morten Christensen
> > 
> >   
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem: OSGI modules and services in javax.scripting (JRuby/Grovvy scripts etc) ?

Posted by Manuel Innerhofer <ma...@trialox.org>.
Hi,

On the Clerezza platform [1] we also support scripting [2]. 
ScriptEngineFactoryS which are specified through a
"META-INF/services/javax.script.ScriptEngineFactory" file are registered
as OSGi services. The registration is done by our
ScriptEngineFactoryManager.
Further we implemented the ScriptExecution service which provides an api
for executing scripts. It binds all ScriptEngineFactoryS services. 

We also bundelized JRuby [3].

The scripting project has a dependency that requires a large portion of
our platform, therefore it is probably not what you are looking for. But
maybe you can get some inspiration for your project.

Cheers,
Manuel

[1] http://incubator.apache.org/clerezza/
[2] https://svn.apache.org/repos/asf/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.scripting/
[3] https://svn.apache.org/repos/asf/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.ext.org.jruby/

On Sun, 2010-04-25 at 23:52 +0000, Morten wrote:
> I am new to OSGI and felix but strongly considering moving to both and have some related questions about javax.scripting and OSGI services.
> 
> My situation: 
> I am developing a web based framework with a service interface that can be implemented in java or in most JVM based languages that support the javax.scripting api in JDK 6. The app can be run standalone using an embedded webserver or inside a modern webserver such as Glassfish 3.
> 
> Currently I use a homegrown plugin scheme with an xml file describe the service implementation module and a script file (f.x. *.rb for jruby) or jar file with the implementation. The plugin manager just scans the classpath and load all plugins in any language. 
> 
> I am currently exploring the possibility to move to a OSGI based platform and felix in particular since it is used by Glassfish also. 
> 
> Question:
> Moving to OSGI+Felix would give me some benefits regarding isolation+versioning but also complicate matters and apparently limit functionality I already have. Most importantly, I can't find any information about easily supporting scripting languages in OSGI modules (as implementers of services in particular).
> 
> Easy is the key word as I would not expect f.x. jruby suppliers to know about OSGI and they would properly not like to deal with activators, osgi lifecycle, multithreading (*), jar files just etc. Also, for jruby I would like users just to be able to supply a *.rb file + an xml file + an osgi manifest file, so some kind of support for exploded "jars" with script code in it would be nice.
> 
> Unfortunately, none of this seems to be supported directly by OSGi and/or Felix. I guess I could write some kind of bridge/proxy module in Java that delegates to the script code but then I would have collect scripts in one module and do my own custom scanning for scripts or have multiple instances which is not allowed in OSGI (both of which seems quite unattractive) ? 
> 
> (*) Ideally, I would like to force a single-threaded, restricted lifecycle running environment on the scripts. 
> 
> Any pointers/help much appreciated?
> 
> /Morten Christensen
> 
>   
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org