You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/04/18 17:26:51 UTC

cvs commit: jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument AbstractInstrumentable.java

leif        02/04/18 08:26:51

  Added:       instrument/src/java/org/apache/avalon/excalibur/instrument
                        AbstractInstrumentable.java
  Log:
  Added class submitted by Ryan
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument/AbstractInstrumentable.java
  
  Index: AbstractInstrumentable.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.instrument;
  
  /**
   * Utility class to ease the construction of components that can be instrumented.
   * Subclasses must override either <code>getChildInstrumentables</code> or
   * <code>getInstruments</code>, or both, to be of any use.
   *
   * @author <a href="mailto:ryan.shaw@stanfordalumni.org">Ryan Shaw</a>
   */
  public abstract class AbstractInstrumentable 
  {
      /** Name of the instrumentable. */
      private String m_instrumentableName; 
      
      /**
       * Gets the name of the Instrumentable.
       *
       * @return The name used to identify a Instrumentable.
       */
      public String getInstrumentableName() 
      {
          return m_instrumentableName;
      }
  
      /**
       * Sets the name for the Instrumentable.  The Instrumentable Name is used
       *  to uniquely identify the Instrumentable during the configuration of
       *  the InstrumentManager and to gain access to an InstrumentableDescriptor
       *  through the InstrumentManager.  The value should be a string which does
       *  not contain spaces or periods.
       * <p>
       * This value may be set by a parent Instrumentable, or by the
       *  InstrumentManager using the value of the 'instrumentable' attribute in
       *  the configuration of the component.
       *
       * @param name The name used to identify a Instrumentable.
       */
      public void setInstrumentableName(String name) 
      {
          m_instrumentableName = name;
      }
      
      /**
       * Any Object which implements Instrumentable can also make use of other
       *  Instrumentable child objects.  This method is used to tell the
       *  InstrumentManager about them.
       *
       * @return An array of child Instrumentables.  This method should never
       *         return null.  If there are no child Instrumentables, then
       *         EMPTY_INSTRUMENTABLE_ARRAY can be returned.
       */
      public Instrumentable[] getChildInstrumentables() 
      {
          return Instrumentable.EMPTY_INSTRUMENTABLE_ARRAY;
      }
      
      /**
       * Obtain a reference to all the Instruments that the Instrumentable object
       *  wishes to expose.  All sampling is done directly through the
       *  Instruments as opposed to the Instrumentable interface.
       *
       * @return An array of the Instruments available for profiling.  Should
       *         never be null.  If there are no Instruments, then
       *         EMPTY_INSTRUMENT_ARRAY can be returned.  This should never be
       *         the case though unless there are child Instrumentables with
       *         Instruments.
       */
      public Instrument[] getInstruments() 
      {
          return Instrumentable.EMPTY_INSTRUMENT_ARRAY;
      }
  }
  
  
  

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