hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r963854 - in /httpcomponents/httpclient/trunk/httpclient-cache/src: main/java/org/apache/http/client/cache/ main/java/org/apache/http/impl/client/cache/ test/java/org/apache/http/impl/client/cache/
Date Tue, 13 Jul 2010 20:40:57 GMT
Author: olegk
Date: Tue Jul 13 20:40:56 2010
New Revision: 963854

URL: http://svn.apache.org/viewvc?rev=963854&view=rev
Log:
Generified HttpCache key

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/DoNotTestProtocolRequirements.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
Tue Jul 13 20:40:56 2010
@@ -29,15 +29,15 @@ package org.apache.http.client.cache;
 /**
  * @since 4.1
  */
-public interface HttpCache<E> {
+public interface HttpCache<K, E> {
 
-    void putEntry(String url, E entry) throws HttpCacheOperationException;
+    void putEntry(K key, E entry) throws HttpCacheOperationException;
 
-    E getEntry(String url) throws HttpCacheOperationException;
+    E getEntry(K key) throws HttpCacheOperationException;
 
-    void removeEntry(String url) throws HttpCacheOperationException;
+    void removeEntry(K key) throws HttpCacheOperationException;
 
     void updateEntry(
-            String url, HttpCacheUpdateCallback<E> callback) throws HttpCacheOperationException;
+            K key, HttpCacheUpdateCallback<E> callback) throws HttpCacheOperationException;
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
Tue Jul 13 20:40:56 2010
@@ -40,7 +40,7 @@ import org.apache.http.client.cache.Http
  * @since 4.1
  */
 @ThreadSafe
-public class BasicHttpCache implements HttpCache<CacheEntry> {
+public class BasicHttpCache implements HttpCache<String, CacheEntry> {
 
     private final LinkedHashMap<String, CacheEntry> baseMap = new LinkedHashMap<String,
CacheEntry>(
             20, 0.75f, true) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
Tue Jul 13 20:40:56 2010
@@ -48,7 +48,7 @@ import org.apache.http.client.cache.Http
 @ThreadSafe // so long as the cache implementation is thread-safe
 public class CacheInvalidator {
 
-    private final HttpCache<CacheEntry> cache;
+    private final HttpCache<String, CacheEntry> cache;
     private final URIExtractor uriExtractor;
 
     private final Log log = LogFactory.getLog(getClass());
@@ -60,7 +60,7 @@ public class CacheInvalidator {
      * @param uriExtractor Provides identifiers for the keys to store cache entries
      * @param cache the cache to store items away in
      */
-    public CacheInvalidator(URIExtractor uriExtractor, HttpCache<CacheEntry> cache)
{
+    public CacheInvalidator(URIExtractor uriExtractor, HttpCache<String, CacheEntry>
cache) {
         this.uriExtractor = uriExtractor;
         this.cache = cache;
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
Tue Jul 13 20:40:56 2010
@@ -76,7 +76,7 @@ public class CachingHttpClient implement
     private final ResponseCachingPolicy responseCachingPolicy;
     private final CacheEntryGenerator cacheEntryGenerator;
     private final URIExtractor uriExtractor;
-    private final HttpCache<CacheEntry> responseCache;
+    private final HttpCache<String, CacheEntry> responseCache;
     private final CachedHttpResponseGenerator responseGenerator;
     private final CacheInvalidator cacheInvalidator;
     private final CacheableRequestPolicy cacheableRequestPolicy;
@@ -112,7 +112,7 @@ public class CachingHttpClient implement
         this.requestCompliance = new RequestProtocolCompliance();
     }
 
-    public CachingHttpClient(HttpCache<CacheEntry> cache, int maxObjectSizeBytes) {
+    public CachingHttpClient(HttpCache<String, CacheEntry> cache, int maxObjectSizeBytes)
{
         this.responseCache = cache;
 
         this.backend = new DefaultHttpClient();
@@ -130,7 +130,7 @@ public class CachingHttpClient implement
         this.requestCompliance = new RequestProtocolCompliance();
     }
 
-    public CachingHttpClient(HttpClient client, HttpCache<CacheEntry> cache, int maxObjectSizeBytes)
{
+    public CachingHttpClient(HttpClient client, HttpCache<String, CacheEntry> cache,
int maxObjectSizeBytes) {
         this.responseCache = cache;
 
         this.backend = client;
@@ -150,7 +150,7 @@ public class CachingHttpClient implement
 
     public CachingHttpClient(HttpClient backend, ResponseCachingPolicy responseCachingPolicy,
                              CacheEntryGenerator cacheEntryGenerator, URIExtractor uriExtractor,
-                             HttpCache<CacheEntry> responseCache, CachedHttpResponseGenerator
responseGenerator,
+                             HttpCache<String, CacheEntry> responseCache, CachedHttpResponseGenerator
responseGenerator,
                              CacheInvalidator cacheInvalidator, CacheableRequestPolicy cacheableRequestPolicy,
                              CachedResponseSuitabilityChecker suitabilityChecker,
                              ConditionalRequestBuilder conditionalRequestBuilder, CacheEntryUpdater
entryUpdater,

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/DoNotTestProtocolRequirements.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/DoNotTestProtocolRequirements.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/DoNotTestProtocolRequirements.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/DoNotTestProtocolRequirements.java
Tue Jul 13 20:40:56 2010
@@ -62,7 +62,7 @@ public class DoNotTestProtocolRequiremen
     private HttpHost host;
     private HttpEntity mockEntity;
     private HttpClient mockBackend;
-    private HttpCache<CacheEntry> mockCache;
+    private HttpCache<String, CacheEntry> mockCache;
     private HttpRequest request;
     private HttpResponse originResponse;
 
@@ -77,7 +77,7 @@ public class DoNotTestProtocolRequiremen
 
         originResponse = make200Response();
 
-        HttpCache<CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
+        HttpCache<String, CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
         mockBackend = EasyMock.createMock(HttpClient.class);
         mockEntity = EasyMock.createMock(HttpEntity.class);
         mockCache = EasyMock.createMock(HttpCache.class);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
Tue Jul 13 20:40:56 2010
@@ -46,7 +46,7 @@ public class TestCacheInvalidator {
     private static final ProtocolVersion HTTP_1_1 = new ProtocolVersion("HTTP", 1, 1);
 
     private CacheInvalidator impl;
-    private HttpCache<CacheEntry> mockCache;
+    private HttpCache<String, CacheEntry> mockCache;
     private HttpHost host;
     private URIExtractor extractor;
     private CacheEntry mockEntry;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
Tue Jul 13 20:40:56 2010
@@ -93,7 +93,7 @@ public class TestCachingHttpClient {
     private CacheInvalidator mockInvalidator;
     private CacheableRequestPolicy mockRequestPolicy;
     private HttpClient mockBackend;
-    private HttpCache<CacheEntry> mockCache;
+    private HttpCache<String, CacheEntry> mockCache;
     private CachedResponseSuitabilityChecker mockSuitabilityChecker;
     private ResponseCachingPolicy mockResponsePolicy;
     private HttpRequest mockRequest;
@@ -881,7 +881,7 @@ public class TestCachingHttpClient {
         ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
         HttpClient httpClient = new DefaultHttpClient(cm);
 
-        HttpCache<CacheEntry> cacheImpl = new BasicHttpCache(100);
+        HttpCache<String, CacheEntry> cacheImpl = new BasicHttpCache(100);
 
         CachingHttpClient cachingClient = new CachingHttpClient(httpClient, cacheImpl, 8192);
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
Tue Jul 13 20:40:56 2010
@@ -77,7 +77,7 @@ public class TestProtocolDeviations {
     private HttpEntity body;
     private HttpEntity mockEntity;
     private HttpClient mockBackend;
-    private HttpCache<CacheEntry> mockCache;
+    private HttpCache<String, CacheEntry> mockCache;
     private HttpRequest request;
     private HttpResponse originResponse;
 
@@ -94,7 +94,7 @@ public class TestProtocolDeviations {
 
         originResponse = make200Response();
 
-        HttpCache<CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
+        HttpCache<String, CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
         mockBackend = EasyMock.createMock(HttpClient.class);
         mockEntity = EasyMock.createMock(HttpEntity.class);
         mockCache = EasyMock.createMock(HttpCache.class);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java?rev=963854&r1=963853&r2=963854&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
Tue Jul 13 20:40:56 2010
@@ -82,7 +82,7 @@ public class TestProtocolRequirements {
     private HttpEntity body;
     private HttpEntity mockEntity;
     private HttpClient mockBackend;
-    private HttpCache<CacheEntry> mockCache;
+    private HttpCache<String, CacheEntry> mockCache;
     private HttpRequest request;
     private HttpResponse originResponse;
 
@@ -99,7 +99,7 @@ public class TestProtocolRequirements {
 
         originResponse = make200Response();
 
-        HttpCache<CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
+        HttpCache<String, CacheEntry> cache = new BasicHttpCache(MAX_ENTRIES);
         mockBackend = EasyMock.createMock(HttpClient.class);
         mockEntity = EasyMock.createMock(HttpEntity.class);
         mockCache = EasyMock.createMock(HttpCache.class);



Mime
View raw message