I think even if we strip the extension registry out of the runtime, we
still need to worry about OSGi layer. In order to use plug-ins outside
Eclipse, the application should be able to:
1. Parse the plugin.xml. Generate and manage the extension
registry.
2. Create class by using the information in the extension
registry.
In Eclipse, #1 is implemented by org.eclipse.core.runtime, while #2 is
implemented by OSGi layer. So, even if we can do #1, we still need to
somehow implement #2, which involves bundle
management and classloading, and seems to be more complicated.
For #2, do you have any suggestion?
Even though we can write our own code to load the class (basically by
extending the URLClassLoader class),
the functionality would be
much limited compared with Eclipse's OSGi code. I'm not familiar with OSGi, I
don't know whether it's enough if we only implement loadClass function (for
ConfigurationElement). What other functionality we need to
implement?
If we can use Eclipse standalone OSGi framework as suggested by Glyn,
this part will be much easier. But I'm not sure if the standalone OSGi requires
a separate classloader. If the standalone OSGi and the main Java application can
be in the same classloader, things will be easier and our solution would
be:
1. Create the standalone OSGi framework in the main Java application. The
OSGi framework and the main Java application will be in the same class loader.
If so, the main application can access the OSGi framework directly.
2. Copy
Eclipse's extension point related logic into the Java application. Notice that
the extension related code will call the standalone OSGi framework if necessary.
(In fact, since we have the OSGi, is it possible for us to use
org.eclipse.core.runtime directly instead of copying the
logic?)
Can anyone make sure if the standalone OSGi and the main Java application
can be in the SAME classloader?
By the way, do you guys have any internal design documents which talk
about the architecture of org.eclipse.osgi and
org.eclipse.core.runtime? I realize I need to fully understand them
before I start to work. I would appreciate it a lot if you guys could send
me some documents.
Thanks,
Kai