akarasulu 2003/11/10 16:28:02
Modified: repository/impl/src/java/org/apache/avalon/repository/impl
DefaultRepositoryFactory.java
Log:
Finished some tests.
Revision Changes Path
1.2 +6 -46
avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryFactory.java
Index: DefaultRepositoryFactory.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultRepositoryFactory.java 10 Nov 2003 22:01:20 -0000 1.1
+++ DefaultRepositoryFactory.java 11 Nov 2003 00:28:01 -0000 1.2
@@ -52,14 +52,10 @@
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 ;
@@ -82,8 +78,6 @@
*/
public class DefaultRepositoryFactory 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",
@@ -126,29 +120,6 @@
Properties l_bootstrap = new Properties() ;
ProxyContext l_proxy = null ;
RepositoryContext 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
@@ -159,8 +130,7 @@
new SystemDefaultsFinder()
} ;
- final Defaults l_defaults =
- new Defaults( s_singles, s_multiple, l_finders ) ;
+ Defaults l_defaults = new Defaults( s_singles, s_multiple, l_finders ) ;
Defaults.macroExpand( l_defaults, null ) ;
/*
@@ -186,19 +156,9 @@
.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 ;
- }
- } ;
-
+ Authenticator l_authenticator = new DefaultAuthenticator(
+ l_defaults.getProperty( PROXY_USERNAME ),
+ l_defaults.getProperty( PROXY_PASSWORD ) ) ;
l_proxy = new ProxyContext( l_host, l_port, l_authenticator) ;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]