You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2001/12/17 19:43:41 UTC

cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event Signal.java QueueElement.java

bloritsch    01/12/17 10:43:40

  Modified:    src/scratchpad/org/apache/avalon/excalibur/event
                        QueueElement.java
  Added:       src/scratchpad/org/apache/avalon/excalibur/event Signal.java
  Log:
  add some methods to make using QueueElements easier
  
  Revision  Changes    Path
  1.2       +28 -0     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event/QueueElement.java
  
  Index: QueueElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event/QueueElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- QueueElement.java	2001/12/13 22:17:50	1.1
  +++ QueueElement.java	2001/12/17 18:43:40	1.2
  @@ -15,4 +15,32 @@
    */
   public interface QueueElement
   {
  +    /**
  +     * Get the type id of the QueueElement.  This allows simplified processing
  +     * without alot of explicit casting.  In order to manage the types allowed
  +     * for a subsystem, each subsystem should declare an interface that lists
  +     * all the types available with constant names.  Another rule of thumb is
  +     * to map all the signals into a type of address space.  For instance, the
  +     * code snippet below will help:
  +     *
  +     * <pre>
  +     *   public interface AsyncFileTypes
  +     *   {
  +     *       long ADDRESS = $af100000;
  +     *       long FILE_OPEN = ADDRESS + 1;
  +     *       long FILE_CLOSE = FILE_OPEN + 1;
  +     *   }
  +     * </pre>
  +     */
  +    long getType();
  +
  +    /**
  +     * Get a handle to an attached object.
  +     */
  +    Object getAttachment();
  +
  +    /**
  +     * Attach an object to the element.
  +     */
  +    void attach( Object attachment );
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/event/Signal.java
  
  Index: Signal.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.event;
  
  /**
   * 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 Signal extends QueueElement
  {
  }
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>