/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<>(5); List<FrameworkLogEntry> errors = new ArrayList<>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); configurators.add(CDSHookConfigurator.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created ModuleClassLoader classLoader = manager.getClassLoader(); BundleLoader loader = classLoader.getBundleLoader(); // create a woven class object and add it to the thread local stack WovenClassImpl wovenClass = new WovenClassImpl(name, classbytes, entry, classpathEntry, loader, container, blackList); List<WovenClassImpl> wovenClasses = wovenClassStack.get(); if (wovenClasses == null) { wovenClasses = new ArrayList<WovenClassImpl>(6); wovenClassStack.set(wovenClasses); } wovenClasses.add(wovenClass); // call the weaving hooks try { return wovenClass.callHooks(); } catch (Throwable t) { ServiceRegistration<?> errorHook = wovenClass.getErrorHook(); Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle() : manager.getGeneration().getRevision().getBundle(); container.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t); // fail hard with a class loading error ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$ error.initCause(t); throw error; } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created
/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<String>(5); List<FrameworkLogEntry> errors = new ArrayList<FrameworkLogEntry>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created ModuleClassLoader classLoader = manager.getClassLoader(); BundleLoader loader = classLoader.getBundleLoader(); // create a woven class object and add it to the thread local stack WovenClassImpl wovenClass = new WovenClassImpl(name, classbytes, entry, classpathEntry, loader, container, blackList); List<WovenClassImpl> wovenClasses = wovenClassStack.get(); if (wovenClasses == null) { wovenClasses = new ArrayList<WovenClassImpl>(6); wovenClassStack.set(wovenClasses); } wovenClasses.add(wovenClass); // call the weaving hooks try { return wovenClass.callHooks(); } catch (Throwable t) { ServiceRegistration<?> errorHook = wovenClass.getErrorHook(); Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle() : manager.getGeneration().getRevision().getBundle(); container.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t); // fail hard with a class loading error ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$ error.initCause(t); throw error; } }
/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<String>(5); List<FrameworkLogEntry> errors = new ArrayList<FrameworkLogEntry>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created ModuleClassLoader classLoader = manager.getClassLoader(); BundleLoader loader = classLoader.getBundleLoader(); // create a woven class object and add it to the thread local stack WovenClassImpl wovenClass = new WovenClassImpl(name, classbytes, entry, classpathEntry, loader, container, blackList); List<WovenClassImpl> wovenClasses = wovenClassStack.get(); if (wovenClasses == null) { wovenClasses = new ArrayList<WovenClassImpl>(6); wovenClassStack.set(wovenClasses); } wovenClasses.add(wovenClass); // call the weaving hooks try { return wovenClass.callHooks(); } catch (Throwable t) { ServiceRegistration<?> errorHook = wovenClass.getErrorHook(); Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle() : manager.getGeneration().getRevision().getBundle(); container.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t); // fail hard with a class loading error ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$ error.initCause(t); throw error; } }
/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<String>(5); List<FrameworkLogEntry> errors = new ArrayList<FrameworkLogEntry>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created ModuleClassLoader classLoader = manager.getClassLoader(); BundleLoader loader = classLoader.getBundleLoader(); // create a woven class object and add it to the thread local stack WovenClassImpl wovenClass = new WovenClassImpl(name, classbytes, entry, classpathEntry, loader, container, blackList); List<WovenClassImpl> wovenClasses = wovenClassStack.get(); if (wovenClasses == null) { wovenClasses = new ArrayList<WovenClassImpl>(6); wovenClassStack.set(wovenClasses); } wovenClasses.add(wovenClass); // call the weaving hooks try { return wovenClass.callHooks(); } catch (Throwable t) { ServiceRegistration<?> errorHook = wovenClass.getErrorHook(); Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle() : manager.getGeneration().getRevision().getBundle(); container.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t); // fail hard with a class loading error ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$ error.initCause(t); throw error; } }
/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<>(5); List<FrameworkLogEntry> errors = new ArrayList<>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { ServiceRegistry registry = getRegistry(); if (registry == null) return null; // no registry somehow we are loading classes before the registry has been created
/** * Initializes the hook configurators. The following steps are used to initialize the hook configurators. <p> * 1. Get a list of hook configurators from all hook configurators properties files on the classpath, * add this list to the overall list of hook configurators, remove duplicates. <p> * 2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property * and add this list to the overall list of hook configurators, remove duplicates. <p> * 3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property * and remove this list from the overall list of hook configurators. <p> * 4. Load each hook configurator class, create a new instance, then call the {@link HookConfigurator#addHooks(HookRegistry)} method <p> * 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p> */ public void initialize() { List<String> configurators = new ArrayList<String>(5); List<FrameworkLogEntry> errors = new ArrayList<FrameworkLogEntry>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); addClassLoaderHook(new WeavingHookConfigurator(container)); configurators.add(SignedBundleHook.class.getName()); loadConfigurators(configurators, errors); // set to read-only initialized = true; } for (FrameworkLogEntry error : errors) { container.getLogServices().getFrameworkLog().log(error); } }