commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Waldhoff, Rodney" <rwald...@us.britannica.com>
Subject RE: [PATCH] Docs and formatting for LatkaEventPublisher.java
Date Tue, 15 Jan 2002 01:23:52 GMT
Doh, the eX[P]tremist in me is hurt by that.  We must have used it somewhere
at one point. ;)

-----Original Message-----
From: Morgan Delagrange [mailto:mdelagra@yahoo.com]
Sent: Monday, January 14, 2002 12:09 PM
To: Jakarta Commons Developers List
Subject: Re: [PATCH] Docs and formatting for LatkaEventPublisher.java


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" <dion@multitask.com.au>
To: "commons-dev" <commons-dev@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:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message