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/repository/spi/src/java/org/apache/avalon/repository RepositoryCriteria.java RepositoryFactory.java
Date Mon, 24 Nov 2003 08:22:08 GMT
mcconnell    2003/11/24 00:22:08

  Added:       repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultRepositoryCriteria.java
               repository/main/src/java/org/apache/avalon/repository/main
                        Bootstrapper.java InitialRepositoryFactory.java
                        Loader.java package.html
               repository/spi/src/java/org/apache/avalon/repository
                        RepositoryCriteria.java RepositoryFactory.java
  Removed:     repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultCriteria.java
               repository/main/src/java/org/apache/avalon/repository
                        Bootstrapper.java InitialRepositoryFactory.java
                        Loader.java package.html
  Log:
  Housekeeping.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryCriteria.java
  
  Index: DefaultRepositoryCriteria.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.repository.impl;
  
  import java.io.IOException;
  import java.io.File;
  import java.io.InputStream;
  import java.util.Properties;
  import java.util.Hashtable;
  import java.util.Map;
  import java.net.URL;
  import java.net.MalformedURLException;
  
  import org.apache.avalon.repository.RepositoryException;
  import org.apache.avalon.repository.RepositoryCriteria;
  import org.apache.avalon.repository.criteria.Criteria;
  import org.apache.avalon.repository.criteria.Parameter;
  import org.apache.avalon.repository.criteria.Template;
  import org.apache.avalon.repository.criteria.ValidationException;
  
  import org.apache.avalon.defaults.Defaults;
  import org.apache.avalon.defaults.DefaultsFinder;
  import org.apache.avalon.defaults.SimpleDefaultsFinder;
  import org.apache.avalon.defaults.SystemDefaultsFinder;
  
  
  /**
   * A Criteria is a class holding the values supplied by a user 
   * for application to a factory.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultRepositoryCriteria implements RepositoryCriteria
  {
      //--------------------------------------------------------------
      // static
      //--------------------------------------------------------------
  
     /** 
      * The name of the static defaults property resource.
      */
      public static final String DEFAULTS = "default.properties";
  
     /** 
      * recognized single keys
      */
      private static final String [] SINGLE_KEYS = {
          REPOSITORY_CACHE_DIR.getKey(),
          REPOSITORY_PROXY_HOST.getKey(),
          REPOSITORY_PROXY_PORT.getKey(),
          REPOSITORY_PROXY_USERNAME.getKey(),
          REPOSITORY_PROXY_PASSWORD.getKey()
      };
  
     /** 
      * regognized multivalue keys
      */
      public static final String [] MULTI_VALUE_KEYS = {
          REPOSITORY_REMOTE_HOSTS.getKey()
      };
  
      //--------------------------------------------------------------
      // state
      //--------------------------------------------------------------
  
       private final Hashtable m_bindings = new Hashtable();
  
      //--------------------------------------------------------------
      // constructor
      //--------------------------------------------------------------
  
      /**
       * Creation of a new criteria.
       * @param template the template containing the validation parameters
       */
      public DefaultRepositoryCriteria() throws RepositoryException
      {
          Properties bootstrap = getDefaultProperties();
  
          //
          // Create the finder (discovery policy), construct the defaults, and
          // macro expand the values.
          //
  
          final DefaultsFinder[] finders = {
              new SimpleDefaultsFinder( new Properties[] { bootstrap }, false ), 
              new SystemDefaultsFinder() };
          
          Defaults defaults = new Defaults( SINGLE_KEYS, MULTI_VALUE_KEYS, finders );
          Defaults.macroExpand( defaults, new Properties[]{ System.getProperties() } );
  
          //
          // Here we start to populate the empty repository configuration using
          // the values stored in the defaults.
          //
  
          // TODO: currently assigning the cache as a subdirectory of user.home.
          // That's ok, but we really should be translating a value 
          // ${user.home}/.avalon and avoid the assumption in the first place
          // but this assumes that macro expansion is doing its job (and I havn't 
          // figured this one out yet).
  
          final File home = new File( System.getProperty( "user.home" ) );
          String cache = 
            defaults.getProperty( REPOSITORY_CACHE_DIR.getKey() );
          if( null == cache )
          {
               cache = ".cache";
          }
  
          m_bindings.put( REPOSITORY_CACHE_DIR.getKey(),
              new File( home, cache ) );
  
          try
          {
              String[] hosts = 
                defaults.getEnumerated( REPOSITORY_REMOTE_HOSTS.getKey() );
              m_bindings.put( REPOSITORY_REMOTE_HOSTS.getKey(), hosts );
          }
          catch ( Throwable e )
          {
              final String error = 
                "Failed to set remote repositories.";
              throw new RepositoryException( error, e );
          }
  
          if( defaults.containsKey( REPOSITORY_PROXY_HOST.getKey() ) )
          {    
              m_bindings.put(
                REPOSITORY_PROXY_HOST.getKey(), 
                new Integer( defaults.getProperty( REPOSITORY_PROXY_HOST.getKey() ) ) );
  
              if( defaults.containsKey( REPOSITORY_PROXY_PORT.getKey() ) )
              {
                  m_bindings.put(
                    REPOSITORY_PROXY_PORT.getKey(), 
                    new Integer( defaults.getProperty( REPOSITORY_PROXY_PORT.getKey() ) ) );
              }
  
              if( defaults.containsKey( REPOSITORY_PROXY_USERNAME.getKey() ) )
              {
                  m_bindings.put(
                    REPOSITORY_PROXY_USERNAME.getKey(), 
                    defaults.getProperty( REPOSITORY_PROXY_USERNAME.getKey() ) );
              }
  
              if( defaults.containsKey( REPOSITORY_PROXY_PASSWORD.getKey() ) )
              {
                  m_bindings.put(
                    REPOSITORY_PROXY_PASSWORD.getKey(), 
                    defaults.getProperty( REPOSITORY_PROXY_PASSWORD.getKey() ) );
              }
          }
      }
  
  
      //--------------------------------------------------------------
      // Criteria
      //--------------------------------------------------------------
  
     /**
      * Return the parameter associated to the criteria.
      * @return the parameters
      */
      public Parameter[] getParameters()
      {
          return PARAMS;
      }
  
     /**
      * Set a named parameter of the criteria to a value.
      * @param key the parameter key
      * @param value the value to assign to the key
      * @exception ValidationException if the supplied value fails
      *    the validation test for its associated parameter
      */
      public void setValue( final String key, final Object value ) 
        throws ValidationException
      {
          Parameter p = getParameter( key );
          verify( p, value );
          m_bindings.put( key, value );
      }
  
     /**
      * Return the currently assigned value for a key.
      * @return the assigned value
      */
      public Object getValue( final String key )
      {
          getParameter( key ); // verify key
          return m_bindings.get( key );
      }
  
     /**
      * Return the current state of the criteria as a map.
      * @return the criteria as a map
      */
      public Map getMap()
      {
          Hashtable map = new Hashtable();
          for( int i=0; i<PARAMS.length; i++ )
          {
              final String key = PARAMS[i].getKey();
              Object value = m_bindings.get( key );
              if( value != null )
              {
                  map.put( key, value );
              }
          }
          return map;
      }
  
      public String toString()
      {
          return "[repository: " + getMap() + "]";
      }
  
      //--------------------------------------------------------------
      // private
      //--------------------------------------------------------------
  
      private Properties getDefaultProperties() throws RepositoryException
      {
          Properties bootstrap = new Properties();
          try
          {
              InputStream input = 
                DefaultRepositoryCriteria.class.getResourceAsStream( DEFAULTS );
              if( input == null )
              {
                  final String error = 
                    "Internal error, unable to locate enbedded resource: " 
                    + DEFAULTS 
                    + " from the resource: " 
                    + DefaultRepositoryCriteria.class.getProtectionDomain()
                        .getCodeSource().getLocation();
                  throw new IllegalStateException( error );
              }
              bootstrap.load( input );
              return bootstrap;
          }
          catch ( IOException e )
          {
              throw new RepositoryException( 
               "Failed to load implementation defaults resource: "
               + DEFAULTS, e );
          }
      }
  
     /**
      * Verify a value relative to the parameter constraints.
      * @param value the value to verify
      * @exception ValidationException if the value is invalid
      */
      public void verify( Parameter param, Object value )
        throws ValidationException
      {
          Class c = getParameterClass( param );
          if( value == null ) return;
          if( !c.isInstance( value ) )
          {
              final String error =
                "Value of class: [" 
                + value.getClass().getName() 
                + "] supplied for key [" 
                + param.getKey() 
                + "] is not an instance of type: [" 
                + param.getClassname()
                + "].";
              throw new ValidationException( error );
          }
      }
  
      private Class getParameterClass( Parameter param ) 
        throws ValidationException
      {
          try
          {
              ClassLoader loader = Thread.currentThread().getContextClassLoader();
              return loader.loadClass( param.getClassname() );
          }
          catch( Throwable e )
          {
              final String error = 
                "Unable to resolve parameter class: " 
                + param.getClassname();
              throw new ValidationException( error, e );
          }
      }
  
      public Parameter getParameter( final String key )
      {
          for( int i=0; i<PARAMS.length; i++ )
          {
              Parameter parameter = PARAMS[i];
              if( parameter.getKey().equals( key ) ) return parameter;
          }
          final String error = "Unknown key: [" + key + "].";
          throw new IllegalArgumentException( error );
      }
  }
  
  
  
  1.1                  avalon-sandbox/repository/main/src/java/org/apache/avalon/repository/main/Bootstrapper.java
  
  Index: Bootstrapper.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.repository.main ;
  
  
  import java.text.ParseException ;
  
  import java.lang.reflect.Constructor;
  import java.lang.reflect.Method ;
  import java.lang.reflect.InvocationTargetException ;
  
  import org.apache.avalon.repository.Artifact;
  import org.apache.avalon.repository.Repository;
  import org.apache.avalon.repository.RepositoryException;
  import org.apache.avalon.repository.ClassicArtifact;
  import org.apache.avalon.repository.criteria.Criteria ;
  
  
  /**
   * Application and component bootstrapper used to instantiate, and or invoke
   * Classes and their methods within newly constructed Repository ClassLoaders.
   * 
   * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
   * @author $Author: mcconnell $
   * @version $Revision: 1.1 $
   */
  public class Bootstrapper
  {
      //-----------------------------------------------------------
      // static
      //-----------------------------------------------------------
  
      private static final String[] DEFAULT_REPOSITORIES = 
        new String[]{ "http://dpml.net/","http:ibiblio.org/maven" };
  
      //-----------------------------------------------------------
      // state
      //-----------------------------------------------------------
  
      /** The repository used by this bootstrapper */
      private final Repository m_repository ;
      /** The Jar artifact descriptor containing the target classes */
      private final Artifact m_descriptor ;
      /** The ClassLoader used to load and instantiate target classes */
      private final ClassLoader m_loader ;
      
      
      /**
       * Creates a Bootstrapper for a specific target artifact.
       */
      public Bootstrapper( Repository a_repository, Artifact artifact )
          throws RepositoryException
      {
          m_repository = a_repository ;
          m_descriptor = artifact;
          long time = System.currentTimeMillis();
          m_loader = a_repository.getClassLoader( artifact ) ;
          long after = System.currentTimeMillis();
      }
  
      /**
       * Gets the ClassLoader used by this Bootstrapper.
       * 
       * @return the ClassLoader built by the Repository
       */
      public ClassLoader getClassLoader()
      {
          return m_loader ;
      }
      
      /**
       * Invokes the main application entry point for a class.
       * 
       * @param a_args the arguments to pass-thro to the main of the application
       * @throws RepositoryException on any class loading or invocation failures
       */
      public void main( String main, String[] a_args )
          throws RepositoryException
      {
          Class l_clazz = null ;
          Method l_mainMethod = null ;
          
          try 
          {
              l_clazz = m_loader.loadClass( main ) ;
              l_mainMethod = l_clazz.getMethod( main, new Class[] {String[].class} ) ;
              
              if ( l_mainMethod.getReturnType() != Void.TYPE )
              {
                  throw new RepositoryException( "Invalid main() in " + main 
                          + " has a non-void return type of " 
                          + l_mainMethod.getReturnType() ) ;
              }
              
              l_mainMethod.invoke( null, a_args ) ;
          }
          catch ( InvocationTargetException e )
          {
              throw new RepositoryException( "Failed to invoke target main()"
                      + " in class " + main ) ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "Cannot invoke non-public main()"
                      + " in class " + main ) ;
          }
          catch ( NoSuchMethodException e )
          {
              throw new RepositoryException( main + " Does not contain a main "
                      + "method with a sole String [] argument.", e ) ; 
          }
          catch ( ClassNotFoundException e )
          {
              throw new RepositoryException( "ClassLoader for repository Jar "
                      + "artifact " + m_descriptor + " could not find " 
                      + main, e ) ;
          }
      }
      
      
      /**
       * Instantiates a runnable using a default constructor and calls its run
       * method.
       * 
       * @param main the fully qualified class name of the Runnable 
       * @throws RepositoryException on any class loading or invokation failures
       */
      public void run( String main ) throws RepositoryException
      {
          Class l_clazz = null ;
          Runnable l_runnable = null ;
          
          try
          {
              l_clazz = m_loader.loadClass( main ) ;
              l_runnable = ( Runnable ) l_clazz.newInstance() ;
              l_runnable.run() ;
          }
          catch ( ClassCastException e )
          {
              throw new RepositoryException( main + " is not a Runnable", e ) ;
          }
          catch ( InstantiationException e )
          {
              throw new RepositoryException( main + " in " + m_descriptor
                      + " does not contain a default constructor" ) ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "Cannot invoke non-public run()"
                      + " in class " + main ) ;
          }
          catch ( ClassNotFoundException e )
          {
              throw new RepositoryException( "Could not find " + main 
                      + " in repository jar artifact " + m_descriptor 
                      + " or in any one of its dependent Jars", e ) ;
          }
      }
  
  
      /**
       * Invokes a static method on a class.
       * 
       * @param main the fully qualified class name
       * @param a_method the name of the method to invoke
       * @param a_types the fqcn of the parameters
       * @param a_args the arguments to the method
       * @return the methods return value if one exists, or null if method is void
       */
      public Object invoke( String main, String a_method, String [] a_types, 
                            Object [] a_args )
          throws RepositoryException
      {
          Class l_clazz = loadClass( main ) ;
          Class [] l_types = new Class[a_types.length] ;
          
          /** Get all the argument classes */
          for ( int ii = 0; ii < a_types.length; ii++ )
          {
              l_types[ii] = loadClass( a_types[ii] ) ;
          }
          
          Method l_method = null ;
          try
          {
              l_method = l_clazz.getMethod( a_method, l_types ) ;
              return l_method.invoke( null, a_args ) ;
          }
          catch ( InvocationTargetException e )
          {
              throw new RepositoryException( "Failed to invoke static target "
                      + toSignature( a_method, a_types ) + " in class " 
                      + main ) ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "Cannot access static method " 
                      + toSignature( a_method, a_types ) + " in class "
                      + main, e ) ;
          }
          catch ( NoSuchMethodException e )
          {
              throw new RepositoryException( "Could not find static method with"
                      + " matching signature " + toSignature( a_method, a_types ) 
                      + " for class " + main, e ) ;
          }
      }
      
      
      /**
       * Creates a new instance of a class using the default constructor.
       * 
       * @param main the fully qualified name of the class to create an inst of
       * @return the instance created
       * @throws RepositoryException if the instantiation fails
       */
      public Object newInstance( String main ) throws RepositoryException
      {
          Class l_clazz = loadClass( main ) ;
          
          try
          {
              return l_clazz.newInstance() ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "A public accessible default "
                      + "constructor dies not exist for " + main, e ) ;
          }
          catch ( InstantiationException e )
          {
              throw new RepositoryException( "Failure while creating an"
                      + " instance of " + main 
                      + " via the default constructor", e ) ;
          }
      }
      
      
      /**
       * Creates a new instance of a class using a constructor taking arguments.
       * 
       * @param main the fully qualified name of the class to create an inst of
       * @param a_types the fully qualified names of constructor parameter types
       * @param a_args the arguments to the constructor
       * @return the newly created instance 
       * @throws RepositoryException if the instantiation fails
       */
      public Object newInstance( String main, String[] a_types, 
                                 Object[] a_args )
          throws RepositoryException
      {
          Class l_clazz = loadClass( main ) ;
          Class[] l_types = new Class[a_types.length] ;
          
          for ( int ii = 0; ii < a_types.length; ii++ )
          {
              l_types[ii] = loadClass( a_types[ii] ) ;
          }
          
          try 
          {
              Constructor l_constructor = l_clazz.getConstructor( l_types ) ;
              return l_constructor.newInstance( a_args ) ;
          }
          catch ( InstantiationException e )
          {
              throw new RepositoryException( 
                      "Failed to instantiate with constructor "
                      + toSignature( getConstructor( main ), a_types ), e ) ;
          }
          catch ( NoSuchMethodException e )
          {
              throw new RepositoryException( 
                      "Could not find a constructor with signature " 
                      + toSignature( getConstructor( main ), a_types ), e ) ;
          }
          catch ( InvocationTargetException e )
          {
              throw new RepositoryException( "Failed to invoke constructor "
                      + toSignature( getConstructor( main ), a_types ), e ) ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "Cannot access constructor " 
                      + toSignature( getConstructor( main ), a_types ), e ) ;
          }
      }
      
      
      /**
       * Gets the name of the constructor given the fully qualified class name.
       * 
       * @param main the fully qualified class name
       * @return the name of the constructor
       */
      public String getConstructor( String main )
      {
          int l_lastDot = main.indexOf( '.' ) ;
          
          // Class is in default package so main = cn = constructor
          if ( -1 == l_lastDot )
          {
              return main ;
          }
          
          return main.substring( l_lastDot + 1 ) ;
      }
      
  
      /**
       * Invokes a method on an object.
       * 
       * @param a_obj the object to invoke a method on
       * @param a_method the method to invoke
       * @param a_argTypes the fqcn of the parameters 
       * @param a_args the arguments to method
       * @return a return value if one is returned, otherwise null
       * @throws RepositoryException
       */
      public Object invoke( Object a_obj, String a_method, String [] a_argTypes, 
                            Object[] a_args )
          throws RepositoryException
      {
          Class [] l_argClasses = new Class[a_argTypes.length] ;
          
          /** Get all the argument classes */
          for ( int ii = 0; ii < a_argTypes.length; ii++ )
          {
              l_argClasses[ii] = loadClass( a_argTypes[ii] ) ;
          }
          
          Method l_method = null ;
          try
          {
              l_method = a_obj.getClass().getMethod( a_method, l_argClasses ) ;
              return l_method.invoke( a_obj, a_args ) ;
          }
          catch ( InvocationTargetException e )
          {
              throw new RepositoryException( "Failed to invoke target "
                      + toSignature( a_method, a_argTypes ) + " in class " 
                      + a_obj.getClass(), e ) ;
          }
          catch ( IllegalAccessException e )
          {
              throw new RepositoryException( "Cannot access method " 
                      + toSignature( a_method, a_argTypes ) + " in class "
                      + a_obj.getClass(), e ) ;
          }
          catch ( NoSuchMethodException e )
          {
              throw new RepositoryException( "Could not find method with matching"
                      + " signature " + toSignature( a_method, a_argTypes ) 
                      + " for object of class " + a_obj.getClass(), e ) ;
          }
      }
      
      
      /**
       * Loads a class using the ClassLoader created by the Repository.
       * 
       * @param main the fully qualified class name 
       * @return the Class loaded using the Repository built ClassLoader
       * @throws RepositoryException if the class could not be found
       */
      public Class loadClass( String main ) throws RepositoryException
      {
          try
          {
              return m_loader.loadClass( main ) ;
          }
          catch ( ClassNotFoundException e )
          {
              throw new RepositoryException( "Could not find " + main 
                      + " in repository jar artifact " + m_descriptor 
                      + " or in any one of its dependent Jars", e ) ;
          }
      }
      
      
      /**
       * Constructs a String representing the signature of an method.
       * 
       * @param a_method the name of the method
       * @param a_types the fully qualified class names of the method parameters
       * @return the signature String
       */
      public String toSignature( String a_method, String [] a_types )
      {
          StringBuffer l_buf = new StringBuffer( a_method ) ;
          
          l_buf.append( '(' ) ;
          for ( int ii = 0; ii < a_types.length; ii++ )
          {
              l_buf.append( a_types[ii] ) ;
              
              if ( ii < a_types.length )
              {
                  l_buf.append( ',' ) ;
              }
          }
          l_buf.append( ')' ) ;
          
          return l_buf.toString() ;
      }
  
  
      /**
       * Main wrapper.
       * 
       * @todo add more properties to allow full repo specification via 
       * system properties including a repository implementation replacement.
       * 
       * @param a_args
       */
      public static void main( String [] a_args )
      {
          String l_jarSpec = getArtifactSpec( a_args );
          if( null == l_jarSpec )
          {
              final String error = 
                "Cannot resolve an artifict target.";
                System.out.println( error );
              System.exit( -1 );
          }
  
          // SJM: disabled main class aquistion for the moment
  
          //String l_fqcn = getMainClassname( a_args );
          //if( null == l_fqcn )
          //{
          //    final String error = 
          //      "Cannot resolve an main class.";
          //      System.out.println( error );
          //    System.exit( -1 );
          //}
  
          String[] l_repositories = DEFAULT_REPOSITORIES; // need to handle this via args
          
          Repository l_repository ;
          Artifact l_jar = ClassicArtifact.createJarArtifact( l_jarSpec ) ;
          Bootstrapper l_bootstrapper ;
  
          try
          {
              System.out.println("initiating repository creation" );
              InitialRepositoryFactory l_factory = 
                  new InitialRepositoryFactory( l_repositories ) ;
              l_repository = (Repository) l_factory.create( ) ;
              System.out.println("repository established" );
              System.out.println(
                "cache: " 
                + l_repository.getLocation() );
  
              l_bootstrapper = new Bootstrapper( l_repository, l_jar ) ;
  
              System.out.println("classloader established: " + l_jarSpec );
  
              //l_bootstrapper.main( l_fqcn, a_args ) ;
          }
          catch ( RepositoryException e )
          {
              e.printStackTrace() ;
              System.exit( -1 ) ;
          }
      }
  
      private static String getArtifactSpec( String[] args )
      {
          for( int i=0; i<args.length; i++ )
          {
              if( args[i].equals( "-artifact" ) )
              {
                  if( args.length >= i+1 )
                  {
                      return args[ i+1 ];
                  }
                  else
                  {
                      final String error = 
                        "CLI Missing artifict argument.";
                      throw new IllegalArgumentException( error );
                  }
              }
          }
          
          return System.getProperty( "repository.application.jar" ) ;
      }
  
      private static String getMainClassname( String[] args )
      {
          for( int i=0; i<args.length; i++ )
          {
              if( args[i].equals( "-main" ) )
              {
                  if( args.length >= i+1 )
                  {
                      return args[ i+1 ];
                  }
                  else
                  {
                      final String error = 
                        "CLI Missing main argument.";
                      throw new IllegalArgumentException( error );
                  }
              }
          }
          
          return System.getProperty( "repository.application.main" ) ;
      }
  }
  
  
  
  1.1                  avalon-sandbox/repository/main/src/java/org/apache/avalon/repository/main/InitialRepositoryFactory.java
  
  Index: InitialRepositoryFactory.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.repository.main ;
  
  
  import java.io.File ;
  import java.io.IOException ;
  import java.io.InputStream ;
  import java.io.FileOutputStream ;
  
  import java.util.ArrayList ;
  import java.util.Map ;
  import java.util.Properties ;
  import java.text.ParseException ;
  
  import java.net.URL ;
  import java.net.URLConnection ;
  import java.net.URLClassLoader ;
  import java.net.HttpURLConnection ;
  import java.net.MalformedURLException ;
  
  import javax.naming.NamingException ;
  import javax.naming.NamingEnumeration ;
  import javax.naming.directory.Attributes ;
  
  import org.apache.avalon.repository.Artifact;
  import org.apache.avalon.repository.Repository;
  import org.apache.avalon.repository.RepositoryException;
  import org.apache.avalon.repository.util.LOADER;
  import org.apache.avalon.repository.ClassicArtifact ;
  import org.apache.avalon.repository.util.RepositoryUtils ;
  import org.apache.avalon.repository.criteria.Factory ;
  import org.apache.avalon.repository.criteria.Criteria ;
  import org.apache.avalon.repository.meta.TargetMeta ;
  
  /**
   * Sets up the environment to create repositories by downloading the required 
   * jars, preparing a ClassLoader and delegating calls to repository factory 
   * methods using the newly configured ClassLoader.
   * 
   * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $
   */
  public class InitialRepositoryFactory implements Factory
  {
      //------------------------------------------------------------------
      // static 
      //------------------------------------------------------------------
  
      public static final String STANDARD_GROUP = 
          "avalon-repository";
  
      public static final String STANDARD_NAME = 
          "avalon-repository-main";
  
      public static final String AVALON_ARTIFACT_DEPENDENCY =
          "avalon.artifact.dependency";
  
      public static final Artifact STANDARD_REF =
          Artifact.createArtifact( STANDARD_GROUP, STANDARD_NAME );
  
  
      //------------------------------------------------------------------
      // state 
      //------------------------------------------------------------------
          
      /** the delegate repository factory instantiated */
      private final Factory m_delegate;
  
      /** the supplied remote repositories */
      private final String[] m_repositories;
      
      // ------------------------------------------------------------------------
      // constructors
      // ------------------------------------------------------------------------
  
      /**
       * Creates a repository which in turn instantiates a Repository 
       * factory implementation specified by an artifact descriptor and the 
       * implementation factory's class name.  This factory delegates 
       * calls to the implementation factory once it is created.
       * 
       * @throws RepositoryException
       */
      public InitialRepositoryFactory( String[] repositories ) 
          throws RepositoryException
      {
           //this( 
           //  getDefaultImplementation( repositories ), 
           //  repositories );
  
           this( STANDARD_REF, repositories );
      }
      
      /**
       * Creates a repository which in turn instantiates a Repository 
       * factory implementation specified by an artifact descriptor and the 
       * implementation factory's class name.  This factory delegates 
       * calls to the implementation factory once it is created.
       * 
       * @throws RepositoryException
       */
      public InitialRepositoryFactory( Artifact reference, String[] repositories ) 
          throws RepositoryException
      {
          if( reference == null ) throw new NullPointerException( "reference" );
          if( repositories == null ) throw new NullPointerException( "repositories" );
  
          m_repositories = repositories;
  
          //
          // Create the temporary directory to pull down files into
          //
  
          File cache = setupDefaultCache();
          if ( ! cache.exists() )
          {
              cache.mkdirs() ;
          }
  
          //
          // Build the url to access the properties of the implementation artifact
          // which is default mechanism dependent.
          //
  
          TargetMeta target = 
            new TargetMeta( 
              RepositoryUtils.getAttributes( repositories, reference )  );
  
          Artifact implementation = target.getImplementation();
          String factory = target.getFactoryClassname();
  
          //
          // Download every dependency referenced by the implementation into the
          // temporary cache to build the repository classloader with.
          //
  
          Attributes attributes = RepositoryUtils.getAttributes( repositories, implementation ) ;
  
          ArrayList list = new ArrayList() ;
          Artifact dependency = null;
          String spec = null;
          File file = null;
          try
          {
              NamingEnumeration l_list = 
                attributes.get( AVALON_ARTIFACT_DEPENDENCY ).getAll() ;
              while ( l_list.hasMore() )
              {
                  spec = ( String ) l_list.next() ;
                  dependency = ClassicArtifact.createJarArtifact( spec ) ;
                  list.add( LOADER.getResource( 
                    dependency, m_repositories, cache, true ) ) ;
              }
  
              //
              // add the actual implementation jar file
              //
  
              list.add( 
                LOADER.getResource( 
                  implementation, m_repositories, cache, true ) );
          }
          catch ( NamingException e )
          {
              final String error = 
                "Unable to construct attributes for the implementation reference: [" 
                + implementation + "]."; 
              throw new RepositoryException( error, e ) ;
          }
          catch ( Throwable e )
          {
              final String error = 
                "Unable to download dependent artifact [" + spec 
                + "] for the implementation reference: [" + implementation + "]."; 
              throw new RepositoryException( error, e ) ;
          }
  
          //
          // create the classloader to load the implementation stack
          //
          
          ClassLoader classloader = new URLClassLoader( 
             (URL[]) list.toArray( new URL [0] ), 
             Thread.currentThread().getContextClassLoader() ) ;
  
          //
          // load the actual repository implementation 
          //
          
          try
          {
              Class l_clazz = classloader.loadClass( factory ) ;
              m_delegate = ( Factory ) l_clazz.newInstance() ;
          }
          catch( IllegalAccessException e )
          {
              throw new RepositoryException( "Could not default constructor on: " 
                  + factory , e ) ;
          }
          catch( InstantiationException e )
          {
              throw new RepositoryException( 
                  "Could not instantiate the factory class: " + factory, e ) ;
          }
          catch( ClassNotFoundException e )
          {
              printClassLoader( classloader );
              throw new RepositoryException( "Could not find the factory class: " 
                  + factory, e ) ;
          }
      }
  
      private static File setupDefaultCache()
      {
          final File home = new File( System.getProperty( "user.home" ) );
          return new File( home, ".avalon" ); 
      }
  
      // ------------------------------------------------------------------------
      // Factory
      // ------------------------------------------------------------------------
      
     /**
      * Return a new instance of default criteria for the factory.
      * @return a new criteria instance
      */
      public Criteria createDefaultCriteria()
      {
          return m_delegate.createDefaultCriteria() ;
      }
  
     /**
      * Create a new instance of an application.
      * @return the application instance
      */
      public Object create()
      {
          return create( createDefaultCriteria().getMap() );
      }
  
     /**
      * Create a new instance of an application.
      * @param criteria the creation criteria
      * @return the application instance
      */
      public Object create( Criteria criteria )
      {
          return create( criteria.getMap() );
      }
  
     /**
      * Create a new instance of an application.
      * @param map the creatiob criteria
      * @return the application instance
      */
      public Object create( Map map )
      {
          return m_delegate.create( map ) ;
      }
      
      // ------------------------------------------------------------------------
      // utilities
      // ------------------------------------------------------------------------
      
      private void printClassLoader( ClassLoader loader )
      {
          if( loader == null ) return;
          if( loader instanceof URLClassLoader )
          {
              printURLClassLoader( (URLClassLoader) loader );
          }
      }
  
      private void printURLClassLoader( URLClassLoader loader )
      {
          System.out.println( "  " );
          URL[] urls = loader.getURLs();
          for( int i=0; i<urls.length; i++ )
          {
              System.out.println( "  " + urls[i] );
          }
  
          ClassLoader parent = loader.getParent();
          printClassLoader( parent );
      }
  
     /**
      * Build the properties that declare the default repository
      * implementation that was assigned at build time.
      */
      private static Properties createDefaultProperties()
      {
          final String path = 
            STANDARD_GROUP + "/" 
            + STANDARD_NAME 
            + ".meta";
  
          try
          {
              Properties properties = new Properties();
              ClassLoader classloader = 
                Thread.currentThread().getContextClassLoader();
              InputStream input = classloader.getResourceAsStream( path );
              if( input == null ) 
              {
                  final String error = 
                    "Missing resource: [" + path + "]";
                  throw new Error( error );
              }
              properties.load( input ) ;
              return properties;
          }
          catch ( Throwable e )
          {
              final String error = 
                "Internal error. " 
                + "Unable to locate the standard repository impl directive from the path: " 
                + path;
              RepositoryException re = new RepositoryException( error, e );
              re.printStackTrace( System.err ) ;
              return null;
          }
      }
  
      private static ClassicArtifact getDefaultImplementation( String[] hosts )
      {
          Properties properties = null;
          try
          {
              properties = RepositoryUtils.getProperties( hosts, STANDARD_REF );
          }
          catch( RepositoryException re )
          {
              properties = createDefaultProperties();
          }
  
          final String group = properties.getProperty( TargetMeta.GROUP_KEY );
          final String name = properties.getProperty( TargetMeta.NAME_KEY  );
          final String version = properties.getProperty( TargetMeta.VERSION_KEY );
          return ClassicArtifact.createJarArtifact( group, name, version );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/repository/main/src/java/org/apache/avalon/repository/main/Loader.java
  
  Index: Loader.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.repository.main ;
  
  
  import java.text.ParseException ;
  
  import java.lang.reflect.Constructor;
  import java.lang.reflect.Method ;
  import java.lang.reflect.InvocationTargetException ;
  
  import org.apache.avalon.repository.Artifact;
  import org.apache.avalon.repository.Repository;
  import org.apache.avalon.repository.RepositoryException;
  import org.apache.avalon.repository.ClassicArtifact ;
  
  
  /**
   * Application and component bootstrapper used to instantiate, and or invoke
   * Classes and their methods within newly constructed Repository ClassLoaders.
   * 
   * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
   * @author $Author: mcconnell $
   * @version $Revision: 1.1 $
   */
  public class Loader
  {
      //-----------------------------------------------------------
      // static
      //-----------------------------------------------------------
  
      private static final String[] DEFAULT_HOSTS = 
        new String[]{ "http://dpml.net/","http:ibiblio.org/maven" };
  
      //-----------------------------------------------------------
      // state
      //-----------------------------------------------------------
  
      /** The repository used by this bootstrapper */
      private final Repository m_repository ;
      /** The Jar artifact descriptor containing the target classes */
      private final Artifact m_descriptor ;
      /** The ClassLoader used to load and instantiate target classes */
      private final ClassLoader m_loader ;
      
      
      /**
       * Creates a Bootstrapper for a specific target artifact.
       */
      public Loader( Repository repository, Artifact artifact )
          throws RepositoryException
      {
          m_repository = repository ;
          m_descriptor = artifact;
          long time = System.currentTimeMillis();
          m_loader = repository.getClassLoader( artifact );
          long after = System.currentTimeMillis();
      }
  
      /**
       * Gets the ClassLoader used by this Bootstrapper.
       * 
       * @return the ClassLoader built by the Repository
       */
      public ClassLoader getClassLoader()
      {
          return m_loader ;
      }
      
      /**
       * Main wrapper.
       * 
       * @todo add more properties to allow full repo specification via 
       * system properties including a repository implementation replacement.
       * 
       * @param a_args
       */
      public static void main( String [] a_args )
      {
          String l_jarSpec = getArtifactSpec( a_args );
          if( null == l_jarSpec )
          {
              final String error = 
                "Cannot resolve an artifict target.";
                System.out.println( error );
              System.exit( -1 );
          }
  
          // SJM: disabled main class aquistion for the moment
  
          //String l_fqcn = getMainClassname( a_args );
          //if( null == l_fqcn )
          //{
          //    final String error = 
          //      "Cannot resolve an main class.";
          //      System.out.println( error );
          //    System.exit( -1 );
          //}
  
          String[] hosts = DEFAULT_HOSTS; // need to handle this via args
          
          Repository repository ;
          Artifact artifact = ClassicArtifact.createJarArtifact( l_jarSpec ) ;
          Loader loader ;
  
          try
          {
              System.out.println("  Initiating repository creation." );
              InitialRepositoryFactory l_factory = 
                  new InitialRepositoryFactory( hosts ) ;
              repository = (Repository) l_factory.create() ;
              System.out.println("  Repository established." );
              System.out.println(
                "cache: " 
                + repository.getLocation() );
  
              loader = new Loader( repository, artifact ) ;
  
              System.out.println("classloader established: " + l_jarSpec );
  
          }
          catch ( RepositoryException e )
          {
              e.printStackTrace() ;
              System.exit( -1 ) ;
          }
      }
  
      private static String getArtifactSpec( String[] args )
      {
          for( int i=0; i<args.length; i++ )
          {
              if( args[i].equals( "-artifact" ) )
              {
                  if( args.length >= i+1 )
                  {
                      return args[ i+1 ];
                  }
                  else
                  {
                      final String error = 
                        "CLI Missing artifict argument.";
                      throw new IllegalArgumentException( error );
                  }
              }
          }
          
          return System.getProperty( "repository.application.jar" ) ;
      }
  
      private static String getMainClassname( String[] args )
      {
          for( int i=0; i<args.length; i++ )
          {
              if( args[i].equals( "-main" ) )
              {
                  if( args.length >= i+1 )
                  {
                      return args[ i+1 ];
                  }
                  else
                  {
                      final String error = 
                        "CLI Missing main argument.";
                      throw new IllegalArgumentException( error );
                  }
              }
          }
          
          return System.getProperty( "repository.application.main" ) ;
      }
  }
  
  
  
  1.1                  avalon-sandbox/repository/main/src/java/org/apache/avalon/repository/main/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The repository main package is the main end-user deliverable providing support for the deynamic resolution and pluging-in of an repository implementation compliance with the Repository SPI Specification.</p>
  <p>Key features include:</p>
  <ul>
  <li>an initial repository factory supporting plugable implementations</li>
  <li>small footprit (28k)</li>
  <li>application bootstrapping service</li>
  <li>integral proxy support</li>
  </ul>  
  </body>
  
  
  
  1.1                  avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/RepositoryCriteria.java
  
  Index: RepositoryCriteria.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.repository;
  
  import java.net.URL;
  import java.io.File;
  
  import org.apache.avalon.repository.criteria.Criteria;
  import org.apache.avalon.repository.criteria.Parameter;
  
  
  /**
   * A service that provides access to versioned resources.
   * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2003/11/24 08:22:08 $
   */
  public interface RepositoryCriteria extends Criteria
  {
     /**
      * Repository cache directory parameter descriptor.
      */
      final Parameter REPOSITORY_CACHE_DIR = 
        new Parameter( 
          "avalon.repository.cache.dir",
          File.class.getName(),
          false );
  
     /**
      * Repository proxy host parameter descriptor.
      */
      final Parameter REPOSITORY_PROXY_HOST = 
        new Parameter( 
          "avalon.repository.proxy.host",
          String.class.getName(),
          false );
  
     /**
      * Repository proxy port parameter descriptor.
      */
      public static final Parameter REPOSITORY_PROXY_PORT = 
        new Parameter( 
          "avalon.repository.proxy.port",
          Integer.class.getName(),
          false );
  
     /**
      * Repository proxy username parameter descriptor.
      */
      public static final Parameter REPOSITORY_PROXY_USERNAME = 
        new Parameter( 
          "avalon.repository.proxy.username",
          String.class.getName(),
          false );
  
     /**
      * Repository proxy password parameter descriptor.
      */
      public static final Parameter REPOSITORY_PROXY_PASSWORD = 
        new Parameter( 
          "avalon.repository.proxy.password",
          String.class.getName(),
          false );
  
     /**
      * Repository proxy password parameter descriptor.
      */
      final Parameter REPOSITORY_REMOTE_HOSTS = 
        new Parameter( 
          "avalon.repository.remote.url",
          String[].class.getName(),
          false );
  
     /**
      * The factory parameters template.
      */
      final Parameter[] PARAMS = new Parameter[]{
             REPOSITORY_CACHE_DIR,
             REPOSITORY_PROXY_HOST,
             REPOSITORY_PROXY_PORT,
             REPOSITORY_PROXY_USERNAME,
             REPOSITORY_PROXY_PASSWORD,
             REPOSITORY_REMOTE_HOSTS };
  }
  
  
  
  1.7       +22 -27    avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/RepositoryFactory.java
  
  
  
  

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


Mime
View raw message