commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1232163 [4/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...
Date Mon, 16 Jan 2012 21:05:50 GMT
Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java Mon Jan 16 21:05:44 2012
@@ -46,9 +46,9 @@ import org.apache.jcs.engine.stats.Stats
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
 
-/** An abstract base for the No Wait Facade.  Different implmentations will failover differently. */
-public abstract class AbstractRemoteCacheNoWaitFacade
-    extends AbstractAuxiliaryCache
+/** An abstract base for the No Wait Facade.  Different implementations will failover differently. */
+public abstract class AbstractRemoteCacheNoWaitFacade<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -4529970797620747110L;
@@ -57,7 +57,7 @@ public abstract class AbstractRemoteCach
     private final static Log log = LogFactory.getLog( AbstractRemoteCacheNoWaitFacade.class );
 
     /** The connection to a remote server, or a zombie. */
-    public RemoteCacheNoWait[] noWaits;
+    public RemoteCacheNoWait<K, V>[] noWaits;
 
     /** The cache name */
     private final String cacheName;
@@ -77,7 +77,7 @@ public abstract class AbstractRemoteCach
      * @param cacheEventLogger
      * @param elementSerializer
      */
-    public AbstractRemoteCacheNoWaitFacade( RemoteCacheNoWait[] noWaits, RemoteCacheAttributes rca,
+    public AbstractRemoteCacheNoWaitFacade( RemoteCacheNoWait<K, V>[] noWaits, RemoteCacheAttributes rca,
                                     ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
                                     IElementSerializer elementSerializer )
     {
@@ -99,7 +99,7 @@ public abstract class AbstractRemoteCach
      * @param ce
      * @throws IOException
      */
-    public void update( ICacheElement ce )
+    public void update( ICacheElement<K, V> ce )
         throws IOException
     {
         if ( log.isDebugEnabled() )
@@ -148,21 +148,21 @@ public abstract class AbstractRemoteCach
      * Synchronously reads from the remote cache.
      * <p>
      * @param key
-     * @return Either an ICacheElement or null if it is not found.
+     * @return Either an ICacheElement<K, V> or null if it is not found.
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
     {
         for ( int i = 0; i < noWaits.length; i++ )
         {
             try
             {
-                Object obj = noWaits[i].get( key );
+                ICacheElement<K, V> obj = noWaits[i].get( key );
                 if ( obj != null )
                 {
-                    return (ICacheElement) obj;
+                    return obj;
                 }
             }
-            catch ( Exception ex )
+            catch ( IOException ex )
             {
                 log.debug( "Failed to get." );
                 return null;
@@ -178,7 +178,7 @@ public abstract class AbstractRemoteCach
      * @return map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String pattern )
         throws IOException
     {
         for ( int i = 0; i < noWaits.length; i++ )
@@ -199,10 +199,10 @@ public abstract class AbstractRemoteCach
      * 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 )
     {
         if ( keys != null && !keys.isEmpty() )
         {
@@ -218,6 +218,7 @@ public abstract class AbstractRemoteCach
                 }
             }
         }
+
         return Collections.emptyMap();
     }
 
@@ -228,13 +229,13 @@ public abstract class AbstractRemoteCach
      * @return the set of keys of objects currently in the group
      * @throws IOException
      */
-    public Set<Serializable> getGroupKeys( String group )
+    public Set<K> getGroupKeys( String group )
         throws IOException
     {
-        HashSet<Serializable> allKeys = new HashSet<Serializable>();
+        HashSet<K> allKeys = new HashSet<K>();
         for ( int i = 0; i < noWaits.length; i++ )
         {
-            AuxiliaryCache aux = noWaits[i];
+            AuxiliaryCache<K, V> aux = noWaits[i];
             if ( aux != null )
             {
                 allKeys.addAll( aux.getGroupKeys( group ) );
@@ -249,7 +250,7 @@ public abstract class AbstractRemoteCach
      * @param key
      * @return whether or not it was removed, right now it return false.
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
     {
         try
         {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java Mon Jan 16 21:05:44 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.remote;
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -40,8 +41,8 @@ import org.apache.jcs.engine.stats.behav
  * This handles gets, updates, and removes. It also initiates failover recovery when an error is
  * encountered.
  */
-public class RemoteCache
-    extends AbstractRemoteAuxiliaryCache
+public class RemoteCache<K extends Serializable, V extends Serializable>
+    extends AbstractRemoteAuxiliaryCache<K, V>
 {
     /** Don't change. */
     private static final long serialVersionUID = -5329231850422826460L;
@@ -59,7 +60,7 @@ public class RemoteCache
      * @param remote
      * @param listener
      */
-    public RemoteCache( IRemoteCacheAttributes cattr, IRemoteCacheService remote, IRemoteCacheListener listener )
+    public RemoteCache( IRemoteCacheAttributes cattr, IRemoteCacheService<K, V> remote, IRemoteCacheListener<K, V> listener )
     {
         super( cattr, remote, listener );
 
@@ -130,7 +131,7 @@ public class RemoteCache
         if ( getRemoteCacheService() == null || !( getRemoteCacheService() instanceof ZombieRemoteCacheService ) )
         {
             // TODO make configurable
-            setRemoteCacheService( new ZombieRemoteCacheService( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+            setRemoteCacheService( new ZombieRemoteCacheService<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
         }
         // may want to flush if region specifies
         // Notify the cache monitor about the error, and kick off the recovery
@@ -138,7 +139,7 @@ public class RemoteCache
         RemoteCacheMonitor.getInstance().notifyError();
 
         // initiate failover if local
-        RemoteCacheNoWaitFacade rcnwf = (RemoteCacheNoWaitFacade) RemoteCacheFactory.getFacades()
+        RemoteCacheNoWaitFacade<K, V> rcnwf = (RemoteCacheNoWaitFacade<K, V>)RemoteCacheFactory.getFacades()
             .get( getRemoteCacheAttributes().getCacheName() );
 
         if ( log.isDebugEnabled() )

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.remote;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.StringTokenizer;
@@ -49,8 +50,8 @@ public class RemoteCacheFactory
     private String name;
 
     /** store reference of facades to initiate failover */
-    private final static HashMap<String, RemoteCacheNoWaitFacade> facades =
-        new HashMap<String, RemoteCacheNoWaitFacade>();
+    private final static HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> facades =
+        new HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>>();
 
     /**
      * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
@@ -65,12 +66,13 @@ public class RemoteCacheFactory
      * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
-                                       ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache(
+            AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
+           ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         RemoteCacheAttributes rca = (RemoteCacheAttributes) iaca;
 
-        ArrayList<ICache> noWaits = new ArrayList<ICache>();
+        ArrayList<ICache<K, V>> noWaits = new ArrayList<ICache<K, V>>();
 
         // if LOCAL
         if ( rca.getRemoteType() == RemoteCacheAttributes.LOCAL )
@@ -90,7 +92,7 @@ public class RemoteCacheFactory
 
                 RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger,
                                                                          elementSerializer );
-                ICache ic = rcm.getCache( rca );
+                ICache<K, V> ic = rcm.getCache( rca );
                 if ( ic != null )
                 {
                     noWaits.add( ic );
@@ -122,7 +124,7 @@ public class RemoteCacheFactory
                     // number it is at
                     if ( ( !primayDefined && fCnt == 1 ) || noWaits.size() <= 0 )
                     {
-                        ICache ic = rcm.getCache( rca );
+                        ICache<K, V> ic = rcm.getCache( rca );
                         if ( ic != null )
                         {
                             noWaits.add( ic );
@@ -155,7 +157,7 @@ public class RemoteCacheFactory
                 RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger,
                                                                          elementSerializer );
                 rca.setRemoteType( RemoteCacheAttributes.CLUSTER );
-                ICache ic = rcm.getCache( rca );
+                ICache<K, V> ic = rcm.getCache( rca );
                 if ( ic != null )
                 {
                     noWaits.add( ic );
@@ -169,7 +171,7 @@ public class RemoteCacheFactory
         }
         // end if CLUSTER
 
-        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( noWaits
+        RemoteCacheNoWaitFacade<K, V> rcnwf = new RemoteCacheNoWaitFacade<K, V>( noWaits
             .toArray( new RemoteCacheNoWait[0] ), rca, cacheMgr, cacheEventLogger, elementSerializer );
 
         getFacades().put( rca.getCacheName(), rcnwf );
@@ -201,7 +203,7 @@ public class RemoteCacheFactory
      * The facades are what the cache hub talks to.
      * @return Returns the facades.
      */
-    public static HashMap<String, RemoteCacheNoWaitFacade> getFacades()
+    public static HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> getFacades()
     {
         return facades;
     }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java Mon Jan 16 21:05:44 2012
@@ -38,9 +38,9 @@ import org.apache.jcs.engine.behavior.IC
  * One listener is used per remote cache server. The same listener is used for all the regions that
  * talk to a particular server.
  */
-public class RemoteCacheListener
-    extends AbsractRemoteCacheListener
-    implements IRemoteCacheConstants, Serializable, IRemoteCacheListener
+public class RemoteCacheListener<K extends Serializable, V extends Serializable>
+    extends AbsractRemoteCacheListener<K, V>
+    implements IRemoteCacheConstants, Serializable, IRemoteCacheListener<K, V>
 {
     /** Don't change */
     private static final long serialVersionUID = 25345252345322345L;

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Mon Jan 16 21:05:44 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.remote;
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.rmi.Naming;
 import java.rmi.registry.Registry;
 import java.util.HashMap;
@@ -68,7 +69,8 @@ public class RemoteCacheManager
     private int clients;
 
     /** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
-    final Map<String, RemoteCacheNoWait> caches = new HashMap<String, RemoteCacheNoWait>();
+    final Map<String, RemoteCacheNoWait<? extends Serializable, ? extends Serializable>> caches =
+        new HashMap<String, RemoteCacheNoWait<? extends Serializable, ? extends Serializable>>();
 
     /** The remote host */
     final String host;
@@ -89,7 +91,7 @@ public class RemoteCacheManager
     private final IElementSerializer elementSerializer;
 
     /** Handle to the remote cache service; or a zombie handle if failed to connect. */
-    private IRemoteCacheService remoteService;
+    private IRemoteCacheService<?, ?> remoteService;
 
     /**
      * Wrapper of the remote cache watch service; or wrapper of a zombie service if failed to
@@ -146,7 +148,7 @@ public class RemoteCacheManager
             }
 
             // Successful connection to the remote server.
-            remoteService = (IRemoteCacheService) obj;
+            remoteService = (IRemoteCacheService<?, ?>) obj;
             if ( log.isDebugEnabled() )
             {
                 log.debug( "remoteService = " + remoteService );
@@ -161,7 +163,7 @@ public class RemoteCacheManager
             // Configure this RemoteCacheManager instance to use the "zombie"
             // services.
             log.error( "Problem finding server at [" + registry + "]", ex );
-            remoteService = new ZombieRemoteCacheService();
+            remoteService = new ZombieRemoteCacheService<String, String>();
             remoteWatch = new RemoteCacheWatchRepairable();
             remoteWatch.setCacheWatch( new ZombieRemoteCacheWatch() );
 
@@ -188,7 +190,7 @@ public class RemoteCacheManager
      * @param listener The feature to be added to the RemoteCacheListener attribute
      * @throws IOException
      */
-    public void addRemoteCacheListener( IRemoteCacheAttributes cattr, IRemoteCacheListener listener )
+    public <K extends Serializable, V extends Serializable> void addRemoteCacheListener( IRemoteCacheAttributes cattr, IRemoteCacheListener<K, V> listener )
         throws IOException
     {
         if ( cattr.isReceive() )
@@ -225,7 +227,7 @@ public class RemoteCacheManager
      * @param listener
      * @throws IOException
      */
-    public void removeRemoteCacheListener( IRemoteCacheAttributes cattr, IRemoteCacheListener listener )
+    public <K extends Serializable, V extends Serializable> void removeRemoteCacheListener( IRemoteCacheAttributes cattr, IRemoteCacheListener<K, V> listener )
         throws IOException
     {
         synchronized ( caches )
@@ -245,16 +247,16 @@ public class RemoteCacheManager
     {
         synchronized ( caches )
         {
-            RemoteCacheNoWait cache = caches.get( cattr.getCacheName() );
+            RemoteCacheNoWait<?, ?> cache = caches.get( cattr.getCacheName() );
             if ( cache != null )
             {
-                IRemoteCacheClient rc = cache.getRemoteCache();
+                IRemoteCacheClient<?, ?> rc = cache.getRemoteCache();
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Found cache for[ " + cattr.getCacheName() + "], deregistering listener." );
                 }
                 // could also store the listener for a server in the manager.
-                IRemoteCacheListener listener = rc.getListener();
+                IRemoteCacheListener<?, ?> listener = rc.getListener();
                 remoteWatch.removeCacheListener( cattr.getCacheName(), listener );
             }
             else
@@ -286,16 +288,16 @@ public class RemoteCacheManager
     {
         synchronized ( caches )
         {
-            RemoteCacheNoWait cache = caches.get( cacheName );
+            RemoteCacheNoWait<?, ?> cache = caches.get( cacheName );
             if ( cache != null )
             {
-                IRemoteCacheClient rc = cache.getRemoteCache();
+                IRemoteCacheClient<?, ?> rc = cache.getRemoteCache();
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Found cache for [" + cacheName + "], deregistering listener." );
                 }
                 // could also store the listener for a server in the manager.
-                IRemoteCacheListener listener = rc.getListener();
+                IRemoteCacheListener<?, ?> listener = rc.getListener();
                 remoteWatch.removeCacheListener( cacheName, listener );
             }
         }
@@ -370,7 +372,7 @@ public class RemoteCacheManager
      * @param cacheName
      * @return The cache value
      */
-    public AuxiliaryCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName )
     {
         IRemoteCacheAttributes ca = (IRemoteCacheAttributes) remoteCacheAttributes.copy();
         ca.setCacheName( cacheName );
@@ -387,21 +389,21 @@ public class RemoteCacheManager
      * @param cattr
      * @return The cache value
      */
-    public AuxiliaryCache getCache( IRemoteCacheAttributes cattr )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( IRemoteCacheAttributes cattr )
     {
-        RemoteCacheNoWait remoteCacheNoWait = null;
+        RemoteCacheNoWait<K, V> remoteCacheNoWait = null;
 
         synchronized ( caches )
         {
-            remoteCacheNoWait = caches.get( cattr.getCacheName() );
+            remoteCacheNoWait = (RemoteCacheNoWait<K, V>) caches.get( cattr.getCacheName() );
             if ( remoteCacheNoWait == null )
             {
                 // create a listener first and pass it to the remotecache
                 // sender.
-                RemoteCacheListener listener = null;
+                RemoteCacheListener<K, V> listener = null;
                 try
                 {
-                    listener = new RemoteCacheListener( cattr, cacheMgr );
+                    listener = new RemoteCacheListener<K, V>( cattr, cacheMgr );
                     addRemoteCacheListener( cattr, listener );
                 }
                 catch ( IOException ioe )
@@ -415,11 +417,11 @@ public class RemoteCacheManager
                         + listener, e );
                 }
 
-                IRemoteCacheClient remoteCacheClient = new RemoteCache( cattr, remoteService, listener );
+                IRemoteCacheClient<K, V> remoteCacheClient = new RemoteCache<K, V>( cattr, (IRemoteCacheService<K, V>) remoteService, listener );
                 remoteCacheClient.setCacheEventLogger( cacheEventLogger );
                 remoteCacheClient.setElementSerializer( elementSerializer );
 
-                remoteCacheNoWait = new RemoteCacheNoWait( remoteCacheClient );
+                remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
                 remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
                 remoteCacheNoWait.setElementSerializer( elementSerializer );
 
@@ -445,7 +447,7 @@ public class RemoteCacheManager
         {
             log.info( "freeCache [" + name + "]" );
         }
-        ICache c = null;
+        ICache<?, ?> c = null;
         synchronized ( caches )
         {
             c = caches.get( name );
@@ -465,7 +467,7 @@ public class RemoteCacheManager
     public String getStats()
     {
         StringBuffer stats = new StringBuffer();
-        for (RemoteCacheNoWait c : caches.values())
+        for (RemoteCacheNoWait<?, ?> c : caches.values())
         {
             if ( c != null )
             {
@@ -485,7 +487,7 @@ public class RemoteCacheManager
         }
         synchronized ( caches )
         {
-            for (RemoteCacheNoWait c : caches.values())
+            for (RemoteCacheNoWait<?, ?> c : caches.values())
             {
                 if ( c != null )
                 {
@@ -509,7 +511,7 @@ public class RemoteCacheManager
      * @param remoteService
      * @param remoteWatch
      */
-    public void fixCaches( IRemoteCacheService remoteService, IRemoteCacheObserver remoteWatch )
+    public void fixCaches( IRemoteCacheService<?, ?> remoteService, IRemoteCacheObserver remoteWatch )
     {
         if ( log.isInfoEnabled() )
         {
@@ -519,7 +521,7 @@ public class RemoteCacheManager
         {
             this.remoteService = remoteService;
             this.remoteWatch.setCacheWatch( remoteWatch );
-            for (RemoteCacheNoWait c : caches.values())
+            for (RemoteCacheNoWait<?, ?> c : caches.values())
             {
                 c.fixCache( this.remoteService );
             }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java Mon Jan 16 21:05:44 2012
@@ -67,8 +67,8 @@ import org.apache.jcs.engine.stats.behav
  * again. This is a better long term solution, but it requires some significant changes to the
  * complicated worker queues.
  */
-public class RemoteCacheNoWait
-    extends AbstractAuxiliaryCache
+public class RemoteCacheNoWait<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -3104089136003714717L;
@@ -77,10 +77,10 @@ public class RemoteCacheNoWait
     private final static Log log = LogFactory.getLog( RemoteCacheNoWait.class );
 
     /** The remote cache client */
-    private final IRemoteCacheClient remoteCacheClient;
+    private final IRemoteCacheClient<K, V> remoteCacheClient;
 
     /** Event queue for queueing up calls like put and remove. */
-    private ICacheEventQueue cacheEventQueue;
+    private ICacheEventQueue<K, V> cacheEventQueue;
 
     /** how many times get has been called. */
     private int getCount = 0;
@@ -103,12 +103,12 @@ public class RemoteCacheNoWait
      * <p>
      * @param cache
      */
-    public RemoteCacheNoWait( IRemoteCacheClient cache )
+    public RemoteCacheNoWait( IRemoteCacheClient<K, V> cache )
     {
         remoteCacheClient = cache;
 
-        CacheEventQueueFactory factory = new CacheEventQueueFactory();
-        this.cacheEventQueue = factory.createCacheEventQueue( new CacheAdaptor( remoteCacheClient ), remoteCacheClient
+        CacheEventQueueFactory<K, V> factory = new CacheEventQueueFactory<K, V>();
+        this.cacheEventQueue = factory.createCacheEventQueue( new CacheAdaptor<K, V>( remoteCacheClient ), remoteCacheClient
             .getListenerId(), remoteCacheClient.getCacheName(), remoteCacheClient.getAuxiliaryCacheAttributes()
             .getEventQueuePoolName(), remoteCacheClient.getAuxiliaryCacheAttributes().getEventQueueType() );
 
@@ -124,7 +124,7 @@ public class RemoteCacheNoWait
      * @param element
      * @throws IOException
      */
-    public void update( ICacheElement element )
+    public void update( ICacheElement<K, V> element )
         throws IOException
     {
         putCount++;
@@ -147,7 +147,7 @@ public class RemoteCacheNoWait
      * @return element from the remote cache, or null if not present
      * @throws IOException
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
         throws IOException
     {
         getCount++;
@@ -191,7 +191,7 @@ public class RemoteCacheNoWait
      * @throws IOException
      *
      */
-    public Map<Serializable, ICacheElement> getMatching( String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String pattern )
         throws IOException
     {
         getMatchingCount++;
@@ -234,11 +234,11 @@ public class RemoteCacheNoWait
      * request on to the server rather than looping through the requested 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
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMultiple( Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( Set<K> keys )
         throws IOException
     {
         getMultipleCount++;
@@ -273,7 +273,7 @@ public class RemoteCacheNoWait
             throw ex;
         }
 
-        return new HashMap<Serializable, ICacheElement>();
+        return new HashMap<K, ICacheElement<K, V>>();
     }
 
     /**
@@ -281,7 +281,7 @@ public class RemoteCacheNoWait
      * @return the keys for the group name
      * @throws IOException
      */
-    public Set<Serializable> getGroupKeys( String groupName )
+    public Set<K> getGroupKeys( String groupName )
         throws IOException
     {
         return remoteCacheClient.getGroupKeys( groupName );
@@ -294,7 +294,7 @@ public class RemoteCacheNoWait
      * @return if this was successful
      * @throws IOException
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
         throws IOException
     {
         removeCount++;
@@ -392,7 +392,7 @@ public class RemoteCacheNoWait
      * <p>
      * @param remote
      */
-    public void fixCache( IRemoteCacheService remote )
+    public void fixCache( IRemoteCacheService<K, V> remote )
     {
         remoteCacheClient.fixCache( remote );
         resetEventQ();
@@ -407,10 +407,10 @@ public class RemoteCacheNoWait
      */
     public void resetEventQ()
     {
-        ICacheEventQueue previousQueue = cacheEventQueue;
+        ICacheEventQueue<K, V> previousQueue = cacheEventQueue;
 
-        CacheEventQueueFactory fact = new CacheEventQueueFactory();
-        this.cacheEventQueue = fact.createCacheEventQueue( new CacheAdaptor( remoteCacheClient ), remoteCacheClient
+        CacheEventQueueFactory<K, V> fact = new CacheEventQueueFactory<K, V>();
+        this.cacheEventQueue = fact.createCacheEventQueue( new CacheAdaptor<K, V>( remoteCacheClient ), remoteCacheClient
             .getListenerId(), remoteCacheClient.getCacheName(), remoteCacheClient.getAuxiliaryCacheAttributes()
             .getEventQueuePoolName(), remoteCacheClient.getAuxiliaryCacheAttributes().getEventQueueType() );
 
@@ -430,7 +430,7 @@ public class RemoteCacheNoWait
      * <p>
      * @return the instance of the remote cache client used by this object
      */
-    protected IRemoteCacheClient getRemoteCache()
+    protected IRemoteCacheClient<K, V> getRemoteCache()
     {
         return remoteCacheClient;
     }
@@ -448,7 +448,7 @@ public class RemoteCacheNoWait
      * <p>
      * @return ICacheEventQueue
      */
-    protected ICacheEventQueue getCacheEventQueue()
+    protected ICacheEventQueue<K, V> getCacheEventQueue()
     {
         return this.cacheEventQueue;
     }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.remote;
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.engine.CacheConstants;
@@ -34,8 +36,8 @@ import org.apache.jcs.engine.logging.beh
  * Typically, we only connect to one remote server per facade. We use a list of one
  * RemoteCacheNoWait.
  */
-public class RemoteCacheNoWaitFacade
-    extends AbstractRemoteCacheNoWaitFacade
+public class RemoteCacheNoWaitFacade<K extends Serializable, V extends Serializable>
+    extends AbstractRemoteCacheNoWaitFacade<K, V>
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -4529970797620747111L;
@@ -52,7 +54,7 @@ public class RemoteCacheNoWaitFacade
      * @param cacheEventLogger
      * @param elementSerializer
      */
-    public RemoteCacheNoWaitFacade( RemoteCacheNoWait[] noWaits, RemoteCacheAttributes rca,
+    public RemoteCacheNoWaitFacade( RemoteCacheNoWait<K, V>[] noWaits, RemoteCacheAttributes rca,
                                     ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
                                     IElementSerializer elementSerializer )
     {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.remote;
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
 import org.apache.jcs.engine.ZombieCacheServiceNonLocal;
 
@@ -31,9 +33,9 @@ import org.apache.jcs.engine.ZombieCache
  * <p>
  * Much of this was reusable, so I moved it to engine.
  */
-public class ZombieRemoteCacheService
-    extends ZombieCacheServiceNonLocal
-    implements IRemoteCacheService
+public class ZombieRemoteCacheService<K extends Serializable, V extends Serializable>
+    extends ZombieCacheServiceNonLocal<K, V>
+    implements IRemoteCacheService<K, V>
 {
     // backwards compatibility
 

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 
 /**
@@ -29,8 +31,8 @@ import org.apache.jcs.auxiliary.Auxiliar
  * <p>
  * @author Aaron Smuts
  */
-public interface IRemoteCacheClient
-    extends AuxiliaryCache
+public interface IRemoteCacheClient<K extends Serializable, V extends Serializable>
+    extends AuxiliaryCache<K, V>
 {
     /**
      * Replaces the current remote cache service handle with the given handle. If the current remote
@@ -38,7 +40,7 @@ public interface IRemoteCacheClient
      * <p>
      * @param remote IRemoteCacheService -- the remote server or proxy to the remote server
      */
-    public void fixCache( IRemoteCacheService remote );
+    public void fixCache( IRemoteCacheService<K, V> remote );
 
     /**
      * Gets the listenerId attribute of the RemoteCacheListener object.
@@ -56,5 +58,5 @@ public interface IRemoteCacheClient
      * <p>
      * @return IRemoteCacheListener
      */
-    public IRemoteCacheListener getListener();
+    public IRemoteCacheListener<K, V> getListener();
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java Mon Jan 16 21:05:44 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.remote.
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.rmi.Remote;
 
 import org.apache.jcs.engine.behavior.ICacheListener;
@@ -27,8 +28,8 @@ import org.apache.jcs.engine.behavior.IC
 /**
  * Listens for remote cache event notification ( rmi callback ).
  */
-public interface IRemoteCacheListener
-    extends ICacheListener, Remote
+public interface IRemoteCacheListener<K extends Serializable, V extends Serializable>
+    extends ICacheListener<K, V>, Remote
 {
     /** SERVER_LISTENER -- for the cluster */
     public final static int SERVER_LISTENER = 0;

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,8 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.engine.behavior.ICacheServiceNonLocal;
 
 /**
@@ -26,8 +28,8 @@ import org.apache.jcs.engine.behavior.IC
  * <p>
  * For convenience, ICacheServiceNonLocal extends Remote.
  */
-public interface IRemoteCacheService
-    extends ICacheServiceNonLocal
+public interface IRemoteCacheService<K extends Serializable, V extends Serializable>
+    extends ICacheServiceNonLocal<K, V>
 {
     // backwards compatibility
 }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCache.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCache.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCache.java Mon Jan 16 21:05:44 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.remote.
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,8 +32,8 @@ import org.apache.jcs.auxiliary.remote.b
 /**
  * This uses an http client as the service.
  */
-public class RemoteHttpCache
-    extends AbstractRemoteAuxiliaryCache
+public class RemoteHttpCache<K extends Serializable, V extends Serializable>
+    extends AbstractRemoteAuxiliaryCache<K, V>
 {
     /** Don't change. */
     private static final long serialVersionUID = -5329231850422826461L;
@@ -53,8 +54,8 @@ public class RemoteHttpCache
      * @param remote
      * @param listener
      */
-    public RemoteHttpCache( RemoteHttpCacheAttributes remoteHttpCacheAttributes, IRemoteCacheService remote,
-                            IRemoteCacheListener listener )
+    public RemoteHttpCache( RemoteHttpCacheAttributes remoteHttpCacheAttributes, IRemoteCacheService<K, V> remote,
+                            IRemoteCacheListener<K, V> listener )
     {
         super( remoteHttpCacheAttributes, remote, listener );
 
@@ -79,7 +80,7 @@ public class RemoteHttpCache
             logError( cacheName, "", message );
             log.error( message, ex );
 
-            setRemoteCacheService( new ZombieRemoteCacheService( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
+            setRemoteCacheService( new ZombieRemoteCacheService<K, V>( getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
 
             RemoteHttpCacheMonitor.getInstance().notifyError( this );
         }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java Mon Jan 16 21:05:44 2012
@@ -36,8 +36,8 @@ import org.apache.jcs.auxiliary.remote.v
 import org.apache.jcs.engine.behavior.ICacheElement;
 
 /** This is the service used by the remote http auxiliary cache. */
-public class RemoteHttpCacheClient
-    implements IRemoteHttpCacheClient
+public class RemoteHttpCacheClient<K extends Serializable, V extends Serializable>
+    implements IRemoteHttpCacheClient<K, V>
 {
     /** The Logger. */
     private final static Log log = LogFactory.getLog( RemoteCacheServiceAdaptor.class );
@@ -93,7 +93,7 @@ public class RemoteHttpCacheClient
      * @return ICacheElement
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key )
+    public ICacheElement<K, V> get( String cacheName, K key )
         throws IOException
     {
         return get( cacheName, key, 0 );
@@ -108,7 +108,7 @@ public class RemoteHttpCacheClient
      * @return ICacheElement
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key, long requesterId )
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException
     {
         if ( !isInitialized() )
@@ -117,20 +117,20 @@ public class RemoteHttpCacheClient
             log.warn( message );
             throw new IOException( message );
         }
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createGetRequest( cacheName, key,
-                                                                                                requesterId );
+        RemoteCacheRequest<K, Serializable> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId );
 
-        RemoteCacheResponse remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
             log.debug( "Get [" + key + "] = " + remoteHttpCacheResponse );
         }
 
-        ICacheElement retval = null;
+        ICacheElement<K, V> retval = null;
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            retval = (ICacheElement)remoteHttpCacheResponse.getPayload().get( key );
+            retval = remoteHttpCacheResponse.getPayload().get( key );
         }
         return retval;
     }
@@ -140,11 +140,11 @@ public class RemoteHttpCacheClient
      * <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
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
         throws IOException
     {
         return getMatching( cacheName, pattern, 0 );
@@ -156,11 +156,11 @@ public class RemoteHttpCacheClient
      * @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
      */
-    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
     {
         if ( !isInitialized() )
@@ -170,18 +170,17 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName,
-                                                                                                        pattern,
-                                                                                                        requesterId );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId );
 
-        RemoteCacheResponse remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
             log.debug( "GetMatching [" + pattern + "] = " + remoteHttpCacheResponse );
         }
 
-        return (Map)remoteHttpCacheResponse.getPayload();
+        return remoteHttpCacheResponse.getPayload();
     }
 
     /**
@@ -189,11 +188,11 @@ public class RemoteHttpCacheClient
      * <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 IOException
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
         throws IOException
     {
         return getMultiple( cacheName, keys, 0 );
@@ -205,11 +204,11 @@ public class RemoteHttpCacheClient
      * @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
      */
-    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 )
         throws IOException
     {
         if ( !isInitialized() )
@@ -219,18 +218,17 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName,
-                                                                                                        keys,
-                                                                                                        requesterId );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId );
 
-        RemoteCacheResponse remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( log.isDebugEnabled() )
         {
             log.debug( "GetMultiple [" + keys + "] = " + remoteHttpCacheResponse );
         }
 
-        return (Map)remoteHttpCacheResponse.getPayload();
+        return remoteHttpCacheResponse.getPayload();
     }
 
     /**
@@ -240,7 +238,7 @@ public class RemoteHttpCacheClient
      * @param key
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
         throws IOException
     {
         remove( cacheName, key, 0 );
@@ -254,7 +252,7 @@ public class RemoteHttpCacheClient
      * @param requesterId
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key, long requesterId )
+    public void remove( String cacheName, K key, long requesterId )
         throws IOException
     {
         if ( !isInitialized() )
@@ -264,8 +262,8 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key,
-                                                                                                   requesterId );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId );
 
         getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
     }
@@ -299,8 +297,8 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName,
-                                                                                                      requesterId );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId );
 
         getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
     }
@@ -311,7 +309,7 @@ public class RemoteHttpCacheClient
      * @param item
      * @throws IOException
      */
-    public void update( ICacheElement item )
+    public void update( ICacheElement<K, V> item )
         throws IOException
     {
         update( item, 0 );
@@ -324,7 +322,7 @@ public class RemoteHttpCacheClient
      * @param requesterId
      * @throws IOException
      */
-    public void update( ICacheElement cacheElement, long requesterId )
+    public void update( ICacheElement<K, V> cacheElement, long requesterId )
         throws IOException
     {
         if ( !isInitialized() )
@@ -334,8 +332,8 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createUpdateRequest( cacheElement,
-                                                                                                   requesterId );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createUpdateRequest( cacheElement, requesterId );
 
         getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
     }
@@ -356,7 +354,8 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createDisposeRequest( cacheName, 0 );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createDisposeRequest( cacheName, 0 );
 
         getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
     }
@@ -378,7 +377,7 @@ public class RemoteHttpCacheClient
      * @return A Set of keys
      * @throws IOException
      */
-    public Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    public Set<K> getGroupKeys( String cacheName, String groupName )
         throws IOException
     {
         if ( !isInitialized() )
@@ -388,14 +387,15 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createGetGroupKeysRequest( cacheName,
-                                                                                                         groupName, 0 );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest =
+            RemoteCacheRequestFactory.createGetGroupKeysRequest( cacheName, groupName, 0 );
 
-        RemoteCacheResponse remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
         {
-            return (Set<Serializable>)remoteHttpCacheResponse.getPayload().get( groupName );
+            // FIXME: Unchecked cast
+            return (Set<K>)remoteHttpCacheResponse.getPayload().get( groupName );
         }
 
         return Collections.emptySet();
@@ -417,8 +417,8 @@ public class RemoteHttpCacheClient
             throw new IOException( message );
         }
 
-        RemoteCacheRequest remoteHttpCacheRequest = RemoteCacheRequestFactory.createAliveCheckRequest( 0 );
-        RemoteCacheResponse remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
+        RemoteCacheRequest<K, V> remoteHttpCacheRequest = RemoteCacheRequestFactory.createAliveCheckRequest( 0 );
+        RemoteCacheResponse<K, V> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
 
         if ( remoteHttpCacheResponse != null )
         {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -51,8 +52,8 @@ public class RemoteHttpCacheFactory
     private String name;
 
     /** store reference of facades to initiate failover */
-    private final static HashMap<String, RemoteCacheNoWaitFacade> facades =
-        new HashMap<String, RemoteCacheNoWaitFacade>();
+    private final static HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> facades =
+        new HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>>();
 
     /**
      * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
@@ -67,17 +68,17 @@ public class RemoteHttpCacheFactory
      * @param elementSerializer
      * @return AuxiliaryCache
      */
-    public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
                                        ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
     {
         RemoteHttpCacheAttributes rca = (RemoteHttpCacheAttributes) iaca;
 
-        ArrayList<ICache> noWaits = new ArrayList<ICache>();
+        ArrayList<ICache<K, V>> noWaits = new ArrayList<ICache<K, V>>();
 
         RemoteHttpCacheManager rcm = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger, elementSerializer );
         // TODO, use the configured value.
         rca.setRemoteType( RemoteCacheAttributes.LOCAL );
-        ICache ic = rcm.getCache( rca );
+        ICache<K, V> ic = rcm.getCache( rca );
         if ( ic != null )
         {
             noWaits.add( ic );
@@ -87,7 +88,7 @@ public class RemoteHttpCacheFactory
             log.info( "noWait is null" );
         }
 
-        RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade( noWaits
+        RemoteCacheNoWaitFacade<K, V> rcnwf = new RemoteCacheNoWaitFacade<K, V>( noWaits
             .toArray( new RemoteCacheNoWait[0] ), rca, cacheMgr, cacheEventLogger, elementSerializer );
 
         getFacades().put( rca.getCacheName(), rcnwf );
@@ -119,7 +120,7 @@ public class RemoteHttpCacheFactory
      * The facades are what the cache hub talks to.
      * @return Returns the facades.
      */
-    public static HashMap<String, RemoteCacheNoWaitFacade> getFacades()
+    public static HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> getFacades()
     {
         return facades;
     }

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -53,7 +54,8 @@ public class RemoteHttpCacheManager
     private static RemoteHttpCacheManager instance;
 
     /** Contains instances of RemoteCacheNoWait managed by a RemoteCacheManager instance. */
-    static final Map<String, RemoteCacheNoWait> caches = new HashMap<String, RemoteCacheNoWait>();
+    static final Map<String, RemoteCacheNoWait<? extends Serializable, ? extends Serializable>> caches =
+        new HashMap<String, RemoteCacheNoWait<? extends Serializable, ? extends Serializable>>();
 
     /** The configuration attributes. */
     private IRemoteCacheAttributes remoteCacheAttributes;
@@ -150,7 +152,7 @@ public class RemoteHttpCacheManager
      * @param cacheName
      * @return The cache value
      */
-    public AuxiliaryCache getCache( String cacheName )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( String cacheName )
     {
         // TODO get some defaults!
         // Perhaps we will need a manager per URL????
@@ -169,24 +171,24 @@ public class RemoteHttpCacheManager
      * @param cattr
      * @return The cache value
      */
-    public AuxiliaryCache getCache( RemoteHttpCacheAttributes cattr )
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V> getCache( RemoteHttpCacheAttributes cattr )
     {
-        RemoteCacheNoWait remoteCacheNoWait = null;
+        RemoteCacheNoWait<K, V> remoteCacheNoWait = null;
 
         synchronized ( caches )
         {
-            remoteCacheNoWait = caches.get( cattr.getCacheName() + cattr.getUrl() );
+            remoteCacheNoWait = (RemoteCacheNoWait<K, V>) caches.get( cattr.getCacheName() + cattr.getUrl() );
             if ( remoteCacheNoWait == null )
             {
-                RemoteHttpClientListener listener = new RemoteHttpClientListener( cattr, cacheMgr );
+                RemoteHttpClientListener<K, V> listener = new RemoteHttpClientListener<K, V>( cattr, cacheMgr );
 
-                IRemoteHttpCacheClient remoteService = createRemoteHttpCacheClientForAttributes( cattr );
+                IRemoteHttpCacheClient<K, V> remoteService = createRemoteHttpCacheClientForAttributes( cattr );
 
-                IRemoteCacheClient remoteCacheClient = new RemoteHttpCache( cattr, remoteService, listener );
+                IRemoteCacheClient<K, V> remoteCacheClient = new RemoteHttpCache<K, V>( cattr, remoteService, listener );
                 remoteCacheClient.setCacheEventLogger( cacheEventLogger );
                 remoteCacheClient.setElementSerializer( elementSerializer );
 
-                remoteCacheNoWait = new RemoteCacheNoWait( remoteCacheClient );
+                remoteCacheNoWait = new RemoteCacheNoWait<K, V>( remoteCacheClient );
                 remoteCacheNoWait.setCacheEventLogger( cacheEventLogger );
                 remoteCacheNoWait.setElementSerializer( elementSerializer );
 
@@ -205,9 +207,9 @@ public class RemoteHttpCacheManager
      * @param cattr
      * @return IRemoteHttpCacheClient
      */
-    protected IRemoteHttpCacheClient createRemoteHttpCacheClientForAttributes( RemoteHttpCacheAttributes cattr )
+    protected <K extends Serializable, V extends Serializable> IRemoteHttpCacheClient<K, V> createRemoteHttpCacheClientForAttributes( RemoteHttpCacheAttributes cattr )
     {
-        IRemoteHttpCacheClient client = (IRemoteHttpCacheClient) OptionConverter.instantiateByClassName( cattr
+        IRemoteHttpCacheClient<K, V> client = (IRemoteHttpCacheClient<K, V>) OptionConverter.instantiateByClassName( cattr
             .getRemoteHttpClientClassName(), IRemoteHttpCacheClient.class, null );
 
         if ( client == null )
@@ -216,7 +218,7 @@ public class RemoteHttpCacheManager
             {
                 log.info( "Creating the default client." );
             }
-            client = new RemoteHttpCacheClient( );
+            client = new RemoteHttpCacheClient<K, V>( );
         }
         client.initialize( cattr );
         return client;
@@ -230,7 +232,7 @@ public class RemoteHttpCacheManager
     public String getStats()
     {
         StringBuffer stats = new StringBuffer();
-        for (RemoteCacheNoWait c : caches.values())
+        for (RemoteCacheNoWait<?, ?> c : caches.values())
         {
             if ( c != null )
             {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java Mon Jan 16 21:05:44 2012
@@ -19,14 +19,19 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.Serializable;
+
 import org.apache.jcs.auxiliary.remote.AbsractRemoteCacheListener;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /** Does nothing */
-public class RemoteHttpClientListener
-    extends AbsractRemoteCacheListener
+public class RemoteHttpClientListener<K extends Serializable, V extends Serializable>
+    extends AbsractRemoteCacheListener<K, V>
 {
+    /** TODO serialVersionUID */
+    private static final long serialVersionUID = -9078366610772128010L;
+
     /**
      * Only need one since it does work for all regions, just reference by multiple region names.
      * <p>

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java Mon Jan 16 21:05:44 2012
@@ -1,6 +1,7 @@
 package org.apache.jcs.auxiliary.remote.http.client.behavior;
 
 import java.io.IOException;
+import java.io.Serializable;
 
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
 import org.apache.jcs.auxiliary.remote.http.client.RemoteHttpCacheAttributes;
@@ -28,8 +29,8 @@ import org.apache.jcs.auxiliary.remote.h
  * It's not entirely clear that this interface is needed. I simply wanted the initialization method.
  * This could be added to the ICacheSerice method.
  */
-public interface IRemoteHttpCacheClient
-    extends IRemoteCacheService
+public interface IRemoteHttpCacheClient<K extends Serializable, V extends Serializable>
+    extends IRemoteCacheService<K, V>
 {
     /**
      * The provides an extension point. If you want to extend this and use a special dispatcher,

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java Mon Jan 16 21:05:44 2012
@@ -39,15 +39,12 @@ import org.apache.jcs.engine.logging.beh
  * This class contains common methods for remote cache services. Eventually I hope to extract out
  * much of the RMI server to use this as well. I'm starting with the Http service.
  */
-public abstract class AbstractRemoteCacheService
-    implements IRemoteCacheService
+public abstract class AbstractRemoteCacheService<K extends Serializable, V extends Serializable>
+    implements IRemoteCacheService<K, V>
 {
     /** An optional event logger */
     private transient ICacheEventLogger cacheEventLogger;
 
-    /** If there is no event logger, we will return this event for all create calls. */
-    private static final ICacheEvent EMPTY_ICACHE_EVENT = new CacheEvent();
-
     /** The central hub */
     private ICompositeCacheManager cacheManager;
 
@@ -79,7 +76,7 @@ public abstract class AbstractRemoteCach
      * @param item
      * @throws IOException
      */
-    public void update( ICacheElement item )
+    public void update( ICacheElement<K, V> item )
         throws IOException
     {
         update( item, 0 );
@@ -92,10 +89,10 @@ public abstract class AbstractRemoteCach
      * @param requesterId
      * @throws IOException
      */
-    public void update( ICacheElement item, long requesterId )
+    public void update( ICacheElement<K, V> item, long requesterId )
         throws IOException
     {
-        ICacheEvent cacheEvent = createICacheEvent( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
+        ICacheEvent<ICacheElement<K, V>> cacheEvent = createICacheEvent( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
         try
         {
             logUpdateInfo( item );
@@ -115,7 +112,7 @@ public abstract class AbstractRemoteCach
      * @param requesterId
      * @throws IOException
      */
-    abstract void processUpdate( ICacheElement item, long requesterId )
+    abstract void processUpdate( ICacheElement<K, V> item, long requesterId )
         throws IOException;
 
     /**
@@ -123,7 +120,7 @@ public abstract class AbstractRemoteCach
      * <p>
      * @param item
      */
-    private void logUpdateInfo( ICacheElement item )
+    private void logUpdateInfo( ICacheElement<K, V> item )
     {
         if ( log.isInfoEnabled() )
         {
@@ -150,7 +147,7 @@ public abstract class AbstractRemoteCach
      * @return ICacheElement
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key )
+    public ICacheElement<K, V> get( String cacheName, K key )
         throws IOException
     {
         return this.get( cacheName, key, 0 );
@@ -169,11 +166,11 @@ public abstract class AbstractRemoteCach
      * @return ICacheElement
      * @throws IOException
      */
-    public ICacheElement get( String cacheName, Serializable key, long requesterId )
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
         throws IOException
     {
-        ICacheElement element = null;
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
+        ICacheElement<K, V> element = null;
+        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
         try
         {
             element = processGet( cacheName, key, requesterId );
@@ -196,7 +193,7 @@ public abstract class AbstractRemoteCach
      * @return ICacheElement
      * @throws IOException
      */
-    abstract ICacheElement processGet( String cacheName, Serializable key, long requesterId )
+    abstract ICacheElement<K, V> processGet( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -207,7 +204,7 @@ public abstract class AbstractRemoteCach
      * @return Map of keys and wrapped objects
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
         throws IOException
     {
         return getMatching( cacheName, pattern, 0 );
@@ -222,10 +219,10 @@ public abstract class AbstractRemoteCach
      * @return Map of keys and wrapped objects
      * @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
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
                                                     ICacheEventLogger.GETMATCHING_EVENT );
         try
         {
@@ -246,7 +243,7 @@ public abstract class AbstractRemoteCach
      * @return Map of keys and wrapped objects
      * @throws IOException
      */
-    abstract Map<Serializable, ICacheElement> processGetMatching( String cacheName, String pattern, long requesterId )
+    abstract Map<K, ICacheElement<K, V>> processGetMatching( String cacheName, String pattern, long requesterId )
         throws IOException;
 
     /**
@@ -254,11 +251,11 @@ public abstract class AbstractRemoteCach
      * <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 IOException
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
         throws IOException
     {
         return this.getMultiple( cacheName, keys, 0 );
@@ -272,14 +269,14 @@ public abstract class AbstractRemoteCach
      * @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
      */
-    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 )
         throws IOException
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
+        ICacheEvent<Serializable> cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
                                                     ICacheEventLogger.GETMULTIPLE_EVENT );
         try
         {
@@ -297,11 +294,11 @@ public abstract class AbstractRemoteCach
      * @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
      */
-    abstract Map<Serializable, ICacheElement> processGetMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    abstract Map<K, ICacheElement<K, V>> processGetMultiple( String cacheName, Set<K> keys, long requesterId )
         throws IOException;
 
     /**
@@ -311,7 +308,7 @@ public abstract class AbstractRemoteCach
      * @param group
      * @return A Set of group keys
      */
-    public Set<Serializable> getGroupKeys( String cacheName, String group )
+    public Set<K> getGroupKeys( String cacheName, String group )
     {
         return processGetGroupKeys( cacheName, group );
     }
@@ -323,9 +320,9 @@ public abstract class AbstractRemoteCach
      * @param groupName
      * @return Set
      */
-    public Set<Serializable> processGetGroupKeys( String cacheName, String groupName )
+    public Set<K> processGetGroupKeys( String cacheName, String groupName )
     {
-        CompositeCache cache = getCacheManager().getCache( cacheName );
+        CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
 
         return cache.getGroupKeys( groupName );
     }
@@ -337,7 +334,7 @@ public abstract class AbstractRemoteCach
      * @param key
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
         throws IOException
     {
         remove( cacheName, key, 0 );
@@ -353,10 +350,10 @@ public abstract class AbstractRemoteCach
      * @param requesterId
      * @throws IOException
      */
-    public void remove( String cacheName, Serializable key, long requesterId )
+    public void remove( String cacheName, K key, long requesterId )
         throws IOException
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
+        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
         try
         {
             processRemove( cacheName, key, requesterId );
@@ -375,7 +372,7 @@ public abstract class AbstractRemoteCach
      * @param requesterId
      * @throws IOException
      */
-    abstract void processRemove( String cacheName, Serializable key, long requesterId )
+    abstract void processRemove( String cacheName, K key, long requesterId )
         throws IOException;
 
     /**
@@ -402,7 +399,7 @@ public abstract class AbstractRemoteCach
     public void removeAll( String cacheName, long requesterId )
         throws IOException
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
         try
         {
             processRemoveAll( cacheName, requesterId );
@@ -445,7 +442,7 @@ public abstract class AbstractRemoteCach
     public void dispose( String cacheName, long requesterId )
         throws IOException
     {
-        ICacheEvent cacheEvent = createICacheEvent( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
         try
         {
             processDispose( cacheName, requesterId );
@@ -484,11 +481,11 @@ public abstract class AbstractRemoteCach
      * @param eventName
      * @return ICacheEvent
      */
-    protected ICacheEvent createICacheEvent( ICacheElement item, long requesterId, String eventName )
+    protected ICacheEvent<ICacheElement<K, V>> createICacheEvent( ICacheElement<K, V> item, long requesterId, String eventName )
     {
         if ( cacheEventLogger == null )
         {
-            return EMPTY_ICACHE_EVENT;
+            return new CacheEvent<ICacheElement<K, V>>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger.createICacheEvent( getEventLogSourceName(), item.getCacheName(), eventName, ipAddress,
@@ -504,11 +501,11 @@ public abstract class AbstractRemoteCach
      * @param eventName
      * @return ICacheEvent
      */
-    protected ICacheEvent createICacheEvent( String cacheName, Serializable key, long requesterId, String eventName )
+    protected <T extends Serializable> ICacheEvent<T> createICacheEvent( String cacheName, T key, long requesterId, String eventName )
     {
         if ( cacheEventLogger == null )
         {
-            return EMPTY_ICACHE_EVENT;
+            return new CacheEvent<T>();
         }
         String ipAddress = getExtraInfoForRequesterId( requesterId );
         return cacheEventLogger.createICacheEvent( getEventLogSourceName(), cacheName, eventName, ipAddress, key );
@@ -534,7 +531,7 @@ public abstract class AbstractRemoteCach
      * <p>
      * @param cacheEvent
      */
-    protected void logICacheEvent( ICacheEvent cacheEvent )
+    protected <T extends Serializable> void logICacheEvent( ICacheEvent<T> cacheEvent )
     {
         if ( cacheEventLogger != null )
         {

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1232163&r1=1232162&r2=1232163&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Mon Jan 16 21:05:44 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.auxiliary.remote.
  * under the License.
  */
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.Map;
@@ -38,13 +39,13 @@ import org.apache.jcs.engine.control.Com
  * <p>
  * This is essentially an adaptor on top of the service.
  */
-public class RemoteCacheServiceAdaptor
+public class RemoteCacheServiceAdaptor<K extends Serializable, V extends Serializable>
 {
     /** The Logger. */
     private final static Log log = LogFactory.getLog( RemoteCacheServiceAdaptor.class );
 
     /** The service that does the work. */
-    private IRemoteCacheService remoteCacheService;
+    private IRemoteCacheService<K, V> remoteCacheService;
 
     /** This is for testing without the factory. */
     protected RemoteCacheServiceAdaptor()
@@ -59,7 +60,8 @@ public class RemoteCacheServiceAdaptor
      */
     public RemoteCacheServiceAdaptor( CompositeCacheManager cacheManager )
     {
-        setRemoteCacheService( RemoteHttpCacheSeviceFactory.createRemoteHttpCacheService( cacheManager ) );
+        IRemoteCacheService<K, V> rcs = RemoteHttpCacheSeviceFactory.createRemoteHttpCacheService( cacheManager );
+        setRemoteCacheService( rcs );
     }
 
     /**
@@ -68,9 +70,9 @@ public class RemoteCacheServiceAdaptor
      * @param request
      * @return RemoteHttpCacheResponse, never null
      */
-    public RemoteCacheResponse processRequest( RemoteCacheRequest request )
+    public RemoteCacheResponse<K, V> processRequest( RemoteCacheRequest<K, V> request )
     {
-        RemoteCacheResponse response = new RemoteCacheResponse();
+        RemoteCacheResponse<K, V> response = new RemoteCacheResponse<K, V>();
 
         if ( request == null )
         {
@@ -86,7 +88,7 @@ public class RemoteCacheServiceAdaptor
                 switch ( request.getRequestType() )
                 {
                     case RemoteCacheRequest.REQUEST_TYPE_GET:
-                        ICacheElement element = getRemoteCacheService().get( request.getCacheName(), request.getKey(),
+                        ICacheElement<K, V> element = getRemoteCacheService().get( request.getCacheName(), request.getKey(),
                                                                              request.getRequesterId() );
                         if ( element != null )
                         {
@@ -94,7 +96,7 @@ public class RemoteCacheServiceAdaptor
                         }
                         break;
                     case RemoteCacheRequest.REQUEST_TYPE_GET_MULTIPLE:
-                        Map<Serializable, ICacheElement> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
+                        Map<K, ICacheElement<K, V>> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
                                                                               request.getKeySet(),
                                                                               request.getRequesterId() );
                         if ( elementMap != null )
@@ -103,7 +105,7 @@ public class RemoteCacheServiceAdaptor
                         }
                         break;
                     case RemoteCacheRequest.REQUEST_TYPE_GET_MATCHING:
-                        Map<Serializable, ICacheElement> elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
+                        Map<K, ICacheElement<K, V>> elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
                                                                                       request.getPattern(),
                                                                                       request.getRequesterId() );
                         if ( elementMapMatching != null )
@@ -129,7 +131,7 @@ public class RemoteCacheServiceAdaptor
                         // DO NOTHING
                         break;
                     case RemoteCacheRequest.REQUEST_TYPE_GET_GROUP_KEYS:
-                        Set<Serializable> groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
+                        Set<K> groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
                                                                               request.getKey() + "" );
                         if ( groupKeys == null )
                         {
@@ -145,7 +147,7 @@ public class RemoteCacheServiceAdaptor
                         break;
                 }
             }
-            catch ( Exception e )
+            catch ( IOException e )
             {
                 String message = "Problem processing request. " + request + " Error: " + e.getMessage();
                 log.error( message, e );
@@ -160,7 +162,7 @@ public class RemoteCacheServiceAdaptor
     /**
      * @param remoteHttpCacheService the remoteHttpCacheService to set
      */
-    public void setRemoteCacheService( IRemoteCacheService remoteHttpCacheService )
+    public void setRemoteCacheService( IRemoteCacheService<K, V> remoteHttpCacheService )
     {
         this.remoteCacheService = remoteHttpCacheService;
     }
@@ -168,7 +170,7 @@ public class RemoteCacheServiceAdaptor
     /**
      * @return the remoteHttpCacheService
      */
-    public IRemoteCacheService getRemoteCacheService()
+    public IRemoteCacheService<K, V> getRemoteCacheService()
     {
         return remoteCacheService;
     }



Mime
View raw message