// get all hook configurators files in your classloader delegation
Enumeration hookConfigurators;
try {
hookConfigurators = cl != null ? cl.getResources(HookRegistry.HOOK_CONFIGURATORS_FILE) : ClassLoader.getSystemResources(HookRegistry.HOOK_CONFIGURATORS_FILE);
} catch (IOException e) {
errors.add(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, "getResources error on " + HookRegistry.HOOK_CONFIGURATORS_FILE, 0, e, null)); //$NON-NLS-1$
return;
}
int curBuiltin = 0;
while (hookConfigurators.hasMoreElements()) {
URL url = (URL) hookConfigurators.nextElement();
InputStream input = null;
try {
// check each file for a hook.configurators property
Properties configuratorProps = new Properties();
input = url.openStream();
configuratorProps.load(input);
String hooksValue = configuratorProps.getProperty(HOOK_CONFIGURATORS);
if (hooksValue == null)
continue;
boolean builtin = Boolean.valueOf(configuratorProps.getProperty(BUILTIN_HOOKS)).booleanValue();
String[] configurators = ManifestElement.getArrayFromList(hooksValue, ","); //$NON-NLS-1$
for (int i = 0; i < configurators.length; i++)
if (!configuratorList.contains(configurators[i])) {
if (builtin) // make sure the built-in configurators are listed first (bug 170881)
configuratorList.add(curBuiltin++, configurators[i]);
else
configuratorList.add(configurators[i]);
}
} catch (IOException e) {
errors.add(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, "error loading: " + url.toExternalForm(), 0, e, null)); //$NON-NLS-1$
// ignore and continue to next URL
} finally {
if (input != null)
try {
input.close();