/**
   * Load grid configuration for specified node type.
   *
   * @param type Node type to load configuration for.
   * @return Grid configuration for specified node type.
   */
  static IgniteConfiguration getConfig(String type) {
    String path = NODE_CFG.get(type);

    if (path == null) throw new IllegalArgumentException("Unsupported node type: " + type);

    URL url = U.resolveIgniteUrl(path);

    BeanFactory ctx = new FileSystemXmlApplicationContext(url.toString());

    return (IgniteConfiguration) ctx.getBean("grid.cfg");
  }
  /** {@inheritDoc} */
  @Override
  public void onDiscoveryDataReceived(UUID nodeId, UUID rmtNodeId, Serializable data) {
    Map<String, Serializable> discData = (Map<String, Serializable>) data;

    if (discData != null) {
      for (Map.Entry<String, Serializable> e : discData.entrySet()) {
        PluginProvider provider = plugins.get(e.getKey());

        if (provider != null) provider.receiveDiscoveryData(nodeId, e.getValue());
        else U.warn(log, "Received discovery data for unknown plugin: " + e.getKey());
      }
    }
  }
  /**
   * Example for start/stop node tasks.
   *
   * @param args Not used.
   */
  public static void main(String[] args) {
    String nodeType = "tcp+ssl";

    // Start initial node = 1
    try (Ignite g = G.start(NODE_CFG.get(nodeType))) {
      // Change topology.
      changeTopology(g, 4, 1, nodeType);
      changeTopology(g, 1, 4, nodeType);

      // Stop node by id = 0
      g.compute().execute(ClientStopNodeTask.class, g.cluster().localNode().id().toString());

      // Wait for node stops.
      // U.sleep(1000);

      assert G.allGrids().isEmpty();
    } catch (Exception e) {
      System.err.println("Uncaught exception: " + e.getMessage());

      e.printStackTrace(System.err);
    }
  }
 /**
  * @param name Plugin name.
  * @return Plugin provider.
  */
 @SuppressWarnings("unchecked")
 @Nullable
 public <T extends PluginProvider> T pluginProvider(String name) {
   return (T) plugins.get(name);
 }
 /**
  * @param provider Plugin context.
  * @return Plugin context.
  */
 @SuppressWarnings("unchecked")
 public <T extends PluginContext> T pluginContextForProvider(PluginProvider provider) {
   return (T) pluginCtxMap.get(provider);
 }