Package org.apache.ignite.plugin

## Interface PluginProvider<C extends PluginConfiguration>

-     public interface PluginProvider<C extends PluginConfiguration>

  Pluggable Ignite component.

  Ignite plugins can be loaded using JDK `ServiceLoader` or set up explicitly via `IgniteConfiguration.setPluginProviders(PluginProvider[])`. First method called to initialize plugin is `initExtensions(PluginContext, ExtensionRegistry)`. If `ServiceLoader` approach of plugin loading is chosen, fully-qualified `PluginProvider` class name is used as the service type. And required plugin configuration in this case can be set up via `IgniteConfiguration.setPluginConfigurations(PluginConfiguration...)`.

  See Also:
    `IgniteConfiguration.setPluginProviders(PluginProvider[])`, `IgniteConfiguration.setPluginConfigurations(PluginConfiguration...)`, `PluginContext`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `copyright()` |
    `CachePluginProvider` | `createCacheProvider​(CachePluginContext ctx)` | Creates cache plugin provider.
    `<T> T` | `createComponent​(PluginContext ctx, Class<T> cls)` | Creates Ignite component.
    `void` | `initExtensions​(PluginContext ctx, ExtensionRegistry registry)` | Registers extensions.
    `String` | `name()` |
    `void` | `onIgniteStart()` | Callback that notifies that Ignite has successfully started, including all internal components.
    `void` | `onIgniteStop​(boolean cancel)` | Callback to notify that Ignite is about to stop.
    `<T extends IgnitePlugin> T` | `plugin()` |
    `@Nullable Serializable` | `provideDiscoveryData​(UUID nodeId)` | Gets plugin discovery data object that will be sent to the new node during discovery process.
    `void` | `receiveDiscoveryData​(UUID nodeId, Serializable data)` | Receives plugin discovery data object from remote nodes (called on new node during discovery process).
    `void` | `start​(PluginContext ctx)` | Starts grid component.
    `void` | `stop​(boolean cancel)` | Stops grid component.
    `void` | `validateNewNode​(ClusterNode node)` | Deprecated. Use `validateNewNode(ClusterNode, Serializable)` instead.
    `default void` | `validateNewNode​(ClusterNode node, Serializable data)` | Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
    `String` | `version()` |

- - ### Method Detail

    - #### name

          String name()

      Returns:
        Plugin name.

    - #### version

          String version()

      Returns:
        Plugin version.

    - #### copyright

          String copyright()

      Returns:
        Copyright.

    - #### plugin

          <T extends IgnitePlugin> T plugin()

      Type Parameters:
        `T` - Type of the plugin.
      Returns:
        Plugin API.

    - #### initExtensions

          void initExtensions​(PluginContext ctx,
                              ExtensionRegistry registry)
                       throws IgniteCheckedException

      Registers extensions.
      Parameters:
        `ctx` - Plugin context.
        `registry` - Extension registry.
      Throws:
        `IgniteCheckedException`

    - #### createComponent

          @Nullable
          <T> T createComponent​(PluginContext ctx,
                                Class<T> cls)

      Creates Ignite component.
      Type Parameters:
        `T` - Ignite component type.
      Parameters:
        `ctx` - Plugin context.
        `cls` - Ignite component class.
      Returns:
        Ignite component or `null` if component is not supported.

    - #### createCacheProvider

          CachePluginProvider createCacheProvider​(CachePluginContext ctx)

      Creates cache plugin provider.
      Parameters:
        `ctx` - Plugin context.
      Returns:
        Cache plugin provider class.

    - #### start

          void start​(PluginContext ctx)
              throws IgniteCheckedException

      Starts grid component.
      Parameters:
        `ctx` - Plugin context.
      Throws:
        `IgniteCheckedException` - Throws in case of any errors.

    - #### stop

          void stop​(boolean cancel)
             throws IgniteCheckedException

      Stops grid component.
      Parameters:
        `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.
      Throws:
        `IgniteCheckedException` - Thrown in case of any errors.

    - #### onIgniteStart

          void onIgniteStart()
                      throws IgniteCheckedException

      Callback that notifies that Ignite has successfully started, including all internal components.
      Throws:
        `IgniteCheckedException` - Thrown in case of any errors.

    - #### onIgniteStop

          void onIgniteStop​(boolean cancel)

      Callback to notify that Ignite is about to stop.
      Parameters:
        `cancel` - Flag indicating whether jobs should be canceled.

    - #### provideDiscoveryData

          @Nullable
          @Nullable Serializable provideDiscoveryData​(UUID nodeId)

      Gets plugin discovery data object that will be sent to the new node during discovery process.
      Parameters:
        `nodeId` - ID of new node that joins topology.
      Returns:
        Discovery data object or `null` if there is nothing to send for this component.

    - #### receiveDiscoveryData

          void receiveDiscoveryData​(UUID nodeId,
                                    Serializable data)

      Receives plugin discovery data object from remote nodes (called on new node during discovery process). This data is provided by `provideDiscoveryData(UUID)` method on the other nodes.
      Parameters:
        `nodeId` - Remote node ID.
        `data` - Discovery data object or `null` if nothing was sent for this component.

    - #### validateNewNode

          @Deprecated
          void validateNewNode​(ClusterNode node)
                        throws PluginValidationException

      Deprecated.
      Use `validateNewNode(ClusterNode, Serializable)` instead.
      Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
      Parameters:
        `node` - Joining node.
      Throws:
        `PluginValidationException` - If cluster-wide plugin validation failed.

    - #### validateNewNode

          default void validateNewNode​(ClusterNode node,
                                       Serializable data)

      Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
      Parameters:
        `node` - Joining node.
        `data` - Discovery data object or `null` if nothing was sent for this component.
      Throws:
        `PluginValidationException` - If cluster-wide plugin validation failed.