use of org.apache.ignite.plugin.PluginProvider in project ignite by apache.
the class MarshallerUtils method processSystemClasses.
/**
* Find all system class names (for JDK or Ignite classes) and process them with a given consumer.
*
* @param ldr Class loader.
* @param plugins Plugins.
* @param proc Class processor (class name consumer).
*/
public static void processSystemClasses(ClassLoader ldr, @Nullable Collection<PluginProvider> plugins, Consumer<String> proc) throws IOException {
Enumeration<URL> urls = ldr.getResources(CLS_NAMES_FILE);
boolean foundClsNames = false;
while (urls.hasMoreElements()) {
processResource(urls.nextElement(), proc);
foundClsNames = true;
}
if (!foundClsNames)
throw new IgniteException("Failed to load class names properties file packaged with ignite binaries " + "[file=" + CLS_NAMES_FILE + ", ldr=" + ldr + ']');
URL jdkClsNames = ldr.getResource(JDK_CLS_NAMES_FILE);
if (jdkClsNames == null)
throw new IgniteException("Failed to load class names properties file packaged with ignite binaries " + "[file=" + JDK_CLS_NAMES_FILE + ", ldr=" + ldr + ']');
processResource(jdkClsNames, proc);
if (plugins != null && !plugins.isEmpty()) {
for (PluginProvider plugin : plugins) {
Enumeration<URL> pluginUrls = ldr.getResources("META-INF/" + plugin.name().toLowerCase() + ".classnames.properties");
while (pluginUrls.hasMoreElements()) processResource(pluginUrls.nextElement(), proc);
}
}
}
Aggregations