org.osgi.framework.hooks.weaving.WeavingHook的实例源码

项目:osgi-jpms-layer    文件Activator.java   
@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);
}
项目:aries-jpa    文件Activator.java   
/**
 * ARIES-1019: Register with the highest possible service ranking to
 * avoid ClassNotFoundException caused by interfaces added by earlier
 * weaving hooks that are not yet visible to the bundle class loader.
 */
private void registerWeavingHook(BundleContext context,TransformerRegistry tr) {
    Dictionary<String,Object> props = new Hashtable<String,Object>(1); // NOSONAR
    props.put(Constants.SERVICE_RANKING,Integer.MAX_VALUE);
    context.registerService(WeavingHook.class.getName(),tr,props);
}
项目:motech    文件PlatformActivator.java   
private void registerOsgiHooks() {
    bundleContext.registerService(WeavingHook.class,new ValidationWeavingHook(),new Hashtable<>());
}
项目:osgi.ee    文件Activator.java   
@Override
public void start(BundleContext context) {
    LoadingHook hook = new LoadingHook(context);
    context.registerService(WeavingHook.class,hook,null);
}
项目:bundles    文件JPAManager.java   
@Activate
void activate(BundleContext context,Map<String,Object> props) throws Exception {
    this.context = context;
    config = Converter.cnv(Config.class,props);

    //
    // The Transformers hook enables weaving in Osgi
    // Every persistence unit will register itself with
    // the transformers hook. Order is important,once
    // the bundle tracker is called,the transformers
    // will be registered so do not move this method lower.
    //

    transformersHook = new TransformersHook(getImports(persistenceProvider));
    context.registerService(WeavingHook.class,transformersHook,null);

    //
    // Track bundles with persistence units.
    //

    bundles = new BundleTracker<PersistentBundle>(context,Bundle.ACTIVE + Bundle.STARTING,null) {

        @Override
        public PersistentBundle addingBundle(Bundle bundle,BundleEvent event) {
            try {
                //
                // Parse any persistence units,returns null (not tracked)
                // when there is no PU
                //
                return parse(bundle);
            }
            catch (Exception e) {
                e.printstacktrace();
                log.bundleParseException(bundle,e);
                return null;
            }
        }

        @Override
        public void removedBundle(Bundle bundle,BundleEvent event,PersistentBundle put) {
            put.close();
        }
    };

    bundles.open();
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...