You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2012/01/16 22:05:50 UTC

svn commit: r1232163 [6/10] - in /commons/proper/jcs/branches/generics-interface/src: java/org/apache/jcs/ java/org/apache/jcs/access/ java/org/apache/jcs/access/behavior/ java/org/apache/jcs/admin/ java/org/apache/jcs/auxiliary/ java/org/apache/jcs/au...

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheServiceNonLocal.java Mon Jan 16 21:05:44 2012
@@ -42,9 +42,9 @@ import org.apache.jcs.utils.timing.Elaps
  * <p>
  * This originated in the remote cache.
  */
-public class ZombieCacheServiceNonLocal
-    extends ZombieCacheService
-    implements ICacheServiceNonLocal
+public class ZombieCacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends ZombieCacheService<K, V>
+    implements ICacheServiceNonLocal<K, V>
 {
     /** The logger */
     private final static Log log = LogFactory.getLog( ZombieCacheServiceNonLocal.class );
@@ -90,11 +90,11 @@ public class ZombieCacheServiceNonLocal
      * @param item ICacheElement
      * @param listenerId - identifies the caller.
      */
-    public void update( ICacheElement item, long listenerId )
+    public void update( ICacheElement<K, V> item, long listenerId )
     {
         if ( maxQueueSize > 0 )
         {
-            PutEvent event = new PutEvent( item, listenerId );
+            PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
             queue.add( event );
         }
         // Zombies have no inner life
@@ -107,11 +107,11 @@ public class ZombieCacheServiceNonLocal
      * @param key - item key
      * @param listenerId - identifies the caller.
      */
-    public void remove( String cacheName, Serializable key, long listenerId )
+    public void remove( String cacheName, K key, long listenerId )
     {
         if ( maxQueueSize > 0 )
         {
-            RemoveEvent event = new RemoveEvent( cacheName, key, listenerId );
+            RemoveEvent<K, V> event = new RemoveEvent<K, V>( cacheName, key, listenerId );
             queue.add( event );
         }
         // Zombies have no inner life
@@ -142,7 +142,7 @@ public class ZombieCacheServiceNonLocal
      * @return null
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key, long requesterId )
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException
     {
         // Zombies have no inner life
@@ -158,7 +158,7 @@ public class ZombieCacheServiceNonLocal
      * @return empty map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
         return Collections.emptyMap();
@@ -170,9 +170,9 @@ public class ZombieCacheServiceNonLocal
      * @param requesterId - identity of the caller
      * @return an empty map. zombies have no internal data
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
-        return new HashMap<Serializable, ICacheElement>();
+        return new HashMap<K, ICacheElement<K, V>>();
     }
 
     /**
@@ -182,7 +182,7 @@ public class ZombieCacheServiceNonLocal
      * @param groupName - group name
      * @return empty set
      */
-    public Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    public Set<K> getGroupKeys( String cacheName, String groupName )
     {
         return Collections.emptySet();
     }
@@ -193,7 +193,7 @@ public class ZombieCacheServiceNonLocal
      * @param service
      * @throws Exception
      */
-    public synchronized void propagateEvents( ICacheServiceNonLocal service )
+    public synchronized void propagateEvents( ICacheServiceNonLocal<K, V> service )
         throws Exception
     {
         int cnt = 0;
@@ -211,12 +211,12 @@ public class ZombieCacheServiceNonLocal
 
             if ( event instanceof PutEvent )
             {
-                PutEvent putEvent = (PutEvent) event;
+                PutEvent<K, V> putEvent = (PutEvent<K, V>) event;
                 service.update( putEvent.element, event.requesterId );
             }
             else if ( event instanceof RemoveEvent )
             {
-                RemoveEvent removeEvent = (RemoveEvent) event;
+                RemoveEvent<K, V> removeEvent = (RemoveEvent<K, V>) event;
                 service.remove( event.cacheName, removeEvent.key, event.requesterId );
             }
             else if ( event instanceof RemoveAllEvent )
@@ -234,7 +234,7 @@ public class ZombieCacheServiceNonLocal
     /**
      * Base of the other events.
      */
-    protected abstract class ZombieEvent
+    protected static abstract class ZombieEvent
     {
         /** The name of the region. */
         String cacheName;
@@ -246,18 +246,18 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic put event.
      */
-    private class PutEvent
+    private static class PutEvent<K extends Serializable, V extends Serializable>
         extends ZombieEvent
     {
         /** The element to put */
-        ICacheElement element;
+        ICacheElement<K, V> element;
 
         /**
          * Set the element
          * @param element
          * @param requesterId
          */
-        public PutEvent( ICacheElement element, long requesterId )
+        public PutEvent( ICacheElement<K, V> element, long requesterId )
         {
             this.requesterId = requesterId;
             this.element = element;
@@ -267,11 +267,11 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic Remove event.
      */
-    private class RemoveEvent
+    private static class RemoveEvent<K extends Serializable, V extends Serializable>
         extends ZombieEvent
     {
         /** The key to remove */
-        Serializable key;
+        K key;
 
         /**
          * Set the element
@@ -279,7 +279,7 @@ public class ZombieCacheServiceNonLocal
          * @param key
          * @param requesterId
          */
-        public RemoveEvent( String cacheName, Serializable key, long requesterId )
+        public RemoveEvent( String cacheName, K key, long requesterId )
         {
             this.cacheName = cacheName;
             this.requesterId = requesterId;
@@ -290,7 +290,7 @@ public class ZombieCacheServiceNonLocal
     /**
      * A basic RemoveAll event.
      */
-    private class RemoveAllEvent
+    private static class RemoveAllEvent
         extends ZombieEvent
     {
         /**

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheWatch.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheWatch.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheWatch.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/ZombieCacheWatch.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.engine;
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.engine.behavior.ICacheListener;
 import org.apache.jcs.engine.behavior.ICacheObserver;
 import org.apache.jcs.engine.behavior.IZombie;
@@ -35,7 +37,7 @@ public class ZombieCacheWatch
      * @param cacheName The feature to be added to the CacheListener attribute
      * @param obj The feature to be added to the CacheListener attribute
      */
-    public void addCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -45,7 +47,7 @@ public class ZombieCacheWatch
      * <p>
      * @param obj The feature to be added to the CacheListener attribute
      */
-    public void addCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -54,7 +56,7 @@ public class ZombieCacheWatch
      * @param cacheName
      * @param obj
      */
-    public void removeCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
     {
         // empty
     }
@@ -62,7 +64,7 @@ public class ZombieCacheWatch
     /**
      * @param obj
      */
-    public void removeCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
     {
         // empty
     }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICache.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICache.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICache.java Mon Jan 16 21:05:44 2012
@@ -33,7 +33,7 @@ import org.apache.jcs.engine.match.behav
  * This allows for a suite of reusable components for accessing such structures, for example
  * asynchronous access via an event queue.
  */
-public interface ICache
+public interface ICache<K extends Serializable, V extends Serializable>
     extends ICacheType
 {
     /**
@@ -42,7 +42,7 @@ public interface ICache
      * @param element
      * @throws IOException
      */
-    void update( ICacheElement element )
+    void update( ICacheElement<K, V> element )
         throws IOException;
 
     /**
@@ -52,17 +52,17 @@ public interface ICache
      * @return a cache element, or null if there is no data in cache for this key
      * @throws IOException
      */
-    ICacheElement get( Serializable key )
+    ICacheElement<K, V> get( K key )
         throws IOException;
 
     /**
      * Gets multiple items from the cache based on the given set of keys.
      * <p>
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache for any of these keys
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+    Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         throws IOException;
 
     /**
@@ -73,10 +73,10 @@ public interface ICache
      * Auxiliaries will do their best to handle simple expressions.  For instance, the JDBC disk cache will convert * to % and . to _
      * <p>
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no data matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching(String pattern)
+    Map<K, ICacheElement<K, V>> getMatching(String pattern)
         throws IOException;
 
     /**
@@ -86,7 +86,7 @@ public interface ICache
      * @return false if there was an error in removal
      * @throws IOException
      */
-    boolean remove( Serializable key )
+    boolean remove( K key )
         throws IOException;
 
     /**
@@ -137,5 +137,5 @@ public interface ICache
      * <p>
      * @param keyMatcher
      */
-    void setKeyMatcher( IKeyMatcher keyMatcher );
+    void setKeyMatcher( IKeyMatcher<K> keyMatcher );
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElement.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElement.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElement.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElement.java Mon Jan 16 21:05:44 2012
@@ -31,12 +31,12 @@ import java.io.Serializable;
  * allowed to be spooled, etc.
  *
  */
-public interface ICacheElement /* TODO: Should be generic */
+public interface ICacheElement<K extends Serializable, V extends Serializable>
     extends Serializable
 {
 
     /**
-     * Gets the cacheName attribute of the ICacheElement object. The cacheName
+     * Gets the cacheName attribute of the ICacheElement<K, V> object. The cacheName
      * is also known as the region name.
      *
      * @return The cacheName value
@@ -44,28 +44,28 @@ public interface ICacheElement /* TODO: 
     public String getCacheName();
 
     /**
-     * Gets the key attribute of the ICacheElement object
+     * Gets the key attribute of the ICacheElement<K, V> object
      *
      * @return The key value
      */
-    public Serializable getKey();
+    public K getKey();
 
     /**
-     * Gets the val attribute of the ICacheElement object
+     * Gets the val attribute of the ICacheElement<K, V> object
      *
      * @return The val value
      */
-    public Serializable getVal();
+    public V getVal();
 
     /**
-     * Gets the attributes attribute of the ICacheElement object
+     * Gets the attributes attribute of the ICacheElement<K, V> object
      *
      * @return The attributes value
      */
     public IElementAttributes getElementAttributes();
 
     /**
-     * Sets the attributes attribute of the ICacheElement object
+     * Sets the attributes attribute of the ICacheElement<K, V> object
      *
      * @param attr
      *            The new attributes value

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java Mon Jan 16 21:05:44 2012
@@ -26,15 +26,15 @@ import java.io.Serializable;
  * <p>
  * The value is stored as a byte array. This should allow for a variety of serialization mechanisms.
  * <p>
- * This currently extends ICacheElement for backward compatibility.
+ * This currently extends ICacheElement<K, V> for backward compatibility.
  *<p>
  * @author Aaron Smuts
  */
-public interface ICacheElementSerialized
-    extends ICacheElement
+public interface ICacheElementSerialized<K extends Serializable, V extends Serializable>
+    extends ICacheElement<K, V>
 {
     /**
-     * Gets the cacheName attribute of the ICacheElement object. The cacheName is also known as the
+     * Gets the cacheName attribute of the ICacheElement<K, V> object. The cacheName is also known as the
      * region name.
      *<p>
      * @return The cacheName value
@@ -47,7 +47,7 @@ public interface ICacheElementSerialized
      *<p>
      * @return The key value
      */
-    public Serializable getKey();
+    public K getKey();
 
     /**
      * Gets the value attribute of the ICacheElementSerialized object. This is the value the client
@@ -58,14 +58,14 @@ public interface ICacheElementSerialized
     public byte[] getSerializedValue();
 
     /**
-     * Gets the attributes attribute of the ICacheElement object
+     * Gets the attributes attribute of the ICacheElement<K, V> object
      *<p>
      * @return The attributes value
      */
     public IElementAttributes getElementAttributes();
 
     /**
-     * Sets the attributes attribute of the ICacheElement object
+     * Sets the attributes attribute of the ICacheElement<K, V> object
      *<p>
      * @param attr The new attributes value
      */

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java Mon Jan 16 21:05:44 2012
@@ -28,7 +28,7 @@ import org.apache.jcs.engine.stats.behav
  * Interface for a cache event queue. An event queue is used to propagate
  * ordered cache events to one and only one target listener.
  */
-public interface ICacheEventQueue
+public interface ICacheEventQueue<K extends Serializable, V extends Serializable>
 {
     /**
      * Initializes the queue.
@@ -40,9 +40,9 @@ public interface ICacheEventQueue
      * @param waitBeforeRetry
      * @param threadPoolName
      */
-    public void initialize( ICacheListener listener, long listenerId, String cacheName, int maxFailure,
+    public void initialize( ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure,
                             int waitBeforeRetry, String threadPoolName );
-    
+
     /**
      * Does not use a thread pool.
      */
@@ -52,7 +52,7 @@ public interface ICacheEventQueue
      * Uses a thread pool
      */
     public static final String POOLED_QUEUE_TYPE = "POOLED";
-    
+
 
     /**
      * Return the type of event queue we are using, either single or pooled.
@@ -68,7 +68,7 @@ public interface ICacheEventQueue
      *            The feature to be added to the PutEvent attribute
      * @throws IOException
      */
-    public void addPutEvent( ICacheElement ce )
+    public void addPutEvent( ICacheElement<K, V> ce )
         throws IOException;
 
     /**
@@ -79,7 +79,7 @@ public interface ICacheEventQueue
      *            The feature to be added to the RemoveEvent attribute
      * @throws IOException
      */
-    public void addRemoveEvent( Serializable key )
+    public void addRemoveEvent( K key )
         throws IOException;
 
     /**

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheListener.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheListener.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheListener.java Mon Jan 16 21:05:44 2012
@@ -28,7 +28,7 @@ import java.io.Serializable;
  * Note: objects which implement this interface are local listeners to cache changes, whereas
  * objects which implement IRmiCacheListener are remote listeners to cache changes.
  */
-public interface ICacheListener
+public interface ICacheListener<K extends Serializable, V extends Serializable>
 {
     /**
      * Notifies the subscribers for a cache entry update.
@@ -36,7 +36,7 @@ public interface ICacheListener
      * @param item
      * @throws IOException
      */
-    public void handlePut( ICacheElement item )
+    public void handlePut( ICacheElement<K, V> item )
         throws IOException;
 
     /**
@@ -46,7 +46,7 @@ public interface ICacheListener
      * @param key
      * @throws IOException
      */
-    public void handleRemove( String cacheName, Serializable key )
+    public void handleRemove( String cacheName, K key )
         throws IOException;
 
     /**

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheManager.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheManager.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheManager.java Mon Jan 16 21:05:44 2012
@@ -1,5 +1,7 @@
 package org.apache.jcs.engine.behavior;
 
+import java.io.Serializable;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,7 +22,7 @@ package org.apache.jcs.engine.behavior;
  */
 
 /**
- * Inteface implemented by a specific cache.
+ * Interface implemented by a specific cache.
  *
  */
 public interface ICacheManager
@@ -28,12 +30,12 @@ public interface ICacheManager
 {
 
     /**
-     * methods to get a cache region from a maanger
+     * methods to get a cache region from a manager
      * @param cacheName
      *
      * @return The cache value
      */
-    public ICache getCache( String cacheName );
+    public <K extends Serializable, V extends Serializable> ICache<K, V> getCache( String cacheName );
 
 }
 // end interface

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheObserver.java Mon Jan 16 21:05:44 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.engine.behavior;
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 
 /**
  * Used to register interest in receiving cache changes. <br>
@@ -40,7 +41,7 @@ public interface ICacheObserver
      *            object to notify for cache changes.
      * @throws IOException
      */
-    public void addCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     //, CacheNotFoundException;
@@ -52,7 +53,7 @@ public interface ICacheObserver
      *            object to notify for all cache changes.
      * @throws IOException
      */
-    public void addCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void addCacheListener( ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -63,7 +64,7 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public void removeCacheListener( String cacheName, ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
         throws IOException;
 
     /**
@@ -73,6 +74,6 @@ public interface ICacheObserver
      *            existing subscriber.
      * @throws IOException
      */
-    public void removeCacheListener( ICacheListener obj )
+    public <K extends Serializable, V extends Serializable> void removeCacheListener( ICacheListener<K, V> obj )
         throws IOException;
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheService.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheService.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheService.java Mon Jan 16 21:05:44 2012
@@ -33,7 +33,7 @@ import org.apache.jcs.access.exception.O
  * Note: server which implements this interface provides a local cache service, whereas server which
  * implements IRmiCacheService provides a remote cache service.
  */
-public interface ICacheService
+public interface ICacheService<K extends Serializable, V extends Serializable>
 {
     /**
      * Puts a cache item to the cache.
@@ -42,7 +42,7 @@ public interface ICacheService
      * @throws ObjectExistsException
      * @throws IOException
      */
-    void update( ICacheElement item )
+    void update( ICacheElement<K, V> item )
         throws ObjectExistsException, IOException;
 
     /**
@@ -50,11 +50,11 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param key
-     * @return the ICacheElement or null if not found
+     * @return the ICacheElement<K, V> or null if not found
      * @throws ObjectNotFoundException
      * @throws IOException
      */
-    ICacheElement get( String cacheName, Serializable key )
+    ICacheElement<K, V> get( String cacheName, K key )
         throws ObjectNotFoundException, IOException;
 
     /**
@@ -62,12 +62,12 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      * @throws ObjectNotFoundException
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
         throws ObjectNotFoundException, IOException;
 
     /**
@@ -75,11 +75,11 @@ public interface ICacheService
      * <p>
      * @param cacheName
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
         throws IOException;
 
     /**
@@ -89,11 +89,11 @@ public interface ICacheService
      * @param key
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
         throws IOException;
 
     /**
-     * Remove all keys from the sepcified cache.
+     * Remove all keys from the specified cache.
      * @param cacheName
      * @throws IOException
      */

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICacheServiceNonLocal.java Mon Jan 16 21:05:44 2012
@@ -32,8 +32,8 @@ import java.util.Set;
  * <p>
  * TODO consider not extending ICacheService
  */
-public interface ICacheServiceNonLocal
-    extends Remote, ICacheService
+public interface ICacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends Remote, ICacheService<K, V>
 {
     /**
      * Puts a cache item to the cache.
@@ -42,7 +42,7 @@ public interface ICacheServiceNonLocal
      * @param requesterId
      * @throws IOException
      */
-    void update( ICacheElement item, long requesterId )
+    void update( ICacheElement<K, V> item, long requesterId )
         throws IOException;
 
     /**
@@ -53,7 +53,7 @@ public interface ICacheServiceNonLocal
      * @param requesterId
      * @throws IOException
      */
-    void remove( String cacheName, Serializable key, long requesterId )
+    void remove( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -77,7 +77,7 @@ public interface ICacheServiceNonLocal
      * @return ICacheElement
      * @throws IOException
      */
-    ICacheElement get( String cacheName, Serializable key, long requesterId )
+    ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -86,11 +86,11 @@ public interface ICacheServiceNonLocal
      * @param cacheName
      * @param keys
      * @param requesterId
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
         throws IOException;
 
     /**
@@ -99,11 +99,11 @@ public interface ICacheServiceNonLocal
      * @param cacheName
      * @param pattern
      * @param requesterId
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache matching the pattern.
      * @throws IOException
      */
-    Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
+    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException;
 
     /**
@@ -114,6 +114,6 @@ public interface ICacheServiceNonLocal
      * @return A Set of keys
      * @throws IOException
      */
-    Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    Set<K> getGroupKeys( String cacheName, String groupName )
         throws IOException;
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/ICompositeCacheManager.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine.behavior;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Properties;
 
 import org.apache.jcs.engine.control.CompositeCache;
@@ -36,15 +37,15 @@ public interface ICompositeCacheManager
      * @param cacheName
      * @return CompositeCache
      */
-    CompositeCache getCache( String cacheName );
-    
+    <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( String cacheName );
+
     /**
      * This is exposed so other manager can get access to the props.
      * <p>
      * @return the configurationProperties
      */
     Properties getConfigurationProperties();
-    
+
     /**
      * Gets stats for debugging.
      * <p>

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/behavior/IElementSerializer.java Mon Jan 16 21:05:44 2012
@@ -36,7 +36,7 @@ public interface IElementSerializer
      * @return byte[]
      * @throws IOException
      */
-    public abstract byte[] serialize( Serializable obj )
+    <T extends Serializable> byte[] serialize( T obj )
         throws IOException;
 
     /**
@@ -46,6 +46,6 @@ public interface IElementSerializer
      * @throws IOException
      * @throws ClassNotFoundException thrown if we don't know the object.
      */
-    public abstract Object deSerialize( byte[] bytes )
+    <T extends Serializable> T deSerialize( byte[] bytes )
         throws IOException, ClassNotFoundException;
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCache.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCache.java Mon Jan 16 21:05:44 2012
@@ -34,7 +34,6 @@ import org.apache.jcs.access.exception.C
 import org.apache.jcs.access.exception.ObjectNotFoundException;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.engine.CacheConstants;
-import org.apache.jcs.engine.CacheElement;
 import org.apache.jcs.engine.behavior.ICache;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheType;
@@ -65,8 +64,8 @@ import org.apache.jcs.engine.stats.behav
  * <p>
  * This is the core of a JCS region. Hence, this simple class is the core of JCS.
  */
-public class CompositeCache
-    implements ICache, Serializable
+public class CompositeCache<K extends Serializable, V extends Serializable>
+    implements ICache<K, V>, Serializable
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -2838097410378294960L;
@@ -81,7 +80,7 @@ public class CompositeCache
     public IElementEventQueue elementEventQ;
 
     /** Auxiliary caches. */
-    private AuxiliaryCache[] auxCaches = new AuxiliaryCache[0];
+    private AuxiliaryCache<K, V>[] auxCaches = new AuxiliaryCache[0];
 
     /** is this alive? */
     private boolean alive = true;
@@ -120,10 +119,10 @@ public class CompositeCache
      * The cache hub can only have one memory cache. This could be made more flexible in the future,
      * but they are tied closely together. More than one doesn't make much sense.
      */
-    private MemoryCache memCache;
+    private MemoryCache<K, V> memCache;
 
     /** Key matcher used by the getMatching API */
-    protected IKeyMatcher keyMatcher = new KeyMatcherPatternImpl();
+    protected IKeyMatcher<K> keyMatcher = new KeyMatcherPatternImpl<K>();
 
     /**
      * Constructor for the Cache object
@@ -151,7 +150,7 @@ public class CompositeCache
      * <p>
      * @param auxCaches
      */
-    public void setAuxCaches( AuxiliaryCache[] auxCaches )
+    public void setAuxCaches( AuxiliaryCache<K, V>[] auxCaches )
     {
         this.auxCaches = auxCaches;
 
@@ -167,7 +166,7 @@ public class CompositeCache
      * @param ce
      * @exception IOException
      */
-    public void update( ICacheElement ce )
+    public void update( ICacheElement<K, V> ce )
         throws IOException
     {
         update( ce, false );
@@ -179,7 +178,7 @@ public class CompositeCache
      * @param ce
      * @exception IOException
      */
-    public void localUpdate( ICacheElement ce )
+    public void localUpdate( ICacheElement<K, V> ce )
         throws IOException
     {
         update( ce, true );
@@ -189,11 +188,11 @@ public class CompositeCache
      * Put an item into the cache. If it is localOnly, then do no notify remote or lateral
      * auxiliaries.
      * <p>
-     * @param cacheElement the ICacheElement
+     * @param cacheElement the ICacheElement<K, V>
      * @param localOnly Whether the operation should be restricted to local auxiliaries.
      * @exception IOException
      */
-    protected void update( ICacheElement cacheElement, boolean localOnly )
+    protected void update( ICacheElement<K, V> cacheElement, boolean localOnly )
         throws IOException
     {
 
@@ -240,7 +239,7 @@ public class CompositeCache
      * @param localOnly
      * @throws IOException
      */
-    protected void updateAuxiliaries( ICacheElement cacheElement, boolean localOnly )
+    protected void updateAuxiliaries( ICacheElement<K, V> cacheElement, boolean localOnly )
         throws IOException
     {
         // UPDATE AUXILLIARY CACHES
@@ -253,17 +252,17 @@ public class CompositeCache
         {
             if ( auxCaches.length > 0 )
             {
-                log.debug( "Updating auxilliary caches" );
+                log.debug( "Updating auxiliary caches" );
             }
             else
             {
-                log.debug( "No auxilliary cache to update" );
+                log.debug( "No auxiliary cache to update" );
             }
         }
 
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            ICache aux = auxCaches[i];
+            ICache<K, V> aux = auxCaches[i];
 
             if ( log.isDebugEnabled() )
             {
@@ -353,7 +352,7 @@ public class CompositeCache
      * <p>
      * @param ce The CacheElement
      */
-    public void spoolToDisk( ICacheElement ce )
+    public void spoolToDisk( ICacheElement<K, V> ce )
     {
         // if the item is not spoolable, return
         if ( !ce.getElementAttributes().getIsSpool() )
@@ -368,7 +367,7 @@ public class CompositeCache
         // SPOOL TO DISK.
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            ICache aux = auxCaches[i];
+            ICache<K, V> aux = auxCaches[i];
 
             if ( aux != null && aux.getCacheType() == ICache.DISK_CACHE )
             {
@@ -428,7 +427,7 @@ public class CompositeCache
      * @return element from the cache, or null if not present
      * @see org.apache.jcs.engine.behavior.ICache#get(java.io.Serializable)
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
     {
         return get( key, false );
     }
@@ -439,7 +438,7 @@ public class CompositeCache
      * @param key
      * @return ICacheElement
      */
-    public ICacheElement localGet( Serializable key )
+    public ICacheElement<K, V> localGet( K key )
     {
         return get( key, true );
     }
@@ -455,9 +454,9 @@ public class CompositeCache
      * @param localOnly
      * @return ICacheElement
      */
-    protected ICacheElement get( Serializable key, boolean localOnly )
+    protected ICacheElement<K, V> get( K key, boolean localOnly )
     {
-        ICacheElement element = null;
+        ICacheElement<K, V> element = null;
 
         boolean found = false;
 
@@ -507,7 +506,7 @@ public class CompositeCache
 
                 for ( int i = 0; i < auxCaches.length; i++ )
                 {
-                    AuxiliaryCache aux = auxCaches[i];
+                    AuxiliaryCache<K, V> aux = auxCaches[i];
 
                     if ( aux != null )
                     {
@@ -600,10 +599,10 @@ public class CompositeCache
      * Gets multiple items from the cache based on the given set of keys.
      * <p>
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      */
-    public Map<Serializable, ICacheElement> getMultiple( Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( Set<K> keys )
     {
         return getMultiple( keys, false );
     }
@@ -613,10 +612,10 @@ public class CompositeCache
      * laterally for this data.
      * <p>
      * @param keys
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any of these keys
      */
-    public Map<Serializable, ICacheElement> localGetMultiple( Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> localGetMultiple( Set<K> keys )
     {
         return getMultiple( keys, true );
     }
@@ -633,9 +632,9 @@ public class CompositeCache
      * @param localOnly
      * @return ICacheElement
      */
-    protected Map<Serializable, ICacheElement> getMultiple( Set<Serializable> keys, boolean localOnly )
+    protected Map<K, ICacheElement<K, V>> getMultiple( Set<K> keys, boolean localOnly )
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( log.isDebugEnabled() )
         {
@@ -650,7 +649,7 @@ public class CompositeCache
             // If fewer than all items were found in memory, then keep looking.
             if ( elements.size() != keys.size() )
             {
-                Set<Serializable> remainingKeys = pruneKeysFound( keys, elements );
+                Set<K> remainingKeys = pruneKeysFound( keys, elements );
                 elements.putAll( getMultipleFromAuxiliaryCaches( remainingKeys, localOnly ) );
             }
         }
@@ -680,16 +679,16 @@ public class CompositeCache
      * @return the elements found in the memory cache
      * @throws IOException
      */
-    private Map<Serializable, ICacheElement> getMultipleFromMemory( Set<Serializable> keys )
+    private Map<K, ICacheElement<K, V>> getMultipleFromMemory( Set<K> keys )
         throws IOException
     {
-        Map<Serializable, ICacheElement> elementsFromMemory = memCache.getMultiple( keys );
+        Map<K, ICacheElement<K, V>> elementsFromMemory = memCache.getMultiple( keys );
 
-        Iterator<ICacheElement> elementFromMemoryIterator = new HashMap<Serializable, ICacheElement>( elementsFromMemory ).values().iterator();
+        Iterator<ICacheElement<K, V>> elementFromMemoryIterator = new HashMap<K, ICacheElement<K, V>>( elementsFromMemory ).values().iterator();
 
         while ( elementFromMemoryIterator.hasNext() )
         {
-            ICacheElement element = elementFromMemoryIterator.next();
+            ICacheElement<K, V> element = elementFromMemoryIterator.next();
 
             if ( element != null )
             {
@@ -729,20 +728,20 @@ public class CompositeCache
      * @return the elements found in the auxiliary caches
      * @throws IOException
      */
-    private Map<Serializable, ICacheElement> getMultipleFromAuxiliaryCaches( Set<Serializable> keys, boolean localOnly )
+    private Map<K, ICacheElement<K, V>> getMultipleFromAuxiliaryCaches( Set<K> keys, boolean localOnly )
         throws IOException
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
-        Set<Serializable> remainingKeys = new HashSet<Serializable>( keys );
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
+        Set<K> remainingKeys = new HashSet<K>( keys );
 
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            AuxiliaryCache aux = auxCaches[i];
+            AuxiliaryCache<K, V> aux = auxCaches[i];
 
             if ( aux != null )
             {
-                Map<Serializable, ICacheElement> elementsFromAuxiliary =
-                    new HashMap<Serializable, ICacheElement>();
+                Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
+                    new HashMap<K, ICacheElement<K, V>>();
 
                 long cacheType = aux.getCacheType();
 
@@ -791,10 +790,10 @@ public class CompositeCache
      * Build a map of all the matching elements in all of the auxiliaries and memory.
      * <p>
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any matching keys
      */
-    public Map<Serializable, ICacheElement> getMatching( String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String pattern )
     {
         return getMatching( pattern, false );
     }
@@ -804,10 +803,10 @@ public class CompositeCache
      * go remote or laterally for this data.
      * <p>
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any matching keys
      */
-    public Map<Serializable, ICacheElement> localGetMatching( String pattern )
+    public Map<K, ICacheElement<K, V>> localGetMatching( String pattern )
     {
         return getMatching( pattern, true );
     }
@@ -822,12 +821,12 @@ public class CompositeCache
      * <p>
      * @param pattern
      * @param localOnly
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any matching keys
      */
-    protected Map<Serializable, ICacheElement> getMatching( String pattern, boolean localOnly )
+    protected Map<K, ICacheElement<K, V>> getMatching( String pattern, boolean localOnly )
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( log.isDebugEnabled() )
         {
@@ -855,18 +854,18 @@ public class CompositeCache
      * set. Returns a map: key -> result.
      * <p>
      * @param pattern
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any matching keys
      * @throws IOException
      */
-    protected Map<Serializable, ICacheElement> getMatchingFromMemory( String pattern )
+    protected Map<K, ICacheElement<K, V>> getMatchingFromMemory( String pattern )
         throws IOException
     {
         // find matches in key array
         // this avoids locking the memory cache, but it uses more memory
-        Object[] keyArray = memCache.getKeyArray();
+        K[] keyArray = memCache.getKeyArray();
 
-        Set<Serializable> matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
+        Set<K> matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
 
         // call get multiple
         return getMultipleFromMemory( matchingKeys );
@@ -880,23 +879,23 @@ public class CompositeCache
      * <p>
      * @param pattern
      * @param localOnly
-     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
      *         data in cache for any matching keys
      * @throws IOException
      */
-    private Map<Serializable, ICacheElement> getMatchingFromAuxiliaryCaches( String pattern, boolean localOnly )
+    private Map<K, ICacheElement<K, V>> getMatchingFromAuxiliaryCaches( String pattern, boolean localOnly )
         throws IOException
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         for ( int i = auxCaches.length - 1; i >= 0; i-- )
         {
-            AuxiliaryCache aux = auxCaches[i];
+            AuxiliaryCache<K, V> aux = auxCaches[i];
 
             if ( aux != null )
             {
-                Map<Serializable, ICacheElement> elementsFromAuxiliary =
-                    new HashMap<Serializable, ICacheElement>();
+                Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
+                    new HashMap<K, ICacheElement<K, V>>();
 
                 long cacheType = aux.getCacheType();
 
@@ -939,14 +938,14 @@ public class CompositeCache
      * @param elementsFromAuxiliary
      * @throws IOException
      */
-    private void processRetrievedElements( int i, Map<Serializable, ICacheElement> elementsFromAuxiliary )
+    private void processRetrievedElements( int i, Map<K, ICacheElement<K, V>> elementsFromAuxiliary )
         throws IOException
     {
-        Iterator<ICacheElement> elementFromAuxiliaryIterator = new HashMap<Serializable, ICacheElement>( elementsFromAuxiliary ).values().iterator();
+        Iterator<ICacheElement<K, V>> elementFromAuxiliaryIterator = new HashMap<K, ICacheElement<K, V>>( elementsFromAuxiliary ).values().iterator();
 
         while ( elementFromAuxiliaryIterator.hasNext() )
         {
-            ICacheElement element = elementFromAuxiliaryIterator.next();
+            ICacheElement<K, V> element = elementFromAuxiliaryIterator.next();
 
             // Item found in one of the auxiliary caches.
             if ( element != null )
@@ -991,7 +990,7 @@ public class CompositeCache
      * @param element
      * @throws IOException
      */
-    private void copyAuxiliaryRetrievedItemToMemory( ICacheElement element )
+    private void copyAuxiliaryRetrievedItemToMemory( ICacheElement<K, V> element )
         throws IOException
     {
         if ( memCache.getCacheAttributes().getMaxObjects() > 0 )
@@ -1015,11 +1014,11 @@ public class CompositeCache
      * @return the original set of cache keys, minus any cache keys present in the map keys of the
      *         foundElements map
      */
-    private Set<Serializable> pruneKeysFound( Set<Serializable> keys, Map<Serializable, ICacheElement> foundElements )
+    private Set<K> pruneKeysFound( Set<K> keys, Map<K, ICacheElement<K, V>> foundElements )
     {
-        Set<Serializable> remainingKeys = new HashSet<Serializable>( keys );
+        Set<K> remainingKeys = new HashSet<K>( keys );
 
-        for (Serializable key : foundElements.keySet())
+        for (K key : foundElements.keySet())
         {
             remainingKeys.remove( key );
         }
@@ -1033,7 +1032,7 @@ public class CompositeCache
      * @param element
      * @return true if the element is expired, else false.
      */
-    private boolean isExpired( ICacheElement element )
+    private boolean isExpired( ICacheElement<K, V> element )
     {
         try
         {
@@ -1096,13 +1095,13 @@ public class CompositeCache
      * @param group
      * @return A Set of keys, or null.
      */
-    public Set<Serializable> getGroupKeys( String group )
+    public Set<K> getGroupKeys( String group )
     {
-        HashSet<Serializable> allKeys = new HashSet<Serializable>();
+        HashSet<K> allKeys = new HashSet<K>();
         allKeys.addAll( memCache.getGroupKeys( group ) );
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            AuxiliaryCache aux = auxCaches[i];
+            AuxiliaryCache<K, V> aux = auxCaches[i];
             if ( aux != null )
             {
                 try
@@ -1125,7 +1124,7 @@ public class CompositeCache
      * @return true is it was removed
      * @see org.apache.jcs.engine.behavior.ICache#remove(java.io.Serializable)
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
     {
         return remove( key, false );
     }
@@ -1136,7 +1135,7 @@ public class CompositeCache
      * @param key
      * @return true if the item was already in the cache.
      */
-    public boolean localRemove( Serializable key )
+    public boolean localRemove( K key )
     {
         return remove( key, true );
     }
@@ -1158,7 +1157,7 @@ public class CompositeCache
      * @param localOnly
      * @return true if the item was in the cache, else false
      */
-    protected synchronized boolean remove( Serializable key, boolean localOnly )
+    protected synchronized boolean remove( K key, boolean localOnly )
     {
         // not thread safe, but just for debugging and testing.
         removeCount++;
@@ -1177,7 +1176,7 @@ public class CompositeCache
         // Removes from all auxiliary caches.
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            ICache aux = auxCaches[i];
+            ICache<K, V> aux = auxCaches[i];
 
             if ( aux == null )
             {
@@ -1265,7 +1264,7 @@ public class CompositeCache
         // Removes from all auxiliary disk caches.
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            ICache aux = auxCaches[i];
+            ICache<K, V> aux = auxCaches[i];
 
             if ( aux != null && ( aux.getCacheType() == ICache.DISK_CACHE || !localOnly ) )
             {
@@ -1322,7 +1321,7 @@ public class CompositeCache
         {
             try
             {
-                ICache aux = auxCaches[i];
+                ICache<K, V> aux = auxCaches[i];
 
                 // Skip this auxiliary if:
                 // - The auxiliary is null
@@ -1406,19 +1405,19 @@ public class CompositeCache
             {
                 try
                 {
-                    ICache aux = auxCaches[i];
+                    ICache<K, V> aux = auxCaches[i];
 
                     if ( aux.getStatus() == CacheConstants.STATUS_ALIVE )
                     {
 
-                        Iterator<Map.Entry<Serializable, MemoryElementDescriptor>> itr =
+                        Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr =
                             memCache.getIterator();
 
                         while (itr.hasNext())
                         {
-                            Map.Entry<Serializable, MemoryElementDescriptor> entry = itr.next();
+                            Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
 
-                            ICacheElement ce = entry.getValue().ce;
+                            ICacheElement<K, V> ce = entry.getValue().ce;
 
                             aux.update( ce );
                         }
@@ -1508,7 +1507,7 @@ public class CompositeCache
 
         for ( int i = 0; i < auxCaches.length; i++ )
         {
-            AuxiliaryCache aux = auxCaches[i];
+            AuxiliaryCache<K, V> aux = auxCaches[i];
             auxStats[i + 1] = aux.getStatistics();
         }
 
@@ -1583,10 +1582,10 @@ public class CompositeCache
      * @exception CacheException
      * @exception IOException
      */
-    public IElementAttributes getElementAttributes( Serializable key )
+    public IElementAttributes getElementAttributes( K key )
         throws CacheException, IOException
     {
-        CacheElement ce = (CacheElement) get( key );
+        ICacheElement<K, V> ce = get( key );
         if ( ce == null )
         {
             throw new ObjectNotFoundException( "key " + key + " is not found" );
@@ -1608,14 +1607,14 @@ public class CompositeCache
             try
             {
                 Class<?> c = Class.forName( cattr.getMemoryCacheName() );
-                memCache = (MemoryCache) c.newInstance();
+                memCache = (MemoryCache<K, V>) c.newInstance();
                 memCache.initialize( this );
             }
             catch ( Exception e )
             {
                 log.warn( "Failed to init mem cache, using: LRUMemoryCache", e );
 
-                this.memCache = new LRUMemoryCache();
+                this.memCache = new LRUMemoryCache<K, V>();
                 this.memCache.initialize( this );
             }
         }
@@ -1630,7 +1629,7 @@ public class CompositeCache
      * <p>
      * @return the MemoryCache implementation
      */
-    public MemoryCache getMemoryCache()
+    public MemoryCache<K, V> getMemoryCache()
     {
         return memCache;
     }
@@ -1681,7 +1680,7 @@ public class CompositeCache
      * @param ce
      * @param eventType
      */
-    private void handleElementEvent( ICacheElement ce, int eventType )
+    private void handleElementEvent( ICacheElement<K, V> ce, int eventType )
     {
         // handle event, might move to a new method
         ArrayList<IElementEventHandler> eventHandlers = ce.getElementAttributes().getElementEventHandlers();
@@ -1736,7 +1735,7 @@ public class CompositeCache
      * <p>
      * @param keyMatcher
      */
-    public void setKeyMatcher( IKeyMatcher keyMatcher )
+    public void setKeyMatcher( IKeyMatcher<K> keyMatcher )
     {
         if ( keyMatcher != null )
         {
@@ -1749,7 +1748,7 @@ public class CompositeCache
      * <p>
      * @return keyMatcher
      */
-    public IKeyMatcher getKeyMatcher()
+    public IKeyMatcher<K> getKeyMatcher()
     {
         return this.keyMatcher;
     }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Mon Jan 16 21:05:44 2012
@@ -21,6 +21,7 @@ package org.apache.jcs.engine.control;
 
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -216,7 +217,7 @@ public class CompositeCacheConfigurator
      *<p>
      * @param props
      */
-    protected void parseSystemRegions( Properties props )
+    protected <K extends Serializable, V extends Serializable> void parseSystemRegions( Properties props )
     {
         Enumeration<?> en = props.propertyNames();
         while ( en.hasMoreElements() )
@@ -226,13 +227,13 @@ public class CompositeCacheConfigurator
             {
                 String regionName = key.substring( SYSTEM_REGION_PREFIX.length() );
                 String value = OptionConverter.findAndSubst( key, props );
-                ICache cache;
+                ICache<K, V> cache;
                 synchronized ( regionName )
                 {
                     cache = parseRegion( props, regionName, value, null, SYSTEM_REGION_PREFIX );
                 }
                 compositeCacheManager.systemCaches.put( regionName, cache );
-                // to be availiable for remote reference they need to be here as
+                // to be available for remote reference they need to be here as
                 // well
                 compositeCacheManager.caches.put( regionName, cache );
             }
@@ -244,7 +245,7 @@ public class CompositeCacheConfigurator
      *<p>
      * @param props
      */
-    protected void parseRegions( Properties props )
+    protected <K extends Serializable, V extends Serializable> void parseRegions( Properties props )
     {
         List<String> regionNames = new ArrayList<String>();
 
@@ -259,7 +260,7 @@ public class CompositeCacheConfigurator
                 regionNames.add( regionName );
 
                 String auxiliaryList = OptionConverter.findAndSubst( key, props );
-                ICache cache;
+                ICache<K, V> cache;
                 synchronized ( regionName )
                 {
                     cache = parseRegion( props, regionName, auxiliaryList );
@@ -282,7 +283,8 @@ public class CompositeCacheConfigurator
      * @param value
      * @return CompositeCache
      */
-    protected CompositeCache parseRegion( Properties props, String regName, String value )
+    protected <K extends Serializable, V extends Serializable> CompositeCache<K, V> parseRegion(
+            Properties props, String regName, String value )
     {
         return parseRegion( props, regName, value, null, REGION_PREFIX );
     }
@@ -298,7 +300,8 @@ public class CompositeCacheConfigurator
      * @param cca
      * @return CompositeCache
      */
-    protected CompositeCache parseRegion( Properties props, String regName, String value, ICompositeCacheAttributes cca )
+    protected <K extends Serializable, V extends Serializable> CompositeCache<K, V> parseRegion(
+            Properties props, String regName, String value, ICompositeCacheAttributes cca )
     {
         return parseRegion( props, regName, value, cca, REGION_PREFIX );
     }
@@ -313,8 +316,9 @@ public class CompositeCacheConfigurator
      * @param regionPrefix
      * @return CompositeCache
      */
-    protected CompositeCache parseRegion( Properties props, String regName, String value,
-                                          ICompositeCacheAttributes cca, String regionPrefix )
+    protected <K extends Serializable, V extends Serializable> CompositeCache<K, V> parseRegion(
+            Properties props, String regName, String value,
+            ICompositeCacheAttributes cca, String regionPrefix )
     {
         // First, create or get the cache and element attributes, and create
         // the cache.
@@ -326,12 +330,12 @@ public class CompositeCacheConfigurator
 
         IElementAttributes ea = parseElementAttributes( props, regName, regionPrefix );
 
-        CompositeCache cache = new CompositeCache( regName, cca, ea );
+        CompositeCache<K, V> cache = new CompositeCache<K, V>( regName, cca, ea );
 
         if (value != null)
         {
             // Next, create the auxiliaries for the new cache
-            List<AuxiliaryCache> auxList = new ArrayList<AuxiliaryCache>();
+            List<AuxiliaryCache<K, V>> auxList = new ArrayList<AuxiliaryCache<K, V>>();
 
             if ( log.isDebugEnabled() )
             {
@@ -353,7 +357,7 @@ public class CompositeCacheConfigurator
                 }
             }
 
-            AuxiliaryCache auxCache;
+            AuxiliaryCache<K, V> auxCache;
             String auxName;
             while ( st.hasMoreTokens() )
             {
@@ -499,9 +503,9 @@ public class CompositeCacheConfigurator
      * @param regName the name of the region.
      * @return AuxiliaryCache
      */
-    protected AuxiliaryCache parseAuxiliary( CompositeCache cache, Properties props, String auxName, String regName )
+    protected <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> parseAuxiliary( CompositeCache<K, V> cache, Properties props, String auxName, String regName )
     {
-        AuxiliaryCache auxCache;
+        AuxiliaryCache<K, V> auxCache;
 
         if ( log.isDebugEnabled() )
         {
@@ -593,13 +597,13 @@ public class CompositeCacheConfigurator
      * @param auxPrefix - ex. AUXILIARY_PREFIX + auxName
      * @return IKeyMatcher
      */
-    public static IKeyMatcher parseKeyMatcher( Properties props, String auxPrefix )
+    public static <K extends Serializable> IKeyMatcher<K> parseKeyMatcher( Properties props, String auxPrefix )
     {
-        IKeyMatcher keyMatcher = null;
+        IKeyMatcher<K> keyMatcher = null;
 
         // auxFactory was not previously initialized.
         String keyMatcherClassName = auxPrefix + KEY_MATCHER_PREFIX;
-        keyMatcher = (IKeyMatcher) OptionConverter
+        keyMatcher = (IKeyMatcher<K>) OptionConverter
             .instantiateByKey( props, keyMatcherClassName,
                                IKeyMatcher.class, null );
         if ( keyMatcher != null )
@@ -615,7 +619,7 @@ public class CompositeCacheConfigurator
         else
         {
             // use the default standard serializer
-            keyMatcher = new KeyMatcherPatternImpl();
+            keyMatcher = new KeyMatcherPatternImpl<K>();
             if ( log.isInfoEnabled() )
             {
                 log.info( "Using standard key matcher [" + keyMatcher + "] for auxiliary [" + auxPrefix + "]" );

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Mon Jan 16 21:05:44 2012
@@ -70,10 +70,12 @@ public class CompositeCacheManager
     protected final static Log log = LogFactory.getLog( CompositeCacheManager.class );
 
     /** Caches managed by this cache manager */
-    protected Hashtable<String, ICache> caches = new Hashtable<String, ICache>();
+    protected Hashtable<String, ICache<? extends Serializable, ? extends Serializable>> caches =
+        new Hashtable<String, ICache<? extends Serializable, ? extends Serializable>>();
 
     /** Internal system caches for this cache manager */
-    protected Hashtable<String, ICache> systemCaches = new Hashtable<String, ICache>();
+    protected Hashtable<String, ICache<? extends Serializable, ? extends Serializable>> systemCaches =
+        new Hashtable<String, ICache<? extends Serializable, ? extends Serializable>>();
 
     /** Number of clients accessing this cache manager */
     private int clients;
@@ -107,7 +109,7 @@ public class CompositeCacheManager
     /** Should we use system property substitutions. */
     private static final boolean DEFAULT_USE_SYSTEM_PROPERTIES = true;
 
-    /** Once configured, you can force a recofiguration of sorts. */
+    /** Once configured, you can force a reconfiguration of sorts. */
     private static final boolean DEFAULT_FORCE_RECONFIGURATION = false;
 
     /** Those waiting for notification of a shutdown. */
@@ -453,7 +455,7 @@ public class CompositeCacheManager
      * @param cacheName
      * @return CompositeCache -- the cache region controller
      */
-    public CompositeCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( String cacheName )
     {
         return getCache( cacheName, this.defaultCacheAttr.copy() );
     }
@@ -465,7 +467,7 @@ public class CompositeCacheManager
      * @param cattr
      * @return CompositeCache
      */
-    public CompositeCache getCache( String cacheName, ICompositeCacheAttributes cattr )
+    public <K extends Serializable, V extends Serializable> CompositeCache<K, V> getCache( String cacheName, ICompositeCacheAttributes cattr )
     {
         cattr.setCacheName( cacheName );
         return getCache( cattr, this.defaultElementAttr );
@@ -479,7 +481,7 @@ public class CompositeCacheManager
      * @param attr
      * @return CompositeCache
      */
-    public CompositeCache getCache( String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr )
+    public <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr )
     {
         cattr.setCacheName( cacheName );
         return getCache( cattr, attr );
@@ -491,14 +493,14 @@ public class CompositeCacheManager
      * @param cattr
      * @return CompositeCache
      */
-    public CompositeCache getCache( ICompositeCacheAttributes cattr )
+    public <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( ICompositeCacheAttributes cattr )
     {
         return getCache( cattr, this.defaultElementAttr );
     }
 
     /**
      * If the cache has already been created, then the CacheAttributes and the element Attributes
-     * will be ignored. Currently there is no overiding the CacheAttributes once it is set up. You
+     * will be ignored. Currently there is no overriding the CacheAttributes once it is set up. You
      * can change the default ElementAttributes for a region later.
      * <p>
      * Overriding the default elemental attributes will require changing the way the attributes are
@@ -509,9 +511,10 @@ public class CompositeCacheManager
      * @param attr
      * @return CompositeCache
      */
-    public CompositeCache getCache( ICompositeCacheAttributes cattr, IElementAttributes attr )
+    @SuppressWarnings("unchecked")
+    public <K extends Serializable, V extends Serializable> CompositeCache<K, V>  getCache( ICompositeCacheAttributes cattr, IElementAttributes attr )
     {
-        CompositeCache cache;
+        CompositeCache<K, V> cache;
 
         if ( log.isDebugEnabled() )
         {
@@ -520,7 +523,7 @@ public class CompositeCacheManager
 
         synchronized ( caches )
         {
-            cache = (CompositeCache) caches.get( cattr.getCacheName() );
+            cache = (CompositeCache<K, V>) caches.get( cattr.getCacheName() );
             if ( cache == null )
             {
                 cattr.setCacheName( cattr.getCacheName() );
@@ -551,7 +554,7 @@ public class CompositeCacheManager
      */
     public void freeCache( String name, boolean fromRemote )
     {
-        CompositeCache cache = (CompositeCache) caches.remove( name );
+        CompositeCache<?, ?> cache = (CompositeCache<?, ?>) caches.remove( name );
 
         if ( cache != null )
         {
@@ -622,9 +625,9 @@ public class CompositeCacheManager
                 log.debug( "Last client called release. There are " + caches.size() + " caches which will be disposed" );
             }
 
-            for (ICache c : caches.values() )
+            for (ICache<?, ?> c : caches.values() )
             {
-                CompositeCache cache = (CompositeCache) c;
+                CompositeCache<?, ?> cache = (CompositeCache<?, ?>) c;
 
                 if ( cache != null )
                 {
@@ -732,9 +735,9 @@ public class CompositeCacheManager
     public ICacheStats[] getStatistics()
     {
         ArrayList<ICacheStats> cacheStats = new ArrayList<ICacheStats>();
-        for (ICache c :  caches.values())
+        for (ICache<?, ?> c :  caches.values())
         {
-            CompositeCache cache = (CompositeCache) c;
+            CompositeCache<?, ?> cache = (CompositeCache<?, ?>) c;
             if ( cache != null )
             {
                 cacheStats.add( cache.getStatistics() );

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java Mon Jan 16 21:05:44 2012
@@ -24,7 +24,7 @@ import java.io.Serializable;
 /**
  * Description of the Class
  */
-public class GroupAttrName
+public class GroupAttrName<T extends Serializable>
     implements Serializable
 {
     /** Don't change */
@@ -34,7 +34,7 @@ public class GroupAttrName
     public final GroupId groupId;
 
     /** the name of the attribute */
-    public final Object attrName;
+    public final T attrName;
 
     /** Cached toString value */
     private String toString;
@@ -44,7 +44,7 @@ public class GroupAttrName
      * @param groupId
      * @param attrName
      */
-    public GroupAttrName( GroupId groupId, Object attrName )
+    public GroupAttrName( GroupId groupId, T attrName )
     {
         this.groupId = groupId;
         this.attrName = attrName;
@@ -67,7 +67,7 @@ public class GroupAttrName
         {
             return false;
         }
-        GroupAttrName to = (GroupAttrName) obj;
+        GroupAttrName<?> to = (GroupAttrName<?>) obj;
         return groupId.equals( to.groupId ) && attrName.equals( to.attrName );
     }
 

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEvent.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEvent.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEvent.java Mon Jan 16 21:05:44 2012
@@ -6,29 +6,29 @@ import org.apache.commons.lang3.builder.
 import org.apache.jcs.engine.logging.behavior.ICacheEvent;
 
 /** It's returned from create and passed into log. */
-public class CacheEvent
-    implements ICacheEvent
+public class CacheEvent<K extends Serializable>
+    implements ICacheEvent<K>
 {
     /** Don't change. */
     private static final long serialVersionUID = -5913139566421714330L;
-    
+
     /** The time at which this object was created. */
-    private long createTime = System.currentTimeMillis();
-    
+    private final long createTime = System.currentTimeMillis();
+
     /** The auxiliary or other source of the event. */
     private String source;
-    
+
     /** The cache region */
     private String region;
-    
+
     /** The event name: update, get, remove, etc. */
     private String eventName;
-    
+
     /** disk location, ip, etc. */
     private String optionalDetails;
-    
+
     /** The key that was put or retrieved. */
-    private Serializable key;
+    private K key;
 
     /**
      * @param source the source to set
@@ -97,7 +97,7 @@ public class CacheEvent
     /**
      * @param key the key to set
      */
-    public void setKey( Serializable key )
+    public void setKey( K key )
     {
         this.key = key;
     }
@@ -105,11 +105,11 @@ public class CacheEvent
     /**
      * @return the key
      */
-    public Serializable getKey()
+    public K getKey()
     {
         return key;
     }
-    
+
     /**
      * The time at which this object was created.
      * <p>
@@ -119,8 +119,8 @@ public class CacheEvent
     {
         return createTime;
     }
-    
-    /** 
+
+    /**
      * @return reflection toString
      */
     public String toString()

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java Mon Jan 16 21:05:44 2012
@@ -28,10 +28,10 @@ public class CacheEventLoggerDebugLogger
      * @param key
      * @return ICacheEvent
      */
-    public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
-                                          Serializable key )
+    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region, String eventName,
+            String optionalDetails, T key )
     {
-        ICacheEvent event = new CacheEvent();
+        ICacheEvent<T> event = new CacheEvent<T>();
         event.setSource( source );
         event.setRegion( region );
         event.setEventName( eventName );
@@ -70,7 +70,7 @@ public class CacheEventLoggerDebugLogger
     /**
      * @param event
      */
-    public void logICacheEvent( ICacheEvent event )
+    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
     {
         if ( log.isDebugEnabled() )
         {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java Mon Jan 16 21:05:44 2012
@@ -3,7 +3,7 @@ package org.apache.jcs.engine.logging.be
 import java.io.Serializable;
 
 /** Defines the common fields required by a cache event. */
-public interface ICacheEvent
+public interface ICacheEvent<K extends Serializable>
     extends Serializable
 {
     /**
@@ -49,10 +49,10 @@ public interface ICacheEvent
     /**
      * @param key the key to set
      */
-    public void setKey( Serializable key );
+    public void setKey( K key );
 
     /**
      * @return the key
      */
-    public Serializable getKey();
+    public K getKey();
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java Mon Jan 16 21:05:44 2012
@@ -44,15 +44,15 @@ public interface ICacheEventLogger
      * @param key - the cache key
      * @return ICacheEvent
      */
-    ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
-                                   Serializable key );
+    <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region,
+            String eventName, String optionalDetails, T key );
 
     /**
      * Logs an event.
      * <p>
      * @param event - the event created in createICacheEvent
      */
-    void logICacheEvent( ICacheEvent event );
+    <T extends Serializable> void logICacheEvent( ICacheEvent<T> event );
 
     /**
      * Logs an event. These are internal application events that do not correspond to ICache calls.

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/KeyMatcherPatternImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/KeyMatcherPatternImpl.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/KeyMatcherPatternImpl.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/KeyMatcherPatternImpl.java Mon Jan 16 21:05:44 2012
@@ -9,9 +9,12 @@ import java.util.regex.Pattern;
 import org.apache.jcs.engine.match.behavior.IKeyMatcher;
 
 /** This implementation of the KeyMatcher uses standard Java Pattern matching. */
-public class KeyMatcherPatternImpl
-    implements IKeyMatcher
+public class KeyMatcherPatternImpl<K extends Serializable>
+    implements IKeyMatcher<K>
 {
+    /** TODO serialVersionUID */
+    private static final long serialVersionUID = 6667352064144381264L;
+
     /**
      * Creates a pattern and find matches on the array.
      * <p>
@@ -19,26 +22,26 @@ public class KeyMatcherPatternImpl
      * @param keyArray
      * @return Set of the matching keys
      */
-    public Set<Serializable> getMatchingKeysFromArray( String pattern, Object[] keyArray )
+    public Set<K> getMatchingKeysFromArray( String pattern, K[] keyArray )
     {
         Pattern compiledPattern = Pattern.compile( pattern );
 
-        Set<Serializable> matchingKeys = new HashSet<Serializable>();
+        Set<K> matchingKeys = new HashSet<K>();
 
         // Look for matches
-        for ( int i = 0; i < keyArray.length; i++ )
+        for (K key : keyArray)
         {
-            Object key = keyArray[i];
             // TODO we might want to match on the toString.
             if ( key instanceof String )
             {
                 Matcher matcher = compiledPattern.matcher( (String) key );
                 if ( matcher.matches() )
                 {
-                    matchingKeys.add( (Serializable) key );
+                    matchingKeys.add( key );
                 }
             }
         }
+
         return matchingKeys;
     }
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java Mon Jan 16 21:05:44 2012
@@ -4,7 +4,7 @@ import java.io.Serializable;
 import java.util.Set;
 
 /** Key matchers need to implement this interface. */
-public interface IKeyMatcher extends Serializable
+public interface IKeyMatcher<K extends Serializable> extends Serializable
 {
     /**
      * Creates a pattern and find matches on the array.
@@ -13,5 +13,5 @@ public interface IKeyMatcher extends Ser
      * @param keyArray
      * @return Set of the matching keys
      */
-    Set<Serializable> getMatchingKeysFromArray( String pattern, Object[] keyArray );
+    Set<K> getMatchingKeysFromArray( String pattern, K[] keyArray );
 }