Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1348 - in development/main/transit: handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/artifact handler/src/main/net/dpml/transit/monitors plugin/src/main/net/dpml/transit/control

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1348 - in development/main/transit: handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/artifact handler/src/main/net/dpml/transit/monitors plugin/src/main/net/dpml/transit/control
  • Date: Mon, 03 Jan 2005 03:54:02 +0100

Author: mcconnell
Date: Mon Jan 3 03:54:01 2005
New Revision: 1348

Modified:
development/main/transit/handler/src/main/net/dpml/transit/Environment.java
development/main/transit/handler/src/main/net/dpml/transit/Main.java
development/main/transit/handler/src/main/net/dpml/transit/Transit.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/DelegatingAuthenticator.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/Handler.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticator.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticatorImpl.java

development/main/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java

development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java

development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
Log:
checkstyle cleanup

Modified:
development/main/transit/handler/src/main/net/dpml/transit/Environment.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/Environment.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/Environment.java
Mon Jan 3 03:54:01 2005
@@ -50,12 +50,12 @@
/**
* the user's platform specific shell executable
*/
- private static String platformShell = null;
+ private static String m_SHELL = null;

/**
* the last Env instance created
*/
- private static Environment lastEnvironmentInstance = null;
+ private static Environment m_INSTANCE = null;

/**
* Creates a snapshot of the current shell environment variables for a
user.
@@ -71,7 +71,7 @@
String key = ( String ) list.nextElement();
setProperty( key, properties.getProperty( key ) );
}
- lastEnvironmentInstance = this;
+ m_INSTANCE = this;
}

/**
@@ -86,13 +86,13 @@
*/
Environment getLastEnv() throws EnvironmentException
{
- if( lastEnvironmentInstance == null )
+ if( m_INSTANCE == null )
{
- lastEnvironmentInstance = new Environment();
+ m_INSTANCE = new Environment();
}

// return cloned copy so there is no cross interference
- return ( Environment ) lastEnvironmentInstance.clone();
+ return ( Environment ) m_INSTANCE.clone();
}


@@ -243,9 +243,9 @@
Process process = null;
BufferedReader reader = null;

- if( null != platformShell )
+ if( null != m_SHELL )
{
- return platformShell;
+ return m_SHELL;
}

try
@@ -274,8 +274,8 @@
+ USERNAME );
}

- platformShell = entry.substring( index + 1 );
- return platformShell;
+ m_SHELL = entry.substring( index + 1 );
+ return m_SHELL;
}

process.waitFor();
@@ -430,21 +430,21 @@
*/
private static String getWindowsUserShell()
{
- if( null != platformShell )
+ if( null != m_SHELL )
{
- return platformShell;
+ return m_SHELL;
}

if( -1 != OSNAME.indexOf( "98" )
|| -1 != OSNAME.indexOf( "95" )
|| -1 != OSNAME.indexOf( "Me" ) )
{
- platformShell = "command.com";
- return platformShell;
+ m_SHELL = "command.com";
+ return m_SHELL;
}

- platformShell = "cmd.exe";
- return platformShell;
+ m_SHELL = "cmd.exe";
+ return m_SHELL;
}



