geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r780886 - /geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
Date Mon, 01 Jun 2009 23:49:00 GMT
Author: gnodet
Date: Mon Jun  1 23:49:00 2009
New Revision: 780886

URL: http://svn.apache.org/viewvc?rev=780886&view=rev
Log:
Update BlueprintEvent api class

Modified:
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java

Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java?rev=780886&r1=780885&r2=780886&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
Mon Jun  1 23:49:00 2009
@@ -23,8 +23,17 @@
  * <p>
  * <code>BlueprintEvent</code> objects are delivered to all registered <code>BlueprintListener</code>
  * service objects. BlueprintEvents must be asynchronously delivered in chronological order
- * with respect to each listener.  In addition, when a listener is registered, the blueprint
extender
- * will send to this listener the last event for each blueprint bundle managed by this extender.
+ * with respect to each listener.
+ *
+ * <p>
+ * In addition, when a listener is registered, the blueprint extender
+ * will synchronously send to this listener the last event for each blueprint bundle managed
+ * by this extender.  This replay of events is designed so that the new listener can
+ * be informed of the state of each managed bundle.  Events sent during this replay will
+ * have the {@link #replay} flag set. The blueprint extender must ensure that this replay
phase
+ * does not interfere with new events so that the chronological order of all events received
+ * by the listener is preserved. If the last event for a given blueprint bundle is DESTROYED,
+ * the extender must not send it during this replay phase.
  *
  * <p>
  * A type code is used to identify the type of event. The following event types are defined:
@@ -77,7 +86,8 @@
 	/**
 	 * The Blueprint Container has entered the Grace Period.
 	 * The list of missing dependencies must be made available through the {@link #getDependencies()}
- 	 * method.
+ 	 * method.  During the grace period, a GRACE_PERIOD event is sent each time the set of
+	 * unsatisfied dependencies changes.
 	 */
 	public static final int GRACE_PERIOD = 6;
 	/**
@@ -125,6 +135,12 @@
 	 * @see #getException()
 	 */
 	private final Throwable exception;
+	/**
+ 	 * Indicate if this event is a replay event or not.
+	 *
+	 * @see #isReplay()
+	 */
+	private final boolean replay;
 
 
 	public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle) {
@@ -146,6 +162,25 @@
 		this.extenderBundle = extenderBundle;
 		this.dependencies = dependencies;
 		this.exception = exception;
+		this.replay = false;
+	}
+
+	/**
+ 	 * Create a new blueprint event from the given blueprint event.
+ 	 * The timestamp property will be copied from the original event and only the
+ 	 * replay property will be overriden with the given value.
+ 	 *
+	 * @param event the original event to copy
+	 * @param replay if the copied event should be used as a replay event
+	 */
+	public BlueprintEvent(BlueprintEvent event, boolean replay) {
+		this.type = event.type;
+		this.timestamp = event.timestamp;
+		this.bundle = event.bundle;
+		this.extenderBundle = event.extenderBundle;
+		this.dependencies = event.dependencies;
+		this.exception = event.exception;
+		this.replay = replay;
 	}
 
 	/**
@@ -217,4 +252,13 @@
 		return exception;
 	}
 
+	/**
+ 	 * Return the fact that this event is a replay event or not.
+	 *
+	 * @return a boolean indicating if this event is a replay event.
+	 */
+	public boolean isReplay() {
+		return replay;
+	}
+
 }



Mime
View raw message