You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dion <di...@multitask.com.au> on 2002/01/13 22:49:56 UTC
[PATCH] Docs and formatting for LatkaEventPublisher.java
FYI,
By searching the code for references, I couldn't find where this class
is used in Latka.
dIon
Re: [PATCH] Docs and formatting for LatkaEventPublisher.java
Posted by Morgan Delagrange <md...@yahoo.com>.
You're right, it's not referenced anywhere. I think Rod implemented that
class, thinking it would be useful, but so far we haven't needed it.
----- Original Message -----
From: "dion" <di...@multitask.com.au>
To: "commons-dev" <co...@jakarta.apache.org>
Sent: Sunday, January 13, 2002 3:49 PM
Subject: [PATCH] Docs and formatting for LatkaEventPublisher.java
> FYI,
>
> By searching the code for references, I couldn't find where this class
> is used in Latka.
>
> dIon
>
----------------------------------------------------------------------------
----
> Index:
latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java
> ===================================================================
> RCS file:
/home/cvspublic/jakarta-commons/latka/src/java/org/apache/commons/latka/even
t/LatkaEventPublisher.java,v
> retrieving revision 1.5
> diff -u -r1.5 LatkaEventPublisher.java
> --- latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java
12 Sep 2001 16:51:22 -0000 1.5
> +++ latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java
13 Jan 2002 21:50:26 -0000
> @@ -62,54 +62,94 @@
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> -
> +/**
> + * A LatkaEventListener that publishes events to other listeners
> + * @author
> + * @version $Id$
> + */
> public class LatkaEventPublisher implements LatkaEventListener {
>
> - protected List _list = new ArrayList();
> -
> - public void addListener(LatkaEventListener listener) {
> - _list.add(listener);
> - }
> -
> - public void broadcastEvent(LatkaEvent event) {
> - Iterator iter = _list.iterator();
> - while(iter.hasNext()) {
> - broadcastEvent(event,(LatkaEventListener)iter.next());
> - }
> - }
> -
> - protected void broadcastEvent(LatkaEvent event, LatkaEventListener
listener) {
> - if(event instanceof RequestSucceededEvent) {
> - listener.requestSucceeded((RequestEvent)event);
> - } else if(event instanceof RequestFailedEvent) {
> - listener.requestFailed((RequestEvent)event);
> - } else if(event instanceof RequestSkippedEvent) {
> - listener.requestSkipped((RequestEvent)event);
> - } else if(event instanceof RequestErrorEvent) {
> - listener.requestError((RequestEvent)event);
> - } else if(event instanceof SuiteCompletedEvent) {
> - listener.suiteCompleted((SuiteEvent)event);
> - }
> - }
> -
> - public void requestSucceeded(RequestEvent event) {
> - broadcastEvent(event);
> - }
> -
> - public void requestFailed(RequestEvent event) {
> - broadcastEvent(event);
> - }
> -
> - public void requestSkipped(RequestEvent event) {
> - broadcastEvent(event);
> - }
> -
> - public void requestError(RequestEvent event) {
> - broadcastEvent(event);
> - }
> -
> - public void suiteCompleted(SuiteEvent event) {
> - broadcastEvent(event);
> - }
> + /**
> + * the list of listeners for publishing
> + */
> + protected List _list = new ArrayList();
> +
> + /**
> + * add a listener to the list for publishing
> + * @param listener the listener to be added
> + */
> + public void addListener(LatkaEventListener listener) {
> + _list.add(listener);
> + }
> +
> + /**
> + * publish the given event to all previously added listeners
> + * @param event the event to be published
> + */
> + public void broadcastEvent(LatkaEvent event) {
> + Iterator iter = _list.iterator();
> + while(iter.hasNext()) {
> + broadcastEvent(event,(LatkaEventListener)iter.next());
> + }
> + }
> +
> + /**
> + * Send an event to a single listener
> + * @param event the event to be published
> + * @param listener the listener to receive the event
> + */
> + protected void broadcastEvent(LatkaEvent event, LatkaEventListener
listener) {
> + if(event instanceof RequestSucceededEvent) {
> + listener.requestSucceeded((RequestEvent)event);
> + } else if(event instanceof RequestFailedEvent) {
> + listener.requestFailed((RequestEvent)event);
> + } else if(event instanceof RequestSkippedEvent) {
> + listener.requestSkipped((RequestEvent)event);
> + } else if(event instanceof RequestErrorEvent) {
> + listener.requestError((RequestEvent)event);
> + } else if(event instanceof SuiteCompletedEvent) {
> + listener.suiteCompleted((SuiteEvent)event);
> + }
> + }
> +
> + /**
> + * publish a request success to all listeners
> + * @param event the event to be published
> + */
> + public void requestSucceeded(RequestEvent event) {
> + broadcastEvent(event);
> + }
> +
> + /**
> + * publish a request failure to all listeners
> + * @param the event to be published
> + */
> + public void requestFailed(RequestEvent event) {
> + broadcastEvent(event);
> + }
> +
> + /**
> + * publish a request skip to all listeners
> + * @param event the event to be published
> + */
> + public void requestSkipped(RequestEvent event) {
> + broadcastEvent(event);
> + }
> +
> + /**
> + * publish a request error to all listeners
> + * @param event the event to be published
> + */
> + public void requestError(RequestEvent event) {
> + broadcastEvent(event);
> + }
> +
> + /**
> + * publish the suite completion skip to all listeners
> + * @param event the event to be published
> + */
> + public void suiteCompleted(SuiteEvent event) {
> + broadcastEvent(event);
> + }
>
> }
>
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>