How should I implement the OSGi console into a Bundle?

给你一囗甜甜゛ 提交于 2019-12-10 10:48:14

问题


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.


回答1:


Take a look at the class org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider in bundle org.eclipse.osgi to see how the commands are implemented




回答2:


Adding 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.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/9391691/how-should-i-implement-the-osgi-console-into-a-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!