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/11/30 04:17:50 UTC

cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier Resources.properties

leif        2002/11/29 19:17:50

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/verifier
                        Resources.properties
  Added:       containerkit/src/java/org/apache/excalibur/containerkit/metadata
                        PartitionMetaData.java
               containerkit/src/java/org/apache/excalibur/containerkit/registry
                        PartitionProfile.java ProfileBuilder.java
  Log:
  Commit for PeterD.  Add support for partitions.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metadata/PartitionMetaData.java
  
  Index: PartitionMetaData.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.metadata;
  
  import org.apache.avalon.framework.info.Attribute;
  import org.apache.avalon.framework.info.FeatureDescriptor;
  
  /**
   * In each Assembly there may be groups of components that
   * are activated together and treated as a group. These
   * components are all "visible" to each other as peers.
   * The group will have a name and may use resources from
   * other partitions. Partitions can also be nested one inside
   * each other.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/30 03:17:50 $
   */
  public class PartitionMetaData
      extends FeatureDescriptor
  {
      /**
       * Constant for an empty set of partitions.
       */
      public static final PartitionMetaData[] EMPTY_SET = new PartitionMetaData[ 0 ];
  
      /**
       * The name of the partition. This is an
       * abstract name used during assembly.
       */
      private final String m_name;
  
      /**
       * An array listing the set of other partitions required by
       * this partition. The required partitions must be initialized
       * and in ready state prior to this partition starting and this
       * partition must be shutdown prior
       */
      private final String[] m_depends;
  
      /**
       * AN array of partitions that are contained by this
       * object.
       */
      private final PartitionMetaData[] m_partitions;
  
      /**
       * AN array of components that are contained by this
       * object.
       */
      private final ComponentMetaData[] m_components;
  
      /**
       * Create a PartitionMetaData.
       *
       * @param name the abstract name of component meta data instance
       * @param depends the partitions depended upon by this parition
       * @param partitions the partitions contained by this partition
       * @param components the components contained by this partition
       * @param attributes the extra attributes that are used to describe component
       */
      public PartitionMetaData( final String name,
                                final String[] depends,
                                final PartitionMetaData[] partitions,
                                final ComponentMetaData[] components,
                                final Attribute[] attributes )
      {
          super( attributes );
          if( null == name )
          {
              throw new NullPointerException( "name" );
          }
          if( null == depends )
          {
              throw new NullPointerException( "depends" );
          }
          if( null == partitions )
          {
              throw new NullPointerException( "partitions" );
          }
          if( null == components )
          {
              throw new NullPointerException( "components" );
          }
  
          m_name = name;
          m_depends = depends;
          m_partitions = partitions;
          m_components = components;
      }
  
      /**
       * Return the name of component profile.
       *
       * @return the name of the component profile.
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the set of prereqs for this partition.
       *
       * @return the set of prereqs for this partition.
       */
      public String[] getDepends()
      {
          return m_depends;
      }
  
      /**
       * Return the set of partitions contained in this partition.
       *
       * @return the set of partitions contained in this partition.
       */
      public PartitionMetaData[] getPartitions()
      {
          return m_partitions;
      }
  
      /**
       * Return the set of components contained in this partition.
       *
       * @return the set of components contained in this partition.
       */
      public ComponentMetaData[] getComponents()
      {
          return m_components;
      }
  
      /**
       * Return the partition with specified name.
       *
       * @return the partition with specified name.
       */
      public PartitionMetaData getPartition( final String name )
      {
          for( int i = 0; i < m_partitions.length; i++ )
          {
              final PartitionMetaData partition = m_partitions[ i ];
              if( partition.getName().equals( name ) )
              {
                  return partition;
              }
          }
          return null;
      }
  
      /**
       * Return the component with specified name.
       *
       * @return the component with specified name.
       */
      public ComponentMetaData getComponent( final String name )
      {
          for( int i = 0; i < m_components.length; i++ )
          {
              final ComponentMetaData component = m_components[ i ];
              if( component.getName().equals( name ) )
              {
                  return component;
              }
          }
          return null;
      }
  }
  
  
  
  
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/registry/PartitionProfile.java
  
  Index: PartitionProfile.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.registry;
  
  import org.apache.excalibur.containerkit.metadata.PartitionMetaData;
  
  /**
   * The PartitionProfile contains the set of data required
   * to construct a specific instance of a Profile. It contains
   * a set of child PartitionProfile and {@link ComponentProfile}
   * objects.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/30 03:17:50 $
   */
  public class PartitionProfile
  {
      /**
       * Constant for an empty set of partitions.
       */
      public static final PartitionProfile[] EMPTY_SET = new PartitionProfile[ 0 ];
  
      /**
       * The {@link PartitionMetaData} for this partition.
       */
      private final PartitionMetaData m_metaData;
  
      /**
       * An array of partitions that are contained by this
       * object.
       */
      private final PartitionProfile[] m_partitions;
  
      /**
       * An array of partitions that are contained by this
       * object.
       */
      private final ComponentProfile[] m_components;
  
      /**
       * Create a PartitionProfile.
       *
       * @param metaData the meta data about this profile
       * @param partitions the partitions contained by this partition
       * @param components the components contained by this partition
       */
      public PartitionProfile( final PartitionMetaData metaData,
                               final PartitionProfile[] partitions,
                               final ComponentProfile[] components )
      {
          if( null == metaData )
          {
              throw new NullPointerException( "metaData" );
          }
          if( null == partitions )
          {
              throw new NullPointerException( "partitions" );
          }
          if( null == components )
          {
              throw new NullPointerException( "components" );
          }
  
          m_metaData = metaData;
          m_partitions = partitions;
          m_components = components;
      }
  
      /**
       * Return the metaData about this profile.
       *
       * @return the metaData about this profile.
       */
      public PartitionMetaData getMetaData()
      {
          return m_metaData;
      }
  
      /**
       * Return the set of partitions contained in this partition.
       *
       * @return the set of partitions contained in this partition.
       */
      public PartitionProfile[] getPartitions()
      {
          return m_partitions;
      }
  
      /**
       * Return the set of components contained in this partition.
       *
       * @return the set of components contained in this partition.
       */
      public ComponentProfile[] getComponents()
      {
          return m_components;
      }
  
      /**
       * Return the partition with specified name.
       *
       * @return the partition with specified name.
       */
      public PartitionProfile getPartition( final String name )
      {
          for( int i = 0; i < m_partitions.length; i++ )
          {
              final PartitionProfile partition = m_partitions[ i ];
              if( partition.getMetaData().getName().equals( name ) )
              {
                  return partition;
              }
          }
          return null;
      }
  
      /**
       * Return the component with specified name.
       *
       * @return the component with specified name.
       */
      public ComponentProfile getComponent( final String name )
      {
          for( int i = 0; i < m_components.length; i++ )
          {
              final ComponentProfile component = m_components[ i ];
              if( component.getMetaData().getName().equals( name ) )
              {
                  return component;
              }
          }
          return null;
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/registry/ProfileBuilder.java
  
  Index: ProfileBuilder.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.registry;
  
  import java.util.Map;
  
  /**
   * Load metadata for an Assembly from some source.
   * The source is usually one or more xml config files.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/30 03:17:50 $
   */
  public interface ProfileBuilder
  {
      /**
       * Load metadata from a particular source
       * using specified map of parameters. The content
       * of the parameters is left unspecified.
       *
       * @param parameters the parameters indicating method to load meta data source
       * @return the set of components in metadata
       * @throws Exception if unable to load or resolve
       *         meta data for any reason
       */
      PartitionProfile buildProfile( Map parameters )
          throws Exception;
  }
  
  
  
  1.12      +3 -3      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/Resources.properties,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Resources.properties	14 Sep 2002 06:21:00 -0000	1.11
  +++ Resources.properties	30 Nov 2002 03:17:50 -0000	1.12
  @@ -6,11 +6,11 @@
   assembly.nocircular-dependencies.notice=Verifying that there are no circular dependencies between Components.
   assembly.component-type.notice=Verifying that the specified Components have valid types.
   assembly.circular-dependency.error=Component named "{0}" has a circular dependency via path: {1}.
  -assembly.missing-dependency.error=Component "{1}" that satisfies the dependency with role "{0}" of Component "{2}" does not exist.
  +assembly.missing-dependency.error=Component "{1}" that satisfies the dependency with key "{0}" of Component "{2}" does not exist.
   assembly.dependency-missing-service.error=Dependency "{0}" of Block "{2}" does not offer the required service "{1}".
   assembly.bad-class.error=Unable to load class "{1}" for Component named "{0}". (Reason: {2}).
   assembly.bad-name.error=The Component name "{0}" is invalid. Valid names contain only letters, digits and the '-' character.
   assembly.duplicate-name.error=The name "{0}" is used by multiple Components in assembly.
  -assembly.unknown-dependency.error=Unknown dependency named "{0}" with role "{1}" declared for Component {2}.
  -assembly.unspecified-dependency.error=Dependency for role "{0}" not specified for the Component named "{1}".
  +assembly.unknown-dependency.error=Unknown dependency named "{0}" with key "{1}" declared for Component {2}.
  +assembly.unspecified-dependency.error=Dependency for key "{0}" not specified for the Component named "{1}".
   error=Component named "{0}" of type "{1}" is not Contextualizable but declares Context Entrys.
  
  
  

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