avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/model/verifier ProfileVerifier.java
Date Fri, 18 Jul 2003 08:27:36 GMT
mcconnell    2003/07/18 01:27:36

  Modified:    merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl
                        DefaultAppliance.java
               merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl
                        DefaultProfileRepository.java
                        DefaultTypeRepository.java
               merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl
                        DefaultContextualizer.xinfo
               merlin/assembly/src/test/org/apache/avalon/assembly/engine/profile
                        ProfileRepositoryTestCase.java
               merlin/assembly/src/test/org/apache/avalon/playground/basic
                        BasicComponent.xinfo
               merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        Scanner.java
               merlin/meta/src/java/org/apache/avalon/meta/model/verifier
                        ProfileVerifier.java
  Log:
  Sync. with meta stage and extension updates.
  
  Revision  Changes    Path
  1.20      +2 -3      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultAppliance.java
  
  Index: DefaultAppliance.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultAppliance.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultAppliance.java	11 Jul 2003 21:36:27 -0000	1.19
  +++ DefaultAppliance.java	18 Jul 2003 08:27:35 -0000	1.20
  @@ -1101,8 +1101,7 @@
               final String message = "resolving context handler for: " + this;
               getLogger().debug( message );
               Appliance supplier;
  -            ReferenceDescriptor ref = new ReferenceDescriptor( ext );
  -            StageDescriptor stage = new StageDescriptor( ref );
  +            StageDescriptor stage = new StageDescriptor( ext );
   
               try
               {
  
  
  
  1.4       +3 -2      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultProfileRepository.java
  
  Index: DefaultProfileRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultProfileRepository.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultProfileRepository.java	15 Jul 2003 16:50:47 -0000	1.3
  +++ DefaultProfileRepository.java	18 Jul 2003 08:27:35 -0000	1.4
  @@ -438,7 +438,8 @@
           if( classname == null )
           {
               return getProfile( dependency, m_selector );
  -        } else
  +        } 
  +        else
           {
               try
               {
  
  
  
  1.8       +2 -44     avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultTypeRepository.java
  
  Index: DefaultTypeRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultTypeRepository.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultTypeRepository.java	14 Jul 2003 22:44:13 -0000	1.7
  +++ DefaultTypeRepository.java	18 Jul 2003 08:27:35 -0000	1.8
  @@ -377,50 +377,8 @@
           String name = type.getInfo().getName();
           Class clazz = getComponentClass( type );
           Class[] classes = getServiceClasses( type );
  -        Class[] lifecycleExtensions = getExtensionClasses( type );
           TypeVerifier verifier = new TypeVerifier();
  -        verifier.verifyComponent( name, clazz, classes );
  -    }
  -
  -   /**
  -    * Return the set of lifecycle extension classes provided by the given type.
  -    *
  -    * @param type the component type
  -    * @return an array of classes represnting the lifecycle extension interfaces 
  -    *   provided by the type
  -    */
  -    private Class[] getExtensionClasses( Type type )
  -    {
  -        ArrayList list = new ArrayList();
  -        ExtensionDescriptor[] extensions = type.getExtensions();
  -        for( int i = 0; i < extensions.length; i++ )
  -        {
  -            ExtensionDescriptor extension = extensions[i];
  -            list.add( getExtensionClass( extension ) );
  -        }
  -        return (Class[]) list.toArray( new Class[0] );
  -    }
  -
  -   /**
  -    * Returns the lifecycle extension class provided by the type.
  -    * @param extension the lifecycle extension type
  -    * @return the class implementing the extension type
  -    * @exception TypeRuntimeException if a classloader error occurs
  -    */
  -    private Class getExtensionClass( ExtensionDescriptor extension ) throws TypeRuntimeException
  -    {
  -        final String classname = extension.getReference().getClassname();
  -        try
  -        {
  -            return m_classloader.loadClass( classname );
  -        }
  -        catch( Throwable e )
  -        {
  -            final String error =
  -              "Could not load lifecycle extension class of type: "
  -              + classname;
  -            throw new TypeRuntimeException( error, e );
  -        }
  +        verifier.verifyType( name, clazz, classes );
       }
   
       /**
  
  
  
  1.2       +1 -1      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl/DefaultContextualizer.xinfo
  
  Index: DefaultContextualizer.xinfo
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl/DefaultContextualizer.xinfo,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultContextualizer.xinfo	29 Apr 2003 00:55:46 -0000	1.1
  +++ DefaultContextualizer.xinfo	18 Jul 2003 08:27:36 -0000	1.2
  @@ -27,7 +27,7 @@
     Declaration of the lifecycle support phases that this manager provides. 
     -->
     <extensions>
  -    <extension type="org.apache.avalon.assembly.locator.Contextualizable" phase="CONTEXT"
/>
  +    <extension type="org.apache.avalon.assembly.locator.Contextualizable"/>
     </extensions>
   
   </type>
  
  
  
  1.5       +6 -8      avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/assembly/engine/profile/ProfileRepositoryTestCase.java
  
  Index: ProfileRepositoryTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/assembly/engine/profile/ProfileRepositoryTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProfileRepositoryTestCase.java	8 Jul 2003 17:18:55 -0000	1.4
  +++ ProfileRepositoryTestCase.java	18 Jul 2003 08:27:36 -0000	1.5
  @@ -172,10 +172,9 @@
       {
           final String classname = "org.apache.avalon.playground.ExploitationManager";
   
  -        ReferenceDescriptor reference =
  -                new ReferenceDescriptor( "org.apache.avalon.playground.Exploitable" );
  +        String ref = "org.apache.avalon.playground.Exploitable";
   
  -        StageDescriptor stage = new StageDescriptor( reference );
  +        StageDescriptor stage = new StageDescriptor( ref );
   
           try
           {
  @@ -195,7 +194,7 @@
           }
           catch( ProfileException e )
           {
  -            String message = "failure to resolve extension handler profile for : " + reference;
  +            String message = "failure to resolve extension handler profile for : " + ref;
               System.out.println( message );
               e.printStackTrace();
               fail( message );
  @@ -239,10 +238,9 @@
       {
           final String classname = "org.apache.avalon.playground.ExploitationManager";
   
  -        ReferenceDescriptor reference =
  -                new ReferenceDescriptor( "org.apache.avalon.playground.Exploitable" );
  +        String ref = "org.apache.avalon.playground.Exploitable";
   
  -        StageDescriptor stage = new StageDescriptor( reference );
  +        StageDescriptor stage = new StageDescriptor( ref );
   
           try
           {
  @@ -258,7 +256,7 @@
           }
           catch( ProfileException e )
           {
  -            String message = "failure to resolve extension handler profile for : " + reference;
  +            String message = "failure to resolve extension handler profile for : " + ref;
               System.out.println( message );
               e.printStackTrace();
               fail( message );
  
  
  
  1.4       +1 -1      avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xinfo
  
  Index: BasicComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xinfo,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicComponent.xinfo	4 Jul 2003 11:31:36 -0000	1.3
  +++ BasicComponent.xinfo	18 Jul 2003 08:27:36 -0000	1.4
  @@ -22,7 +22,7 @@
     <context type="org.apache.avalon.playground.basic.BasicContext">
       <attributes>
         <attribute key="urn:assembly:lifecycle.context.strategy"
  -          value="org.apache.avalon.framework.context.Contextualizable:4.1"/>
  +          value="org.apache.avalon.framework.context.Contextualizable"/>
       </attributes>
       <entry key="location"/>
       <entry key="home" type="java.io.File"/>
  
  
  
  1.11      +2 -50     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java
  
  Index: Scanner.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Scanner.java	17 Jul 2003 21:21:57 -0000	1.10
  +++ Scanner.java	18 Jul 2003 08:27:36 -0000	1.11
  @@ -435,57 +435,9 @@
       {
           final String name = type.getInfo().getName();
           final Class[] classes = getServiceClasses( type );
  -        final Class[] extensions = getExtensionClasses( type );
           final TypeVerifier verifier = new TypeVerifier();
  -        verifier.verifyComponent( name, clazz, classes );
  +        verifier.verifyType( name, clazz, classes );
       }
  -
  -   /**
  -    * Return the set of lifecycle extension classes provided 
  -    * by the given type.  This method is used as part of the 
  -    * process of verifying the integrity of a type.
  -    *
  -    * @param type the component type
  -    * @return an array of classes represnting the lifecycle
  -    *   extension interfaces provided by the type
  -    */
  -    private Class[] getExtensionClasses( Type type ) 
  -      throws ModelException
  -    {
  -        ArrayList list = new ArrayList();
  -        ExtensionDescriptor[] extensions = type.getExtensions();
  -        for( int i = 0; i < extensions.length; i++ )
  -        {
  -            ExtensionDescriptor extension = extensions[i];
  -            list.add( getExtensionClass( type, extension ) );
  -        }
  -        return (Class[]) list.toArray( new Class[0] );
  -    }
  -
  -    private Class getExtensionClass( Type type, ExtensionDescriptor extension ) 
  -      throws ModelException
  -    {
  -        final String classname = extension.getReference().getClassname();
  -        final String typeClass = type.getInfo().getClassname();
  -        try
  -        {
  -            return m_classloader.loadClass( classname );
  -        }
  -        catch( NoClassDefFoundError ncdf )
  -        {
  -            String ref = parseResourceName( ncdf.getMessage() );
  -            final String error = 
  -              REZ.getString( "scanner.extension.bad-class.error", typeClass, classname,
ref );
  -            throw new ModelException( error );
  -        }
  -        catch( ClassNotFoundException cnfe )
  -        {
  -            final String error = 
  -              REZ.getString( "scanner.extension.missing-class.error", typeClass, classname
);
  -            throw new ModelException( error );
  -        }
  -    }
  -
   
       /**
        * Verify the intergrity of the supplied type.
  
  
  
  1.3       +2 -47     avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/model/verifier/ProfileVerifier.java
  
  Index: ProfileVerifier.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/model/verifier/ProfileVerifier.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProfileVerifier.java	14 Jul 2003 22:44:13 -0000	1.2
  +++ ProfileVerifier.java	18 Jul 2003 08:27:36 -0000	1.3
  @@ -147,14 +147,7 @@
               getServiceClasses( name,
                                  profile.getType().getServices(),
                                  clazz.getClassLoader() );
  -        final Class[] phases =
  -            getPhaseClasses( name,
  -                             profile.getType().getStages(),
  -                             clazz.getClassLoader() );
  -
  -        m_verifier.verifyType( name, clazz, interfaces, phases );
  -
  -        //verifyContextPresence( profile, clazz );
  +        m_verifier.verifyType( name, clazz, interfaces );
       }
   
       /**
  @@ -224,44 +217,6 @@
               {
                   final String message =
                       REZ.getString( "metadata.bad-service-class.error",
  -                                   name,
  -                                   classname,
  -                                   t.toString() );
  -                throw new VerifyException( message, t );
  -            }
  -        }
  -
  -        return classes;
  -    }
  -
  -    /**
  -     * Retrieve an array of Classes for all the phases that a Component
  -     * is depenent on.
  -     *
  -     * @param name the name of profile
  -     * @param phases the set of stage depedencies
  -     * @param classLoader the classLoader
  -     * @return an array of Classes for all the services
  -     * @throws VerifyException if an error occurs
  -     */
  -    protected Class[] getPhaseClasses( final String name,
  -                                       final StageDescriptor[] phases,
  -                                       final ClassLoader classLoader )
  -        throws VerifyException
  -    {
  -        final Class[] classes = new Class[ phases.length ];
  -        for( int i = 0; i < phases.length; i++ )
  -        {
  -            final ReferenceDescriptor service = phases[ i ].getReference();
  -            final String classname = service.getClassname();
  -            try
  -            {
  -                classes[ i ] = classLoader.loadClass( classname );
  -            }
  -            catch( final Throwable t )
  -            {
  -                final String message =
  -                    REZ.getString( "metadata.bad-phase-class.error",
                                      name,
                                      classname,
                                      t.toString() );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message