public abstract class IgniteAbstractOsgiContextActivator extends Object implements org.osgi.framework.BundleActivator
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.IgniteActivatorYou 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.
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 and Description |
---|
IgniteAbstractOsgiContextActivator() |
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.
|
public static final String OSGI_SERVICE_PROP_IGNITE_NAME
protected Ignite ignite
public final void start(org.osgi.framework.BundleContext ctx) throws Exception
start
in interface org.osgi.framework.BundleActivator
ctx
- Bundle context.Exception
public final void stop(org.osgi.framework.BundleContext ctx) throws Exception
stop
in interface org.osgi.framework.BundleActivator
ctx
- Bundle context.Exception
- If failed.protected void onBeforeStart(org.osgi.framework.BundleContext ctx)
The default implementation is empty. Override it to introduce custom logic.
ctx
- The BundleContext
.protected void onAfterStart(org.osgi.framework.BundleContext ctx, @Nullable @Nullable Throwable t)
The default implementation is empty. Override it to introduce custom logic.
ctx
- The BundleContext
.t
- Throwable in case an error occurred when starting. null
otherwise.protected void onBeforeStop(org.osgi.framework.BundleContext ctx)
The default implementation is empty. Override it to introduce custom logic.
ctx
- The BundleContext
.protected void onAfterStop(org.osgi.framework.BundleContext ctx, @Nullable @Nullable Throwable t)
The default implementation is empty. Override it to introduce custom logic.
ctx
- The BundleContext
.t
- Throwable in case an error occurred when stopping. null
otherwise.public abstract IgniteConfiguration igniteConfiguration()
public OsgiClassLoadingStrategyType classLoadingStrategy()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019