avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject cvs commit: avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl DefaultRepositoryConfig.java DefaultFactory.java
Date Thu, 06 Nov 2003 05:28:34 GMT
akarasulu    2003/11/05 21:28:34

  Modified:    repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultFactory.java
  Added:       repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultRepositoryConfig.java
  Log:
  Converted RepositoryConfig to an interface and
  created a default implementation for it.
  
  Revision  Changes    Path
  1.2       +239 -239  avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultFactory.java	6 Nov 2003 04:03:49 -0000	1.1
  +++ DefaultFactory.java	6 Nov 2003 05:28:34 -0000	1.2
  @@ -1,239 +1,239 @@
  -/*
  -
  - ============================================================================
  -                   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.File ;
  -import java.io.IOException ;
  -import java.io.InputStream ;
  -import java.io.FileInputStream ;
  -
  -import java.util.Properties ;
  -import java.net.Authenticator ;
  -import java.net.MalformedURLException ;
  -import java.net.PasswordAuthentication ;
  -
  -import org.apache.avalon.defaults.Defaults ;
  -import org.apache.avalon.defaults.DefaultsFinder ;
  -import org.apache.avalon.defaults.SimpleDefaultsFinder ;
  -import org.apache.avalon.defaults.SystemDefaultsFinder ;
  -
  -import org.apache.avalon.repository.Repository ;
  -import org.apache.avalon.repository.ProxyContext ;
  -import org.apache.avalon.repository.RepositoryConfig ;
  -import org.apache.avalon.repository.RepositoryFactory ;
  -import org.apache.avalon.repository.RepositoryException ;
  -
  -
  -/**
  - * The default repository factory implementation.
  - * 
  - * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
  - * @author $Author$
  - * @version $Revision$
  - */
  -public class DefaultFactory implements RepositoryFactory
  -{
  -    /** properties file where we pull defaults from */
  -    public static final String DEFAULTS = "repository.properties" ;
  -    /** single valued properties */
  -    private static final String [] s_singles = {
  -        "cache.dir",
  -        "proxyHost",
  -        "proxyPort",
  -        "proxyUsername",
  -        "proxyPassword"
  -    } ;
  -    /** the local repository base key where we download files into */
  -    public static final String CACHE_DIR = s_singles[0] ;
  -    /** the proxy host key */
  -    public static final String PROXY_HOST = s_singles[1] ;
  -    /** the proxy port key */
  -    public static final String PROXY_PORT = s_singles[2] ;
  -    /** the proxy username key */
  -    public static final String PROXY_USERNAME = s_singles[3] ;
  -    /** the proxy password key */
  -    public static final String PROXY_PASSWORD = s_singles[4] ;
  -
  -    /** enumerated (multivalued) properties */
  -    public static final String [] s_multiple = {
  -        "remote.repository.url"
  -    } ;
  -    
  -    /** the key base for the remote repo enumerated property */
  -    public static final String REMOTE_REPO_BASE = s_multiple[0] ;
  -
  -
  -    /**
  -     * Creates a repository configuration and populates it with parameters 
  -     * obtained from a default bootstrap properties file, a hidden form of the
  -     * same properties file (dot '.' prefixed), and the system properties in 
  -     * that order.  Support property key macro expansion.
  -     * 
  -     * @see org.apache.avalon.repository.RepositoryFactory#getDefaultConfig()
  -     */
  -    public RepositoryConfig getDefaultConfig()
  -        throws RepositoryException
  -    {
  -        Properties l_bootstrap = new Properties() ;
  -        ProxyContext l_proxy = null ;
  -        RepositoryConfig l_config = new RepositoryConfig() ;
  -        InputStream l_in = Repository.class.getResourceAsStream( DEFAULTS ) ;
  -        
  -        /*
  -         * Load the jar relative default properties file first.  Then load into
  -         * the same properties the dot prefixed version of the defaults file 
  -         * within the user's home directory.
  -         */
  -        try 
  -        {
  -            l_bootstrap.load( l_in ) ;
  -            String l_userHome = System.getProperty( "user.home" ) ;
  -            File l_user = new File( l_userHome, "." + DEFAULTS ) ;
  -            
  -            if ( l_user.exists() ) 
  -            {    
  -                l_in = new FileInputStream( l_user ) ;
  -                l_bootstrap.load( l_in ) ;
  -            }
  -        }
  -        catch( IOException e )
  -        {
  -            throw new RepositoryException( "Failed to load defaults", e ) ;
  -        }
  -
  -        /*
  -         * Create the finder (discovery policy), construct the defaults, and
  -         * macro expand the values.
  -         */
  -        final DefaultsFinder [] l_finders = {
  -            new SimpleDefaultsFinder( new Properties[] { l_bootstrap }, false ),
  -            new SystemDefaultsFinder()
  -        } ;
  -        
  -        final Defaults l_defaults = 
  -            new Defaults( s_singles, s_multiple, l_finders ) ;
  -        Defaults.macroExpand( l_defaults, null ) ;
  -        
  -        /*
  -         * Here we start to populate the empty repository configuration using
  -         * the values stored in the defaults.
  -         */
  -        
  -        l_config.setCacheDir( l_defaults.getProperty( CACHE_DIR ) ) ;
  -        
  -        try
  -        {
  -            l_config.setRemoteRepositoryUrls( 
  -                    l_defaults.getEnumerated( REMOTE_REPO_BASE ) ) ;
  -        }
  -        catch ( MalformedURLException e )
  -        {
  -            throw new RepositoryException( "Failed to set remote repos", e ) ;
  -        }
  -
  -        if ( l_defaults.containsKey( PROXY_HOST ) )
  -        {    
  -            int l_port = Integer
  -                .parseInt( l_defaults.getProperty( PROXY_PORT ) ) ;
  -            String l_host = l_defaults.getProperty( PROXY_HOST ) ;
  -    
  -            Authenticator l_authenticator = new Authenticator()
  -            {
  -                protected PasswordAuthentication getPasswordAuthentication()
  -                {
  -                    PasswordAuthentication l_pwdAuth = 
  -                        new PasswordAuthentication(
  -                        l_defaults.getProperty( PROXY_USERNAME ),
  -                        l_defaults.getProperty( PROXY_PASSWORD )
  -                            .toCharArray() ) ;
  -                    return l_pwdAuth ;
  -                }
  -            } ;
  -            
  -            l_proxy = new ProxyContext( l_host, l_port, l_authenticator) ;
  -        }
  -        
  -        l_config.setProxyContext( l_proxy ) ;
  -        
  -        return l_config ;
  -    }
  -
  -
  -    /**
  -     * Creates a file repository using the properties of a configuration bean.
  -     * 
  -     * @see org.apache.avalon.repository.RepositoryFactory
  -     * create(org.apache.avalon.repository.RepositoryConfig)
  -     */
  -    public Repository create( RepositoryConfig a_config )
  -    {
  -        Repository l_repository = null ;
  -        File l_base = new File( a_config.getCacheDir() ) ;
  -        
  -        if ( null == a_config.getProxyContext() && 
  -             null == a_config.getRemoteRepositories() )
  -        {
  -            l_repository = new DefaultFileRepository( l_base ) ;
  -        }
  -        else if ( null == a_config.getProxyContext() )
  -        {
  -            l_repository = new DefaultFileRepository( l_base, 
  -                    a_config.getRemoteRepositories() ) ;
  -        }
  -        
  -        l_repository = new DefaultFileRepository( l_base, 
  -                a_config.getProxyContext(), 
  -                a_config.getRemoteRepositories() ) ;
  -        
  -        return l_repository ;
  -    }
  -}
  +/*
  +
  + ============================================================================
  +                   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.File ;
  +import java.io.IOException ;
  +import java.io.InputStream ;
  +import java.io.FileInputStream ;
  +
  +import java.util.Properties ;
  +import java.net.Authenticator ;
  +import java.net.MalformedURLException ;
  +import java.net.PasswordAuthentication ;
  +
  +import org.apache.avalon.defaults.Defaults ;
  +import org.apache.avalon.defaults.DefaultsFinder ;
  +import org.apache.avalon.defaults.SimpleDefaultsFinder ;
  +import org.apache.avalon.defaults.SystemDefaultsFinder ;
  +
  +import org.apache.avalon.repository.Repository ;
  +import org.apache.avalon.repository.ProxyContext ;
  +import org.apache.avalon.repository.RepositoryConfig ;
  +import org.apache.avalon.repository.RepositoryFactory ;
  +import org.apache.avalon.repository.RepositoryException ;
  +
  +
  +/**
  + * The default repository factory implementation.
  + * 
  + * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
  + * @author $Author$
  + * @version $Revision$
  + */
  +public class DefaultFactory implements RepositoryFactory
  +{
  +    /** properties file where we pull defaults from */
  +    public static final String DEFAULTS = "repository.properties" ;
  +    /** single valued properties */
  +    private static final String [] s_singles = {
  +        "cache.dir",
  +        "proxyHost",
  +        "proxyPort",
  +        "proxyUsername",
  +        "proxyPassword"
  +    } ;
  +    /** the local repository base key where we download files into */
  +    public static final String CACHE_DIR = s_singles[0] ;
  +    /** the proxy host key */
  +    public static final String PROXY_HOST = s_singles[1] ;
  +    /** the proxy port key */
  +    public static final String PROXY_PORT = s_singles[2] ;
  +    /** the proxy username key */
  +    public static final String PROXY_USERNAME = s_singles[3] ;
  +    /** the proxy password key */
  +    public static final String PROXY_PASSWORD = s_singles[4] ;
  +
  +    /** enumerated (multivalued) properties */
  +    public static final String [] s_multiple = {
  +        "remote.repository.url"
  +    } ;
  +    
  +    /** the key base for the remote repo enumerated property */
  +    public static final String REMOTE_REPO_BASE = s_multiple[0] ;
  +
  +
  +    /**
  +     * Creates a repository configuration and populates it with parameters 
  +     * obtained from a default bootstrap properties file, a hidden form of the
  +     * same properties file (dot '.' prefixed), and the system properties in 
  +     * that order.  Support property key macro expansion.
  +     * 
  +     * @see org.apache.avalon.repository.RepositoryFactory#getDefaultConfig()
  +     */
  +    public RepositoryConfig getDefaultConfig()
  +        throws RepositoryException
  +    {
  +        Properties l_bootstrap = new Properties() ;
  +        ProxyContext l_proxy = null ;
  +        RepositoryConfig l_config = new DefaultRepositoryConfig() ;
  +        InputStream l_in = Repository.class.getResourceAsStream( DEFAULTS ) ;
  +        
  +        /*
  +         * Load the jar relative default properties file first.  Then load into
  +         * the same properties the dot prefixed version of the defaults file 
  +         * within the user's home directory.
  +         */
  +        try 
  +        {
  +            l_bootstrap.load( l_in ) ;
  +            String l_userHome = System.getProperty( "user.home" ) ;
  +            File l_user = new File( l_userHome, "." + DEFAULTS ) ;
  +            
  +            if ( l_user.exists() ) 
  +            {    
  +                l_in = new FileInputStream( l_user ) ;
  +                l_bootstrap.load( l_in ) ;
  +            }
  +        }
  +        catch( IOException e )
  +        {
  +            throw new RepositoryException( "Failed to load defaults", e ) ;
  +        }
  +
  +        /*
  +         * Create the finder (discovery policy), construct the defaults, and
  +         * macro expand the values.
  +         */
  +        final DefaultsFinder [] l_finders = {
  +            new SimpleDefaultsFinder( new Properties[] { l_bootstrap }, false ),
  +            new SystemDefaultsFinder()
  +        } ;
  +        
  +        final Defaults l_defaults = 
  +            new Defaults( s_singles, s_multiple, l_finders ) ;
  +        Defaults.macroExpand( l_defaults, null ) ;
  +        
  +        /*
  +         * Here we start to populate the empty repository configuration using
  +         * the values stored in the defaults.
  +         */
  +        
  +        l_config.setCacheDir( l_defaults.getProperty( CACHE_DIR ) ) ;
  +        
  +        try
  +        {
  +            l_config.setRemoteRepositoryUrls( 
  +                    l_defaults.getEnumerated( REMOTE_REPO_BASE ) ) ;
  +        }
  +        catch ( MalformedURLException e )
  +        {
  +            throw new RepositoryException( "Failed to set remote repos", e ) ;
  +        }
  +
  +        if ( l_defaults.containsKey( PROXY_HOST ) )
  +        {    
  +            int l_port = Integer
  +                .parseInt( l_defaults.getProperty( PROXY_PORT ) ) ;
  +            String l_host = l_defaults.getProperty( PROXY_HOST ) ;
  +    
  +            Authenticator l_authenticator = new Authenticator()
  +            {
  +                protected PasswordAuthentication getPasswordAuthentication()
  +                {
  +                    PasswordAuthentication l_pwdAuth = 
  +                        new PasswordAuthentication(
  +                        l_defaults.getProperty( PROXY_USERNAME ),
  +                        l_defaults.getProperty( PROXY_PASSWORD )
  +                            .toCharArray() ) ;
  +                    return l_pwdAuth ;
  +                }
  +            } ;
  +            
  +            l_proxy = new ProxyContext( l_host, l_port, l_authenticator) ;
  +        }
  +        
  +        l_config.setProxyContext( l_proxy ) ;
  +        
  +        return l_config ;
  +    }
  +
  +
  +    /**
  +     * Creates a file repository using the properties of a configuration bean.
  +     * 
  +     * @see org.apache.avalon.repository.RepositoryFactory
  +     * create(org.apache.avalon.repository.RepositoryConfig)
  +     */
  +    public Repository create( RepositoryConfig a_config )
  +    {
  +        Repository l_repository = null ;
  +        File l_base = new File( a_config.getCacheDir() ) ;
  +        
  +        if ( null == a_config.getProxyContext() && 
  +             null == a_config.getRemoteRepositories() )
  +        {
  +            l_repository = new DefaultFileRepository( l_base ) ;
  +        }
  +        else if ( null == a_config.getProxyContext() )
  +        {
  +            l_repository = new DefaultFileRepository( l_base, 
  +                    a_config.getRemoteRepositories() ) ;
  +        }
  +        
  +        l_repository = new DefaultFileRepository( l_base, 
  +                a_config.getProxyContext(), 
  +                a_config.getRemoteRepositories() ) ;
  +        
  +        return l_repository ;
  +    }
  +}
  
  
  
  1.1                  avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryConfig.java
  
  Index: DefaultRepositoryConfig.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.net.URL ;
  import java.net.MalformedURLException ;
  
  import org.apache.avalon.repository.ProxyContext ;
  import org.apache.avalon.repository.RepositoryConfig ;
  
  
  /**
   * Default implementation for a repository configuration parameters bean.
   * 
   * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
   * @author $Author: akarasulu $
   * @version $Revision: 1.1 $
   */
  public class DefaultRepositoryConfig implements RepositoryConfig
  {
      /** the set of remote repositories to pull jars from */
      private URL [] m_remoteRepositories = null ; 
  
      /** the path to the local repository that caches remote artifacts */
      private String m_cacheDir = null ; 
  
      /** descriptor for proxy used to access remote repositories */
      private ProxyContext m_proxyCtx = null ;
      
      
      /**
       * Gets the ProxyContext used by the Kernel to access remote repositories.
       * 
       * @return the proxy context used by the Kernel
       */
      public ProxyContext getProxyContext()
      {
          return m_proxyCtx ;
      }
  
  
      /**
       * Sets the ProxyContext for this KernelConfig.
       * 
       * @param a_proxyCtx sets the proxy context
       */
      public void setProxyContext( ProxyContext a_proxyCtx )
      {
          m_proxyCtx = a_proxyCtx ;
      }
  
  
      /**
       * Gets the set of remote repositories used to download artifacts.
       * 
       * @return the remote repositories to use
       */
      public URL[] getRemoteRepositories()
      {
          return m_remoteRepositories ;
      }
  
      
      /**
       * Gets the remote repository urls for downloading artifacts.
       * 
       * @param a_remoteRepositories the remote Repositories to use.
       */
      public void setRemoteRepositoryUrls( URL[] a_remoteRepositories )
      {
          m_remoteRepositories = a_remoteRepositories ;
      }
      
      
      /**
       * Sets the remote repository urls for downloading artifacts.
       * 
       * @param urls the remote Repositories to use.
       */
      public void setRemoteRepositoryUrls( String[] urls )
          throws MalformedURLException
      {
          URL [] a_urls = new URL [urls.length] ;
          
          for ( int ii = 0; ii < a_urls.length; ii++ )
          {
              a_urls[ii] = new URL( urls[ii] ) ;
          }
          
          
          m_remoteRepositories = a_urls ;
      }
      
      
      /**
       * Gets the directory where repository artifacts are stored after being 
       * downloaded from the Repository.
       * 
       * @return the place to cache repository artifacts
       */
      public String getCacheDir()
      {
          return m_cacheDir ;
      }
  
      
      /**
       * Sets the directory where we store downloaded artifacts.
       * 
       * @param a_cacheDir the place to cache repository artifacts
       */
      public void setCacheDir( String a_cacheDir )
      {
          m_cacheDir = a_cacheDir ;
      }
  }
  
  
  

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


Mime
View raw message