maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r684797 - in /maven/sandbox/trunk/mercury: mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/ mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ mercury-crypto/mercury-...
Date Mon, 11 Aug 2008 16:22:08 GMT
Author: ogusakov
Date: Mon Aug 11 09:22:07 2008
New Revision: 684797

URL: http://svn.apache.org/viewvc?rev=684797&view=rev
Log:
absorbed Jen's latest changes

Added:
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java
  (contents, props changed)
      - copied, changed from r684153, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractVerifier.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifier.java
      - copied, changed from r684147, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/Verifier.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifierFactory.java
      - copied, changed from r684147, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamObserverFactory.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/
  (with props)
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1Verifier.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1VerifierFactory.java
Removed:
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractVerifier.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamObserverFactory.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/Verifier.java
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/SHA1Verifier.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/transport/http/SHA1VerifierFactory.java
Modified:
    maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ChecksumCalculator.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-api/src/main/java/org/apache/maven/mercury/transport/api/Server.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/RetrievalTarget.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyRetrieverTest.java

Copied: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java
(from r684153, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractVerifier.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java?p2=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java&p1=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractVerifier.java&r1=684153&r2=684797&rev=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractVerifier.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java
Mon Aug 11 09:22:07 2008
@@ -7,37 +7,21 @@
  * @version $Id$
  *
  */
-public abstract class AbstractVerifier
+public abstract class AbstractStreamVerifier
 {
-  protected boolean isLenient;
-  protected boolean isSufficient;
-  
+  protected StreamVerifierAttributes attributes;
+
   /**
-   * 
+   * @param attributes
    */
-  public AbstractVerifier(boolean isLenient, boolean isSufficient)
-  {
-    this.isLenient = isLenient;
-    this.isSufficient = isSufficient;
-  }
-  
-  public void setLenient (boolean lenient)
-  {
-      isLenient = lenient;
-  }
-
-  public boolean isLenient()
+  public AbstractStreamVerifier( StreamVerifierAttributes attributes )
   {
-      return isLenient;
+    this.attributes = attributes;
   }
 
-  public void setSufficient (boolean sufficient)
-  {
-      isSufficient = sufficient;
-  }
-  public boolean isSufficient()
+  public StreamVerifierAttributes getAttributes()
   {
-      return isSufficient;
+    return attributes;
   }
-
+  
 }

Propchange: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/AbstractStreamVerifier.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifier.java
(from r684147, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/Verifier.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifier.java?p2=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifier.java&p1=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/Verifier.java&r1=684147&r2=684797&rev=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/Verifier.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifier.java
Mon Aug 11 09:22:07 2008
@@ -18,11 +18,11 @@
  */
 package org.apache.maven.mercury.crypto.api;
 
-public interface Verifier extends StreamObserver
+public interface StreamVerifier
+extends StreamObserver
 {
-    public String getSignature();
-    public boolean verifySignature (String signature);
-    public boolean isLenient();
-    public boolean isSufficient();
-    public String getExtension();
+  public StreamVerifierAttributes getAttributes();
+
+  public String getSignature();
+  public boolean verifySignature( String signature );
 }

Copied: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifierFactory.java
(from r684147, maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamObserverFactory.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifierFactory.java?p2=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifierFactory.java&p1=maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamObserverFactory.java&r1=684147&r2=684797&rev=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamObserverFactory.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-api/src/main/java/org/apache/maven/mercury/crypto/api/StreamVerifierFactory.java
Mon Aug 11 09:22:07 2008
@@ -18,7 +18,8 @@
  */
 package org.apache.maven.mercury.crypto.api;
 
-public interface StreamObserverFactory
+public interface StreamVerifierFactory
 {
-    public StreamObserver newInstance();
+  public StreamVerifier newInstance();
+  public String getDefaultExtension();
 }

Modified: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ChecksumCalculator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ChecksumCalculator.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ChecksumCalculator.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/basic/ChecksumCalculator.java
Mon Aug 11 09:22:07 2008
@@ -25,7 +25,6 @@
 {
     private static final byte[] __HEX_DIGITS = "0123456789abcdef".getBytes();
 
-
     public static String encodeToAsciiHex( byte[] bytes )
     {
         int l = bytes.length;
@@ -34,8 +33,8 @@
 
         for ( int i = 0, j = 0; i < l; i++ )
         {
-            raw[j++] = __HEX_DIGITS[( 0xF0 & bytes[i] ) >>> 4];
-            raw[j++] = __HEX_DIGITS[0x0F & bytes[i]];
+            raw[j++] = __HEX_DIGITS[ ( 0xF0 & bytes[i] ) >>> 4 ];
+            raw[j++] = __HEX_DIGITS[ 0x0F & bytes[i] ];
         }
 
         return new String( raw );

Propchange: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1Verifier.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1Verifier.java?rev=684797&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1Verifier.java
(added)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1Verifier.java
Mon Aug 11 09:22:07 2008
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file                           
                                                                
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.mercury.crypto.sha;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.maven.mercury.crypto.api.AbstractStreamVerifier;
+import org.apache.maven.mercury.crypto.api.StreamVerifier;
+import org.apache.maven.mercury.crypto.api.StreamVerifierAttributes;
+import org.apache.maven.mercury.crypto.basic.ChecksumCalculator;
+
+
+/**
+ * SHA1Verifier
+ *
+ *
+ */
+public class SHA1Verifier
+extends AbstractStreamVerifier
+implements StreamVerifier
+{
+    public static final String digestAlgorithm = "SHA-1";
+
+    private MessageDigest digest;
+    private byte[] digestBytes;
+    
+    public SHA1Verifier( StreamVerifierAttributes attributes )
+    {
+      super( attributes );
+
+      try
+      {
+          digest = MessageDigest.getInstance( digestAlgorithm );
+      }
+      catch (NoSuchAlgorithmException e)
+      {
+          //TODO
+      }
+    }
+
+    public String getExtension()
+    {
+        return '.'+SHA1VerifierFactory.DEFAULT_EXTENSION;
+    }
+
+    public byte[] getSignatureBytes ()
+    {
+        if (digestBytes == null)
+            digestBytes = digest.digest();
+        return digestBytes;
+    }
+    
+    public String getSignature()
+    {
+        return ChecksumCalculator.encodeToAsciiHex( getSignatureBytes() );
+    }
+
+    public boolean verifySignature(String sig)
+    {
+        String calculatedSignature = getSignature();
+        if (calculatedSignature == null && sig == null)
+            return true;
+        if ((calculatedSignature != null) && calculatedSignature.equals(sig))
+            return true;
+        return false;
+    }
+
+    public void byteReady(int b)
+    {
+        if (digest != null)
+            digest.update((byte)b);
+    }
+
+    public void bytesReady(byte[] b, int off, int len)
+    {
+        if (digest != null)
+            digest.update(b, off, len);
+    }
+
+}

Added: maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1VerifierFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1VerifierFactory.java?rev=684797&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1VerifierFactory.java
(added)
+++ maven/sandbox/trunk/mercury/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/sha/SHA1VerifierFactory.java
Mon Aug 11 09:22:07 2008
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file                           
                                                                
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.mercury.crypto.sha;
+
+import org.apache.maven.mercury.crypto.api.AbstractStreamVerifierFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifier;
+import org.apache.maven.mercury.crypto.api.StreamVerifierAttributes;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
+
+public class SHA1VerifierFactory
+extends AbstractStreamVerifierFactory
+implements StreamVerifierFactory
+{
+  public static final String DEFAULT_EXTENSION = "sha1";
+  
+  public SHA1VerifierFactory( StreamVerifierAttributes attrs )
+  {
+    super( attrs );
+  }
+  
+  public SHA1VerifierFactory( boolean lenient, boolean satisfactory )
+  {
+    super( new StreamVerifierAttributes( DEFAULT_EXTENSION, lenient, satisfactory ) );
+  }
+  
+  public StreamVerifier newInstance()
+  {
+     return new SHA1Verifier( attributes );
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.maven.mercury.crypto.api.StreamVerifierFactory#getDefaultExtension()
+   */
+  public String getDefaultExtension()
+  {
+    return DEFAULT_EXTENSION;
+  }
+
+}

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-api/src/main/java/org/apache/maven/mercury/transport/api/Server.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-api/src/main/java/org/apache/maven/mercury/transport/api/Server.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-api/src/main/java/org/apache/maven/mercury/transport/api/Server.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-api/src/main/java/org/apache/maven/mercury/transport/api/Server.java
Mon Aug 11 09:22:07 2008
@@ -21,12 +21,11 @@
 import java.net.URL;
 import java.util.Set;
 
-import org.apache.maven.mercury.crypto.api.StreamObserverFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
 
 public class Server
 {
   private String                      id;
-  private Set<StreamObserverFactory>  streamObserverFactories;
   private URL                         url;
   private Credentials                 serverCredentials;
   private URL                         proxy;
@@ -34,6 +33,8 @@
   private boolean                     requireEncryption = false;
   private boolean                     requireTrustedServer = false;
 
+  private Set<StreamVerifierFactory>  streamObserverFactories;
+
   public Server( String id, URL url )
   {
     this.url = url;
@@ -96,12 +97,12 @@
     return this.serverCredentials;
   }
 
-  public Set<StreamObserverFactory> getStreamObserverFactories()
+  public Set<StreamVerifierFactory> getStreamObserverFactories()
   {
     return streamObserverFactories;
   }
 
-  public void setStreamObserverFactories( Set<StreamObserverFactory> factories )
+  public void setStreamObserverFactories( Set<StreamVerifierFactory> factories )
   {
     streamObserverFactories = factories;
   }

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
Mon Aug 11 09:22:07 2008
@@ -32,7 +32,7 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.maven.mercury.crypto.api.StreamObserver;
-import org.apache.maven.mercury.crypto.api.StreamObserverFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
 import org.apache.maven.mercury.spi.http.client.FileExchange;
 import org.apache.maven.mercury.spi.http.client.HandshakeExchange;
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
@@ -328,8 +328,8 @@
     private Set<StreamObserver> createStreamObservers (Server server)
     {
         HashSet<StreamObserver> observers = new HashSet<StreamObserver>();
-        Set<StreamObserverFactory> factories = server.getStreamObserverFactories();
-        for (StreamObserverFactory f:factories)
+        Set<StreamVerifierFactory> factories = server.getStreamObserverFactories();
+        for (StreamVerifierFactory f:factories)
         {
             observers.add(f.newInstance());
         }

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DeploymentTarget.java
Mon Aug 11 09:22:07 2008
@@ -30,7 +30,7 @@
 import java.util.Set;
 
 import org.apache.maven.mercury.crypto.api.StreamObserver;
-import org.apache.maven.mercury.crypto.api.Verifier;
+import org.apache.maven.mercury.crypto.api.StreamVerifier;
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
 import org.apache.maven.mercury.spi.http.validate.Validator;
 import org.apache.maven.mercury.transport.api.Binding;
@@ -50,7 +50,7 @@
     protected HttpClientException _exception;
     protected String _remoteJettyUrl;
     protected Set<StreamObserver> _observers = new HashSet<StreamObserver>();
-    protected List<Verifier> _verifiers = new ArrayList<Verifier>();
+    protected List<StreamVerifier> _verifiers = new ArrayList<StreamVerifier>();
     protected int _index = -1; 
 
     
@@ -134,8 +134,8 @@
         
         for (StreamObserver o:observers)
         {
-            if (Verifier.class.isAssignableFrom(o.getClass()))
-                _verifiers.add((Verifier)o);
+            if (StreamVerifier.class.isAssignableFrom(o.getClass()))
+                _verifiers.add((StreamVerifier)o);
             _observers.add(o);
         }
       
@@ -221,7 +221,7 @@
     {
         Binding binding = _binding;
         File file = null;
-        Verifier v =  _verifiers.get(_index);
+        StreamVerifier v =  _verifiers.get(_index);
 
         //No local checksum file, so make a temporary one using the checksum we 
         //calculated as we uploaded the file
@@ -230,7 +230,7 @@
             URL url = _binding.getRemoteResource();
             if (url != null)
             {
-                url = new URL( url.toString() + v.getExtension());
+                url = new URL( url.toString() + v.getAttributes().getExtension() );
             }
       
             String localFileName = getFileName(url);

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/DefaultRetriever.java
Mon Aug 11 09:22:07 2008
@@ -30,7 +30,7 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.maven.mercury.crypto.api.StreamObserver;
-import org.apache.maven.mercury.crypto.api.StreamObserverFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
 import org.apache.maven.mercury.transport.api.Binding;
 import org.apache.maven.mercury.transport.api.Server;
@@ -303,8 +303,8 @@
         HashSet<StreamObserver> observers = new HashSet<StreamObserver>();
         if (server != null)
         {
-            Set<StreamObserverFactory> factories = server.getStreamObserverFactories();
-            for (StreamObserverFactory f:factories)
+            Set<StreamVerifierFactory> factories = server.getStreamObserverFactories();
+            for (StreamVerifierFactory f:factories)
             {
                 observers.add(f.newInstance());
             }

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/RetrievalTarget.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/RetrievalTarget.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/RetrievalTarget.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/retrieve/RetrievalTarget.java
Mon Aug 11 09:22:07 2008
@@ -33,7 +33,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.maven.mercury.crypto.api.StreamObserver;
-import org.apache.maven.mercury.crypto.api.Verifier;
+import org.apache.maven.mercury.crypto.api.StreamVerifier;
 import org.apache.maven.mercury.spi.http.client.FileExchange;
 import org.apache.maven.mercury.spi.http.client.HttpClientException;
 import org.apache.maven.mercury.spi.http.validate.Validator;
@@ -68,8 +68,8 @@
     protected HttpExchange _exchange;
     protected Set<Validator> _validators;
     protected Set<StreamObserver> _observers = new HashSet<StreamObserver>();
-    protected List<Verifier> _verifiers = new ArrayList<Verifier>();
-    protected Map<Verifier, String> _verifierMap = new HashMap<Verifier, String>();
+    protected List<StreamVerifier> _verifiers = new ArrayList<StreamVerifier>();
+    protected Map<StreamVerifier, String> _verifierMap = new HashMap<StreamVerifier,
String>();
  
     
     public abstract void onComplete();
@@ -98,8 +98,8 @@
         //sift out the potential checksum verifiers
         for (StreamObserver o: observers)
         {
-            if (Verifier.class.isAssignableFrom(o.getClass()))
-                _verifiers.add((Verifier)o);
+            if (StreamVerifier.class.isAssignableFrom(o.getClass()))
+                _verifiers.add((StreamVerifier)o);
             else
                 _observers.add(o);
         }
@@ -210,8 +210,8 @@
             if (index >= 0)
             {
                 //check if the just-completed retrieval means that we can stop trying to
download checksums 
-                Verifier v = _verifiers.get(index);
-                if (_verifierMap.containsKey(v) && v.isSufficient())
+                StreamVerifier v = _verifiers.get(index);
+                if (_verifierMap.containsKey(v) && v.getAttributes().isSufficient())
                     proceedWithTargetFile = true;
             }
 
@@ -250,10 +250,10 @@
         
         synchronized (_verifierMap)
         {
-            Iterator<Map.Entry<Verifier, String>> itor = _verifierMap.entrySet().iterator();
+            Iterator<Map.Entry<StreamVerifier, String>> itor = _verifierMap.entrySet().iterator();
             while (itor.hasNext() && ok)
             {               
-                Map.Entry<Verifier, String> e = itor.next();
+                Map.Entry<StreamVerifier, String> e = itor.next();
                 ok = e.getKey().verifySignature(e.getValue());
             }
         }
@@ -352,7 +352,7 @@
             protected void onException( Throwable ex )
             {
                 //if the checksum is mandatory, then propagate the exception and stop processing
-                if (!_verifiers.get(index).isLenient())
+                if (!_verifiers.get(index).getAttributes().isLenient())
                 {
                     updateChecksumState(index, ex);
                 }
@@ -364,14 +364,14 @@
             protected void onResponseComplete() throws IOException
             {
                 super.onResponseComplete();
-                Verifier v = _verifiers.get(index);
+                StreamVerifier v = _verifiers.get(index);
                 
                 if ( getResponseStatus() == HttpServletResponse.SC_OK )
                 {
                     //We got a checksum so match it up with the verifier it is for
                     synchronized (_verifierMap)
                     {
-                        if (v.isSufficient())
+                        if (v.getAttributes().isSufficient())
                             _verifierMap.clear(); //remove all other entries, we only need
one checksum
                         _verifierMap.put(v, getResponseContent().trim());
                     }
@@ -379,7 +379,7 @@
                 }
                 else 
                 {
-                    if (!v.isLenient()) 
+                    if (!v.getAttributes().isLenient()) 
                     {
                         //checksum file MUST be present, fail
                         updateChecksumState(index, new Exception ("Mandatory checksum file
not found "+this.getURI()));
@@ -430,9 +430,9 @@
         return exchange;
     }
 
-    private String getChecksumFileURLAsString (Verifier verifier)
+    private String getChecksumFileURLAsString (StreamVerifier verifier)
     {
-        String extension = verifier.getExtension();
+        String extension = verifier.getAttributes().getExtension();
         if (extension.charAt(0) != '.')
             extension = "."+extension;
         return _binding.getRemoteResource().toString() + extension;

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
Mon Aug 11 09:22:07 2008
@@ -34,14 +34,14 @@
 
 import junit.framework.TestCase;
 
-import org.apache.maven.mercury.crypto.api.StreamObserverFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
+import org.apache.maven.mercury.crypto.sha.SHA1VerifierFactory;
 import org.apache.maven.mercury.spi.http.client.deploy.DefaultDeployer;
 import org.apache.maven.mercury.spi.http.client.deploy.DeployRequest;
 import org.apache.maven.mercury.spi.http.client.deploy.DeployResponse;
 import org.apache.maven.mercury.spi.http.server.SimplePutServer;
 import org.apache.maven.mercury.spi.http.validate.Validator;
 import org.apache.maven.mercury.transport.api.Binding;
-import org.apache.maven.mercury.transport.http.SHA1VerifierFactory;
 import org.mortbay.util.IO;
 
 public class JettyDeployerTest extends TestCase
@@ -60,7 +60,7 @@
     File _file5;
 
     org.apache.maven.mercury.transport.api.Server remoteServerType;
-    HashSet<StreamObserverFactory> factories;
+    HashSet<StreamVerifierFactory> factories;
     
     private class DeployRequestImpl implements DeployRequest
     {
@@ -147,7 +147,7 @@
     {
         HashSet<org.apache.maven.mercury.transport.api.Server> remoteServerTypes =
new HashSet<org.apache.maven.mercury.transport.api.Server>();
         remoteServerType = new org.apache.maven.mercury.transport.api.Server( "test", new
URL(_HOST_FRAGMENT+_port));
-        factories = new HashSet<StreamObserverFactory>();       
+        factories = new HashSet<StreamVerifierFactory>();       
         remoteServerTypes.add(remoteServerType);
         _deployer.setServers(remoteServerTypes);
     }

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyRetrieverTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyRetrieverTest.java?rev=684797&r1=684796&r2=684797&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyRetrieverTest.java
(original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/test/java/org/apache/maven/mercury/spi/http/client/JettyRetrieverTest.java
Mon Aug 11 09:22:07 2008
@@ -28,7 +28,8 @@
 
 import junit.framework.TestCase;
 
-import org.apache.maven.mercury.crypto.api.StreamObserverFactory;
+import org.apache.maven.mercury.crypto.api.StreamVerifierFactory;
+import org.apache.maven.mercury.crypto.sha.SHA1VerifierFactory;
 import org.apache.maven.mercury.spi.http.client.retrieve.DefaultRetrievalRequest;
 import org.apache.maven.mercury.spi.http.client.retrieve.DefaultRetriever;
 import org.apache.maven.mercury.spi.http.client.retrieve.RetrievalResponse;
@@ -36,7 +37,6 @@
 import org.apache.maven.mercury.spi.http.validate.Validator;
 import org.apache.maven.mercury.transport.api.Binding;
 import org.apache.maven.mercury.transport.api.Server;
-import org.apache.maven.mercury.transport.http.SHA1VerifierFactory;
 import org.mortbay.util.IO;
 
 public class JettyRetrieverTest extends TestCase
@@ -53,7 +53,7 @@
     DefaultRetriever retriever;
     SimpleTestServer server;
     Server remoteServerType;
-    HashSet<StreamObserverFactory> factories;
+    HashSet<StreamVerifierFactory> factories;
     File dir;
     
 
@@ -106,7 +106,7 @@
         
         HashSet<Server> remoteServerTypes = new HashSet<Server>();
         remoteServerType = new Server( "test", new URL(__HOST_FRAGMENT+_port));
-        factories = new HashSet<StreamObserverFactory>();
+        factories = new HashSet<StreamVerifierFactory>();
             
         remoteServerTypes.add(remoteServerType);
         
@@ -156,7 +156,7 @@
     public void testSyncRetrievalAllGood()
     throws Exception
     {
-        factories.add(new SHA1VerifierFactory(false, true)); //!lenient, sufficient
+        factories.add( new SHA1VerifierFactory(false, true) ); //!lenient, sufficient
         remoteServerType.setStreamObserverFactories(factories);
         
         //make local dir to put stuff in



Mime
View raw message