org.apache.ignite.osgi

## Class IgniteAbstractOsgiContextActivator

- java.lang.Object
- - org.apache.ignite.osgi.IgniteAbstractOsgiContextActivator

- All Implemented Interfaces:
    org.osgi.framework.BundleActivator

      public abstract class IgniteAbstractOsgiContextActivator
      extends Object
      implements org.osgi.framework.BundleActivator

  This `BundleActivator` starts Apache Ignite inside the OSGi container when the bundle is started.

  Create an implementation of this class and set the `Bundle-Activator` OSGi Manifest header to the FQN of your class.

  You must provide the `IgniteConfiguration` to start by implementing the `igniteConfiguration()` abstract method. The return value of this method cannot be `null`. For example, if your implementation is called `org.myorg.osgi.IgniteActivator`, your bundle must provide the following header:

       Bundle-Activator: org.myorg.osgi.IgniteActivator

  You may use the Maven Bundle Plugin to generate your bundle (or bundle manifest), including the required header.

  This activator also exports the Ignite instance as an OSGi service, with the property `ignite.name` set to the value of `Ignite.name()`, if and only if the name is not null.

  Currently, Ignite only allows a single instance per container. We may remove this limitation if enough demand builds up in the community.

  See Also:
    Bundle-Activator OSGi Manifest header

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Ignite` | `ignite` The instance of Ignite started by this Activator.
    `static String` | `OSGI_SERVICE_PROP_IGNITE_NAME` OSGI service property name.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteAbstractOsgiContextActivator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OsgiClassLoadingStrategyType` | `classLoadingStrategy()` Override this method to indicate which classloading strategy to use.
    `abstract IgniteConfiguration` | `igniteConfiguration()` Override this method to provide the Ignite configuration this bundle will start.
    `protected void` | `onAfterStart(org.osgi.framework.BundleContext ctx, @Nullable Throwable t)` This method is called after Ignite initialises, only if initialization succeeded.
    `protected void` | `onAfterStop(org.osgi.framework.BundleContext ctx, @Nullable Throwable t)` This method is called after Ignite stops, only if the operation succeeded.
    `protected void` | `onBeforeStart(org.osgi.framework.BundleContext ctx)` This method is called before Ignite initialises.
    `protected void` | `onBeforeStop(org.osgi.framework.BundleContext ctx)` This method is called before Ignite stops.
    `void` | `start(org.osgi.framework.BundleContext ctx)` Method invoked by OSGi to start the bundle.
    `void` | `stop(org.osgi.framework.BundleContext ctx)` Stops Ignite when the bundle is stopping.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### OSGI_SERVICE_PROP_IGNITE_NAME

          public static final String OSGI_SERVICE_PROP_IGNITE_NAME

      OSGI service property name.
      See Also:
        Constant Field Values

    - #### ignite

          protected Ignite ignite

      The instance of Ignite started by this Activator.

  - ### Constructor Detail

    - #### IgniteAbstractOsgiContextActivator

          public IgniteAbstractOsgiContextActivator()

  - ### Method Detail

    - #### start

          public final void start(org.osgi.framework.BundleContext ctx)
                           throws Exception

      Method invoked by OSGi to start the bundle. It starts the specified Ignite configuration.
      Specified by:
        `start` in interface `org.osgi.framework.BundleActivator`
      Parameters:
        `ctx` - Bundle context.
      Throws:
        `Exception`

    - #### stop

          public final void stop(org.osgi.framework.BundleContext ctx)
                          throws Exception

      Stops Ignite when the bundle is stopping.
      Specified by:
        `stop` in interface `org.osgi.framework.BundleActivator`
      Parameters:
        `ctx` - Bundle context.
      Throws:
        `Exception` - If failed.

    - #### onBeforeStart

          protected void onBeforeStart(org.osgi.framework.BundleContext ctx)

      This method is called before Ignite initialises.

      The default implementation is empty. Override it to introduce custom logic.

      Parameters:
        `ctx` - The `BundleContext`.

    - #### onAfterStart

          protected void onAfterStart(org.osgi.framework.BundleContext ctx,
                                      @Nullable
                                      @Nullable Throwable t)

      This method is called after Ignite initialises, only if initialization succeeded.

      The default implementation is empty. Override it to introduce custom logic.

      Parameters:
        `ctx` - The `BundleContext`.
        `t` - Throwable in case an error occurred when starting. `null` otherwise.

    - #### onBeforeStop

          protected void onBeforeStop(org.osgi.framework.BundleContext ctx)

      This method is called before Ignite stops.

      The default implementation is empty. Override it to introduce custom logic.

      Parameters:
        `ctx` - The `BundleContext`.

    - #### onAfterStop

          protected void onAfterStop(org.osgi.framework.BundleContext ctx,
                                     @Nullable
                                     @Nullable Throwable t)

      This method is called after Ignite stops, only if the operation succeeded.

      The default implementation is empty. Override it to introduce custom logic.

      Parameters:
        `ctx` - The `BundleContext`.
        `t` - Throwable in case an error occurred when stopping. `null` otherwise.

    - #### igniteConfiguration

          public abstract IgniteConfiguration igniteConfiguration()

      Override this method to provide the Ignite configuration this bundle will start.
      Returns:
        The Ignite configuration.

    - #### classLoadingStrategy

          public OsgiClassLoadingStrategyType classLoadingStrategy()

      Override this method to indicate which classloading strategy to use.
      Returns:
        The strategy.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021