avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/event/src/xdocs event-howto.xml
Date Mon, 30 Sep 2002 20:49:07 GMT
bloritsch    2002/09/30 13:49:07

  Modified:    event/src/xdocs event-howto.xml
  Log:
  add the EventHandler docs
  
  Revision  Changes    Path
  1.3       +33 -1     jakarta-avalon-excalibur/event/src/xdocs/event-howto.xml
  
  Index: event-howto.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/xdocs/event-howto.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- event-howto.xml	30 Sep 2002 20:43:09 -0000	1.2
  +++ event-howto.xml	30 Sep 2002 20:49:07 -0000	1.3
  @@ -183,6 +183,38 @@
           ]]>
         </source>
       </s1>
  +    <s1 title="EventHandlers">
  +      <p>
  +        Event Handlers are used in automated event routing systems like
  +        SEDA architectures.  Basically, it is a way for your object/component
  +        to handle events without having to implement the Sink interface,
  +        which can be kind of tricky.  Here is an example:
  +      </p>
  +      <source>
  +        <![CDATA[
  +import org.apache.excalibur.event.EventHandler;
  +
  +/** Send events to System.out */
  +public class MyEventHandler implements EventHandler
  +{
  +     /** Handle several events at one time */
  +     public void handleEvents( Object[] events )
  +     {
  +         for (int i = 0; i < events.length; i++)
  +         {
  +             handleEvent( events[i] );
  +         }
  +     }
  +
  +     /** Handle one event at a time */
  +     public void handleEvent( Object event )
  +     {
  +         System.out.println( event );
  +     }
  +}
  +        ]]>
  +      </source>
  +    </s1>
     </body>
     <footer>
       <legal>
  
  
  

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


Mime
View raw message