aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-06-24 11:12:40 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-06-25 18:03:41 -0700
commit8a9844b2afc4e30e60759c03a1428dc99a13619e (patch)
treec1f5c4faf2a6be87c3dca4c9b4fd00bdaf1cbe09 /org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
parent203bd6626767015dfb04d421c572b26a34e9cecf (diff)
downloadjgit-8a9844b2afc4e30e60759c03a1428dc99a13619e.tar.gz
jgit-8a9844b2afc4e30e60759c03a1428dc99a13619e.zip
Redo event listeners to be more generic
Replace the old crude event listener system with a much more generic implementation, patterned after the event dispatch techniques used in Google Web Toolkit 1.5 and later. Each event delivers to an interface that defines a single method, and the event itself is what performs the delivery in a type-safe way through its own dispatch method. Listeners are registered in a generic listener list, indexed by the interface they implement and wish to receive an event for. Delivery of events is performed by looping through all listeners implementing the event's corresponding listener interface, and using the event's own dispatch method to deliver the event. This is the classical "double dispatch" pattern for event delivery. Listeners can be unregistered by invoking remove() on their registration handle. This change therefore requires application code to track the handle if it wishes to remove the listener at a later point in time. Event delivery is now exposed as a generic public method on the Repository class, making it easier for any type of message to be sent out to any type of listener that has registered, without needing to pre-arrange for type-safe fireFoo() methods. New event types can be added in the future simply by defining a new RepositoryEvent subclass and a corresponding RepositoryListener interface that it dispatches to. By always adding new events through a new interface, we never need to worry about defining an Adapter to provide default no-op implementations of new event methods. Change-Id: I651417b3098b9afc93d91085e9f0b2265df8fc81 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java')
0 files changed, 0 insertions, 0 deletions