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/verifier AssemblyVerifier.java Resources.properties
Date Fri, 14 Jun 2002 07:23:20 GMT
donaldp     2002/06/14 00:23:19

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/verifier
                        AssemblyVerifier.java Resources.properties
  Log:
  Allow nulls in dependencyInfo and DependencyMetaData but they must both be null or neither
  
  Revision  Changes    Path
  1.14      +65 -1     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java
  
  Index: AssemblyVerifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AssemblyVerifier.java	14 Jun 2002 06:56:54 -0000	1.13
  +++ AssemblyVerifier.java	14 Jun 2002 07:23:19 -0000	1.14
  @@ -128,6 +128,56 @@
       }
   
       /**
  +     * Verfiy that the Component type and component meta data agree
  +     * have either both specified dependencies or neither have.
  +     *
  +     * @param components the ComponentMetaData objects for the components
  +     * @throws VerifyException if an error occurs
  +     */
  +    protected void verifyDependencySpecified( final ComponentMetaData[] components )
  +        throws VerifyException
  +    {
  +        for( int i = 0; i < components.length; i++ )
  +        {
  +            verifyDependencySpecified( components[ i ], components );
  +        }
  +    }
  +
  +    /**
  +     * Verfiy that the Component type and component meta data agree
  +     * have either both specified dependencies or neither have.
  +     *
  +     * @param component the ComponentMetaData object for the component
  +     * @param others the ComponentMetaData objects for the other components
  +     * @throws VerifyException if an error occurs
  +     */
  +    protected void verifyDependencySpecified( final ComponentMetaData component,
  +                                               final ComponentMetaData[] others )
  +        throws VerifyException
  +    {
  +        final ComponentInfo info = component.getComponentInfo();
  +        final DependencyDescriptor[] depInfos = info.getDependencies();
  +        final DependencyMetaData[] roles = component.getDependencies();
  +
  +        if( null == depInfos && null != roles )
  +        {
  +            final String message =
  +                REZ.getString( "assembly.null-infos.error",
  +                               info.getComponentDescriptor().getClassname(),
  +                               component.getName() );
  +            throw new VerifyException( message );
  +        }
  +        else if( null != depInfos && null == roles )
  +        {
  +            final String message =
  +                REZ.getString( "assembly.null-deps.error",
  +                               info.getComponentDescriptor().getClassname(),
  +                               component.getName() );
  +            throw new VerifyException( message );
  +        }
  +    }
  +
  +    /**
        * Verfiy that all Components have the needed dependencies specified correctly.
        *
        * @param components the ComponentMetaData objects for the components
  @@ -176,6 +226,11 @@
           throws VerifyException
       {
           final ComponentMetaData[] dependencies = getDependencies( component, components
);
  +        if( null == dependencies )
  +        {
  +            //ie dependencies were not specified
  +            return;
  +        }
   
           for( int i = 0; i < dependencies.length; i++ )
           {
  @@ -287,6 +342,10 @@
       {
           final ComponentInfo info = component.getComponentInfo();
           final DependencyMetaData[] roles = component.getDependencies();
  +        if( null == roles )
  +        {
  +            return;
  +        }
   
           for( int i = 0; i < roles.length; i++ )
           {
  @@ -494,6 +553,11 @@
       {
           //Make sure all role entries specified in config file are valid
           final DependencyMetaData[] roles = component.getDependencies();
  +        if( null == roles )
  +        {
  +            return;
  +        }
  +
           for( int i = 0; i < roles.length; i++ )
           {
               final String roleName = roles[ i ].getRole();
  
  
  
  1.5       +2 -0      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resources.properties	6 Jun 2002 02:15:42 -0000	1.4
  +++ Resources.properties	14 Jun 2002 07:23:19 -0000	1.5
  @@ -28,3 +28,5 @@
   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.bad-service-class.error=Unable to load service class "{1}" for Component named
"{0}". (Reason: {2}).
  +assembly.null-infos.error=Component type "{0}" does not specify whether it has any dependencies
but the Component "{1}" of that type specifies that it requires dependencies.
  +assembly.null-deps.error=The Component named "{1}" of type "{0}" specifies no dependencies
but the type requires dependencies to be specified.
  \ No newline at end of file
  
  
  

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