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/info/src/java/org/apache/avalon/framework/info SchemaDescriptor.java
Date Thu, 14 Nov 2002 07:41:12 GMT
donaldp     2002/11/13 23:41:11

  Added:       info/src/java/org/apache/avalon/framework/info
                        SchemaDescriptor.java
  Log:
  Add descriptor for schema of of configuration/parameters
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/SchemaDescriptor.java
  
  Index: SchemaDescriptor.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.framework.info;
  
  /**
   * A descriptor describing the schema to validate the components
   * {@link org.apache.avalon.framework.parameters.Parameters} or
   * {@link org.apache.avalon.framework.configuration.Configuration}
   * object. If a component is neither
   * {@link org.apache.avalon.framework.parameters.Parameterizable}
   * nor {@link org.apache.avalon.framework.configuration.Configurable}
   * then this descriptor will hold empty values for location, category
   * and type.
   *
   * <p>Associated with each Schema is a set of arbitrary
   * Attributes that can be used to store extra information
   * about Schema requirements.</p>
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/14 07:41:11 $
   */
  public class SchemaDescriptor
      extends FeatureDescriptor
  {
      /**
       * The category of input data that this descriptor is for.
       * Currently must be one of eeither "parameters" or
       * "configuration".
       */
      private final String m_category;
  
      /**
       * The location of schema relative to component.
       */
      private final String m_location;
  
      /**
       * The type of the schema.
       */
      private final String m_type;
  
      /**
       * Create a Schema descriptor.
       *
       * @param category the category of the schema.
       * @param location the location of schema relative to component
       * @param type the type of the schema
       * @param attributes the attributes associated with schema
       */
      public SchemaDescriptor( final String category,
                               final String location,
                               final String type,
                               final Attribute[] attributes )
      {
          super( attributes );
          if( null == category )
          {
              throw new NullPointerException( "category" );
          }
          if( null == location )
          {
              throw new NullPointerException( "location" );
          }
          if( null == type )
          {
              throw new NullPointerException( "type" );
          }
  
          if( !"parameters".equals( category ) &&
              !"configuration".equals( category ) )
          {
              final String message = "category = " + category + ". Should be" +
                  "parameters or configuration";
              throw new IllegalArgumentException( message );
          }
  
          m_category = category;
          m_location = location;
          m_type = type;
      }
  
      /**
       * Return the category of the schema. ie What it is used for.
       * Usually one of "configuration" or "parameters".
       *
       * @return the category of the schema
       */
      public String getCategory()
      {
          return m_category;
      }
  
      /**
       * Return the location of the schema relative to the component.
       *
       * @return the location of the schema relative to the component.
       */
      public String getLocation()
      {
          return m_location;
      }
  
      /**
       * Return the type of the schema.
       * Usually represented as a URI referring to schema
       * namespace declaration.
       *
       * @return the type of the schema
       */
      public String getType()
      {
          return m_type;
      }
  }
  
  
  

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