Class BlueprintEvent
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.osgi.framework.BundleThe Blueprint bundle.private final ThrowableCause of the failure.static final intThe Blueprint extender has created a Blueprint Container for the bundle.static final intThe Blueprint extender has started creating a Blueprint Container for the bundle.private final String[]An array containing filters identifying the missing dependencies.static final intThe Blueprint Container for the bundle has been completely destroyed.static final intThe Blueprint extender has started destroying the Blueprint Container for the bundle.private final org.osgi.framework.BundleThe Blueprint extender bundle.static final intThe Blueprint Container creation for the bundle has failed.static final intThe Blueprint Container has entered the grace period.private final booleanIndicate if this event is a replay event or not.private final longThe time when the event occurred.private final intType of this event.static final intThe Blueprint Container is waiting on the availability of a service to satisfy an invocation on a referenced service. -
Constructor Summary
ConstructorsConstructorDescriptionBlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle) Create a simpleBlueprintEventobject.BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, String[] dependencies) Create aBlueprintEventobject associated with a set of dependencies.BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, String[] dependencies, Throwable cause) Create aBlueprintEventobject associated with a failure cause and a set of dependencies.BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, Throwable cause) Create aBlueprintEventobject associated with a failure cause.BlueprintEvent(BlueprintEvent event, boolean replay) Create a newBlueprintEventfrom the specifiedBlueprintEvent. -
Method Summary
Modifier and TypeMethodDescriptionorg.osgi.framework.BundleReturn the Blueprint bundle associated with this event.getCause()Return the cause for thisFAILUREevent.String[]Return the filters identifying the missing dependencies that caused this event.org.osgi.framework.BundleReturn the Blueprint extender bundle that is generating this event.longReturn the time at which this event was created.intgetType()Return the type of this event.booleanisReplay()Return whether this event is a replay event.
-
Field Details
-
CREATING
public static final int CREATINGThe Blueprint extender has started creating a Blueprint Container for the bundle.- See Also:
-
CREATED
public static final int CREATEDThe Blueprint extender has created a Blueprint Container for the bundle. This event is sent after the Blueprint Container has been registered as a service.- See Also:
-
DESTROYING
public static final int DESTROYINGThe Blueprint extender has started destroying the Blueprint Container for the bundle.- See Also:
-
DESTROYED
public static final int DESTROYEDThe Blueprint Container for the bundle has been completely destroyed. This event is sent after the Blueprint Container has been unregistered as a service.- See Also:
-
FAILURE
public static final int FAILUREThe Blueprint Container creation for the bundle has failed. If this event is sent after a timeout in the Grace Period, thegetDependencies()method must return an array of missing mandatory dependencies. The event must also contain the cause of the failure as aThrowablethrough thegetCause()method.- See Also:
-
GRACE_PERIOD
public static final int GRACE_PERIODThe Blueprint Container has entered the grace period. The list of missing dependencies must be made available through thegetDependencies()method. During the grace period, aGRACE_PERIODevent is sent each time the set of unsatisfied dependencies changes.- See Also:
-
WAITING
public static final int WAITINGThe Blueprint Container is waiting on the availability of a service to satisfy an invocation on a referenced service. The missing dependency must be made available through thegetDependencies()method which will return an array containing one filter object as a String.- See Also:
-
type
private final int typeType of this event.- See Also:
-
timestamp
private final long timestampThe time when the event occurred.- See Also:
-
bundle
private final org.osgi.framework.Bundle bundleThe Blueprint bundle.- See Also:
-
extenderBundle
private final org.osgi.framework.Bundle extenderBundleThe Blueprint extender bundle.- See Also:
-
dependencies
An array containing filters identifying the missing dependencies. Must not benullwhen the event type requires it.- See Also:
-
cause
Cause of the failure.- See Also:
-
replay
private final boolean replayIndicate if this event is a replay event or not.- See Also:
-
-
Constructor Details
-
BlueprintEvent
public BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle) Create a simpleBlueprintEventobject.- Parameters:
type- The type of this event.bundle- The Blueprint bundle associated with this event. This parameter must not benull.extenderBundle- The Blueprint extender bundle that is generating this event. This parameter must not benull.
-
BlueprintEvent
public BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, String[] dependencies) Create aBlueprintEventobject associated with a set of dependencies.- Parameters:
type- The type of this event.bundle- The Blueprint bundle associated with this event. This parameter must not benull.extenderBundle- The Blueprint extender bundle that is generating this event. This parameter must not benull.dependencies- An array ofStringfilters for each dependency associated with this event. Must be a non-empty array for event typesGRACE_PERIODandWAITING. It is optional for event typeFAILURE. Must benullfor other event types.
-
BlueprintEvent
public BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, Throwable cause) Create aBlueprintEventobject associated with a failure cause.- Parameters:
type- The type of this event.bundle- The Blueprint bundle associated with this event. This parameter must not benull.extenderBundle- The Blueprint extender bundle that is generating this event. This parameter must not benull.cause- AThrowableobject describing the root cause of the event. May benull.
-
BlueprintEvent
public BlueprintEvent(int type, org.osgi.framework.Bundle bundle, org.osgi.framework.Bundle extenderBundle, String[] dependencies, Throwable cause) Create aBlueprintEventobject associated with a failure cause and a set of dependencies.- Parameters:
type- The type of this event.bundle- The Blueprint bundle associated with this event. This parameter must not benull.extenderBundle- The Blueprint extender bundle that is generating this event. This parameter must not benull.dependencies- An array ofStringfilters for each dependency associated with this event. Must be a non-empty array for event typesGRACE_PERIODandWAITING. It is optional for event typeFAILURE. Must benullfor other event types.cause- AThrowableobject describing the root cause of this event. May benull.
-
BlueprintEvent
Create a newBlueprintEventfrom the specifiedBlueprintEvent. Thetimestampproperty will be copied from the original event and only the replay property will be overridden with the given value.- Parameters:
event- The originalBlueprintEventto copy. Must not benull.replay-trueif this event should be used as a replay event.
-
-
Method Details
-
getType
public int getType()Return the type of this event.The type values are:
- Returns:
- The type of this event.
-
getTimestamp
public long getTimestamp()Return the time at which this event was created.- Returns:
- The time at which this event was created.
-
getBundle
public org.osgi.framework.Bundle getBundle()Return the Blueprint bundle associated with this event.- Returns:
- The Blueprint bundle associated with this event.
-
getExtenderBundle
public org.osgi.framework.Bundle getExtenderBundle()Return the Blueprint extender bundle that is generating this event.- Returns:
- The Blueprint extender bundle that is generating this event.
-
getDependencies
Return the filters identifying the missing dependencies that caused this event.- Returns:
- The filters identifying the missing dependencies that caused this
event if the event type is one of
WAITING,GRACE_PERIODorFAILUREornullfor the other event types.
-
getCause
Return the cause for thisFAILUREevent.- Returns:
- The cause of the failure for this event. May be
null.
-
isReplay
public boolean isReplay()Return whether this event is a replay event.- Returns:
trueif this event is a replay event andfalseotherwise.
-