You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Lance Frohman <lf...@gmail.com> on 2011/10/19 17:06:51 UTC

java scripting inside a bundle

Does anyone have experience using the javax.script scripting inside a
bundle?
Normally you can add the jar(s) for any script language (ruby, python, ...)
to
the class path, and the scripting is available from

new ScriptEngineManager().getEngineByExtension(extension)

(extension is "rb" for ruby, "py" for python, ...)
without doing anything else.

but this does not work when the script jars are inside a bundle (in the
bundle classpath).

Thanks,
Lance

Re: java scripting inside a bundle

Posted by Justin Edelson <ju...@justinedelson.com>.
Lance:
You might also want to look at Apache Sling's scripting support. After
installing a few bundles (I'd need to test to be sure, but my guess is
its probably 3 or 4), you can get a ScriptEngineManager from the OSGi
service registry.

If you have questions about this approach, probably better to post
them on the sling-users mailing list.

Regards,
Justin

On Wed, Oct 19, 2011 at 11:15 AM, Andrei Pozolotin
<an...@gmail.com> wrote:
> Lance:
>
> the underlying problem is that
> http://download.oracle.com/javase/6/docs/api/javax/script/ScriptEngineManager.html
>
> is using spi
> http://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider
>
> which is to be supported soon in osgi (page 145):
> http://www.osgi.org/download/osgi-early-draft-2011-09.pdf
>
> in my case, I activate script engine in the osgi host embedder,
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
>
> and access it via TCCL
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
>
> to avoid the issue.
>
> Andrei.
>
> -------- Original Message  --------
> Subject: java scripting inside a bundle
> From: Lance Frohman <lf...@gmail.com>
> To: users@felix.apache.org
> Date: Wed 19 Oct 2011 10:06:51 AM CDT
>> Does anyone have experience using the javax.script scripting inside a
>> bundle?
>> Normally you can add the jar(s) for any script language (ruby, python, ...)
>> to
>> the class path, and the scripting is available from
>>
>> new ScriptEngineManager().getEngineByExtension(extension)
>>
>> (extension is "rb" for ruby, "py" for python, ...)
>> without doing anything else.
>>
>> but this does not work when the script jars are inside a bundle (in the
>> bundle classpath).
>>
>> Thanks,
>> Lance
>>
>>
>
>

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


Re: java scripting inside a bundle

Posted by Andrei Pozolotin <an...@gmail.com>.
Lance:

the underlying problem is that
http://download.oracle.com/javase/6/docs/api/javax/script/ScriptEngineManager.html

is using spi
http://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider

which is to be supported soon in osgi (page 145):
http://www.osgi.org/download/osgi-early-draft-2011-09.pdf

in my case, I activate script engine in the osgi host embedder,
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html

and access it via TCCL
http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html

to avoid the issue.

Andrei.

-------- Original Message  --------
Subject: java scripting inside a bundle
From: Lance Frohman <lf...@gmail.com>
To: users@felix.apache.org
Date: Wed 19 Oct 2011 10:06:51 AM CDT
> Does anyone have experience using the javax.script scripting inside a
> bundle?
> Normally you can add the jar(s) for any script language (ruby, python, ...)
> to
> the class path, and the scripting is available from
>
> new ScriptEngineManager().getEngineByExtension(extension)
>
> (extension is "rb" for ruby, "py" for python, ...)
> without doing anything else.
>
> but this does not work when the script jars are inside a bundle (in the
> bundle classpath).
>
> Thanks,
> Lance
>
>