@Override
public void start(BundleContext context) {
logErrors = Boolean.parseBoolean(context.getProperty("osgi.jpms.layer.log.errors"));
// Check that the launcher created a layer for the framework
Module systemModule = context.getClass().getModule();
if (!Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(systemModule.getName())) {
throw new IllegalStateException("The framework launcher has not setup the system.bundle module for the framework implementation: " + getClass().getModule());
}
logService = new ServiceTracker<>(context, LOG_SERVICE, null);
logService.open();
// Create the LayerFactory implementation and register it
factory = new LayerFactoryImpl(this, context, systemModule);
// The factory is a bundle listener to keep track of resolved bundles
context.addBundleListener(factory);
// The factory is also a WovenClassListener to intercept bundle class loaders before
// they define any classes. This is to ensure they are part of a layer before the
// first class is defined.
String[] serviceClasses = new String[] {LayerFactory.class.getName(), WovenClassListener.class.getName(), WeavingHook.class.getName()};
factoryReg = context.registerService(serviceClasses, factory, null);
}
Activator.java 文件源码
java
阅读 41
收藏 0
点赞 0
评论 0
项目:osgi-jpms-layer
作者:
评论列表
文章目录