简体   繁体   English

如何从代码中获取运行中的OSGi容器信息(名称,版本等)?

[英]How to get running OSGi container info (name, version etc.) from code?

I want to detect under which OSGi container my application (bundle) is running. 我想检测我的应用程序(捆绑包)在哪个OSGi容器下运行。 How to do this from java code? 如何从Java代码做到这一点?

Bundle systemBundle = bundleContext.getBundle(0);
String symbolicName = systemBundle.getSymbolicName();
Version version = systemBundle.getVersion();

You can guess the implementation (felix, equinox, ...) from the symbolicName and the version from the version of the systemBundle . 您可以从symbolicNamesystemBundle版本中猜测实现(felix,equinox等)。

The id of the systemBundle is always 0 . systemBundleid始终为0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用uId在Facebook中登录用户的信息,例如电子邮件ID,名称,城市等 - How I can get logged in user's info like email id,name,city etc. in Facebook with uId 如何摆脱OSGi捆绑软件的相应配置(“ service.pid”等)中不存在的属性? - How to get rid of OSGi bundle's properties that are not exist in their corresponding configuration (“service.pid”, etc.)? 如何检测是否在osgi容器中运行 - how to detect if running in osgi container 如何在simpleadapter中实现OnItemClickListener? 代码删除,更新等, - how to implement OnItemClickListener in simpleadapter? code delete, update etc., 尝试从Java中的AWS Gateway获取HTTP标头等 - Trying to get HTTP headers, etc. from AWS Gateway in Java OSGi JAR运行后是否可以要求其容器从另一个位置加载另一个OSGi JAR? - Can an OSGi JAR once running ask its container to load another OSGi JAR from another location? 如何以编程方式从二维码中获取所有数据,如姓名、电子邮件、联系信息? - How to get all data from Qr code like Name, Email, Contact info programetically? 如何获得hadoop reducer得到一个集合(数组,集等)? - How to get hadoop reducer results in a collection(array, set, etc.)? 在JPA中怎么不得到孩子的孩子的孩子……等等? - How not to get the children of the children of the children… etc. in JPA? GlassFish如何成为OSGi容器? - How is GlassFish an OSGi container?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM