maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r769199 [9/19] - in /maven/mercury/trunk: mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/ mercury-core/src/main/java/org/apache/maven/mercury/artifact/ ...
Date Mon, 27 Apr 2009 23:12:32 GMT
Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/HttpServletResponse.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/HttpServletResponse.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/HttpServletResponse.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/HttpServletResponse.java Mon Apr 27 23:12:25 2009
@@ -15,20 +15,17 @@
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-*/
+ */
 
 package org.apache.maven.mercury.spi.http.client;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public interface HttpServletResponse
 {
-    
+
     /*
      * Server status codes; see RFC 2068.
      */
@@ -39,10 +36,8 @@
 
     public static final int SC_CONTINUE = 100;
 
-    
     /**
-     * Status code (101) indicating the server is switching protocols
-     * according to Upgrade header.
+     * Status code (101) indicating the server is switching protocols according to Upgrade header.
      */
 
     public static final int SC_SWITCHING_PROTOCOLS = 101;
@@ -54,125 +49,107 @@
     public static final int SC_OK = 200;
 
     /**
-     * Status code (201) indicating the request succeeded and created
-     * a new resource on the server.
+     * Status code (201) indicating the request succeeded and created a new resource on the server.
      */
 
     public static final int SC_CREATED = 201;
 
     /**
-     * Status code (202) indicating that a request was accepted for
-     * processing, but was not completed.
+     * Status code (202) indicating that a request was accepted for processing, but was not completed.
      */
 
     public static final int SC_ACCEPTED = 202;
 
     /**
-     * Status code (203) indicating that the meta information presented
-     * by the client did not originate from the server.
+     * Status code (203) indicating that the meta information presented by the client did not originate from the server.
      */
 
     public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
 
     /**
-     * Status code (204) indicating that the request succeeded but that
-     * there was no new information to return.
+     * Status code (204) indicating that the request succeeded but that there was no new information to return.
      */
 
     public static final int SC_NO_CONTENT = 204;
 
     /**
-     * Status code (205) indicating that the agent <em>SHOULD</em> reset
-     * the document view which caused the request to be sent.
+     * Status code (205) indicating that the agent <em>SHOULD</em> reset the document view which caused the request to
+     * be sent.
      */
 
     public static final int SC_RESET_CONTENT = 205;
 
     /**
-     * Status code (206) indicating that the server has fulfilled
-     * the partial GET request for the resource.
+     * Status code (206) indicating that the server has fulfilled the partial GET request for the resource.
      */
 
     public static final int SC_PARTIAL_CONTENT = 206;
 
     /**
-     * Status code (300) indicating that the requested resource
-     * corresponds to any one of a set of representations, each with
-     * its own specific location.
+     * Status code (300) indicating that the requested resource corresponds to any one of a set of representations, each
+     * with its own specific location.
      */
 
     public static final int SC_MULTIPLE_CHOICES = 300;
 
     /**
-     * Status code (301) indicating that the resource has permanently
-     * moved to a new location, and that future references should use a
-     * new URI with their requests.
+     * Status code (301) indicating that the resource has permanently moved to a new location, and that future
+     * references should use a new URI with their requests.
      */
 
     public static final int SC_MOVED_PERMANENTLY = 301;
 
     /**
-     * Status code (302) indicating that the resource has temporarily
-     * moved to another location, but that future references should
-     * still use the original URI to access the resource.
-     *
-     * This definition is being retained for backwards compatibility.
-     * SC_FOUND is now the preferred definition.
+     * Status code (302) indicating that the resource has temporarily moved to another location, but that future
+     * references should still use the original URI to access the resource. This definition is being retained for
+     * backwards compatibility. SC_FOUND is now the preferred definition.
      */
 
     public static final int SC_MOVED_TEMPORARILY = 302;
 
     /**
-    * Status code (302) indicating that the resource reside
-    * temporarily under a different URI. Since the redirection might
-    * be altered on occasion, the client should continue to use the
-    * Request-URI for future requests.(HTTP/1.1) To represent the
-    * status code (302), it is recommended to use this variable.
-    */
+     * Status code (302) indicating that the resource reside temporarily under a different URI. Since the redirection
+     * might be altered on occasion, the client should continue to use the Request-URI for future requests.(HTTP/1.1) To
+     * represent the status code (302), it is recommended to use this variable.
+     */
 
     public static final int SC_FOUND = 302;
 
     /**
-     * Status code (303) indicating that the response to the request
-     * can be found under a different URI.
+     * Status code (303) indicating that the response to the request can be found under a different URI.
      */
 
     public static final int SC_SEE_OTHER = 303;
 
     /**
-     * Status code (304) indicating that a conditional GET operation
-     * found that the resource was available and not modified.
+     * Status code (304) indicating that a conditional GET operation found that the resource was available and not
+     * modified.
      */
 
     public static final int SC_NOT_MODIFIED = 304;
 
     /**
-     * Status code (305) indicating that the requested resource
-     * <em>MUST</em> be accessed through the proxy given by the
+     * Status code (305) indicating that the requested resource <em>MUST</em> be accessed through the proxy given by the
      * <code><em>Location</em></code> field.
      */
 
     public static final int SC_USE_PROXY = 305;
 
-     /**
-     * Status code (307) indicating that the requested resource 
-     * resides temporarily under a different URI. The temporary URI
-     * <em>SHOULD</em> be given by the <code><em>Location</em></code> 
-     * field in the response.
+    /**
+     * Status code (307) indicating that the requested resource resides temporarily under a different URI. The temporary
+     * URI <em>SHOULD</em> be given by the <code><em>Location</em></code> field in the response.
      */
 
-     public static final int SC_TEMPORARY_REDIRECT = 307;
+    public static final int SC_TEMPORARY_REDIRECT = 307;
 
     /**
-     * Status code (400) indicating the request sent by the client was
-     * syntactically incorrect.
+     * Status code (400) indicating the request sent by the client was syntactically incorrect.
      */
 
     public static final int SC_BAD_REQUEST = 400;
 
     /**
-     * Status code (401) indicating that the request requires HTTP
-     * authentication.
+     * Status code (401) indicating that the request requires HTTP authentication.
      */
 
     public static final int SC_UNAUTHORIZED = 401;
@@ -184,160 +161,140 @@
     public static final int SC_PAYMENT_REQUIRED = 402;
 
     /**
-     * Status code (403) indicating the server understood the request
-     * but refused to fulfill it.
+     * Status code (403) indicating the server understood the request but refused to fulfill it.
      */
 
     public static final int SC_FORBIDDEN = 403;
 
     /**
-     * Status code (404) indicating that the requested resource is not
-     * available.
+     * Status code (404) indicating that the requested resource is not available.
      */
 
     public static final int SC_NOT_FOUND = 404;
 
     /**
-     * Status code (405) indicating that the method specified in the
-     * <code><em>Request-Line</em></code> is not allowed for the resource
-     * identified by the <code><em>Request-URI</em></code>.
+     * Status code (405) indicating that the method specified in the <code><em>Request-Line</em></code> is not allowed
+     * for the resource identified by the <code><em>Request-URI</em></code>.
      */
 
     public static final int SC_METHOD_NOT_ALLOWED = 405;
 
     /**
-     * Status code (406) indicating that the resource identified by the
-     * request is only capable of generating response entities which have
-     * content characteristics not acceptable according to the accept
-     * headers sent in the request.
+     * Status code (406) indicating that the resource identified by the request is only capable of generating response
+     * entities which have content characteristics not acceptable according to the accept headers sent in the request.
      */
 
     public static final int SC_NOT_ACCEPTABLE = 406;
 
     /**
-     * Status code (407) indicating that the client <em>MUST</em> first
-     * authenticate itself with the proxy.
+     * Status code (407) indicating that the client <em>MUST</em> first authenticate itself with the proxy.
      */
 
     public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
 
     /**
-     * Status code (408) indicating that the client did not produce a
-     * request within the time that the server was prepared to wait.
+     * Status code (408) indicating that the client did not produce a request within the time that the server was
+     * prepared to wait.
      */
 
     public static final int SC_REQUEST_TIMEOUT = 408;
 
     /**
-     * Status code (409) indicating that the request could not be
-     * completed due to a conflict with the current state of the
-     * resource.
+     * Status code (409) indicating that the request could not be completed due to a conflict with the current state of
+     * the resource.
      */
 
     public static final int SC_CONFLICT = 409;
 
     /**
-     * Status code (410) indicating that the resource is no longer
-     * available at the server and no forwarding address is known.
-     * This condition <em>SHOULD</em> be considered permanent.
+     * Status code (410) indicating that the resource is no longer available at the server and no forwarding address is
+     * known. This condition <em>SHOULD</em> be considered permanent.
      */
 
     public static final int SC_GONE = 410;
 
     /**
-     * Status code (411) indicating that the request cannot be handled
-     * without a defined <code><em>Content-Length</em></code>.
+     * Status code (411) indicating that the request cannot be handled without a defined
+     * <code><em>Content-Length</em></code>.
      */
 
     public static final int SC_LENGTH_REQUIRED = 411;
 
     /**
-     * Status code (412) indicating that the precondition given in one
-     * or more of the request-header fields evaluated to false when it
-     * was tested on the server.
+     * Status code (412) indicating that the precondition given in one or more of the request-header fields evaluated to
+     * false when it was tested on the server.
      */
 
     public static final int SC_PRECONDITION_FAILED = 412;
 
     /**
-     * Status code (413) indicating that the server is refusing to process
-     * the request because the request entity is larger than the server is
-     * willing or able to process.
+     * Status code (413) indicating that the server is refusing to process the request because the request entity is
+     * larger than the server is willing or able to process.
      */
 
     public static final int SC_REQUEST_ENTITY_TOO_LARGE = 413;
 
     /**
-     * Status code (414) indicating that the server is refusing to service
-     * the request because the <code><em>Request-URI</em></code> is longer
-     * than the server is willing to interpret.
+     * Status code (414) indicating that the server is refusing to service the request because the
+     * <code><em>Request-URI</em></code> is longer than the server is willing to interpret.
      */
 
     public static final int SC_REQUEST_URI_TOO_LONG = 414;
 
     /**
-     * Status code (415) indicating that the server is refusing to service
-     * the request because the entity of the request is in a format not
-     * supported by the requested resource for the requested method.
+     * Status code (415) indicating that the server is refusing to service the request because the entity of the request
+     * is in a format not supported by the requested resource for the requested method.
      */
 
     public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
 
     /**
-     * Status code (416) indicating that the server cannot serve the
-     * requested byte range.
+     * Status code (416) indicating that the server cannot serve the requested byte range.
      */
 
     public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
 
     /**
-     * Status code (417) indicating that the server could not meet the
-     * expectation given in the Expect request header.
+     * Status code (417) indicating that the server could not meet the expectation given in the Expect request header.
      */
 
     public static final int SC_EXPECTATION_FAILED = 417;
 
     /**
-     * Status code (500) indicating an error inside the HTTP server
-     * which prevented it from fulfilling the request.
+     * Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
      */
 
     public static final int SC_INTERNAL_SERVER_ERROR = 500;
 
     /**
-     * Status code (501) indicating the HTTP server does not support
-     * the functionality needed to fulfill the request.
+     * Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.
      */
 
     public static final int SC_NOT_IMPLEMENTED = 501;
 
     /**
-     * Status code (502) indicating that the HTTP server received an
-     * invalid response from a server it consulted when acting as a
-     * proxy or gateway.
+     * Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when
+     * acting as a proxy or gateway.
      */
 
     public static final int SC_BAD_GATEWAY = 502;
 
     /**
-     * Status code (503) indicating that the HTTP server is
-     * temporarily overloaded, and unable to handle the request.
+     * Status code (503) indicating that the HTTP server is temporarily overloaded, and unable to handle the request.
      */
 
     public static final int SC_SERVICE_UNAVAILABLE = 503;
 
     /**
-     * Status code (504) indicating that the server did not receive
-     * a timely response from the upstream server while acting as
-     * a gateway or proxy.
+     * Status code (504) indicating that the server did not receive a timely response from the upstream server while
+     * acting as a gateway or proxy.
      */
 
     public static final int SC_GATEWAY_TIMEOUT = 504;
 
     /**
-     * Status code (505) indicating that the server does not support
-     * or refuses to support the HTTP protocol version that was used
-     * in the request message.
+     * Status code (505) indicating that the server does not support or refuses to support the HTTP protocol version
+     * that was used in the request message.
      */
 
     public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableInputStream.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableInputStream.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableInputStream.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableInputStream.java Mon Apr 27 23:12:25 2009
@@ -29,93 +29,90 @@
 import org.apache.maven.mercury.crypto.api.StreamObserver;
 import org.apache.maven.mercury.crypto.api.StreamObserverException;
 
-
-
 public class ObservableInputStream
-extends FilterInputStream
+    extends FilterInputStream
 {
     Set<StreamObserver> observers = new HashSet<StreamObserver>();
 
-    public ObservableInputStream(InputStream in)
+    public ObservableInputStream( InputStream in )
     {
-        super(in);
+        super( in );
     }
 
-    public int read(byte[] b, int off, int len)
-    throws IOException
+    public int read( byte[] b, int off, int len )
+        throws IOException
     {
-        int result = in.read(b, off, len);
-        if (result != -1) 
+        int result = in.read( b, off, len );
+        if ( result != -1 )
         {
-            notifyListeners(b, off, result);
+            notifyListeners( b, off, result );
         }
         return result;
     }
 
-   
-    public int read() throws IOException
+    public int read()
+        throws IOException
     {
         int ch = in.read();
-        if (ch != -1) 
+        if ( ch != -1 )
         {
-            notifyListeners(ch);
+            notifyListeners( ch );
         }
         return ch;
     }
 
-    
-    public void addObserver (StreamObserver o)
+    public void addObserver( StreamObserver o )
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            this.observers.add(o);
+            this.observers.add( o );
         }
     }
-    
-    public void addObservers (Collection<? extends StreamObserver> observers)
+
+    public void addObservers( Collection<? extends StreamObserver> observers )
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            this.observers.addAll(observers);
+            this.observers.addAll( observers );
         }
     }
-    
-    private void notifyListeners (byte[]b, int off, int len)
-    throws IOException
+
+    private void notifyListeners( byte[] b, int off, int len )
+        throws IOException
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            for (StreamObserver o: this.observers)
+            for ( StreamObserver o : this.observers )
             {
                 try
                 {
-                  o.bytesReady(b, off, len);
+                    o.bytesReady( b, off, len );
                 }
-                catch( StreamObserverException e )
+                catch ( StreamObserverException e )
                 {
-                  throw new IOException(e.getMessage());
+                    throw new IOException( e.getMessage() );
                 }
             }
         }
     }
 
-    private void notifyListeners (int b)
-    throws IOException
+    private void notifyListeners( int b )
+        throws IOException
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            for (StreamObserver o: this.observers)
+            for ( StreamObserver o : this.observers )
             {
                 try
                 {
-                  o.byteReady(b);
+                    o.byteReady( b );
                 }
-                catch( StreamObserverException e )
+                catch ( StreamObserverException e )
                 {
-                  throw new IOException(e.getMessage());
+                    throw new IOException( e.getMessage() );
                 }
             }
         }
-    } 
-   
+    }
+
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableOutputStream.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableOutputStream.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableOutputStream.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/ObservableOutputStream.java Mon Apr 27 23:12:25 2009
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-
 package org.apache.maven.mercury.spi.http.client;
 
 import java.io.FilterOutputStream;
@@ -30,77 +29,79 @@
 import org.apache.maven.mercury.crypto.api.StreamObserver;
 import org.apache.maven.mercury.crypto.api.StreamObserverException;
 
-
-
-public class ObservableOutputStream extends FilterOutputStream
+public class ObservableOutputStream
+    extends FilterOutputStream
 {
     Set<StreamObserver> observers = new HashSet<StreamObserver>();
-    
-    
-    public ObservableOutputStream(OutputStream out)
+
+    public ObservableOutputStream( OutputStream out )
     {
-        super(out);
+        super( out );
     }
 
-    public void write(int b) throws IOException 
+    public void write( int b )
+        throws IOException
     {
-        notifyListeners(b);
-        this.out.write(b);
+        notifyListeners( b );
+        this.out.write( b );
     }
 
-    public void write(byte[] b, int off, int len) throws IOException 
-    {  
-        notifyListeners(b, off, len);
-        this.out.write(b, off, len);
+    public void write( byte[] b, int off, int len )
+        throws IOException
+    {
+        notifyListeners( b, off, len );
+        this.out.write( b, off, len );
     }
-    public void addObserver (StreamObserver o)
+
+    public void addObserver( StreamObserver o )
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            this.observers.add(o);
+            this.observers.add( o );
         }
     }
-    
-    public void addObservers (Collection<? extends StreamObserver> observers)
+
+    public void addObservers( Collection<? extends StreamObserver> observers )
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            this.observers.addAll(observers);
+            this.observers.addAll( observers );
         }
     }
-    private void notifyListeners (byte[]b, int off, int len)
-    throws IOException
+
+    private void notifyListeners( byte[] b, int off, int len )
+        throws IOException
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            for (StreamObserver o: this.observers)
+            for ( StreamObserver o : this.observers )
             {
                 try
                 {
-                  o.bytesReady(b, off, len);
+                    o.bytesReady( b, off, len );
                 }
-                catch( StreamObserverException e )
+                catch ( StreamObserverException e )
                 {
-                  throw new IOException(e.getMessage());
+                    throw new IOException( e.getMessage() );
                 }
             }
         }
     }
 
-    private void notifyListeners (int b)
-    throws IOException
+    private void notifyListeners( int b )
+        throws IOException
     {
-        synchronized (this.observers)
+        synchronized ( this.observers )
         {
-            for (StreamObserver o: this.observers)
+            for ( StreamObserver o : this.observers )
             {
                 try
                 {
-                  o.byteReady(b);
+                    o.byteReady( b );
                 }
-                catch( StreamObserverException e )
+                catch ( StreamObserverException e )
                 {
-                  throw new IOException(e.getMessage());
+                    throw new IOException( e.getMessage() );
                 }
             }
         }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/SecureSender.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/SecureSender.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/SecureSender.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/SecureSender.java Mon Apr 27 23:12:25 2009
@@ -33,67 +33,64 @@
 import org.mortbay.jetty.client.security.ProxyAuthorization;
 
 /**
- * SecureSender
- *
- * Initiates a HttpExchange with the remote server, taking into account any proxy
- * authentication required. Any non-proxy authentication required will be taken
- * care of by the DestinationRealmResolver that is set on the HttpClient used
- * by this class.
- * 
- * TODO think of a better name for this class.
+ * SecureSender Initiates a HttpExchange with the remote server, taking into account any proxy authentication required.
+ * Any non-proxy authentication required will be taken care of by the DestinationRealmResolver that is set on the
+ * HttpClient used by this class. TODO think of a better name for this class.
  */
 public class SecureSender
 {
-  private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( SecureSender.class );
+    private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( SecureSender.class );
 
-  public static void send (Server server, HttpClient httpClient, HttpExchange exchange)
-    throws Exception
+    public static void send( Server server, HttpClient httpClient, HttpExchange exchange )
+        throws Exception
     {
-        if (server != null && server.hasProxy() && (server.getProxy() != null))
+        if ( server != null && server.hasProxy() && ( server.getProxy() != null ) )
         {
             String s = exchange.getURI();
-            URI uri = new URI(s);
-            boolean ssl = "https".equalsIgnoreCase(uri.getScheme());
+            URI uri = new URI( s );
+            boolean ssl = "https".equalsIgnoreCase( uri.getScheme() );
             URL proxy = server.getProxy();
 
             String host = proxy.getHost();
             int port = proxy.getPort();
-            boolean proxySsl = "https".equalsIgnoreCase(proxy.getProtocol());
-            if (port < 0)
+            boolean proxySsl = "https".equalsIgnoreCase( proxy.getProtocol() );
+            if ( port < 0 )
             {
-                port = proxySsl?443:80;
+                port = proxySsl ? 443 : 80;
             }
 
-            Address proxyAddress = new Address(host,port);
-            HttpDestination destination = httpClient.getDestination(exchange.getAddress(), ssl);  
-            if( LOG.isDebugEnabled() )
-                LOG.debug("Matched destination "+destination);
-
-            destination.setProxy(proxyAddress);
-            if( LOG.isDebugEnabled() )
-                LOG.debug("Set proxy "+host+":"+port+" on destination");
-            LOG.info("Set proxy "+host+":"+port+" on destination");
-         
-            //set up authentication for the proxy
+            Address proxyAddress = new Address( host, port );
+            HttpDestination destination = httpClient.getDestination( exchange.getAddress(), ssl );
+            if ( LOG.isDebugEnabled() )
+                LOG.debug( "Matched destination " + destination );
+
+            destination.setProxy( proxyAddress );
+            if ( LOG.isDebugEnabled() )
+                LOG.debug( "Set proxy " + host + ":" + port + " on destination" );
+            LOG.info( "Set proxy " + host + ":" + port + " on destination" );
+
+            // set up authentication for the proxy
             Credentials proxyCredentials = server.getProxyCredentials();
 
-            if (proxyCredentials != null)
+            if ( proxyCredentials != null )
             {
-                if (proxyCredentials.isCertificate())
-                    throw new UnsupportedOperationException ("Proxy credential not supported");
+                if ( proxyCredentials.isCertificate() )
+                    throw new UnsupportedOperationException( "Proxy credential not supported" );
                 else
                 {
-                    destination.setProxyAuthentication(new ProxyAuthorization (proxyCredentials.getUser(), proxyCredentials.getPass()));
-                    if( LOG.isDebugEnabled() )
-                        LOG.debug( "Set proxy authentication: "+proxyCredentials.getUser()+":"+proxyCredentials.getPass());
+                    destination.setProxyAuthentication( new ProxyAuthorization( proxyCredentials.getUser(),
+                                                                                proxyCredentials.getPass() ) );
+                    if ( LOG.isDebugEnabled() )
+                        LOG.debug( "Set proxy authentication: " + proxyCredentials.getUser() + ":"
+                            + proxyCredentials.getPass() );
                 }
             }
-            destination.send(exchange); 
+            destination.send( exchange );
         }
         else
-        { 
-            httpClient.send(exchange);
-        } 
+        {
+            httpClient.send( exchange );
+        }
     }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployRequest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployRequest.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployRequest.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployRequest.java Mon Apr 27 23:12:25 2009
@@ -25,26 +25,26 @@
 import org.apache.maven.mercury.transport.api.Binding;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class DefaultDeployRequest
-implements DeployRequest
+    implements DeployRequest
 {
     private Set<Binding> _bindings = new HashSet<Binding>();
+
     private boolean _failFast;
-    
+
     public Set<Validator> getValidators()
     {
         return null;
     }
-    public void setBindings(Set<Binding> bindings)
+
+    public void setBindings( Set<Binding> bindings )
     {
-        _bindings=bindings;
+        _bindings = bindings;
     }
+
     public Set<Binding> getBindings()
     {
         return _bindings;
@@ -54,9 +54,9 @@
     {
         return _failFast;
     }
-    
-    public void setFailFast (boolean f)
+
+    public void setFailFast( boolean f )
     {
-        _failFast=f;
+        _failFast = f;
     }
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployResponse.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployResponse.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployResponse.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployResponse.java Mon Apr 27 23:12:25 2009
@@ -26,7 +26,7 @@
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
 
 public class DefaultDeployResponse
-implements DeployResponse
+    implements DeployResponse
 {
     private Set<HttpClientException> _exceptions = Collections.synchronizedSet( new HashSet<HttpClientException>() );
 
@@ -51,7 +51,7 @@
 
     public boolean hasExceptions()
     {
-      return _exceptions != null && _exceptions.size() > 0;
+        return _exceptions != null && _exceptions.size() > 0;
     }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java Mon Apr 27 23:12:25 2009
@@ -19,7 +19,6 @@
 
 package org.apache.maven.mercury.spi.http.client.deploy;
 
-
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -51,12 +50,15 @@
  * <p/>
  * Implementation of Deployer using Jetty async HttpClient.
  */
-public class DefaultDeployer implements Deployer
+public class DefaultDeployer
+    implements Deployer
 {
     private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( DefaultDeployer.class );
-    
+
     private HttpClient _httpClient;
+
     private BatchIdGenerator _idGenerator;
+
     private Set<Server> _servers = new HashSet<Server>();
 
     public DefaultDeployer()
@@ -65,7 +67,7 @@
         _idGenerator = new RandomBatchIdGenerator();
         _httpClient = new HttpClient();
         _httpClient.setConnectorType( HttpClient.CONNECTOR_SELECT_CHANNEL );
-        _httpClient.registerListener( "org.mortbay.jetty.client.webdav.WebdavListener");
+        _httpClient.registerListener( "org.mortbay.jetty.client.webdav.WebdavListener" );
         try
         {
             _httpClient.start();
@@ -108,29 +110,28 @@
     {
         return _httpClient;
     }
-    
-    public void setServers (Set<Server>servers)
+
+    public void setServers( Set<Server> servers )
     {
         _servers.clear();
-        _servers.addAll(servers);
-        _httpClient.setRealmResolver(new DestinationRealmResolver(_servers));
+        _servers.addAll( servers );
+        _httpClient.setRealmResolver( new DestinationRealmResolver( _servers ) );
     }
-    
+
     public Set<Server> getServers()
     {
         return _servers;
     }
 
     /**
-     * Deploy a set files synchronously. This call will return when either all
-     * files have been successfully deployed, or one or more failures have
-     * occurred, depending on the failFast setting of the DeployRequest.
-     *
+     * Deploy a set files synchronously. This call will return when either all files have been successfully deployed, or
+     * one or more failures have occurred, depending on the failFast setting of the DeployRequest.
+     * 
      * @see org.apache.maven.mercury.spi.http.client.deploy.Deployer#deploy(org.apache.maven.mercury.spi.http.client.deploy.DeployRequest)
      */
     public DeployResponse deploy( DeployRequest request )
     {
-        final DeployResponse[] response = new DeployResponse[]{null};
+        final DeployResponse[] response = new DeployResponse[] { null };
 
         deploy( request, new DeployCallback()
         {
@@ -162,11 +163,11 @@
     }
 
     /**
-     * Deploy a set of files, returning immediately. The callback will be called when
-     * all the files have been deployed or one or more errors occur (depends on the FailFast
-     * setting of the DeployRequest).
-     *
-     * @see org.apache.maven.mercury.spi.http.client.deploy.Deployer#deploy(org.apache.maven.mercury.spi.http.client.deploy.DeployRequest, org.apache.maven.mercury.spi.http.client.deploy.DeployCallback)
+     * Deploy a set of files, returning immediately. The callback will be called when all the files have been deployed
+     * or one or more errors occur (depends on the FailFast setting of the DeployRequest).
+     * 
+     * @see org.apache.maven.mercury.spi.http.client.deploy.Deployer#deploy(org.apache.maven.mercury.spi.http.client.deploy.DeployRequest,
+     *      org.apache.maven.mercury.spi.http.client.deploy.DeployCallback)
      */
     public void deploy( final DeployRequest request, final DeployCallback callback )
     {
@@ -194,32 +195,33 @@
             DeploymentTarget target = null;
             try
             {
-                Server server = resolveServer(binding);
-                
+                Server server = resolveServer( binding );
+
                 Set<StreamObserver> observers = createStreamObservers( server, binding.isExempt() );
-                
-                target = new DeploymentTarget( server, _httpClient, batchId, binding, request.getValidators(), observers )
-                {
-                    public void onComplete()
+
+                target =
+                    new DeploymentTarget( server, _httpClient, batchId, binding, request.getValidators(), observers )
                     {
-                        if ( getRemoteJettyUrl() != null )
+                        public void onComplete()
                         {
-                            remoteHandshakeUrls.add( getRemoteJettyUrl() );
+                            if ( getRemoteJettyUrl() != null )
+                            {
+                                remoteHandshakeUrls.add( getRemoteJettyUrl() );
+                            }
+                            // uploaded the file - have we uploaded all of them?
+                            checkComplete( callback, batchId, count, request, response, remoteHandshakeUrls );
                         }
-                        //uploaded the file - have we uploaded all of them?
-                        checkComplete( callback, batchId, count, request, response, remoteHandshakeUrls );
-                    }
 
-                    public void onError( HttpClientException exception )
-                    {
-                        if ( getRemoteJettyUrl() != null )
+                        public void onError( HttpClientException exception )
                         {
-                            remoteHandshakeUrls.add( getRemoteJettyUrl() );
+                            if ( getRemoteJettyUrl() != null )
+                            {
+                                remoteHandshakeUrls.add( getRemoteJettyUrl() );
+                            }
+                            response.add( exception );
+                            checkComplete( callback, batchId, count, request, response, remoteHandshakeUrls );
                         }
-                        response.add( exception );
-                        checkComplete( callback, batchId, count, request, response, remoteHandshakeUrls );
-                    }
-                };
+                    };
                 targets.add( target );
             }
             catch ( Exception e )
@@ -231,15 +233,12 @@
 
         for ( final DeploymentTarget target : targets )
         {
-            target.deploy(); //upload file
+            target.deploy(); // upload file
         }
     }
 
-    private synchronized void checkComplete( final DeployCallback callback,
-                                             String batchId,
-                                             AtomicInteger count,
-                                             DeployRequest request,
-                                             DeployResponse response,
+    private synchronized void checkComplete( final DeployCallback callback, String batchId, AtomicInteger count,
+                                             DeployRequest request, DeployResponse response,
                                              Set<String> remoteHandshakeUrls )
     {
         int x = count.decrementAndGet();
@@ -256,14 +255,12 @@
     }
 
     /**
-     * Send message to remote server (if Jetty) to indicate all
-     * files uploaded should now be commited or discarded if there were exceptions.
-     *
+     * Send message to remote server (if Jetty) to indicate all files uploaded should now be commited or discarded if
+     * there were exceptions.
+     * 
      * @param batchId
      */
-    private void commit( final DeployCallback callback,
-                         final DeployResponse response,
-                         final String batchId,
+    private void commit( final DeployCallback callback, final DeployResponse response, final String batchId,
                          final Set<String> remoteHandshakeUrls )
     {
         if ( remoteHandshakeUrls.isEmpty() )
@@ -274,7 +271,7 @@
         {
             final AtomicInteger count = new AtomicInteger( remoteHandshakeUrls.size() );
             Map<String, String> headers = new HashMap<String, String>();
-            //if no errors, then commit, otherwise send a discard message
+            // if no errors, then commit, otherwise send a discard message
             if ( response.getExceptions().isEmpty() )
             {
                 headers.put( FileExchange.__BATCH_COMMIT_HEADER, batchId );
@@ -303,9 +300,7 @@
         }
     }
 
-
-    private void checkHandshakeComplete( final DeployCallback callback,
-                                         final DeployResponse response,
+    private void checkHandshakeComplete( final DeployCallback callback, final DeployResponse response,
                                          AtomicInteger count )
     {
         boolean completor = count.decrementAndGet() == 0;
@@ -314,63 +309,63 @@
             callback.onComplete( response );
         }
     }
- 
-    private Server resolveServer (Binding binding)
-    throws MalformedURLException
-    {
-        if (binding.getRemoteResource() == null)
-        return null;
-        
+
+    private Server resolveServer( Binding binding )
+        throws MalformedURLException
+    {
+        if ( binding.getRemoteResource() == null )
+            return null;
+
         URL bindingURL = binding.getRemoteResource();
         Iterator<Server> itor = _servers.iterator();
         Server server = null;
-        while(itor.hasNext() && server==null)
+        while ( itor.hasNext() && server == null )
         {
             Server s = itor.next();
-            if (bindingURL.getProtocol().equalsIgnoreCase(s.getURL().getProtocol()) 
-                    && bindingURL.getHost().equalsIgnoreCase(s.getURL().getHost())
-                    && bindingURL.getPort() == s.getURL().getPort())
+            if ( bindingURL.getProtocol().equalsIgnoreCase( s.getURL().getProtocol() )
+                && bindingURL.getHost().equalsIgnoreCase( s.getURL().getHost() )
+                && bindingURL.getPort() == s.getURL().getPort() )
                 server = s;
         }
         return server;
     }
-    
+
     private Set<StreamObserver> createStreamObservers( Server server, boolean exempt )
-    throws StreamObserverException
+        throws StreamObserverException
     {
         HashSet<StreamObserver> observers = new HashSet<StreamObserver>();
-        
-        if( server == null )
-          return observers;
-        
-        if( (!exempt) && server.hasWriterStreamVerifierFactories() )
-        {
-          Set<StreamVerifierFactory> factories = server.getWriterStreamVerifierFactories();
-          for (StreamVerifierFactory f:factories)
-          {
-              observers.add( f.newInstance() );
-          }
-        }
-        
-        if( server.hasWriterStreamObserverFactories() )
-        {
-          Set<StreamObserverFactory> factories = server.getWriterStreamObserverFactories();
-          for (StreamObserverFactory f:factories)
-          {
-              observers.add( f.newInstance() );
-          }
+
+        if ( server == null )
+            return observers;
+
+        if ( ( !exempt ) && server.hasWriterStreamVerifierFactories() )
+        {
+            Set<StreamVerifierFactory> factories = server.getWriterStreamVerifierFactories();
+            for ( StreamVerifierFactory f : factories )
+            {
+                observers.add( f.newInstance() );
+            }
+        }
+
+        if ( server.hasWriterStreamObserverFactories() )
+        {
+            Set<StreamObserverFactory> factories = server.getWriterStreamObserverFactories();
+            for ( StreamObserverFactory f : factories )
+            {
+                observers.add( f.newInstance() );
+            }
         }
         return observers;
     }
-    
+
     public void stop()
     {
-        if( _httpClient == null )
+        if ( _httpClient == null )
             return;
-        
-        if( _httpClient.isStopped() || _httpClient.isStopping() )
+
+        if ( _httpClient.isStopped() || _httpClient.isStopping() )
             return;
-        
+
         try
         {
             _httpClient.stop();
@@ -379,7 +374,7 @@
         {
             LOG.error( e.getMessage() );
         }
-            
+
     }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployCallback.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployCallback.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployCallback.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployCallback.java Mon Apr 27 23:12:25 2009
@@ -22,14 +22,13 @@
 /**
  * DeployCallback
  * <p/>
- * Classes that implement this method will be notified when a given job has
- * been completed and validated.
+ * Classes that implement this method will be notified when a given job has been completed and validated.
  */
 public interface DeployCallback
 {
     /**
      * Callback for asynchronous version of Retriever.retrieve.
-     *
+     * 
      * @param response empty if all artifacts retrieved ok, list of exceptions otherwise
      */
     void onComplete( DeployResponse response );

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployRequest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployRequest.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployRequest.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployRequest.java Mon Apr 27 23:12:25 2009
@@ -24,7 +24,6 @@
 import org.apache.maven.mercury.spi.http.validate.Validator;
 import org.apache.maven.mercury.transport.api.Binding;
 
-
 /**
  * RetrievalRequest
  * <p/>
@@ -35,6 +34,6 @@
     public abstract Set<Binding> getBindings();
 
     public abstract boolean isFailFast();
-    
+
     public Set<Validator> getValidators();
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployResponse.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployResponse.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployResponse.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeployResponse.java Mon Apr 27 23:12:25 2009
@@ -26,19 +26,17 @@
 /**
  * DeployResponse
  * <p/>
- * A response to a request to upload a set of files to
- * remote location(s).
+ * A response to a request to upload a set of files to remote location(s).
  */
 public interface DeployResponse
 {
     /**
-     * The set will be empty if the operation completed successfully,
-     * or will contain a single entry if the Request is failFast, otherwise
-     * there will be one exception for every Binding in the Request.
-     *
+     * The set will be empty if the operation completed successfully, or will contain a single entry if the Request is
+     * failFast, otherwise there will be one exception for every Binding in the Request.
+     * 
      * @return
      */
     public Set<HttpClientException> getExceptions();
-    
+
     public boolean hasExceptions();
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/Deployer.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/Deployer.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/Deployer.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/Deployer.java Mon Apr 27 23:12:25 2009
@@ -29,17 +29,16 @@
     /** Deploy a set of files and return when all done. */
     DeployResponse deploy( DeployRequest request );
 
-
     /**
-     * Deploy a set of files and return immediately without waiting.
-     * The callback will be called when files are ready or an error
-     * has occurred.
+     * Deploy a set of files and return immediately without waiting. The callback will be called when files are ready or
+     * an error has occurred.
      */
     void deploy( DeployRequest request, DeployCallback callback );
-    
+
     /**
      * stop and release all resources
-     * @throws Exception 
+     * 
+     * @throws Exception
      */
     void stop();
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java Mon Apr 27 23:12:25 2009
@@ -41,34 +41,47 @@
 import org.mortbay.jetty.client.HttpClient;
 
 public abstract class DeploymentTarget
-{    
-    private static final IMercuryLogger log = MercuryLoggerManager.getLogger(DeploymentTarget.class);
+{
+    private static final IMercuryLogger log = MercuryLoggerManager.getLogger( DeploymentTarget.class );
+
     protected Server _server;
+
     protected HttpClient _httpClient;
+
     protected String _batchId;
+
     protected Binding _binding;
+
     protected Set<Validator> _validators;
+
     protected TargetState _targetState;
+
     protected TargetState _checksumState;
+
     protected HttpClientException _exception;
+
     protected String _remoteJettyUrl;
+
     protected Set<StreamObserver> _observers = new HashSet<StreamObserver>();
+
     protected List<StreamVerifier> _verifiers = new ArrayList<StreamVerifier>();
-    protected int _checkSumFilesDeployed = -1; 
 
-    
+    protected int _checkSumFilesDeployed = -1;
+
     public abstract void onComplete();
 
     public abstract void onError( HttpClientException exception );
 
-
     public class TargetState
     {
         public static final int __START_STATE = 1;
+
         public static final int __REQUESTED_STATE = 2;
+
         public static final int __READY_STATE = 3;
 
         private int _state;
+
         private Exception _exception;
 
         public TargetState()
@@ -128,37 +141,38 @@
         }
     }
 
-    public DeploymentTarget( Server server, HttpClient client, String batchId, Binding binding, Set<Validator> validators, Set<StreamObserver> observers )
+    public DeploymentTarget( Server server, HttpClient client, String batchId, Binding binding,
+                             Set<Validator> validators, Set<StreamObserver> observers )
     {
         _server = server;
         _httpClient = client;
         _batchId = batchId;
         _binding = binding;
         _validators = validators;
-        
-        for (StreamObserver o:observers)
+
+        for ( StreamObserver o : observers )
         {
-            if (StreamVerifier.class.isAssignableFrom(o.getClass()))
-                _verifiers.add((StreamVerifier)o);
-            _observers.add(o);
+            if ( StreamVerifier.class.isAssignableFrom( o.getClass() ) )
+                _verifiers.add( (StreamVerifier) o );
+            _observers.add( o );
         }
-      
+
         if ( _binding == null )
         {
             throw new IllegalArgumentException( "Nothing to deploy - null binding" );
         }
-        
-        if ( _binding.isFile() && (_binding.getLocalFile() == null || !_binding.getLocalFile().exists()) )
+
+        if ( _binding.isFile() && ( _binding.getLocalFile() == null || !_binding.getLocalFile().exists() ) )
         {
             throw new IllegalArgumentException( "Nothing to deploy - local file not found: " + _binding.getLocalFile() );
         }
-        if( _binding.isInMemory() && _binding.getLocalInputStream() == null )
+        if ( _binding.isInMemory() && _binding.getLocalInputStream() == null )
         {
             throw new IllegalArgumentException( "Nothing to deploy - inMemory binding with null stream" );
         }
         _targetState = new TargetState();
         _checksumState = new TargetState();
-        if (_verifiers.isEmpty())
+        if ( _verifiers.isEmpty() )
             _checksumState.ready();
     }
 
@@ -174,33 +188,37 @@
 
     private synchronized void updateState( Throwable t )
     {
-  
-        if (log.isDebugEnabled())
+
+        if ( log.isDebugEnabled() )
         {
-            log.debug("updateState: exception="+t+" targetState="+_targetState.getState()+" checksumState="+_checksumState.getState()+" verifiers="+_verifiers.size()+" checksumsdeployed="+_checkSumFilesDeployed);
+            log.debug( "updateState: exception=" + t + " targetState=" + _targetState.getState() + " checksumState="
+                + _checksumState.getState() + " verifiers=" + _verifiers.size() + " checksumsdeployed="
+                + _checkSumFilesDeployed );
         }
         if ( t != null && _exception == null )
         {
-            _exception = ( t instanceof HttpClientException ? (HttpClientException) t : new HttpClientException( _binding, t ) );
+            _exception =
+                ( t instanceof HttpClientException ? (HttpClientException) t : new HttpClientException( _binding, t ) );
         }
 
-        if (_exception != null)
+        if ( _exception != null )
         {
-            onError(_exception);
+            onError( _exception );
         }
         else
         {
-            //if the target file can be uploaded, then upload it, calculating checksums on the fly as necessary
+            // if the target file can be uploaded, then upload it, calculating checksums on the fly as necessary
             if ( _targetState.isStart() )
             {
                 deployLocalFile();
             }
-            //Upload the checksums
-            else if ( _targetState.isReady() && (_verifiers.size()>0) && (_checkSumFilesDeployed < (_verifiers.size() -1)) )
+            // Upload the checksums
+            else if ( _targetState.isReady() && ( _verifiers.size() > 0 )
+                && ( _checkSumFilesDeployed < ( _verifiers.size() - 1 ) ) )
             {
                 deployNextChecksumFile();
             }
-            else if ( _targetState.isReady() && (_checksumState.isReady()))
+            else if ( _targetState.isReady() && ( _checksumState.isReady() ) )
             {
                 onComplete();
             }
@@ -209,88 +227,88 @@
 
     private void deployLocalFile()
     {
-        FilePutExchange fileExchange = new FilePutExchange( _server, _batchId, _binding, _binding.getLocalFile(), _observers, _httpClient )
-        {
-            public void onFileComplete( String url, File localFile )
+        FilePutExchange fileExchange =
+            new FilePutExchange( _server, _batchId, _binding, _binding.getLocalFile(), _observers, _httpClient )
             {
-                
-                DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
-                _targetState.ready();
-                updateState( null );
-            }
+                public void onFileComplete( String url, File localFile )
+                {
 
-            public void onFileError( String url, Exception e )
-            {
-                
-                DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
-                _targetState.ready( e );
-                updateState( e );
-            }
-        };
+                    DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
+                    _targetState.ready();
+                    updateState( null );
+                }
+
+                public void onFileError( String url, Exception e )
+                {
+
+                    DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
+                    _targetState.ready( e );
+                    updateState( e );
+                }
+            };
 
-        if( _server != null && _server.hasUserAgent() )
-          fileExchange.setRequestHeader( HttpHeaders.USER_AGENT, _server.getUserAgent() );
+        if ( _server != null && _server.hasUserAgent() )
+            fileExchange.setRequestHeader( HttpHeaders.USER_AGENT, _server.getUserAgent() );
 
         _targetState.requested();
-        
+
         fileExchange.send();
     }
 
-
     private void deployNextChecksumFile()
     {
         Binding binding = _binding;
         File file = null;
-        StreamVerifier v =  _verifiers.get(++_checkSumFilesDeployed);
+        StreamVerifier v = _verifiers.get( ++_checkSumFilesDeployed );
 
-        //No local checksum file, so make a temporary one using the checksum we 
-        //calculated as we uploaded the file
+        // No local checksum file, so make a temporary one using the checksum we
+        // calculated as we uploaded the file
         try
         {
             URL url = _binding.getRemoteResource();
-            if (url != null)
+            if ( url != null )
             {
                 url = new URL( url.toString() + v.getAttributes().getExtension() );
             }
-      
-            String localFileName = getFileName(url);
-            
+
+            String localFileName = getFileName( url );
+
             file = File.createTempFile( localFileName, ".tmp" );
             file.deleteOnExit();
             OutputStreamWriter fw = new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" );
             fw.write( v.getSignature() );
             fw.close();
-            binding = new Binding(url, file);
+            binding = new Binding( url, file );
         }
         catch ( Exception e )
         {
             _checksumState.ready( e );
         }
 
-
-        //upload the checksum file
+        // upload the checksum file
         Set<StreamObserver> emptySet = Collections.emptySet();
-        FilePutExchange checksumExchange = new FilePutExchange( _server, _batchId, binding, file, emptySet, _httpClient )
-        {
-            public void onFileComplete( String url, File localFile )
-            {      
-                DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
-                if (_checkSumFilesDeployed == (_verifiers.size() - 1))
-                    _checksumState.ready();
-                updateState( null );
-            }
-
-            public void onFileError( String url, Exception e )
-            {             
-                DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
-                if (_checkSumFilesDeployed == (_verifiers.size() - 1))
-                    _checksumState.ready( e );
-                updateState( e );
-            }
-        };
+        FilePutExchange checksumExchange =
+            new FilePutExchange( _server, _batchId, binding, file, emptySet, _httpClient )
+            {
+                public void onFileComplete( String url, File localFile )
+                {
+                    DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
+                    if ( _checkSumFilesDeployed == ( _verifiers.size() - 1 ) )
+                        _checksumState.ready();
+                    updateState( null );
+                }
+
+                public void onFileError( String url, Exception e )
+                {
+                    DeploymentTarget.this._remoteJettyUrl = getRemoteJettyUrl();
+                    if ( _checkSumFilesDeployed == ( _verifiers.size() - 1 ) )
+                        _checksumState.ready( e );
+                    updateState( e );
+                }
+            };
 
-        if( _server != null && _server.hasUserAgent() )
-          checksumExchange.setRequestHeader( HttpHeaders.USER_AGENT, _server.getUserAgent() );
+        if ( _server != null && _server.hasUserAgent() )
+            checksumExchange.setRequestHeader( HttpHeaders.USER_AGENT, _server.getUserAgent() );
 
         _checksumState.requested();
         checksumExchange.send();
@@ -310,26 +328,27 @@
     {
         return ( _checksumState.isReady() && _targetState.isReady() );
     }
-    
-    public String getFileName (URL url)
+
+    public String getFileName( URL url )
     {
-        if (url==null)
+        if ( url == null )
             return "";
         String localFileName = url.getFile();
-        int i = localFileName.indexOf('?');
-        if (i > 0)
-            localFileName = localFileName.substring(0, i);
-        if (localFileName.endsWith("/"))
-            localFileName = localFileName.substring(0, localFileName.length()-1);
-        i = localFileName.lastIndexOf('/');
-        if (i >= 0)
-            localFileName = localFileName.substring(i+1);
+        int i = localFileName.indexOf( '?' );
+        if ( i > 0 )
+            localFileName = localFileName.substring( 0, i );
+        if ( localFileName.endsWith( "/" ) )
+            localFileName = localFileName.substring( 0, localFileName.length() - 1 );
+        i = localFileName.lastIndexOf( '/' );
+        if ( i >= 0 )
+            localFileName = localFileName.substring( i + 1 );
         return localFileName;
     }
 
     public String toString()
     {
-        return "DeploymentTarget:" + _binding.getRemoteResource() + ":" + _targetState + ":" + _checksumState + ":" + isComplete();
+        return "DeploymentTarget:" + _binding.getRemoteResource() + ":" + _targetState + ":" + _checksumState + ":"
+            + isComplete();
     }
-   
+
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/FilePutExchange.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/FilePutExchange.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/FilePutExchange.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/FilePutExchange.java Mon Apr 27 23:12:25 2009
@@ -19,7 +19,6 @@
 
 package org.apache.maven.mercury.spi.http.client.deploy;
 
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -40,42 +39,47 @@
 import org.mortbay.jetty.HttpMethods;
 import org.mortbay.jetty.client.HttpClient;
 
-
 /**
  * FilePutExchange
  * <p/>
- * Asynchronously PUT a file to a remote server. The file that is being uploaded can also
- * have it's SHA-1 digest calculated as it is being streamed up.
+ * Asynchronously PUT a file to a remote server. The file that is being uploaded can also have it's SHA-1 digest
+ * calculated as it is being streamed up.
  */
-public abstract class FilePutExchange extends FileExchange
+public abstract class FilePutExchange
+    extends FileExchange
 {
     private static final int __readLimit = 1024;
-    private static final IMercuryLogger log = MercuryLoggerManager.getLogger(FilePutExchange.class);
+
+    private static final IMercuryLogger log = MercuryLoggerManager.getLogger( FilePutExchange.class );
+
     private String _batchId;
+
     private InputStream _inputStream;
+
     private String _remoteRepoUrl;
+
     private String _remoteBatchId;
+
     private Set<StreamObserver> _observers = new HashSet<StreamObserver>();
-    
+
     public abstract void onFileComplete( String url, File localFile );
 
     public abstract void onFileError( String url, Exception e );
 
-
-    public FilePutExchange( Server server, String batchId, Binding binding, File localFile, Set<StreamObserver> observers, HttpClient client )
+    public FilePutExchange( Server server, String batchId, Binding binding, File localFile,
+                            Set<StreamObserver> observers, HttpClient client )
     {
         super( server, binding, localFile, client );
-        
+
         _batchId = batchId;
-        
-        if( observers != null && ! observers.isEmpty() )
-            _observers.addAll(observers);
-    }
 
+        if ( observers != null && !observers.isEmpty() )
+            _observers.addAll( observers );
+    }
 
     /**
-     * Start the upload. Ensure that the id of the mercury is set as a request header
-     * so all files part of the same mercury can be identified as an atomic unit.
+     * Start the upload. Ensure that the id of the mercury is set as a request header so all files part of the same
+     * mercury can be identified as an atomic unit.
      */
     public void send()
     {
@@ -83,21 +87,21 @@
         {
             setMethod( HttpMethods.PUT );
             setRequestHeader( "Content-Type", "application/octet-stream" );
-            if (_binding.isFile())
+            if ( _binding.isFile() )
             {
                 setRequestHeader( "Content-Length", String.valueOf( _localFile.length() ) );
-                if (log.isDebugEnabled())
-                    log.debug("PUT of "+_localFile.length()+" bytes");
-                
-                for (StreamObserver o: _observers)
-                    o.setLength(_localFile.length());
+                if ( log.isDebugEnabled() )
+                    log.debug( "PUT of " + _localFile.length() + " bytes" );
+
+                for ( StreamObserver o : _observers )
+                    o.setLength( _localFile.length() );
             }
 
-            if (log.isDebugEnabled())
-                log.debug("PUT: "+getURI());
-            
+            if ( log.isDebugEnabled() )
+                log.debug( "PUT: " + getURI() );
+
             setRequestContentSource( getInputStream() );
-            setRequestHeader( __BATCH_HEADER, _batchId );            
+            setRequestHeader( __BATCH_HEADER, _batchId );
             super.send();
         }
         catch ( Exception e )
@@ -116,7 +120,6 @@
         return _remoteRepoUrl;
     }
 
-
     protected void onResponseHeader( Buffer name, Buffer value )
     {
         if ( name.toString().equalsIgnoreCase( __BATCH_SUPPORTED_HEADER ) )
@@ -133,10 +136,11 @@
     {
         try
         {
-            if (_inputStream != null)
+            if ( _inputStream != null )
                 _inputStream.close();
-            
-            if ( _status != HttpServletResponse.SC_OK && _status != HttpServletResponse.SC_CREATED && _status != HttpServletResponse.SC_NO_CONTENT )
+
+            if ( _status != HttpServletResponse.SC_OK && _status != HttpServletResponse.SC_CREATED
+                && _status != HttpServletResponse.SC_NO_CONTENT )
             {
                 onFileError( _url, new HttpClientException( _binding, "Http status code=" + _status ) );
                 return;
@@ -144,12 +148,12 @@
 
             if ( _remoteBatchId != null && !_batchId.equals( _remoteBatchId ) )
             {
-                onFileError( _url, new HttpClientException( _binding,
-                    "Non matching mercury ids. Sent=" + _batchId + " received=" + _remoteBatchId ) );
+                onFileError( _url, new HttpClientException( _binding, "Non matching mercury ids. Sent=" + _batchId
+                    + " received=" + _remoteBatchId ) );
                 return;
             }
 
-            //we've uploaded the file
+            // we've uploaded the file
             onFileComplete( _url, _localFile );
         }
         catch ( Exception e )
@@ -158,53 +162,52 @@
         }
     }
 
-
     private InputStream getInputStream()
         throws IOException
     {
         if ( _inputStream == null )
         {
             InputStream is = null;
-            if (_binding.isFile())
+            if ( _binding.isFile() )
                 is = new FileInputStream( _localFile );
-            else if (_binding.isInMemory())
+            else if ( _binding.isInMemory() )
             {
                 is = _binding.getLocalInputStream();
-                if (!getRetryStatus())
-                {                 
-                    if (is.markSupported())
-                        is.mark(__readLimit);
+                if ( !getRetryStatus() )
+                {
+                    if ( is.markSupported() )
+                        is.mark( __readLimit );
                 }
                 else
                 {
-                    if (is.markSupported())
+                    if ( is.markSupported() )
                         is.reset();
                 }
             }
 
-            //if this request is being retried, then don't set up the observers a second
-            //time?
-            if (!getRetryStatus())
+            // if this request is being retried, then don't set up the observers a second
+            // time?
+            if ( !getRetryStatus() )
             {
                 ObservableInputStream ois = new ObservableInputStream( is );
                 _inputStream = ois;
-                ois.addObservers(_observers);
+                ois.addObservers( _observers );
             }
             else
                 _inputStream = is;
-        }    
+        }
         return _inputStream;
     }
 
-   
-    protected void onRetry() throws IOException
+    protected void onRetry()
+        throws IOException
     {
         super.onRetry();
-        if (_inputStream != null)
+        if ( _inputStream != null )
             _inputStream.close();
-        
+
         _inputStream = null;
-        setRequestContent(null);
-        setRequestContentSource(getInputStream());
+        setRequestContent( null );
+        setRequestContentSource( getInputStream() );
     }
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/RandomBatchIdGenerator.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/RandomBatchIdGenerator.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/RandomBatchIdGenerator.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/RandomBatchIdGenerator.java Mon Apr 27 23:12:25 2009
@@ -23,13 +23,14 @@
 import java.security.SecureRandom;
 import java.util.Random;
 
-
-public class RandomBatchIdGenerator implements BatchIdGenerator
+public class RandomBatchIdGenerator
+    implements BatchIdGenerator
 {
     protected final static String SESSION_ID_RANDOM_ALGORITHM = "SHA1PRNG";
+
     private Random _random;
-    private boolean _initialized;
 
+    private boolean _initialized;
 
     public RandomBatchIdGenerator()
     {
@@ -74,8 +75,8 @@
                 {
                     _random = new Random();
                 }
-                _random.setSeed(
-                    _random.nextLong() ^ System.currentTimeMillis() ^ hashCode() ^ Runtime.getRuntime().freeMemory() );
+                _random.setSeed( _random.nextLong() ^ System.currentTimeMillis() ^ hashCode()
+                    ^ Runtime.getRuntime().freeMemory() );
                 _initialized = true;
             }
         }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalRequest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalRequest.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalRequest.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalRequest.java Mon Apr 27 23:12:25 2009
@@ -25,13 +25,16 @@
 import org.apache.maven.mercury.spi.http.validate.Validator;
 import org.apache.maven.mercury.transport.api.Binding;
 
-public class DefaultRetrievalRequest implements RetrievalRequest
+public class DefaultRetrievalRequest
+    implements RetrievalRequest
 {
     private boolean _isFailFast;
+
     private Set<Binding> _bindings;
+
     private Set<Validator> _validators;
-    
-    public void setFailFast(boolean failFast)
+
+    public void setFailFast( boolean failFast )
     {
         _isFailFast = failFast;
     }
@@ -40,42 +43,42 @@
     {
         return _isFailFast;
     }
-    
+
     public RetrievalRequest addBinding( Binding binding )
     {
         if ( _bindings == null )
         {
             _bindings = new HashSet<Binding>();
         }
-        
+
         _bindings.add( binding );
-        
+
         return this;
     }
-    
-    public void setBindings(Set<Binding> bindings)
+
+    public void setBindings( Set<Binding> bindings )
     {
-        _bindings = new HashSet<Binding>(bindings);
+        _bindings = new HashSet<Binding>( bindings );
     }
-    
+
     public Set<Binding> getBindings()
     {
         return _bindings;
     }
 
-    public void setValidators(Set<Validator> validators)
+    public void setValidators( Set<Validator> validators )
     {
-        _validators = new HashSet<Validator>(validators);
+        _validators = new HashSet<Validator>( validators );
     }
-    
+
     public Set<Validator> getValidators()
     {
         return _validators;
     }
-    
+
     public String toString()
     {
-        return _bindings.toString()+"|"+_isFailFast;
+        return _bindings.toString() + "|" + _isFailFast;
     }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalResponse.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalResponse.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalResponse.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetrievalResponse.java Mon Apr 27 23:12:25 2009
@@ -25,7 +25,8 @@
 
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
 
-public class DefaultRetrievalResponse implements RetrievalResponse
+public class DefaultRetrievalResponse
+    implements RetrievalResponse
 {
     private Set<HttpClientException> _exceptions = Collections.synchronizedSet( new HashSet<HttpClientException>() );
 
@@ -47,7 +48,7 @@
     {
         return _exceptions.toString();
     }
-    
+
     public boolean hasExceptions()
     {
         return _exceptions.size() > 0;

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java Mon Apr 27 23:12:25 2009
@@ -19,7 +19,6 @@
 
 package org.apache.maven.mercury.spi.http.client.retrieve;
 
-
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -42,11 +41,13 @@
 import org.apache.maven.mercury.transport.api.Server;
 import org.mortbay.jetty.client.HttpClient;
 
-public class DefaultRetriever implements Retriever
+public class DefaultRetriever
+    implements Retriever
 {
     private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( DefaultRetriever.class );
-    
+
     private HttpClient _httpClient;
+
     private Set<Server> _servers = new HashSet<Server>();
 
     public DefaultRetriever()
@@ -57,7 +58,7 @@
         _httpClient.setConnectorType( HttpClient.CONNECTOR_SELECT_CHANNEL );
         try
         {
-            //TODO: What are all the reasons that the httpclient couldn't start up correctly?
+            // TODO: What are all the reasons that the httpclient couldn't start up correctly?
             _httpClient.start();
         }
         catch ( Exception e )
@@ -83,32 +84,31 @@
             throw new HttpClientException( null, "unable to start http client", e );
         }
     }
-                           
-    public void setServers (Set<Server>servers)
+
+    public void setServers( Set<Server> servers )
     {
         _servers.clear();
-        _servers.addAll(servers);
-        _httpClient.setRealmResolver(new DestinationRealmResolver(_servers));
+        _servers.addAll( servers );
+        _httpClient.setRealmResolver( new DestinationRealmResolver( _servers ) );
     }
-    
+
     public Set<Server> getServers()
     {
         return _servers;
     }
 
     /**
-     * Retrieve a set of artifacts and wait until all retrieved successfully
-     * or an error occurs.
+     * Retrieve a set of artifacts and wait until all retrieved successfully or an error occurs.
      * <p/>
-     * Note: whilst this method is synchronous for the caller, the implementation
-     * will be asynchronous so many artifacts are fetched in parallel.
-     *
+     * Note: whilst this method is synchronous for the caller, the implementation will be asynchronous so many artifacts
+     * are fetched in parallel.
+     * 
      * @param request
      * @return the list of errors, if any
      */
     public RetrievalResponse retrieve( RetrievalRequest request )
     {
-        final RetrievalResponse[] response = new RetrievalResponse[]{null};
+        final RetrievalResponse[] response = new RetrievalResponse[] { null };
 
         retrieve( request, new RetrievalCallback()
         {
@@ -140,10 +140,9 @@
     }
 
     /**
-     * Retrieve a set of artifacts without waiting for the results.
-     * When all results have been obtained (or an error occurs) the
-     * RetrievalResponse will be called.
-     *
+     * Retrieve a set of artifacts without waiting for the results. When all results have been obtained (or an error
+     * occurs) the RetrievalResponse will be called.
+     * 
      * @param request
      * @param callback
      */
@@ -170,60 +169,61 @@
         for ( int i = 0; i < bindings.length && count.get() > 0; i++ )
         {
             final Binding binding = bindings[i];
-            
+
             RetrievalTarget target = null;
             try
             {
-                Server server = resolveServer(binding);
+                Server server = resolveServer( binding );
                 Set<StreamObserver> observers = createStreamObservers( server, binding.isExempt() );
-                
-                target = new RetrievalTarget( server, DefaultRetriever.this, binding, request.getValidators(), observers )
-                {
-                    public void onComplete()
+
+                target =
+                    new RetrievalTarget( server, DefaultRetriever.this, binding, request.getValidators(), observers )
                     {
-                        //got the file, check the checksum
-                        boolean checksumOK = false;
-                        try
+                        public void onComplete()
                         {
-                          checksumOK = verifyChecksum();
-                          if ( !checksumOK )
-                          {
-                              response.add( new HttpClientException( binding, "Checksum failed") );
-                          }
-                        }
-                        catch( StreamVerifierException e )
-                        {
-                          response.add( new HttpClientException( binding, e.getMessage()) );
-                        }
+                            // got the file, check the checksum
+                            boolean checksumOK = false;
+                            try
+                            {
+                                checksumOK = verifyChecksum();
+                                if ( !checksumOK )
+                                {
+                                    response.add( new HttpClientException( binding, "Checksum failed" ) );
+                                }
+                            }
+                            catch ( StreamVerifierException e )
+                            {
+                                response.add( new HttpClientException( binding, e.getMessage() ) );
+                            }
 
-                        //if the file checksum is ok, then apply the validators
-                        if ( checksumOK )
-                        {
-                            List<String> validateErrors = new ArrayList<String>();
-                            if ( !validate( validateErrors ) )
+                            // if the file checksum is ok, then apply the validators
+                            if ( checksumOK )
                             {
-                                for ( String s : validateErrors )
+                                List<String> validateErrors = new ArrayList<String>();
+                                if ( !validate( validateErrors ) )
                                 {
-                                    response.add( new HttpClientException( binding, s ) );
+                                    for ( String s : validateErrors )
+                                    {
+                                        response.add( new HttpClientException( binding, s ) );
+                                    }
                                 }
                             }
-                        }
 
-                        if ( DefaultRetriever.this.isComplete( count, request, response, targets ) )
-                        {
-                            callback.onComplete( response );
+                            if ( DefaultRetriever.this.isComplete( count, request, response, targets ) )
+                            {
+                                callback.onComplete( response );
+                            }
                         }
-                    }
 
-                    public void onError( HttpClientException exception )
-                    {
-                        response.add( exception );
-                        if ( DefaultRetriever.this.isComplete( count, request, response, targets ) )
+                        public void onError( HttpClientException exception )
                         {
-                            callback.onComplete( response );
+                            response.add( exception );
+                            if ( DefaultRetriever.this.isComplete( count, request, response, targets ) )
+                            {
+                                callback.onComplete( response );
+                            }
                         }
-                    }
-                };
+                    };
 
                 targets.add( target );
             }
@@ -239,17 +239,15 @@
 
         for ( final RetrievalTarget target : targets )
         {
-            target.retrieve(); //go get the remote file
+            target.retrieve(); // go get the remote file
         }
     }
 
-    private boolean isComplete( AtomicInteger count,
-                                RetrievalRequest request,
-                                RetrievalResponse response,
+    private boolean isComplete( AtomicInteger count, RetrievalRequest request, RetrievalResponse response,
                                 List<RetrievalTarget> targets )
     {
         boolean completor = count.decrementAndGet() == 0;
-        
+
         if ( !completor && request.isFailFast() && response.getExceptions().size() > 0 )
         {
             completor = count.getAndSet( 0 ) > 0;
@@ -278,52 +276,51 @@
         return false;
     }
 
-
     /**
      * Get the jetty async client
-     *
+     * 
      * @return
      */
     public HttpClient getHttpClient()
     {
         return _httpClient;
     }
-    
-    private Server resolveServer (Binding binding)
-    throws MalformedURLException
-    {
-        if (binding.getRemoteResource() == null)
-        return null;
-        
+
+    private Server resolveServer( Binding binding )
+        throws MalformedURLException
+    {
+        if ( binding.getRemoteResource() == null )
+            return null;
+
         URL bindingURL = binding.getRemoteResource();
-        if (_servers == null)
+        if ( _servers == null )
             return null;
-        
+
         Iterator<Server> itor = _servers.iterator();
         Server server = null;
-        while(itor.hasNext() && server==null)
+        while ( itor.hasNext() && server == null )
         {
             Server s = itor.next();
-            if (bindingURL.getProtocol().equalsIgnoreCase(s.getURL().getProtocol()) 
-                    && bindingURL.getHost().equalsIgnoreCase(s.getURL().getHost())
-                    && bindingURL.getPort() == s.getURL().getPort())
+            if ( bindingURL.getProtocol().equalsIgnoreCase( s.getURL().getProtocol() )
+                && bindingURL.getHost().equalsIgnoreCase( s.getURL().getHost() )
+                && bindingURL.getPort() == s.getURL().getPort() )
                 server = s;
         }
         return server;
     }
-    
-    private Set<StreamObserver> createStreamObservers (Server server, boolean exempt )
-    throws StreamObserverException
+
+    private Set<StreamObserver> createStreamObservers( Server server, boolean exempt )
+        throws StreamObserverException
     {
         HashSet<StreamObserver> observers = new HashSet<StreamObserver>();
-        
-        if( server == null )
-          return observers;
-        
-        if ( (!exempt) && server.hasReaderStreamVerifierFactories() )
+
+        if ( server == null )
+            return observers;
+
+        if ( ( !exempt ) && server.hasReaderStreamVerifierFactories() )
         {
             Set<StreamVerifierFactory> factories = server.getReaderStreamVerifierFactories();
-            for( StreamVerifierFactory f:factories )
+            for ( StreamVerifierFactory f : factories )
             {
                 observers.add( f.newInstance() );
             }
@@ -332,22 +329,22 @@
         if ( server.hasReaderStreamObserverFactories() )
         {
             Set<StreamObserverFactory> factories = server.getReaderStreamObserverFactories();
-            for( StreamObserverFactory f:factories )
+            for ( StreamObserverFactory f : factories )
             {
                 observers.add( f.newInstance() );
             }
         }
         return observers;
     }
-    
+
     public void stop()
     {
-        if( _httpClient == null )
+        if ( _httpClient == null )
             return;
-        
-        if( _httpClient.isStopped() || _httpClient.isStopping() )
+
+        if ( _httpClient.isStopped() || _httpClient.isStopping() )
             return;
-        
+
         try
         {
             _httpClient.stop();
@@ -356,7 +353,7 @@
         {
             LOG.error( e.getMessage() );
         }
-            
+
     }
 
 }



Mime
View raw message