[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Using Equinox for Headless Applications

The Apache Felix project includes JMood and MOSGi, both of them JMX-based management agents that allow operation and maintenance of OSGi platforms and also applications. AFAIK both of them can be used with any OSGi platform so you can use it with the the Equinox platform or the Apache Felix one.

Being JMX-based agents you can use any JMX GUI console available in the market such as JConsole or MC4J or make use of the JMX remoting APIs to invoke remote operations. Thus, it is a simple and powerful environment to fulfill remote management use cases.

I hope it helps.

Cheers,

/jose

--
Jose L. Ruiz


DIT Departamento de Ingeniería de Sistemas Telemáticos
UPM Universidad Politécnica de Madrid
http://www.dit.upm.es/jlruiz



Neil Bartlett escribió:
Marcus,

Yes these are all excellent use-cases for the use of OSGi in general and
Equinox specifically. As other respondents have pointed out, your best
source of documentation is probably the core OSGi specification
downloadable from www.osgi.org. However I'll try to give you some pointers
for your specific use-cases so that you may have an idea where to start.

1) Run an execution environment (server)

Running Equinox as a standalone executable (ie without the GUI) is documented here: http://www.eclipse.org/equinox/documents/quickstart.php

The OSGi console will let you do most of the management that you need to
do. The only major drawback at the moment is you can't run it over port in
a secure way, so you have to use it from the console. However you can use
standard UNIX tools like bg, fg or even "screen" to manage this.

The OSGi console can also be extended with your own code, so you can build
custom commands to control your server. I believe that Chris Aniszczyk has
written a how-to article on that recently.

In the longer term, the Equinox team are building JMX support so you could
manage the whole thing through your web browser or a JMX management tool.

2) Deploy application as bundles/plugins (hopefully remotely)

You can do this from the console using the "install" command. Alternatively any bundle can call the installBundle() method on BundleContext, so you could write your own manager bundle that installs and updates bundles on request. installBundle() is overloaded, one version takes an InputStream to supply the bundle data. That InputStream could come from a remote source such as an HTTP or FTP connection or whatever.

3) Scheduling: run "jobs" or "tasks" at certain times

There's nothing in the OSGi APIs for scheduling at the moment. You could investigate a library such as Quartz to help you out here. I don't have personal experience of using Quartz so there might be some glue code to write.

One thing to be wary of is using the start() method of your
BundleActivator to perform your tasks. You could certainly use it to kick
off a thread, but if you start doing lots of work right in the start()
method then you will starve the framework.... OSGi would like its thread
back!

You could use the Eclipse Jobs API to abstract away from the raw threads.
The really cool thing about this is you can then take the same Jobs and
run them in your RCP app or the IDE, and you'll get progress reporting etc
on them. The core Jobs API has no dependency on the GUI though.

4) Start/Stop (hopefully remotely)

Do you mean overriding the scheduler in order to manually start tasks? There are lots of ways to do this, but I would probably look at writing a console command for it (see (1)).

5) Upgrade (hopefully remotely)

To upgrade a bundle just use the "update" command on the console, or from code call update() on the Bundle. Just like installBundle(), there's a version that takes an InputStream so you can supply the data from anywhere. This again is probably a job for a manager bundle. The manager bundle can even use update() to upgrade itself :-)

I hope this helps to get you started. Good luck.

Regards,
Neil




_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev