[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Embedding Equinox OSGi and EclipseStarter

I just run into a related problem and created an enhancement request to track it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=174009

In short, it seems that there is no easy way to establish communication between a Java application and Eclipse instance launched from it.

(For me, this originated with the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=173460 )

Oleg Besedin

"Alex Blewitt" <alex.blewitt@xxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx

02/05/2007 06:49 PM

Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

"Equinox development mailing list" <equinox-dev@xxxxxxxxxxx>
[equinox-dev] Embedding Equinox OSGi and EclipseStarter

I've been playing around with embedding the OSGi/Equinox platform into
an existing Java system (as opposed to the other way around). I'm
using the EclipseStarter to bring up the framework, and once it's up
and running with the bundles it works like a charm. I can start up a
remote console and reconfigure it if necessary etc.

What I'd really like to do is give some control over to the Java
system that contains it, particularly with reference to installing new
bundles, starting and stopping existing bundles and so forth. All I'd
need to do is get hold of a suitable BundleContext and I should be
able to do this.

Unfortunately, there doesn't seem to be any way of getting this back
from an EclipseStarter. I could duplicate the code but it seems
somewhat wasteful; there's an OSGi instance in EclipseStarter that has
a getBundleContext() that would probably do me, if it weren't for the
fact that OSGi is a private field of EclipseStarter.

I'm wondering whether you think it's a good idea to add something like
this to EclipseStarter:

public static BundleContext getSystemBundleContext() {
 return osgi.getBundleContext();

I'd then be able to use that to stop/start the various bundles,
install others etc. Of course, whilst I can do this via the console, I
really want to have a programmatic hook up to make it work. And no, I
can't refactor the old system to be a bundle of the Equinox runtime;
this is strictly a subset of an existing system.

I note that other places do this kind of thing e.g. the servlet
bridge, which maps a URL onto commands that get processed. I'm
wondering if the direct way has some obvious flaw that I'm missing?

equinox-dev mailing list