ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [31/50] [abbrv] incubator-ignite git commit: # ignite-707
Date Thu, 09 Apr 2015 14:59:47 GMT
# ignite-707


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/17c94b6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/17c94b6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/17c94b6b

Branch: refs/heads/ignite-673
Commit: 17c94b6b730989b6d4a5cbcc5893cced73518e47
Parents: 3e6da9c
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Apr 9 12:02:07 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Apr 9 12:02:07 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridPluginContext.java      | 15 ++----
 .../apache/ignite/internal/IgniteKernal.java    |  5 --
 .../plugin/IgnitePluginProcessor.java           | 52 +++++---------------
 .../ignite/plugin/CachePluginConfiguration.java |  2 +-
 .../org/apache/ignite/plugin/IgnitePlugin.java  |  3 --
 .../ignite/plugin/PluginConfiguration.java      | 10 +---
 .../org/apache/ignite/plugin/PluginContext.java |  7 +--
 .../apache/ignite/plugin/PluginProvider.java    |  4 +-
 8 files changed, 20 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
index 31a4246..af03670 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
@@ -30,30 +30,21 @@ import java.util.*;
  */
 public class GridPluginContext implements PluginContext {
     /** */
-    private final PluginConfiguration cfg;
-
-    /** */
     private final GridKernalContext ctx;
 
     /** */
-    private IgniteConfiguration igniteCfg;
+    private final IgniteConfiguration igniteCfg;
 
     /**
      * @param ctx Kernal context.
-     * @param cfg Plugin configuration.
+     * @param igniteCfg Ignite configuration.
      */
-    public GridPluginContext(GridKernalContext ctx, PluginConfiguration cfg, IgniteConfiguration
igniteCfg) {
-        this.cfg = cfg;
+    public GridPluginContext(GridKernalContext ctx, IgniteConfiguration igniteCfg) {
         this.ctx = ctx;
         this.igniteCfg = igniteCfg;
     }
 
     /** {@inheritDoc} */
-    @Override public <C extends PluginConfiguration> C configuration() {
-        return (C)cfg;
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteConfiguration igniteConfiguration() {
         return igniteCfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 0db2ad6..8e5779e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1021,11 +1021,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
         A.ensure(cfg.getNetworkTimeout() > 0, "cfg.getNetworkTimeout() > 0");
         A.ensure(cfg.getNetworkSendRetryDelay() > 0, "cfg.getNetworkSendRetryDelay() >
0");
         A.ensure(cfg.getNetworkSendRetryCount() > 0, "cfg.getNetworkSendRetryCount() >
0");
-
-        if (!F.isEmpty(cfg.getPluginConfigurations())) {
-            for (PluginConfiguration pluginCfg : cfg.getPluginConfigurations())
-                A.notNull(pluginCfg.providerClass(), "PluginConfiguration.providerClass()");
-        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
index bf5d61f..8d71ad7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
@@ -53,53 +53,25 @@ public class IgnitePluginProcessor extends GridProcessorAdapter {
 
         ExtensionRegistryImpl registry = new ExtensionRegistryImpl();
 
-        if (cfg.getPluginConfigurations() != null) {
-            for (PluginConfiguration pluginCfg : cfg.getPluginConfigurations()) {
-                GridPluginContext pluginCtx = new GridPluginContext(ctx, pluginCfg, cfg);
+        ServiceLoader<PluginProvider> ldr = ServiceLoader.load(PluginProvider.class);
 
-                PluginProvider provider;
+        for (PluginProvider provider : ldr) {
+            GridPluginContext pluginCtx = new GridPluginContext(ctx, cfg);
 
-                try {
-                    if (pluginCfg.providerClass() == null)
-                        throw new IgniteException("Provider class is null.");
+            if (F.isEmpty(provider.name()))
+                throw new IgniteException("Plugin name can not be empty.");
 
-                    try {
-                        Constructor<? extends PluginProvider> ctr =
-                            pluginCfg.providerClass().getConstructor(PluginContext.class);
+            if (plugins.containsKey(provider.name()))
+                throw new IgniteException("Duplicated plugin name: " + provider.name());
 
-                        provider = ctr.newInstance(pluginCtx);
-                    }
-                    catch (NoSuchMethodException ignore) {
-                        try {
-                            Constructor<? extends PluginProvider> ctr =
-                                pluginCfg.providerClass().getConstructor(pluginCfg.getClass());
+            plugins.put(provider.name(), provider);
 
-                            provider = ctr.newInstance(pluginCfg);
-                        }
-                        catch (NoSuchMethodException ignored) {
-                            provider = pluginCfg.providerClass().newInstance();
-                        }
-                    }
-                }
-                catch (InstantiationException | IllegalAccessException | InvocationTargetException
e) {
-                    throw new IgniteException("Failed to create plugin provider instance.",
e);
-                }
+            pluginCtxMap.put(provider, pluginCtx);
 
-                if (F.isEmpty(provider.name()))
-                    throw new IgniteException("Plugin name can not be empty.");
+            provider.initExtensions(pluginCtx, registry);
 
-                if (provider.plugin() == null)
-                    throw new IgniteException("Plugin is null.");
-
-                if (plugins.containsKey(provider.name()))
-                    throw new IgniteException("Duplicated plugin name: " + provider.name());
-
-                plugins.put(provider.name(), provider);
-
-                pluginCtxMap.put(provider, pluginCtx);
-
-                provider.initExtensions(pluginCtx, registry);
-            }
+            if (provider.plugin() == null)
+                throw new IgniteException("Plugin is null.");
         }
 
         extensions = registry.createExtensionMap();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginConfiguration.java
index 1df48b3..2bb0996 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginConfiguration.java
@@ -30,7 +30,7 @@ public interface CachePluginConfiguration<K, V> extends Serializable
{
      * Creates cache plugin provider.
      *
      * @return Cache plugin provider class.
-     * @param ctx
+     * @param ctx Plugin context.
      */
     public CachePluginProvider createProvider(CachePluginContext ctx);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/plugin/IgnitePlugin.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/IgnitePlugin.java b/modules/core/src/main/java/org/apache/ignite/plugin/IgnitePlugin.java
index 6a928af..7a8a99a 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/IgnitePlugin.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/IgnitePlugin.java
@@ -19,9 +19,6 @@ package org.apache.ignite.plugin;
 
 /**
  * Marker interface for all Ignite plugins.
- *
- * @author @java.author
- * @version @java.version
  */
 public interface IgnitePlugin {
     // No-op.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/plugin/PluginConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/plugin/PluginConfiguration.java
index f30e897..1a4e2dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginConfiguration.java
@@ -18,14 +18,8 @@
 package org.apache.ignite.plugin;
 
 /**
- * TODO: Add class description.
- *
- * @author @java.author
- * @version @java.version
+ * Plugin configuration.
  */
 public interface PluginConfiguration {
-    /**
-     * @return Plugin provider class.
-     */
-    public Class<? extends PluginProvider> providerClass();
+    // No-op.
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java
index f2a972c..6a4f20b 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java
@@ -26,15 +26,10 @@ import org.apache.ignite.spi.discovery.DiscoverySpi;
 import java.util.*;
 
 /**
- * TODO: Add class description.
+ * Plugin context.
  */
 public interface PluginContext {
     /**
-     * @return Plugin configuration.
-     */
-    public <C extends PluginConfiguration> C configuration();
-
-    /**
      * @return Ignite configuration.
      */
     public IgniteConfiguration igniteConfiguration();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17c94b6b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
index 1d965f5..d2aedff 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
@@ -25,9 +25,6 @@ import java.util.*;
 
 /**
  * Pluggable ignite component.
- *
- * @author @java.author
- * @version @java.version
  */
 public interface PluginProvider<C extends PluginConfiguration> {
     /**
@@ -51,6 +48,7 @@ public interface PluginProvider<C extends PluginConfiguration> {
     public <T extends IgnitePlugin> T plugin();
 
     /**
+     * @param ctx Plugin context.
      * @param cls Ignite component class.
      * @return Ignite component or {@code null} if component is not supported.
      */


Mime
View raw message