platform independent OSGi console-Collection of common programming errors
Yes, of course it is possible to administer OSGi in a platform-independent way. It all depends on how much of the administration you are ready to implement yourself.
The OSGi APIs give you access to everything, you only need to design/choose your shell, format of the commands etc.
Do you want a command prompt based one, a web-based one or a remote management protocol to be used with some backend management server?
1) Let’s start with the functionality. Your shell will be implemented as a bundle itself. You can use the BundleContext of this bundle to get access to the other bundle objects. Through them you can:
- install, start, stop, update bundles:
BundleContext.installBundle(String) – Installs a bundle from the specified location string (which should be a URL).
BundleContext.getBundles( )
Bundle.start()
Bundle.update( InputStream input )
-
Inspect bundles, bundle versions, exported/imported packages, registered services
-
From the OSGi service registry you can get the ConfigurationAdmin service, through which you can list the configurations of bundles, and change them
-
From the registry you can also get the LogService, to read the logs
-
From the StartLevel service you can control the order of starting of the bundles when the fw is started
etc etc
2) How do you want to make the above info accessible? If you want a command-based console, you can write one, using the system output. You can check this implementation for ideas
If you want a web-based one, the easiest way to remain platform-independent is to write a standard servlet and register it in the standard OSGi HTTP service. The relevant web pages will then call the functions above.
If you want a remote management protocol, you can map to many different possibilities. Check for example the OSGi DMT service, which maps to the OMA DM spec, which maps easily to the TR-069 management protocol. There are existing implementations.
All this is completely independent from Felix, Equinox etc and will work on any of them, as well as any other OSGi fw.