Felix如何使用FrameworkWiring.getDependencyClosure

时间:2012-08-20 07:58:29

标签: java osgi bundle apache-felix

我正在尝试依赖每个捆绑。 在此SO post我被建议使用FrameworkWiring.getDependencyClosure, 但我无法理解如何初始化类FrameworkWiring.getDependencyClosure - 它的界面。 在felix中是否有这个接口的实现?

第二个问题: 我找到了

BundleWiringImpl getRequirements(null);

但我无法初始化

BundleWiringImpl testObject = new BundleWiringImpl();

NetBeans显示错误:

constructor BundleWiringImpl in class BundleWiringImpl cannot be applied to given types;
  required: Logger,Map,StatefulResolver,BundleRevisionImpl,List<BundleRevision>,List<BundleWire>,Map<String,BundleRevision>,Map<String,List<BundleRevision>>
  found: no arguments
  reason: actual and formal argument lists differ in length

如何获得deps? :) 可能是其他任何方式?

1 个答案:

答案 0 :(得分:1)

叹息。您是否为FrameworkWiring类型阅读了javadoc

The framework wiring object for the framework can be obtained by calling bundle.adapt(FrameworkWiring.class) on the system bundle. Only the system bundle can be adapted to a FrameworkWiring object.