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/src/scratchpad/org/apache/avalon/excalibur/event EventHandler.java
Date Mon, 28 Jan 2002 16:01:00 GMT
bloritsch    02/01/28 08:01:00

  Modified:    src/scratchpad/org/apache/avalon/excalibur/command
                        Command.java
               src/scratchpad/org/apache/avalon/excalibur/event
                        EventHandler.java
  Added:       src/scratchpad/org/apache/avalon/excalibur/command
                        CommandManager.java DelayedCommand.java
                        RepeatedCommand.java
  Log:
  adjust API for eventHandler et. al.
  
  Revision  Changes    Path
  1.2       +2 -14     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/Command.java
  
  Index: Command.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/Command.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Command.java	28 Jan 2002 15:15:34 -0000	1.1
  +++ Command.java	28 Jan 2002 16:01:00 -0000	1.2
  @@ -11,23 +11,11 @@
   import org.apache.avalon.excalibur.event.Signal;
   
   /**
  - * A Signal is a specific type of QueueElement that denotes a Control code for
  - * the Queue system.
  + * A Command is a specific type of Signal that denotes an asynchronous execution
  + * unit that must be performed by the CommandManager.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    */
   public interface Command extends Signal, Executable
   {
  -    /**
  -     * Test whether this command is repeatable.  If so, it will be placed back
  -     * on the CommandQueue to be issued again when it is time.
  -     */
  -    boolean isRepeatable();
  -
  -    /**
  -     * Gets the repeat interval so that the CommandQueue keeps it for the specified
  -     * amount of time before enqueuing it.  If the Command is not repeatable,
  -     * then the repeat interval is -1.
  -     */
  -    long getRepeatInterval();
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/CommandManager.java
  
  Index: CommandManager.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.command;
  
  import org.apache.avalon.excalibur.event.DefaultQueue;
  import org.apache.avalon.excalibur.event.Queue;
  import org.apache.avalon.excalibur.event.QueueElement;
  import org.apache.avalon.excalibur.event.Signal;
  import org.apache.avalon.excalibur.event.EventHandler;
  
  /**
   * The CommandManager handles asynchronous commands from the rest of the system.
   * The only exposed piece is the Queue that other components use to give Commands
   * to this system.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public class CommandManager implements EventHandler
  {
      private final Queue m_queue = new DefaultQueue();
      //private final ThreadManager;
  
      public CommandManager()
      {
      }
  
      /*
      public CommandManager( ThreadManager threadManager )
      {
      }
      */
  
      public final Queue getCommandQueue()
      {
          return m_queue;
      }
  
      public final void registerSignalHandler( Signal signal, EventHandler handler )
      {
      }
  
      public final void deregisterSignalHandler( Signal signal, EventHandler handler )
      {
      }
  
      public final void handleEvents( QueueElement[] elements )
      {
          for (int i = 0; i < elements.length; i++)
          {
              handleEvent( elements[i] );
          }
      }
  
      public final void handleEvent( QueueElement element )
      {
      }
  
      private final static class Runner implements Runnable
      {
          private final Queue m_queue;
  
          private Runner( Queue queue )
          {
              m_queue = queue;
          }
  
          public void run()
          {
          }
      }
  }
  
  
  1.1                  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/DelayedCommand.java
  
  Index: DelayedCommand.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.command;
  
  import org.apache.avalon.framework.activity.Executable;
  import org.apache.avalon.excalibur.event.Signal;
  
  /**
   * A DelayedCommand is a specific type of Command that denotes a an execution
   * unit that will be delayed at least X number of milliseconds.  The mechanism
   * is not guaranteed to be deterministic.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public interface DelayedCommand extends Command
  {
      /**
       * Sets the initial delay for the Command.  This defaults to 0 milliseconds.
       * The value must be positive.
       */
      long getDelayInterval();
  }
  
  
  1.1                  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/RepeatedCommand.java
  
  Index: RepeatedCommand.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.command;
  
  /**
   * A Signal is a specific type of QueueElement that denotes a Control code for
   * the Queue system.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public interface RepeatedCommand extends DelayedCommand
  {
      /**
       * If the value is less than 1 (0 or negative), the command repeats for as
       * long as the CommandManager is running.  If the value is above 0, the Command
       * repeats only for that specific amount of times before it is removed from
       * the system.
       */
      int getNumberOfRepeats();
  
      /**
       * Gets the repeat interval so that the CommandQueue keeps it for the specified
       * amount of time before enqueuing it again.  This value must not be negative.
       */
      long getRepeatInterval();
  }
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event/EventHandler.java
  
  Index: EventHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event/EventHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EventHandler.java	28 Jan 2002 15:43:28 -0000	1.1
  +++ EventHandler.java	28 Jan 2002 16:01:00 -0000	1.2
  @@ -21,10 +21,10 @@
       /**
        * Handle one event at a time.
        */
  -    handleEvent( QueueElement element );
  +    void handleEvent( QueueElement element );
   
       /**
        * Handle a whole array of events at a time.
        */
  -    handleEvents( QueueElement[] elements );
  +    void handleEvents( QueueElement[] elements );
   }
  
  
  

--
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