I'm new on OSGi and I'm trying to implement the osgi console into a bundle.
I need to manage the other bundles/services from my bundle. So I need to be able to use the "ss", "install" and "unistall" commands at least on other services already installed or not. All this commands must be managed without human interaction, so I must to implement this into my application. This program will be installed on a uPC without a continuous monitoring.
I've googled the way to implement the OSGi console into a bundle but i cant found nothing relevant.
I'm using OSGi 3.7.1 and trying to deply on an Equinox.
you can checke the org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider class and org.eclipse.core.runtime.internal.adaptor.EclipseCommandProvider class , you will see the command implement. and every Command can access by services with " (classobject=org.eclipse.osgi.framework.console.CommandProvider)" filter.
Use the OSGi Framework API, from the
org.osgi.framework
package. This is the API that the console itself invokes in order to implement those commands.Take a look at the class
org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider
in bundleorg.eclipse.osgi
to see how the commands are implementedAdding to what Tom said, this link might come in handy: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java?view=markup&root=RT_Project.
I remember that it took me quite a while to find this class last time I needed to look into it. It might not be the newest version (I didn't check this), but it should be enough to give you a jump start. The CVS repository path btw is "/cvsroot/rt" on "dev.eclipse.org", module "org.eclipse.equinox/framework/bundles/org.eclipse.osgi".
Sorry for not adding this as a comment to Toms answer, but I do not have the permissions to do so it seems.