Search in sources :

Example 1 with DevClassLoadingHook

use of org.eclipse.osgi.internal.hooks.DevClassLoadingHook in project rt.equinox.framework by eclipse.

the class HookRegistry method initialize.

/**
 * 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 (&quot;osgi.hook.configurators.include&quot;) 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 (&quot;osgi.hook.configurators.exclude&quot;) 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);
    // optimistic that no errors will occur
    List<FrameworkLogEntry> errors = new ArrayList<>(0);
    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);
    }
}
Also used : SignedBundleHook(org.eclipse.osgi.internal.signedcontent.SignedBundleHook) DevClassLoadingHook(org.eclipse.osgi.internal.hooks.DevClassLoadingHook) WeavingHookConfigurator(org.eclipse.osgi.internal.weaving.WeavingHookConfigurator) EclipseLazyStarter(org.eclipse.osgi.internal.hooks.EclipseLazyStarter) FrameworkLogEntry(org.eclipse.osgi.framework.log.FrameworkLogEntry)

Aggregations

FrameworkLogEntry (org.eclipse.osgi.framework.log.FrameworkLogEntry)1 DevClassLoadingHook (org.eclipse.osgi.internal.hooks.DevClassLoadingHook)1 EclipseLazyStarter (org.eclipse.osgi.internal.hooks.EclipseLazyStarter)1 SignedBundleHook (org.eclipse.osgi.internal.signedcontent.SignedBundleHook)1 WeavingHookConfigurator (org.eclipse.osgi.internal.weaving.WeavingHookConfigurator)1