Hi Michael,

If I am reading your post correctly, I think you should be able to do what you want (and we are doing it... ;o) ).  I'd like to elaborate, but I am in the middle of a release process right now.  If you can hang on a couple days I'll post a little more in-depth.  Basically, you can iterate over the bundles and figure out what packages each bundle "exports", and add them to Jython system state (so Jython will know about the package names) - and if you write your own classloader, you can then have Eclipse load the class for you.  It all seems to work great for me.  I'll get back to you with some code in a couple days if no-one else chimes in before then.

Mark.
----------------------------------------------------------



"Michael J. Kitchin" <mcoyote_jr@yahoo.com>
Sent by: jython-users-admin@lists.sourceforge.net

02/08/2006 06:00 PM
Please respond to
mcoyote@mcoyote.com

To
jython-users@lists.sourceforge.net
cc
Subject
[Jython-users] Best approach to embedding jython w/in Eclipse RCP plugin





Hi there,

Been using jython in different contexts for some
years, and have finally been stumped enough to write
in (everything else has been so straightforward and
well done, thanks a bunch).

Basically, my embedded jython engine is part of an
eclipse rcp plugin, and I need to reach classes
deployed in other plugins to make it useful.

Our goal, specifically, is to have a jython-containing
scripting plugin that is not explicitly depended upon
by most/all of the other plugins, so those developers
don't have to take any special steps to make their
classes available and scriptable.

The eclipse/OSGI classloader makes this hard, however,
by controlling what jars and classes are visible among
plugins very carefully.

For example, in order for jython to detect classes in
another plugin from within its own, that other plugin
must (a) depend on the jython plugin and (b) wrap up
its classes in a jar and contribute that (and any
included third party ones) to the aggregate classpath.

This is because, it appears, jython will not be able
to import a package/class without an actual jar to
index, and even the location and abundance of these
jars in the file system are not determinable until
runtime.

Our solution seems to be exporting jars in either the
above way or referencing them through extension
points, so we're stumped because this may make jython
impractical for how our software is being developed
and deployed.

The eclipse buddy classloader and dynamic-import
manifest settings appear to have no effect on jython,
BTW, though they help our hibernate deployment out
because it can now serialize/deserialize classes that
it couldn't without them.

I've also noticed the add_extdir()/add_package() and
related calls on PySystemState, so I'm hoping there is
a way to have jython not depend on pre-cacheing object
definitions, but I'd like to check here first and see
if this has previously been done by somebody else.

Thanks, in advance.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users