Search in sources :

Example 11 with PluginProvider

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);
        }
    }
}
Also used : IgniteException(org.apache.ignite.IgniteException) PluginProvider(org.apache.ignite.plugin.PluginProvider) URL(java.net.URL)

Aggregations

PluginProvider (org.apache.ignite.plugin.PluginProvider)11 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 IgnitePluginProcessor (org.apache.ignite.internal.processors.plugin.IgnitePluginProcessor)4 HashMap (java.util.HashMap)3 IgniteException (org.apache.ignite.IgniteException)3 ClusterNode (org.apache.ignite.cluster.ClusterNode)3 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)3 GridEventStorageManager (org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager)3 RuntimeMXBean (java.lang.management.RuntimeMXBean)2 DecimalFormat (java.text.DecimalFormat)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 IgniteSystemProperties.getBoolean (org.apache.ignite.IgniteSystemProperties.getBoolean)2 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)2 GridCheckpointManager (org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager)2 GridCollisionManager (org.apache.ignite.internal.managers.collision.GridCollisionManager)2 GridIoManager (org.apache.ignite.internal.managers.communication.GridIoManager)2 GridDeploymentManager (org.apache.ignite.internal.managers.deployment.GridDeploymentManager)2 DiscoveryLocalJoinData (org.apache.ignite.internal.managers.discovery.DiscoveryLocalJoinData)2