donaldp     2002/09/08 05:51:50

  Modified:    src/java/org/apache/avalon/phoenix/metadata Tag:
                        FACTORY-branch BlockMetaData.java
               src/java/org/apache/avalon/phoenix/tools/assembler Tag:
                        FACTORY-branch Assembler.java
  Added:       src/java/org/apache/avalon/phoenix/metadata Tag:
                        FACTORY-branch InterceptorMetaData.java
  Removed:     src/java/org/apache/avalon/phoenix/metainfo Tag:
                        FACTORY-branch InvocationInterceptorDescriptor.java
  Log:
  Add in the parsing of interceptors out from configuration file. Attach the 
interceptors to BlockMetaData.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.14.4.1  +15 -1     
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/metadata/BlockMetaData.java
  
  Index: BlockMetaData.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/metadata/BlockMetaData.java,v
  retrieving revision 1.14
  retrieving revision 1.14.4.1
  diff -u -r1.14 -r1.14.4.1
  --- BlockMetaData.java        26 Aug 2002 10:39:56 -0000      1.14
  +++ BlockMetaData.java        8 Sep 2002 12:51:50 -0000       1.14.4.1
  @@ -24,15 +24,19 @@
   
       private final BlockInfo m_blockInfo;
   
  +    private final InterceptorMetaData[] m_invocationInterceptors;
  +
       public BlockMetaData( final String name,
                             final DependencyMetaData[] dependencies,
                             final boolean disableProxy, 
  -                          final BlockInfo blockInfo )
  +                          final BlockInfo blockInfo,
  +                      final InterceptorMetaData[] invocationHandles )
       {
           m_name = name;
           m_dependencies = dependencies;
           m_disableProxy = disableProxy;
           m_blockInfo = blockInfo;
  +        m_invocationInterceptors = invocationHandles;
       }
   
       public String getName()
  @@ -79,5 +83,15 @@
       public boolean isDisableProxy()
       {
           return m_disableProxy;
  +    }
  +
  +    /**
  +     * Returns an array of invocation interceptors configured for that Block.
  +     *
  +     * @return an array of InterceptorMetaData
  +     */
  +    public InterceptorMetaData[] getInvocationInterceptors()
  +    {
  +        return m_invocationInterceptors;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +28 -0     
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/metadata/Attic/InterceptorMetaData.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.20.4.1  +49 -3     
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/assembler/Assembler.java
  
  Index: Assembler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/assembler/Assembler.java,v
  retrieving revision 1.20
  retrieving revision 1.20.4.1
  diff -u -r1.20 -r1.20.4.1
  --- Assembler.java    6 Sep 2002 11:20:22 -0000       1.20
  +++ Assembler.java    8 Sep 2002 12:51:50 -0000       1.20.4.1
  @@ -20,6 +20,7 @@
   import org.apache.avalon.phoenix.metadata.BlockMetaData;
   import org.apache.avalon.phoenix.metadata.DependencyMetaData;
   import org.apache.avalon.phoenix.metadata.SarMetaData;
  +import org.apache.avalon.phoenix.metadata.InterceptorMetaData;
   import org.apache.avalon.phoenix.metainfo.BlockInfo;
   import org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder;
   import org.apache.avalon.phoenix.tools.infobuilder.BlockInfoBuilder;
  @@ -125,9 +126,9 @@
   
               final DependencyMetaData[] roles = buildDependencyMetaDatas( provides );
               final BlockInfo info = getBlockInfo( name, classname, classLoader );
  +            final InterceptorMetaData[] interceptors = buildInterceptorMetaData( 
block );
   
  -
  -            return new BlockMetaData( name, roles, disableProxy, info );
  +            return new BlockMetaData( name, roles, disableProxy, info, interceptors 
);
           }
           catch( final ConfigurationException ce )
           {
  @@ -248,5 +249,50 @@
           }
   
           return (DependencyMetaData[])dependencies.toArray( new DependencyMetaData[ 
0 ] );
  +    }
  +
  +
  +    /**
  +     * A utility method to build an array of <code>InterceptorMetaData</code>
  +     * objects from specified configuraiton.
  +     *
  +     * @param configuration the interceptors configuration
  +     * @return the created InterceptorMetaData
  +     * @throws ConfigurationException if an error occurs
  +     */
  +    private InterceptorMetaData[] buildInterceptorMetaData( Configuration 
configuration )
  +        throws ConfigurationException
  +    {
  +        final boolean proxyDisabled = 
configuration.getAttributeAsBoolean("disable", false);
  +        final Configuration[] elements = configuration.getChildren( "interceptor" );
  +        if( proxyDisabled && elements.length > 0 )
  +        {
  +            final String message =
  +                REZ.getString( "interceptors-without-proxy", 
configuration.getLocation() );
  +            throw new ConfigurationException( message );
  +        }
  +        final ArrayList interceptors = new ArrayList();
  +
  +        for( int i = 0; i < elements.length; i++ )
  +        {
  +            final InterceptorMetaData interceptor = buildInterceptor( elements[ i ] 
);
  +            interceptors.add( interceptor );
  +        }
  +
  +        return (InterceptorMetaData[])interceptors.toArray( new 
InterceptorMetaData[ 0 ] );
  +    }
  +
  +    /**
  +     * A utility method to build a <code>InterceptorMetaData</code>
  +     * object from specified configuraiton.
  +     *
  +     * @return the created DependencyDescriptor
  +     * @throws ConfigurationException if an error occurs
  +     */
  +    private InterceptorMetaData buildInterceptor( final Configuration interceptor )
  +        throws ConfigurationException
  +    {
  +        final String classname = interceptor.getAttribute( "class" );
  +        return new InterceptorMetaData( classname );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to