public class BlueprintEvent
extends java.lang.Object
BlueprintEvent
objects are delivered to all registered
BlueprintListener
services. Blueprint Events must be asynchronously
delivered in chronological order with respect to each listener.
In addition, after a Blueprint Listener is registered, the Blueprint extender
will synchronously send to this Blueprint Listener the last Blueprint Event
for each ready Blueprint bundle managed by this extender. This
replay of Blueprint Events is designed so that the new Blueprint
Listener can be informed of the state of each Blueprint bundle. Blueprint
Events sent during this replay will have the isReplay()
flag set.
The Blueprint extender must ensure that this replay phase does not interfere
with new Blueprint Events so that the chronological order of all Blueprint
Events received by the Blueprint Listener is preserved. If the last Blueprint
Event for a given Blueprint bundle is DESTROYED
, the extender must
not send it during this replay phase.
A type code is used to identify the type of event. The following event types are defined:
In addition to calling the registered BlueprintListener
services, the
Blueprint extender must also send those events to the Event Admin service, if
it is available.
BlueprintListener
,
EventConstants
Modifier and Type | Field and Description |
---|---|
static int |
CREATED
The Blueprint extender has created a Blueprint Container for the bundle.
|
static int |
CREATING
The Blueprint extender has started creating a Blueprint Container for the
bundle.
|
static int |
DESTROYED
The Blueprint Container for the bundle has been completely destroyed.
|
static int |
DESTROYING
The Blueprint extender has started destroying the Blueprint Container for
the bundle.
|
static int |
FAILURE
The Blueprint Container creation for the bundle has failed.
|
static int |
GRACE_PERIOD
The Blueprint Container has entered the grace period.
|
static int |
WAITING
The Blueprint Container is waiting on the availability of a service to
satisfy an invocation on a referenced service.
|
Constructor and Description |
---|
BlueprintEvent(BlueprintEvent event,
boolean replay)
Create a new
BlueprintEvent from the specified
BlueprintEvent . |
BlueprintEvent(int type,
Bundle bundle,
Bundle extenderBundle)
Create a simple
BlueprintEvent object. |
BlueprintEvent(int type,
Bundle bundle,
Bundle extenderBundle,
java.lang.String[] dependencies)
Create a
BlueprintEvent object associated with a set of
dependencies. |
BlueprintEvent(int type,
Bundle bundle,
Bundle extenderBundle,
java.lang.String[] dependencies,
java.lang.Throwable cause)
Create a
BlueprintEvent object associated with a failure cause
and a set of dependencies. |
BlueprintEvent(int type,
Bundle bundle,
Bundle extenderBundle,
java.lang.Throwable cause)
Create a
BlueprintEvent object associated with a failure cause. |
Modifier and Type | Method and Description |
---|---|
Bundle |
getBundle()
Return the Blueprint bundle associated with this event.
|
java.lang.Throwable |
getCause()
Return the cause for this
FAILURE event. |
java.lang.String[] |
getDependencies()
Return the filters identifying the missing dependencies that caused this
event.
|
Bundle |
getExtenderBundle()
Return the Blueprint extender bundle that is generating this event.
|
long |
getTimestamp()
Return the time at which this event was created.
|
int |
getType()
Return the type of this event.
|
boolean |
isReplay()
Return whether this event is a replay event.
|
public static final int CREATING
public static final int CREATED
public static final int DESTROYING
public static final int DESTROYED
public static final int FAILURE
getDependencies()
method must return an array of missing
mandatory dependencies. The event must also contain the cause of the
failure as a Throwable
through the getCause()
method.public static final int GRACE_PERIOD
getDependencies()
method. During the grace period, a
GRACE_PERIOD
event is sent each time the set of unsatisfied
dependencies changes.public static final int WAITING
getDependencies()
method
which will return an array containing one filter object as a String.public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle)
BlueprintEvent
object.type
- The type of this event.bundle
- The Blueprint bundle associated with this event. This
parameter must not be null
.extenderBundle
- The Blueprint extender bundle that is generating
this event. This parameter must not be null
.public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, java.lang.String[] dependencies)
BlueprintEvent
object associated with a set of
dependencies.type
- The type of this event.bundle
- The Blueprint bundle associated with this event. This
parameter must not be null
.extenderBundle
- The Blueprint extender bundle that is generating
this event. This parameter must not be null
.dependencies
- An array of String
filters for each
dependency associated with this event. Must be a non-empty array
for event types GRACE_PERIOD
and WAITING
. It is
optional for event type FAILURE
. Must be null
for
other event types.public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, java.lang.Throwable cause)
BlueprintEvent
object associated with a failure cause.type
- The type of this event.bundle
- The Blueprint bundle associated with this event. This
parameter must not be null
.extenderBundle
- The Blueprint extender bundle that is generating
this event. This parameter must not be null
.cause
- A Throwable
object describing the root cause of the
event. May be null
.public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, java.lang.String[] dependencies, java.lang.Throwable cause)
BlueprintEvent
object associated with a failure cause
and a set of dependencies.type
- The type of this event.bundle
- The Blueprint bundle associated with this event. This
parameter must not be null
.extenderBundle
- The Blueprint extender bundle that is generating
this event. This parameter must not be null
.dependencies
- An array of String
filters for each
dependency associated with this event. Must be a non-empty array
for event types GRACE_PERIOD
and WAITING
. It is
optional for event type FAILURE
. Must be null
for
other event types.cause
- A Throwable
object describing the root cause of this
event. May be null
.public BlueprintEvent(BlueprintEvent event, boolean replay)
BlueprintEvent
from the specified
BlueprintEvent
. The timestamp
property will be copied
from the original event and only the replay property will be overridden
with the given value.event
- The original BlueprintEvent
to copy. Must not be
null
.replay
- true
if this event should be used as a replay
event.public int getType()
The type values are:
public long getTimestamp()
public Bundle getBundle()
public Bundle getExtenderBundle()
public java.lang.String[] getDependencies()
WAITING
,
GRACE_PERIOD
or FAILURE
or null
for the
other event types.public java.lang.Throwable getCause()
FAILURE
event.null
.public boolean isReplay()
true
if this event is a replay event and false
otherwise.Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0