Modified: development/main/transit/handler/src/main/net/dpml/transit/Main.java
==============================================================================
--- development/main/transit/handler/src/main/net/dpml/transit/Main.java
(original)
+++ development/main/transit/handler/src/main/net/dpml/transit/Main.java
Mon Jan 3 03:54:01 2005
@@ -81,10 +81,12 @@
{
fis = new FileInputStream( propsFile );
System.getProperties().load( fis );
- } catch( Exception e )
+ }
+ catch( Exception e )
{
System.out.println( "Can't read: " + propsFile );
- } finally
+ }
+ finally
{
fis.close();
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
--- development/main/transit/handler/src/main/net/dpml/transit/Transit.java
(original)
+++ development/main/transit/handler/src/main/net/dpml/transit/Transit.java
Mon Jan 3 03:54:01 2005
@@ -60,7 +60,7 @@
/**
* Singleton transit instance.
*/
- private static Transit transitSingletonInstance;
+ private static Transit m_INSTANCE;

/**
* Repository established by transit.
@@ -116,11 +116,11 @@
}
synchronized( Transit.class )
{
- if( transitSingletonInstance == null )
+ if( m_INSTANCE == null )
{
- transitSingletonInstance = new Transit( monitor );
+ m_INSTANCE = new Transit( monitor );
}
- return transitSingletonInstance;
+ return m_INSTANCE;
}
}


Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/DelegatingAuthenticator.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/DelegatingAuthenticator.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/DelegatingAuthenticator.java
Mon Jan 3 03:54:01 2005
@@ -23,6 +23,7 @@
import java.net.PasswordAuthentication;
import java.net.UnknownHostException;

+import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;

@@ -32,20 +33,31 @@
*/
final class DelegatingAuthenticator extends Authenticator
{
- private static DelegatingAuthenticator m_instance;
+
+ /**
+ * The singleton delegating authenticator instance.
+ */
+ private static DelegatingAuthenticator m_INSTANCE;

- private HashMap m_Authenticators;
+ /**
+ * The set of registered authenticators keyed by id.
+ */
+ private Map m_authenticators;

+ /**
+ * Return the singleton authenticator.
+ * @return the authenticator
+ */
static DelegatingAuthenticator getInstance()
{
synchronized( DelegatingAuthenticator.class )
{
- if( m_instance == null )
+ if( m_INSTANCE == null )
{
- m_instance = new DelegatingAuthenticator();
- Authenticator.setDefault( m_instance );
+ m_INSTANCE = new DelegatingAuthenticator();
+ Authenticator.setDefault( m_INSTANCE );
}
- return m_instance;
+ return m_INSTANCE;
}
}

@@ -54,26 +66,37 @@
*/
DelegatingAuthenticator()
{
- m_Authenticators = new HashMap();
+ m_authenticators = new HashMap();
}

- void addTransitAuthenticator( TransitAuthenticator auth,
RequestIdentifier id )
+ /**
+ * Add an authenticator to the set of authenticators managed by the
+ * singleton delegating authenticator.
+ * @param authenticator the authenticator to add
+ * @param id the request identifier
+ */
+ void addTransitAuthenticator( TransitAuthenticator authenticator,
RequestIdentifier id )
{
- synchronized( m_Authenticators )
+ synchronized( m_authenticators )
{
- m_Authenticators.put( id, auth );
+ m_authenticators.put( id, authenticator );
}
}

- void removeTransitAuthenticator( TransitAuthenticator auth )
+ /**
+ * Remove an authenticator from the set of authenticators managed by the
+ * singleton delegating authenticator.
+ * @param authenticator the authenticator to remove
+ */
+ void removeTransitAuthenticator( TransitAuthenticator authenticator )
{
- synchronized( m_Authenticators )
+ synchronized( m_authenticators )
{
- Iterator list = m_Authenticators.values().iterator();
+ Iterator list = m_authenticators.values().iterator();
while( list.hasNext() )
{
Authenticator item = (Authenticator) list.next();
- if( item.equals( auth ) )
+ if( item.equals( authenticator ) )
{
list.remove();
}
@@ -96,19 +119,21 @@
int port = getRequestingPort();
InetAddress addr = getRequestingSite();
if( addr == null )
+ {
addr = InetAddress.getByName( host );
-
+ }
RequestIdentifier id = new RequestIdentifier( addr, port,
protocol, scheme, prompt );
- synchronized( m_Authenticators )
+ synchronized( m_authenticators )
{
- TransitAuthenticator auth = (TransitAuthenticator)
m_Authenticators.get( id );
+ TransitAuthenticator auth = (TransitAuthenticator)
m_authenticators.get( id );
if( auth == null )
{
return null;
}
return auth.resolvePasswordAuthentication( this );
}
- } catch( UnknownHostException e )
+ }
+ catch( UnknownHostException e )
{
return null;
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/Handler.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/Handler.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/Handler.java
Mon Jan 3 03:54:01 2005
@@ -185,7 +185,7 @@
if( path == null )
{
path = specPath;
- if( ! path.endsWith( "/" ) )
+ if( !path.endsWith( "/" ) )
{
// SJM
// only add a "/" if we don't have an internal address

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
Mon Jan 3 03:54:01 2005
@@ -51,6 +51,21 @@
{

/**
+ * HTTP port number.
+ */
+ private static final int HTTP_PORT = 80;
+
+ /**
+ * FTP port number.
+ */
+ private static final int FTP_PORT = 21;
+
+ /**
+ * HTTPS port number.
+ */
+ private static final int HTTPS_PORT = 443;
+
+ /**
* Host base url.
*/
private URL m_baseUrl;
@@ -106,17 +121,11 @@
* @param password the authentication password
* @param scheme the authentication scheme
* @param prompt the authentication prompt/realm
+ * @exception UnknownHostException if the supplied base url references
an unknown host
*/
- public MavenResourceHost( URL base,
- String[] knownGroups,
- int priority,
- Policy downloadPolicy,
- boolean enabled,
- boolean trusted,
- String username,
- String password,
- String scheme,
- String prompt )
+ public MavenResourceHost(
+ URL base, String[] knownGroups, int priority, Policy downloadPolicy,
+ boolean enabled, boolean trusted, String username, String password,
String scheme, String prompt )
throws UnknownHostException
{
m_locks = new HashMap();
@@ -140,11 +149,17 @@
if( port == 0 )
{
if( protocol.equals( "http" ) )
- port = 80;
- if( protocol.equals( "ftp" ) )
- port = 21;
- if( protocol.equals( "https" ) )
- port = 443;
+ {
+ port = HTTP_PORT;
+ }
+ else if( protocol.equals( "ftp" ) )
+ {
+ port = FTP_PORT;
+ }
+ else if( protocol.equals( "https" ) )
+ {
+ port = HTTPS_PORT;
+ }
}
RequestIdentifier id = new RequestIdentifier( host, port, protocol,
scheme, prompt );
TransitAuthenticator ta = new TransitAuthenticatorImpl( username,
password );
@@ -343,8 +358,10 @@

/**
* Open a remote connection relative to a supplied artifact.
- * @param artifact the artifact agaisnt which a connection will be
established
+ * @param artifact the artifact against which a connection will be
established
* @exception IOException if an IO error occurs
+ * @exception KeyManagementException if a key management error occurs
+ * @exception NoSuchAlgorithmException if no such algorithm exists?
*/
private void openRemoteConnection( Artifact artifact )
throws IOException, KeyManagementException, NoSuchAlgorithmException
@@ -358,7 +375,7 @@
HttpsURLConnection ssl = (HttpsURLConnection) conn;
TrustManager tm = new AllowSelfCertTrustManager();
SSLContext ctx = SSLContext.getInstance( "SSLv3" );
- ctx.init( null, new TrustManager[] { tm }, null );
+ ctx.init( null, new TrustManager[] {tm}, null );
SSLSocketFactory factory = ctx.getSocketFactory();
ssl.setSSLSocketFactory( factory );
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
Mon Jan 3 03:54:01 2005
@@ -22,6 +22,8 @@

final class RequestIdentifier
{
+ private static final int MAGIC_NUMBER = 72349724;
+
private InetAddress m_address;
private int m_port;
private String m_prompt;
@@ -32,13 +34,21 @@
String protocol, String scheme, String prompt )
{
if( addr == null )
- throw new IllegalArgumentException( "Null argument: addr" );
+ {
+ throw new NullPointerException( "addr" );
+ }
if( protocol == null )
- throw new IllegalArgumentException( "Null argument: protocol" );
+ {
+ throw new NullPointerException( "protocol" );
+ }
if( scheme == null )
- throw new IllegalArgumentException( "Null argument: scheme" );
+ {
+ throw new NullPointerException( "scheme" );
+ }
if( prompt == null )
- throw new IllegalArgumentException( "Null argument: prompt" );
+ {
+ throw new NullPointerException( "prompt" );
+ }
m_address = addr;
m_port = port;
m_protocol = protocol;
@@ -48,27 +58,39 @@

public boolean equals( Object obj )
{
- if( ! ( obj instanceof RequestIdentifier ) )
+ if( !( obj instanceof RequestIdentifier ) )
+ {
return false;
+ }
RequestIdentifier other = (RequestIdentifier) obj;

if( m_port != other.m_port )
+ {
return false;
+ }

- if( ! m_address.equals( other.m_address ) )
+ if( !m_address.equals( other.m_address ) )
+ {
return false;
- if( ! m_protocol.equals( other.m_protocol ) )
+ }
+ if( !m_protocol.equals( other.m_protocol ) )
+ {
return false;
- if( ! m_prompt.equals( other.m_prompt ) )
+ }
+ if( !m_prompt.equals( other.m_prompt ) )
+ {
return false;
- if( ! m_scheme.equals( other.m_scheme ) )
+ }
+ if( !m_scheme.equals( other.m_scheme ) )
+ {
return false;
+ }
return true;
}

public int hashCode()
{
- int hash = 72349724 >>> m_port;
+ int hash = MAGIC_NUMBER >>> m_port;
hash = hash ^ m_address.hashCode();
hash = hash ^ m_protocol.hashCode();
hash = hash ^ m_prompt.hashCode();

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
Mon Jan 3 03:54:01 2005
@@ -21,8 +21,6 @@
import java.io.File;
import java.io.IOException;

-import java.net.PasswordAuthentication;
-
/**
* An interface that represents locations where the artifacts can be
* downloaded.

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
Mon Jan 3 03:54:01 2005
@@ -29,6 +29,7 @@
import java.net.URL;
import java.net.MalformedURLException;

+import java.util.List;
import java.util.ArrayList;
import java.util.Properties;

@@ -128,9 +129,12 @@
}

File base = new File( authorative );
- if( ! base.exists() )
+ if( !base.exists() )
{
- final String error = "Authority base directory does not
exist: " + base;
+ final String error =
+ "Authority base directory ["
+ + base
+ + "] does not exist.";
throw new FileNotFoundException( error );
}
createResourceHostsFromDirectory( result, base );
@@ -146,7 +150,8 @@
return hostArray;
}

- /** Creates the ResourceHosts defined in the properties for the
ResourceHost.
+ /**
+ * Creates the ResourceHosts defined in the properties for the
ResourceHost.
*
* <pre>
* dpml.transit.resourcehost.class=[classname]
@@ -158,11 +163,11 @@
* dpml.transit.resourcehost.scheme=[scheme]
* dpml.transit.resourcehost.prompt=[prompt/realm]
* </pre>
+ * @param result the list of established hosts
* @param files the set of filesname to scan
- * @return the resource hosts resolved from the supplied files
* @exception TransitException if an error occurs in resource host
construction
*/
- private void createResourceHosts( ArrayList result, String[] files )
+ private void createResourceHosts( List result, String[] files )
throws TransitException
{
for( int i=0; i < files.length; i++ )
@@ -201,11 +206,11 @@
* dpml.transit.resourcehost.username=[username]
* dpml.transit.resourcehost.password=[password]
* </pre>
+ * @param result the list of established hosts
* @param base the base directory from within which host files will be
located
- * @return the set of host defintions
* @exception TransitException if an error occurs while reading host
descriptors
*/
- private void createResourceHostsFromDirectory( ArrayList result, File
base )
+ private void createResourceHostsFromDirectory( List result, File base )
throws TransitException
{
File hosts = new File( base, "hosts" );
@@ -226,11 +231,11 @@
* dpml.transit.resourcehost.username=[username]
* dpml.transit.resourcehost.password=[password]
* </pre>
+ * @param result the list of established hosts
* @param files the set of host descriptors to read
- * @return the set of host defintions
* @exception TransitException if an error occurs while reading host
descriptors
*/
- private void createResourceHostsFromFiles( ArrayList result, File[]
files )
+ private void createResourceHostsFromFiles( List result, File[] files )
throws TransitException
{
if( null == files )
@@ -275,7 +280,13 @@
catch( MalformedURLException mue )
{
final String error =
- "The file [" + file + "] (" + file.exists() + ") raised a MUE
- " + mue.getMessage();
+ "The file ["
+ + file
+ + "] ("
+ + file.exists()
+ + ") raised a malformed url exception with the message '"
+ + mue.getMessage()
+ + "'.";
throw new TransitException( error );
}
}
@@ -361,7 +372,8 @@
try
{
return createResourceHost(
- classname, baseUrl, groupFile, priority, policy, enabled,
trusted, username, password, scheme, prompt );
+ classname, baseUrl, groupFile, priority, policy, enabled,
trusted,
+ username, password, scheme, prompt );
}
catch( Throwable e )
{
@@ -388,8 +400,11 @@
catch( MalformedURLException mue )
{
final String error =
- "An error occured while attempting to construct a new url
using the path [" + path
- + "] and base url [" + anchor + "].";
+ "An error occured while attempting to construct a new url
using the path ["
+ + path
+ + "] and base url ["
+ + anchor
+ + "].";
throw new TransitException( error, mue );
}
}
@@ -424,7 +439,8 @@
catch( Exception e )
{
final String error =
- "Unable to extract the groups from " + href;
+ "Unable to extract the groups from "
+ + href;
throw new TransitException( error, e );
}
}
@@ -498,33 +514,60 @@
else
{
final String error =
- "Class " + classname + " does not implement " +
ResourceHost.class.getName() + ".";
+ "Class "
+ + classname
+ + " does not implement "
+ + ResourceHost.class.getName() + ".";
throw new TransitException( error );
}
}
catch( ClassNotFoundException e )
{
- throw new TransitException( "The resource host factory classname
" + classname + " is unknown." );
+ final String error =
+ "The resource host factory classname ["
+ + classname
+ + "] is unknown.";
+ throw new TransitException( error );
}
catch( NoSuchMethodException e )
{
- throw new TransitException( "The " + classname + " does not have
the required constructor." );
+ final String error =
+ "The resource host factory class ["
+ + classname
+ + "] does not declare the required constructor.";
+ throw new TransitException( error );
}
catch( IllegalAccessException e )
{
- throw new TransitException( "The constructor of " + classname +
" is not accessible.", e );
+ final String error =
+ "The resource host factory class ["
+ + classname
+ + "] is not accessible.";
+ throw new TransitException( error );
}
catch( IllegalArgumentException e )
{
- throw new InternalError( "Internal Error in ResourceHost
construction: " + e.getMessage() );
+ final String error =
+ "The resource host factory class ["
+ + classname
+ + "] could not be established due to an internal error.";
+ throw new TransitException( error, e );
}
catch( InstantiationException e )
{
- throw new TransitException( "The " + classname + " could not be
instantiated.", e );
+ final String error =
+ "The resource host factory class ["
+ + classname
+ + "] could not be instantiated.";
+ throw new TransitException( error, e );
}
catch( InvocationTargetException e )
{
- throw new TransitException( "The constructor of " + classname +
" threw an exception.", e.getTargetException() );
+ final String error =
+ "The resource host factory class ["
+ + classname
+ + "] raised an unexpected error during instantiation.";
+ throw new TransitException( error, e.getTargetException() );
}
}
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
Mon Jan 3 03:54:01 2005
@@ -22,7 +22,6 @@
import java.io.FileInputStream;
import java.io.IOException;

-import java.net.Authenticator;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
@@ -41,7 +40,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: InitialContext.java 218 2004-10-26 06:00:42Z mcconnell $
*/
-public class SecuredTransitContext
+public final class SecuredTransitContext
{
//------------------------------------------------------------------
// static
@@ -110,7 +109,7 @@
/**
* The singleton transit context.
*/
- private static SecuredTransitContext m_secureTransitContext;
+ private static SecuredTransitContext m_CONTEXT;

//------------------------------------------------------------------
// state
@@ -131,9 +130,13 @@
*/
private ResourceHost[] m_resourceHosts;

+ /**
+ * Return the singleton context.
+ * @return the secure context
+ */
public static SecuredTransitContext getInstance()
{
- return m_secureTransitContext;
+ return m_CONTEXT;
}

//------------------------------------------------------------------
@@ -166,9 +169,9 @@
public static SecuredTransitContext create( final Monitor monitor )
throws TransitException
{
- if( m_secureTransitContext != null )
+ if( m_CONTEXT != null )
{
- return m_secureTransitContext;
+ return m_CONTEXT;
}
if( null == monitor )
{
@@ -185,8 +188,8 @@
ResourceHost[] hosts = rhFactory.createResourceHosts();
CacheHandlerFactory chFactory = new CacheHandlerFactory(
authorative );
CacheHandler ch = chFactory.createCacheHandler( hosts );
- m_secureTransitContext = new SecuredTransitContext( authorative,
hosts, ch );
- return m_secureTransitContext;
+ m_CONTEXT = new SecuredTransitContext( authorative, hosts, ch );
+ return m_CONTEXT;
}
catch( IOException e )
{
@@ -199,15 +202,15 @@
* made into private without notice at any time.
* @param authorative the authorative url
* @param hosts the set of hosts
- * @param ch the cache handler
+ * @param handler the cache handler
* @exception TransitException if a context creation error occurs
*/
- private SecuredTransitContext( URL authorative, ResourceHost[] hosts,
CacheHandler ch )
+ private SecuredTransitContext( URL authorative, ResourceHost[] hosts,
CacheHandler handler )
throws TransitException
{
m_authorativeHost = authorative;
m_resourceHosts = hosts;
- m_cacheHandler = ch;
+ m_cacheHandler = handler;
try
{
URL conf = new URL( authorative, TRANSIT_PROPERTIES_FILENAME );
@@ -434,16 +437,16 @@

/**
* Setup the transit authenticator.
- * @param props the transit properties
- * @param hosts the transit remote hosts
+ * @param properties the transit properties
+ * @exception UnknownHostException if a proxy host is declared but is
unknown
*/
- private void setupAuthenticator( Properties props )
+ private void setupAuthenticator( Properties properties )
throws UnknownHostException
{
- TransitAuthenticator ta = createProxyAuthenticator( props );
+ TransitAuthenticator ta = createProxyAuthenticator( properties );
if( ta != null )
{
- RequestIdentifier id = createProxyRequestIdentifier( props );
+ RequestIdentifier id = createProxyRequestIdentifier( properties
);
DelegatingAuthenticator da =
DelegatingAuthenticator.getInstance();
da.addTransitAuthenticator( ta, id );
}
@@ -451,41 +454,56 @@

/**
* Creation of a new transit authenticator.
- * @param props the transit properties
- * @param hosts the transit hosts
+ * @param properties the transit properties
+ * @return the transit authenticator
*/
- private TransitAuthenticator createProxyAuthenticator( Properties props )
+ private TransitAuthenticator createProxyAuthenticator( Properties
properties )
{
- String username = Util.getProperty( props, PROXY_USERNAME_KEY, null
);
- String password = Util.getProperty( props, PROXY_PASSWORD_KEY, null
);
+ String username = Util.getProperty( properties, PROXY_USERNAME_KEY,
null );
+ String password = Util.getProperty( properties, PROXY_PASSWORD_KEY,
null );
if( null == username )
+ {
return null;
-
+ }
return new TransitAuthenticatorImpl( username, password );
}

- private RequestIdentifier createProxyRequestIdentifier( Properties props
)
+ /**
+ * Creation of a new request identifier.
+ * @param properties the transit properties
+ * @return the request identifier
+ * @exception UnknownHostException if a proxy host is declared but is
unknown
+ * @exception IllegalArgumentException if a proxy host is declared and
+ * either the proxy scheme or proxy prompt property values are undefined
+ */
+ private RequestIdentifier createProxyRequestIdentifier( Properties
properties )
throws UnknownHostException, IllegalArgumentException
{
- String proxy = Util.getProperty( props, PROXY_HOST_KEY, null );
+ String proxy = Util.getProperty( properties, PROXY_HOST_KEY, null );
if( null == proxy )
+ {
return null;
-
- String protocol = Util.getProperty( props, PROXY_PROTOCOL_KEY,
"http" );
- String scheme = Util.getProperty( props, PROXY_SCHEME_KEY, null );
+ }
+
+ String protocol = Util.getProperty( properties, PROXY_PROTOCOL_KEY,
"http" );
+ String scheme = Util.getProperty( properties, PROXY_SCHEME_KEY, null
);
if( scheme == null )
+ {
throw new IllegalArgumentException( "Missing " +
PROXY_SCHEME_KEY + " in properties." );
- String prompt = Util.getProperty( props, PROXY_PROMPT_KEY, null );
+ }
+ String prompt = Util.getProperty( properties, PROXY_PROMPT_KEY, null
);
if( prompt == null )
+ {
throw new IllegalArgumentException( "Missing " +
PROXY_PROMPT_KEY + " in properties." );
+ }

InetAddress host = InetAddress.getByName( proxy );
- String portText = Util.getProperty( props, PROXY_PORT_KEY, "0" );
+ String portText = Util.getProperty( properties, PROXY_PORT_KEY, "0"
);
int port = Integer.parseInt( portText );
Properties system = System.getProperties();
system.put( "http.proxyHost", proxy );
system.put( "http.proxyPort", "" + port );
- String excludes = Util.getProperty( props, PROXY_EXCLUDES_KEY, null
);
+ String excludes = Util.getProperty( properties, PROXY_EXCLUDES_KEY,
null );
if( null != excludes )
{
system.put( "http.nonProxyHosts", excludes );

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticator.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticator.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticator.java
Mon Jan 3 03:54:01 2005
@@ -22,6 +22,7 @@
import java.net.PasswordAuthentication;

/**
+ * Transit authenticator contract.
* @author <a href="mailto:dev AT avalon.apache.org";>Avalon Development Team</a>
* @version $Id: DefaultAuthenticator.java 30977 2004-07-30 08:57:54Z niclas
$
*/
@@ -29,7 +30,8 @@
{
/**
* Returns the password authenticator.
+ * @param authenticator the default authenticator
* @return the password authenticator
*/
- PasswordAuthentication resolvePasswordAuthentication( Authenticator auth
);
+ PasswordAuthentication resolvePasswordAuthentication( Authenticator
authenticator );
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticatorImpl.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticatorImpl.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/TransitAuthenticatorImpl.java
Mon Jan 3 03:54:01 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Stephen McConnell, DPML
+ * Copyright 2004-2005 Stephen McConnell, DPML
* Copyright 2004 Niclas Hedhman, DPML
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,7 +28,6 @@
* TODO: setup implementation of password authentication relative to
* supplied hosts.
*
- * @author <a href="mailto:dev AT avalon.apache.org";>Avalon Development Team</a>
* @version $Id: DefaultAuthenticator.java 30977 2004-07-30 08:57:54Z niclas
$
*/
final class TransitAuthenticatorImpl
@@ -41,24 +40,30 @@

/**
* Creation of a new simple authenticator.
- * @param hosts the registered hosts
- * @exception IllegalArgumentException if either the username or passwd
argument is null
+ * @param username the username
+ * @param password the password
+ * @exception NullPointerException if either the username or password
argument is null
*/
- public TransitAuthenticatorImpl( String username, String passwd )
- throws IllegalArgumentException
+ public TransitAuthenticatorImpl( String username, String password )
+ throws NullPointerException
{
if( username == null )
- throw new IllegalArgumentException( "Null argument: username" );
- if( passwd == null )
- throw new IllegalArgumentException( "Null argument: passwd" );
- m_authentication = new PasswordAuthentication( username,
passwd.toCharArray() );
+ {
+ throw new NullPointerException( "username" );
+ }
+ if( password == null )
+ {
+ throw new NullPointerException( "password" );
+ }
+ m_authentication = new PasswordAuthentication( username,
password.toCharArray() );
}

/**
* Returns the password authenticator.
+ * @param authenticator an default authenticator
* @return the password authenticator
*/
- public PasswordAuthentication resolvePasswordAuthentication(
Authenticator auth )
+ public PasswordAuthentication resolvePasswordAuthentication(
Authenticator authenticator )
{
return m_authentication;
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
Mon Jan 3 03:54:01 2005
@@ -42,20 +42,25 @@
*/
final class XMLHostsBuilder
{
- private ResourceHostFactory m_ResourceHostFactory;
+ /**
+ * The factory used to create resource hosts based on the data collected
+ * from xml based specifications.
+ */
+ private ResourceHostFactory m_resourceHostFactory;

/**
- * Constructor (disabled).
+ * Constructor.
+ * @param factory the resource host factory
*/
- XMLHostsBuilder( ResourceHostFactory rf )
+ XMLHostsBuilder( ResourceHostFactory factory )
{
- m_ResourceHostFactory = rf;
+ m_resourceHostFactory = factory;
}

/**
* Build a set of resource hosts using a supplied input stream.
+ * @param result a list containing the acculated host definitions
* @param input the input stream of an XML document
- * @return a sequence of resource hosts
* @exception IOException if an IO related error occurs
* @exception TransitException if an error occurs in constructing the
* host defintions
@@ -105,7 +110,7 @@
String scheme = getScheme( element );
String prompt = getPrompt( element );

- return m_ResourceHostFactory.createResourceHost(
+ return m_resourceHostFactory.createResourceHost(
classname, base, index, priority, policy, enabled, trusted,
username, password, scheme, prompt );
}

Modified:
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
Mon Jan 3 03:54:01 2005
@@ -23,6 +23,9 @@
*/
public interface Monitor
{
+ /**
+ * Null monitor.
+ */
final Monitor NULL_MONITOR = new NullMonitor();

/**

Modified:
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
==============================================================================
---
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
(original)
+++
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
Mon Jan 3 03:54:01 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Stephen J. McConnell.
+ * Copyright 2004-2005 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -282,7 +282,7 @@
Dictionary dictionary = new Dictionary( map );

ClassLoader loader = CommandHandler.class.getClassLoader();
- Object[] args = new Object[]{dictionary,m_args};
+ Object[] args = new Object[]{dictionary, m_args};
try
{
URI uri = new URI( target );
@@ -309,7 +309,7 @@
}

/**
- * Convert a URL tyo a URI.
+ * Convert a URL to a URI.
* @param uri the uri to convert
* @return the converted url
* @exception Exception if an error occurs



  • svn commit: r1348 - in development/main/transit: handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/artifact handler/src/main/net/dpml/transit/monitors plugin/src/main/net/dpml/transit/control, mcconnell, 01/02/2005

Archive powered by MHonArc 2.6.24.

Top of Page