avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader ContextClassLoaderManager.java DefaultClassLoaderManager.java SarPolicy.java SarPolicyResolver.java SarPolicyVerifier.java
Date Fri, 25 Apr 2003 01:38:38 GMT
donaldp     2003/04/24 18:38:38

  Modified:    .        build.xml
               src/java/org/apache/avalon/phoenix/interfaces
                        ClassLoaderManager.java
               src/java/org/apache/avalon/phoenix/components/deployer
                        DefaultDeployer.java
               src/java/org/apache/avalon/phoenix/components/classloader
                        ContextClassLoaderManager.java
                        DefaultClassLoaderManager.java SarPolicy.java
                        SarPolicyResolver.java SarPolicyVerifier.java
  Added:       lib/container spice-xmlpolicy-1.0.jar
  Removed:     lib/container excalibur-policy-1.0a.jar
  Log:
  Cut across to xml policy and prep so that interpolation of config file occurs outside the
policy toolkit.
  
  Revision  Changes    Path
  1.246     +3 -2      avalon-phoenix/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/build.xml,v
  retrieving revision 1.245
  retrieving revision 1.246
  diff -u -r1.245 -r1.246
  --- build.xml	17 Apr 2003 02:05:03 -0000	1.245
  +++ build.xml	25 Apr 2003 01:38:36 -0000	1.246
  @@ -826,7 +826,7 @@
           <copy file="${target.lib}/phoenix-engine.jar" todir="${bin.dist.container.lib}"/>
   
           <copy file="${classman.jar}" todir="${bin.dist.container.lib}"/>
  -        <copy todir="${bin.dist.container.lib}">
  +        <copy todir="${bin.dist.container.lib}" flatten="true">
               <fileset refid="classman.fileset"/>
           </copy>
   
  @@ -841,7 +841,7 @@
               </fileset>
           </copy>
           <copy file="${configkit.jar}" todir="${bin.dist.tools.lib}"/>
  -        <copy todir="${bin.dist.tools.lib}">
  +        <copy todir="${bin.dist.tools.lib}" flatten="true">
               <fileset refid="configkit.fileset"/>
           </copy>
           <copy todir="${bin.dist.container.lib}">
  @@ -1012,6 +1012,7 @@
           <copy todir="${src.dist.lib}">
               <fileset dir="${lib.dir}">
                   <include name="excalibur*.jar"/>
  +                <include name="spice*.jar"/>
                   <include name="README.txt"/>
               </fileset>
           </copy>
  
  
  
  1.20      +3 -0      avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ClassLoaderManager.java
  
  Index: ClassLoaderManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ClassLoaderManager.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ClassLoaderManager.java	22 Mar 2003 12:07:14 -0000	1.19
  +++ ClassLoaderManager.java	25 Apr 2003 01:38:36 -0000	1.20
  @@ -51,6 +51,7 @@
   package org.apache.avalon.phoenix.interfaces;
   
   import java.io.File;
  +import java.util.Map;
   import org.apache.avalon.framework.configuration.Configuration;
   
   /**
  @@ -70,12 +71,14 @@
        * Create a {@link ClassLoaderSet} for a specific application.
        *
        * @param environment the configuration "environment.xml" for the application
  +     * @param data the context data used when expanding config files
        * @param baseDirectory the base directory of application
        * @param workDirectory the work directory of application
        * @return the ClassLoaderSet created
        * @throws Exception if an error occurs
        */
       ClassLoaderSet createClassLoaderSet( Configuration environment,
  +                                         Map data,
                                            File baseDirectory,
                                            File workDirectory )
           throws Exception;
  
  
  
  1.84      +5 -0      avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/DefaultDeployer.java
  
  Index: DefaultDeployer.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/DefaultDeployer.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- DefaultDeployer.java	17 Apr 2003 02:11:47 -0000	1.83
  +++ DefaultDeployer.java	25 Apr 2003 01:38:37 -0000	1.84
  @@ -319,6 +319,10 @@
               final File workDirectory =
                   (File)installation.get( ContainerConstants.INSTALL_WORK );
   
  +            final Map data = new HashMap();
  +            data.put( BlockContext.APP_NAME, name );
  +            data.put( BlockContext.APP_HOME_DIR, homeDirectory );
  +
               final DefaultContext context = new DefaultContext();
               context.put( BlockContext.APP_NAME, name );
               context.put( BlockContext.APP_HOME_DIR, homeDirectory );
  @@ -333,6 +337,7 @@
   
               final ClassLoaderSet classLoaderSet =
                   m_classLoaderManager.createClassLoaderSet( environment,
  +                                                           data,
                                                              homeDirectory,
                                                              workDirectory );
               final ClassLoader classLoader = classLoaderSet.getDefaultClassLoader();
  
  
  
  1.1                  avalon-phoenix/lib/container/spice-xmlpolicy-1.0.jar
  
  	<<Binary file>>
  
  
  1.12      +2 -0      avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/ContextClassLoaderManager.java
  
  Index: ContextClassLoaderManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/ContextClassLoaderManager.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ContextClassLoaderManager.java	1 Nov 2002 08:23:30 -0000	1.11
  +++ ContextClassLoaderManager.java	25 Apr 2003 01:38:37 -0000	1.12
  @@ -2,6 +2,7 @@
   
   import java.io.File;
   import java.util.HashMap;
  +import java.util.Map;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.phoenix.interfaces.ClassLoaderManager;
   import org.apache.avalon.phoenix.interfaces.ClassLoaderSet;
  @@ -17,6 +18,7 @@
       implements ClassLoaderManager
   {
       public ClassLoaderSet createClassLoaderSet( final Configuration environment,
  +                                                final Map data,
                                                   final File baseDirectory,
                                                   final File workDirectory )
           throws Exception
  
  
  
  1.56      +15 -12    avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/DefaultClassLoaderManager.java
  
  Index: DefaultClassLoaderManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/DefaultClassLoaderManager.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- DefaultClassLoaderManager.java	25 Apr 2003 01:16:40 -0000	1.55
  +++ DefaultClassLoaderManager.java	25 Apr 2003 01:38:37 -0000	1.56
  @@ -72,10 +72,6 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.phoenix.interfaces.ClassLoaderManager;
   import org.apache.avalon.phoenix.interfaces.ClassLoaderSet;
  -import org.apache.avalon.phoenix.BlockContext;
  -import org.apache.excalibur.policy.builder.PolicyBuilder;
  -import org.apache.excalibur.policy.metadata.PolicyMetaData;
  -import org.apache.excalibur.policy.reader.PolicyReader;
   import org.realityforge.classman.builder.LoaderBuilder;
   import org.realityforge.classman.builder.LoaderResolver;
   import org.realityforge.classman.metadata.ClassLoaderMetaData;
  @@ -85,6 +81,9 @@
   import org.realityforge.classman.reader.ClassLoaderSetReader;
   import org.realityforge.classman.verifier.ClassLoaderVerifier;
   import org.realityforge.configkit.PropertyExpander;
  +import org.realityforge.xmlpolicy.builder.PolicyBuilder;
  +import org.realityforge.xmlpolicy.metadata.PolicyMetaData;
  +import org.realityforge.xmlpolicy.reader.PolicyReader;
   import org.w3c.dom.Element;
   
   /**
  @@ -172,9 +171,6 @@
           throws ContextException
       {
           m_commonClassLoader = (ClassLoader)context.get( "common.classloader" );
  -        m_data.put( BlockContext.APP_HOME_DIR, context.get( BlockContext.APP_HOME_DIR )
);
  -        m_data.put( BlockContext.APP_NAME, context.get( BlockContext.APP_NAME ) );
  -        //extractData( context, "phoenix.home" );
       }
   
       /**
  @@ -196,6 +192,8 @@
       public void initialize()
           throws Exception
       {
  +        m_data.putAll( System.getProperties() );
  +
           final Map defined = new HashMap();
           defined.put( "*system*", m_commonClassLoader );
           m_predefinedLoaders = Collections.unmodifiableMap( defined );
  @@ -213,6 +211,7 @@
        * @throws Exception if an error occurs
        */
       public ClassLoaderSet createClassLoaderSet( final Configuration environment,
  +                                                final Map data,
                                                   final File homeDirectory,
                                                   final File workDirectory )
           throws Exception
  @@ -220,7 +219,7 @@
           //Configure policy
           final Configuration policyConfig = environment.getChild( "policy" );
           final Policy policy =
  -            configurePolicy( policyConfig, homeDirectory, workDirectory );
  +            configurePolicy( policyConfig, data, homeDirectory, workDirectory );
   
           final ClassLoaderSetMetaData metaData =
               getLoaderMetaData( environment );
  @@ -309,10 +308,12 @@
        * Setup policy based on configuration data.
        *
        * @param configuration the configuration data
  +     * @param data the context data used to expand policy file
        * @param baseDirectory the applications base directory
        * @throws ConfigurationException if an error occurs
        */
       private Policy configurePolicy( final Configuration configuration,
  +                                    final Map data,
                                       final File baseDirectory,
                                       final File workDirectory )
           throws Exception
  @@ -326,10 +327,12 @@
           setupLogger( verifier );
   
           final Element element = ConfigurationUtil.toElement( configuration );
  -        final HashMap data = new HashMap();
  -        data.putAll( m_data );
  -        data.put( "/", File.separator );
  -        m_expander.expandValues( element, data );
  +        final HashMap newData = new HashMap();
  +        newData.putAll( m_data );
  +        newData.putAll( data );
  +        newData.put( "/", File.separator );
  +
  +        m_expander.expandValues( element, newData );
   
           element.setAttribute( "version", "1.0" );
           try
  
  
  
  1.6       +1 -1      avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicy.java
  
  Index: SarPolicy.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SarPolicy.java	22 Mar 2003 12:07:08 -0000	1.5
  +++ SarPolicy.java	25 Apr 2003 01:38:37 -0000	1.6
  @@ -57,7 +57,7 @@
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  -import org.apache.excalibur.policy.runtime.DefaultPolicy;
  +import org.realityforge.xmlpolicy.runtime.DefaultPolicy;
   
   /**
    * Policy that extracts information from policy files.
  
  
  
  1.10      +2 -50     avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicyResolver.java
  
  Index: SarPolicyResolver.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicyResolver.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SarPolicyResolver.java	5 Apr 2003 04:25:42 -0000	1.9
  +++ SarPolicyResolver.java	25 Apr 2003 01:38:37 -0000	1.10
  @@ -53,18 +53,11 @@
   import java.io.File;
   import java.net.URL;
   import java.security.Policy;
  -import java.util.HashMap;
   import java.util.Map;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
  -import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.CascadingException;
   import org.apache.avalon.framework.container.ContainerUtil;
  -import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.phoenix.BlockContext;
  -import org.apache.avalon.phoenix.components.util.PropertyUtil;
   import org.apache.avalon.phoenix.components.util.ResourceUtil;
  -import org.apache.excalibur.policy.builder.PolicyResolver;
  +import org.realityforge.xmlpolicy.builder.PolicyResolver;
   
   /**
    * A basic resolver that resolves Phoenix specific features.
  @@ -77,22 +70,12 @@
       extends AbstractLogEnabled
       implements PolicyResolver
   {
  -    private final static Resources REZ =
  -        ResourceManager.getPackageResources( SarPolicyResolver.class );
  -
       private final File m_baseDirectory;
       private final File m_workDirectory;
  -    private final DefaultContext m_context;
   
       SarPolicyResolver( final File baseDirectory,
                          final File workDirectory )
       {
  -        final HashMap map = new HashMap();
  -        map.putAll( System.getProperties() );
  -        m_context = new DefaultContext( map );
  -        m_context.put( "/", File.separator );
  -        //m_context.put( BlockContext.APP_NAME, sarName );
  -        m_context.put( BlockContext.APP_HOME_DIR, baseDirectory );
           m_workDirectory = workDirectory;
           m_baseDirectory = baseDirectory;
       }
  @@ -115,41 +98,10 @@
           }
           else
           {
  -            location = expand( location );
               location = ResourceUtil.expandSarURL( location,
                                                     m_baseDirectory,
                                                     m_workDirectory );
               return new URL( location );
  -        }
  -    }
  -
  -    public String resolveTarget( final String target )
  -    {
  -        try
  -        {
  -            return expand( target );
  -        }
  -        catch( Exception e )
  -        {
  -            final String message = "Error resolving: " + target;
  -            getLogger().warn( message, e );
  -            return target;
  -        }
  -    }
  -
  -    private String expand( final String value )
  -        throws Exception
  -    {
  -        try
  -        {
  -            final Object resolvedValue =
  -                PropertyUtil.resolveProperty( value, m_context, false );
  -            return resolvedValue.toString();
  -        }
  -        catch( final Exception e )
  -        {
  -            final String message = REZ.getString( "policy.error.property.resolve", value
);
  -            throw new CascadingException( message, e );
           }
       }
   }
  
  
  
  1.5       +2 -2      avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicyVerifier.java
  
  Index: SarPolicyVerifier.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/SarPolicyVerifier.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SarPolicyVerifier.java	22 Mar 2003 12:07:08 -0000	1.4
  +++ SarPolicyVerifier.java	25 Apr 2003 01:38:37 -0000	1.5
  @@ -52,7 +52,7 @@
   
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  -import org.apache.excalibur.policy.verifier.PolicyVerifier;
  +import org.realityforge.xmlpolicy.verifier.PolicyVerifier;
   
   /**
    * A simple adapter for verifier to support logging to
  
  
  

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


Mime
View raw message