avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo ContextDescriptor.java
Date Sun, 09 Jun 2002 01:04:00 GMT
donaldp     2002/06/08 18:04:00

  Added:       containerkit/src/java/org/apache/excalibur/containerkit/metainfo
                        ContextDescriptor.java
  Log:
  Add a descriptor for Context
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo/ContextDescriptor.java
  
  Index: ContextDescriptor.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.excalibur.containerkit.metainfo;
  
  import java.util.Properties;
  
  /**
   * A descriptor describing the Context that the Component
   * is passed to describe information about Runtime environment
   * of Component. It contains information such as;
   * <ul>
   *   <li>classname: the classname of the Context type if it
   *       differs from base Context class (ie BlockContext).</li>
   *   <li>entrys: a list of entrys contained in context</li>
   * </ul>
   *
   * <p>Also associated with each Context is a set of arbitrary
   * attributes that can be used to store extra information
   * about Context requirements.</p>
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/09 01:04:00 $
   */
  public class ContextDescriptor
      extends FeatureDescriptor
  {
      private final String m_classname;
      private final EntryDescriptor[] m_entrys;
  
      /**
       * Create a descriptor sans attributes.
       */
      public ContextDescriptor( final String classname,
                                final EntryDescriptor[] entrys )
      {
          this( classname, entrys, null );
      }
  
      /**
       * Create a descriptor.
       */
      public ContextDescriptor( final String classname,
                                final EntryDescriptor[] entrys,
                                final Properties attributes )
      {
          super( attributes );
          m_classname = classname;
          m_entrys = entrys;
      }
  
      /**
       * Return the classname of Context class.
       *
       * @return the classname of Context class.
       */
      public String getClassname()
      {
          return m_classname;
      }
  
      /**
       * Return the entrys contained in the context.
       *
       * @return the entrys contained in the context.
       */
      public EntryDescriptor[] getEntrys()
      {
          return m_entrys;
      }
  
      /**
       * Return the entry with specified key.
       *
       * @return the entry with specified key.
       */
      public EntryDescriptor getEntry( final String key )
      {
          for( int i = 0; i < m_entrys.length; i++ )
          {
              final EntryDescriptor entry = m_entrys[ i ];
              if( entry.getKey().equals( key ) )
              {
                  return entry;
              }
          }
          return null;
      }
  }
  
  
  

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