avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/repository/main maven.xml
Date Sun, 07 Dec 2003 03:15:16 GMT
mcconnell    2003/12/06 19:15:16

  Modified:    repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultCacheManager.java DefaultFactory.java
                        DefaultRepository.java
               repository/main maven.xml
  Log:
  Update factory to return a CacheManager instead of a Repository so that consumer components
can do privaliged things like resource installation.
  
  Revision  Changes    Path
  1.2       +28 -2     avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultCacheManager.java
  
  Index: DefaultCacheManager.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultCacheManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultCacheManager.java	4 Dec 2003 19:34:31 -0000	1.1
  +++ DefaultCacheManager.java	7 Dec 2003 03:15:16 -0000	1.2
  @@ -95,6 +95,11 @@
       */
       private final File m_base;
       
  +   /**
  +    * The default hosts.
  +    */
  +    private final String[] m_hosts;
  +    
       //------------------------------------------------------------------
       // constructor 
       //------------------------------------------------------------------
  @@ -104,13 +109,15 @@
       *
       * @param base the base directory for the repository cache
       * @param context the proxy context
  +    * @param hosts the default hosts
       */
  -    public DefaultCacheManager( File base, ProxyContext context )
  +    public DefaultCacheManager( File base, ProxyContext context, String[] hosts )
       {
           if( null == base ) 
            throw new NullPointerException( "base" );
   
           m_base = base;
  +        m_hosts = hosts;
   
           if( context != null )
           {
  @@ -136,6 +143,25 @@
       public File getCacheDirectory()
       {
           return m_base;
  +    }
  +
  +    /**
  +     * Return the default hosts.
  +     * 
  +     * @return the host names
  +     */
  +    public String[] getDefaultHosts()
  +    {
  +        return m_hosts;
  +    }
  +
  +   /**
  +    * Creation of a new repository handler using teh default hosts.
  +    * @return the repository
  +    */
  +    public Repository createRepository()
  +    {
  +        return createRepository( m_hosts );
       }
   
      /**
  
  
  
  1.3       +11 -21    avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultFactory.java	6 Dec 2003 23:51:08 -0000	1.2
  +++ DefaultFactory.java	7 Dec 2003 03:15:16 -0000	1.3
  @@ -107,7 +107,7 @@
       //--------------------------------------------------------------------------
   
      /**
  -    * Creation of a new default repository factory.
  +    * Creation of a new default repository manager factory.
       * @param context the initial context
       * @exception NullPointerException if the supplied context is null
       */
  @@ -130,7 +130,7 @@
       {
           try
           {
  -            return new RepositoryCriteria( m_context );
  +            return new DefaultRepositoryCriteria( m_context );
           }
           catch( Throwable e )
           {
  @@ -152,7 +152,7 @@
       }
   
      /**
  -    * Create a new instance of a repository administrator 
  +    * Create a new instance of a repository 
       * using the supplied parameters.
       *
       * @param map a map of repository parameters
  @@ -166,36 +166,26 @@
           File root = getCache( map );
           String[] hosts = getHosts( map );
           ProxyContext proxy = createProxyContext( map );
  -
  -        CacheManager cache = 
  -          new DefaultCacheManager( root, proxy );
  -
  -        //
  -        // TODO: add a criteria key to enable selection of 
  -        // either the repository or the cache manager as the 
  -        // service to return
  -        //
  -
  -        return cache.createRepository( hosts );
  +        return new DefaultCacheManager( root, proxy, hosts );
       }
   
       private File getCache( Map map )
       {
           return (File) map.get( 
  -            RepositoryCriteria.REPOSITORY_CACHE_DIR );
  +            DefaultRepositoryCriteria.REPOSITORY_CACHE_DIR );
       }
   
       private String[] getHosts( Map map )
       {
           return (String[]) map.get( 
  -            RepositoryCriteria.REPOSITORY_REMOTE_HOSTS );
  +            DefaultRepositoryCriteria.REPOSITORY_REMOTE_HOSTS );
       }
   
       private ProxyContext createProxyContext( Map map )
       {
           final String proxyHostName = 
             (String) map.get( 
  -            RepositoryCriteria.REPOSITORY_PROXY_HOST );
  +            DefaultRepositoryCriteria.REPOSITORY_PROXY_HOST );
   
           if( null == proxyHostName )
           {
  @@ -205,18 +195,18 @@
           {    
               final String proxyUsername = 
                 (String) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_USERNAME );
  +                DefaultRepositoryCriteria.REPOSITORY_PROXY_USERNAME );
   
               final String proxyPassword = 
                 (String) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_PASSWORD );
  +                DefaultRepositoryCriteria.REPOSITORY_PROXY_PASSWORD );
   
               Authenticator authenticator = 
                 new DefaultAuthenticator( proxyUsername, proxyPassword );
   
               Integer proxyPort = 
                 (Integer) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_PORT );
  +                DefaultRepositoryCriteria.REPOSITORY_PROXY_PORT );
               if( null == proxyPort ) proxyPort = new Integer( 0 );
   
               return new ProxyContext( 
  
  
  
  1.3       +1 -21     avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepository.java
  
  Index: DefaultRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultRepository.java	6 Dec 2003 23:51:08 -0000	1.2
  +++ DefaultRepository.java	7 Dec 2003 03:15:16 -0000	1.3
  @@ -88,13 +88,6 @@
   public class DefaultRepository implements Repository
   {
       //------------------------------------------------------------------
  -    // static 
  -    //------------------------------------------------------------------
  -
  -    private static final String[] DEFAULT_HOSTS = 
  -      new String[]{ "http://dpml.net", "http://ibiblio.org/maven" };
  -
  -    //------------------------------------------------------------------
       // immutable state 
       //------------------------------------------------------------------
   
  @@ -113,19 +106,6 @@
       //------------------------------------------------------------------
       // constructor 
       //------------------------------------------------------------------
  -
  -   /**
  -    * Creation of a new instance of the default repository using the 
  -    * default hosts.
  -    *
  -    * @param cache the cache manager assigned to the repository
  -    * @exception NullPointerException if the cache or hosts argument
  -    * is null
  -    */
  -    public DefaultRepository( CacheManager cache )
  -    {
  -        this( cache, DEFAULT_HOSTS );
  -    }
   
      /**
       * Creation of a new instance of the default repository.
  
  
  
  1.4       +2 -2      avalon/repository/main/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml	5 Dec 2003 06:23:06 -0000	1.3
  +++ maven.xml	7 Dec 2003 03:15:16 -0000	1.4
  @@ -18,7 +18,7 @@
   
     <!--
     ###########################################################################
  -  # Create the target .meta metadata.                                       #
  +  # Create the avalon.implementation metadata.                              #
     # This contains the information used by the factory to identify the       #
     # the implementation artifact classpath, factory, and whatever else       #
     # we need to include this jar as the implementation strategy.             #
  @@ -29,7 +29,7 @@
   
       <j:set var="impl" value="${pom.getDependency('avalon-repository:avalon-repository-impl')}"/>
   
  -    <ant:echo file="${maven.build.dir}/classes/implementation.properties">
  +    <ant:echo file="${maven.build.dir}/classes/avalon.implementation">
   #===================================================================#
   # Default repository implementation artifact identifier.            #
   #===================================================================#
  
  
  

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


Mime
View raw message