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/impl/src/java/org/apache/avalon/repository/impl DefaultFactory.java RepositoryCriteria.java
Date Tue, 02 Dec 2003 07:33:22 GMT
mcconnell    2003/12/01 23:33:22

  Modified:    repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultFactory.java RepositoryCriteria.java
  Log:
  Improve definition of criteria parameters.
  
  Revision  Changes    Path
  1.17      +7 -7      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultFactory.java	30 Nov 2003 08:11:36 -0000	1.16
  +++ DefaultFactory.java	2 Dec 2003 07:33:22 -0000	1.17
  @@ -184,20 +184,20 @@
       private File getCache( Map map )
       {
           return (File) map.get( 
  -            RepositoryCriteria.REPOSITORY_CACHE_DIR.getKey() );
  +            RepositoryCriteria.REPOSITORY_CACHE_DIR );
       }
   
       private String[] getHosts( Map map )
       {
           return (String[]) map.get( 
  -            RepositoryCriteria.REPOSITORY_REMOTE_HOSTS.getKey() );
  +            RepositoryCriteria.REPOSITORY_REMOTE_HOSTS );
       }
   
       private ProxyContext createProxyContext( Map map )
       {
           final String proxyHostName = 
             (String) map.get( 
  -            RepositoryCriteria.REPOSITORY_PROXY_HOST.getKey() );
  +            RepositoryCriteria.REPOSITORY_PROXY_HOST );
   
           if( null == proxyHostName )
           {
  @@ -207,18 +207,18 @@
           {    
               final String proxyUsername = 
                 (String) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_USERNAME.getKey() );
  +                RepositoryCriteria.REPOSITORY_PROXY_USERNAME );
   
               final String proxyPassword = 
                 (String) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_PASSWORD.getKey() );
  +                RepositoryCriteria.REPOSITORY_PROXY_PASSWORD );
   
               Authenticator authenticator = 
                 new DefaultAuthenticator( proxyUsername, proxyPassword );
   
               Integer proxyPort = 
                 (Integer) map.get( 
  -                RepositoryCriteria.REPOSITORY_PROXY_PORT.getKey() );
  +                RepositoryCriteria.REPOSITORY_PROXY_PORT );
               if( null == proxyPort ) proxyPort = new Integer( 0 );
   
               return new ProxyContext( 
  
  
  
  1.5       +55 -59    avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/RepositoryCriteria.java
  
  Index: RepositoryCriteria.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/RepositoryCriteria.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RepositoryCriteria.java	30 Nov 2003 08:11:36 -0000	1.4
  +++ RepositoryCriteria.java	2 Dec 2003 07:33:22 -0000	1.5
  @@ -87,67 +87,73 @@
      /**
       * Repository cache directory parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_CACHE_DIR = 
  +    public static final String REPOSITORY_CACHE_DIR = "avalon.repository.cache.dir";
  +    private static final Parameter REPOSITORY_CACHE_DIR_PARAM = 
         new Parameter( 
  -        "avalon.home",
  -        File.class.getName(),
  +        REPOSITORY_CACHE_DIR,
  +        File.class,
           null );
   
      /**
       * Repository proxy host parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_PROXY_HOST = 
  +    public static final String REPOSITORY_PROXY_HOST = "avalon.repository.proxy.host";
  +    private static final Parameter REPOSITORY_PROXY_HOST_PARAM = 
         new Parameter( 
  -        "avalon.repository.proxy.host",
  -        String.class.getName(),
  +        REPOSITORY_PROXY_HOST,
  +        String.class,
           null );
   
      /**
       * Repository proxy port parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_PROXY_PORT = 
  +    public static final String REPOSITORY_PROXY_PORT = "avalon.repository.proxy.port";
  +    private static final Parameter REPOSITORY_PROXY_PORT_PARAM = 
         new Parameter( 
  -        "avalon.repository.proxy.port",
  -        Integer.class.getName(),
  +        REPOSITORY_PROXY_PORT,
  +        Integer.class,
           null );
   
      /**
       * Repository proxy username parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_PROXY_USERNAME = 
  +    public static final String REPOSITORY_PROXY_USERNAME = "avalon.repository.proxy.username";
  +    private static final Parameter REPOSITORY_PROXY_USERNAME_PARAM = 
         new Parameter( 
  -        "avalon.repository.proxy.username",
  -        String.class.getName(),
  +        REPOSITORY_PROXY_USERNAME,
  +        String.class,
           null );
   
      /**
       * Repository proxy password parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_PROXY_PASSWORD = 
  +    public static final String REPOSITORY_PROXY_PASSWORD = "avalon.repository.proxy.password";
  +    private static final Parameter REPOSITORY_PROXY_PASSWORD_PARAM = 
         new Parameter( 
  -        "avalon.repository.proxy.password",
  -        String.class.getName(),
  +        REPOSITORY_PROXY_PASSWORD,
  +        String.class,
           null );
   
      /**
       * Repository proxy password parameter descriptor.
       */
  -    public static final Parameter REPOSITORY_REMOTE_HOSTS = 
  +    public static final String REPOSITORY_REMOTE_HOSTS = "avalon.repository.remote.url";
  +    public static final Parameter REPOSITORY_REMOTE_HOSTS_PARAM = 
         new Parameter( 
  -        "avalon.repository.remote.url",
  -        String[].class.getName(),
  +        REPOSITORY_REMOTE_HOSTS,
  +        String[].class,
           null );
   
      /**
       * The factory parameters template.
       */
       public static final Parameter[] PARAMS = new Parameter[]{
  -           REPOSITORY_CACHE_DIR,
  -           REPOSITORY_PROXY_HOST,
  -           REPOSITORY_PROXY_PORT,
  -           REPOSITORY_PROXY_USERNAME,
  -           REPOSITORY_PROXY_PASSWORD,
  -           REPOSITORY_REMOTE_HOSTS };
  +           REPOSITORY_CACHE_DIR_PARAM,
  +           REPOSITORY_PROXY_HOST_PARAM,
  +           REPOSITORY_PROXY_PORT_PARAM,
  +           REPOSITORY_PROXY_USERNAME_PARAM,
  +           REPOSITORY_PROXY_PASSWORD_PARAM,
  +           REPOSITORY_REMOTE_HOSTS_PARAM };
   
   
      /** 
  @@ -159,18 +165,18 @@
       * 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()
  +        REPOSITORY_CACHE_DIR,
  +        REPOSITORY_PROXY_HOST,
  +        REPOSITORY_PROXY_PORT,
  +        REPOSITORY_PROXY_USERNAME,
  +        REPOSITORY_PROXY_PASSWORD
       };
   
      /** 
       * regognized multivalue keys
       */
       public static final String [] MULTI_VALUE_KEYS = {
  -        REPOSITORY_REMOTE_HOSTS.getKey()
  +        REPOSITORY_REMOTE_HOSTS
       };
   
       //--------------------------------------------------------------
  @@ -204,42 +210,32 @@
           // the values stored in the defaults.
           //
   
  -        //final File home = new File( System.getProperty( "user.home" ) );
  -        //String cache = 
  -        //  defaults.getProperty( REPOSITORY_CACHE_DIR.getKey() );
  -        //if( null == cache )
  -        //{
  -        //     cache = ".cache";
  -        //}
  -        //put( REPOSITORY_CACHE_DIR.getKey(),
  -        //    new File( home, cache ) );
  -
           String cache = 
  -          defaults.getProperty( REPOSITORY_CACHE_DIR.getKey() );
  +          defaults.getProperty( REPOSITORY_CACHE_DIR );
           if( null == cache )
           {
               put( 
  -              REPOSITORY_CACHE_DIR.getKey(), 
  +              REPOSITORY_CACHE_DIR, 
                 context.getInitialCacheDirectory() );
           }
           else
           {
               put( 
  -              REPOSITORY_CACHE_DIR.getKey(), 
  +              REPOSITORY_CACHE_DIR, 
                 new File( cache ) );
           }
   
           try
           {
               String[] hosts = 
  -              defaults.getEnumerated( REPOSITORY_REMOTE_HOSTS.getKey() );
  +              defaults.getEnumerated( REPOSITORY_REMOTE_HOSTS );
               if( null != hosts )
               {
  -                put( REPOSITORY_REMOTE_HOSTS.getKey(), hosts );
  +                put( REPOSITORY_REMOTE_HOSTS, hosts );
               }
               else
               {
  -                put( REPOSITORY_REMOTE_HOSTS.getKey(), context.getInitialHosts() );
  +                put( REPOSITORY_REMOTE_HOSTS, context.getInitialHosts() );
               }
           }
           catch ( Throwable e )
  @@ -249,31 +245,31 @@
               throw new RepositoryException( error, e );
           }
   
  -        if( defaults.containsKey( REPOSITORY_PROXY_HOST.getKey() ) )
  +        if( defaults.containsKey( REPOSITORY_PROXY_HOST ) )
           {    
               put(
  -              REPOSITORY_PROXY_HOST.getKey(), 
  -              new Integer( defaults.getProperty( REPOSITORY_PROXY_HOST.getKey() ) ) );
  +              REPOSITORY_PROXY_HOST, 
  +              new Integer( defaults.getProperty( REPOSITORY_PROXY_HOST ) ) );
   
  -            if( defaults.containsKey( REPOSITORY_PROXY_PORT.getKey() ) )
  +            if( defaults.containsKey( REPOSITORY_PROXY_PORT ) )
               {
                   put(
  -                  REPOSITORY_PROXY_PORT.getKey(), 
  -                  new Integer( defaults.getProperty( REPOSITORY_PROXY_PORT.getKey() ) )
);
  +                  REPOSITORY_PROXY_PORT, 
  +                  new Integer( defaults.getProperty( REPOSITORY_PROXY_PORT ) ) );
               }
   
  -            if( defaults.containsKey( REPOSITORY_PROXY_USERNAME.getKey() ) )
  +            if( defaults.containsKey( REPOSITORY_PROXY_USERNAME ) )
               {
                   put(
  -                  REPOSITORY_PROXY_USERNAME.getKey(), 
  -                  defaults.getProperty( REPOSITORY_PROXY_USERNAME.getKey() ) );
  +                  REPOSITORY_PROXY_USERNAME, 
  +                  defaults.getProperty( REPOSITORY_PROXY_USERNAME ) );
               }
   
  -            if( defaults.containsKey( REPOSITORY_PROXY_PASSWORD.getKey() ) )
  +            if( defaults.containsKey( REPOSITORY_PROXY_PASSWORD ) )
               {
                   put(
  -                  REPOSITORY_PROXY_PASSWORD.getKey(), 
  -                  defaults.getProperty( REPOSITORY_PROXY_PASSWORD.getKey() ) );
  +                  REPOSITORY_PROXY_PASSWORD, 
  +                  defaults.getProperty( REPOSITORY_PROXY_PASSWORD ) );
               }
           }
       }
  
  
  

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


Mime
View raw message