svn commit: r714178 [1/3] - in /jakarta/jcs/trunk/src: java/org/apache/jcs/access/ java/org/apache/jcs/auxiliary/ java/org/apache/jcs/auxiliary/disk/ java/org/apache/jcs/auxiliary/disk/block/ java/org/apache/jcs/auxiliary/disk/indexed/ java/org/apache/...

[email protected] Fri, 14 Nov 2008 22:50:14 -0000
Newsgroups gmane.comp.jakarta.turbine.jcs.devel
Message-ID <[email protected]>
Author: asmuts
Date: Fri Nov 14 14:50:12 2008
New Revision: 714178

URL: http://svn.apache.org/viewvc?rev=714178&view=rev
Log:
More work on the new getMatching( String pattern ) API.

Added:
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/match/
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/match/KeyMatcherPatternImpl.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/match/behavior/IKeyMatcher.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/match/
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java   (contents, props changed)
      - copied, changed from r707758, jakarta/jcs/trunk/src/test/org/apache/jcs/utils/match/KeyMatcherUtilUnitTest.java
Removed:
    jakarta/jcs/trunk/src/java/org/apache/jcs/utils/match/KeyMatcherUtil.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/BasicHttpAuthenticator.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheManagerTester.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/servlet/ListTestCacheServlet.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/utils/match/KeyMatcherUtilUnitTest.java
Modified:
    jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/access/CacheAccessUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPConcurrentRandomTestUtil.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPFilterRemoveHashCodeUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/MockLateralCache.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/TestRemoteCache.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java Fri Nov 14 14:50:12 2008
@@ -21,6 +21,8 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -193,7 +195,35 @@
 
         return ( element != null ) ? element.getVal() : null;
     }
-
+    
+    /**
+     * Retrieve matching objects from the cache region this instance provides access to.
+     * <p>
+     * @param pattern - a key pattern for the objects stored
+     * @return A map of key to values.  These are stripped from the wrapper.
+     */
+    public HashMap getMatching( String pattern )
+    {
+        HashMap unwrappedResults = new HashMap();
+        
+        Map wrappedResults = this.cacheControl.getMatching( pattern );
+        if ( wrappedResults != null )
+        {
+            Set keySet = wrappedResults.keySet();
+            Iterator it = keySet.iterator();
+            while ( it.hasNext() )
+            {
+                Object key = it.next();
+                ICacheElement element = (ICacheElement)wrappedResults.get( key );
+                if ( element != null )
+                {
+                    unwrappedResults.put( key, element.getVal() );
+                }
+            }            
+        }
+        return unwrappedResults;
+    }
+    
     /**
      * This method returns the ICacheElement wrapper which provides access to element info and other
      * attributes.

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java Fri Nov 14 14:50:12 2008
@@ -7,6 +7,8 @@
 import org.apache.jcs.engine.logging.CacheEvent;
 import org.apache.jcs.engine.logging.behavior.ICacheEvent;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
+import org.apache.jcs.engine.match.KeyMatcherPatternImpl;
+import org.apache.jcs.engine.match.behavior.IKeyMatcher;
 import org.apache.jcs.utils.serialization.StandardSerializer;
 
 /** This holds convenience methods used by most auxiliary caches. */
@@ -25,6 +27,9 @@
     /** If there is no event logger, we will return this event for all create calls. */
     private static final ICacheEvent EMPTY_ICACHE_EVENT = new CacheEvent();
 
+    /** Key matcher used by the getMatching API */
+    protected IKeyMatcher keyMatcher = new KeyMatcherPatternImpl();
+
     /**
      * Logs an event if an event logger is configured.
      * <p>
@@ -163,4 +168,27 @@
     {
         return this.elementSerializer;
     }
+
+    /**
+     * Sets the key matcher used by get matching.
+     * <p>
+     * @param keyMatcher
+     */
+    public void setKeyMatcher( IKeyMatcher keyMatcher )
+    {
+        if ( keyMatcher != null )
+        {
+            this.keyMatcher = keyMatcher;
+        }
+    }
+
+    /**
+     * Rerturns the key matcher used by get matching.
+     * <p>
+     * @return keyMatcher
+     */
+    public IKeyMatcher getKeyMatcher()
+    {
+        return this.keyMatcher;
+    }
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java Fri Nov 14 14:50:12 2008
@@ -58,7 +58,8 @@
             PropertySetter.setProperties( cacheEventLogger, props, cacheEventLoggerAttributePrefix + "." );
             if ( log.isInfoEnabled() )
             {
-                log.info( "Using custom cache event logger [" + cacheEventLogger + "] for auxiliary [" + auxPrefix + "]" );
+                log.info( "Using custom cache event logger [" + cacheEventLogger + "] for auxiliary [" + auxPrefix
+                    + "]" );
             }
         }
         else
@@ -91,8 +92,8 @@
                                org.apache.jcs.engine.behavior.IElementSerializer.class, null );
         if ( elementSerializer != null )
         {
-            String cacheEventLoggerAttributePrefix = auxPrefix + SERIALIZER_PREFIX + ATTRIBUTE_PREFIX;
-            PropertySetter.setProperties( elementSerializer, props, cacheEventLoggerAttributePrefix + "." );
+            String attributePrefix = auxPrefix + SERIALIZER_PREFIX + ATTRIBUTE_PREFIX;
+            PropertySetter.setProperties( elementSerializer, props, attributePrefix + "." );
             if ( log.isInfoEnabled() )
             {
                 log.info( "Using custom element serializer [" + elementSerializer + "] for auxiliary [" + auxPrefix

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java Fri Nov 14 14:50:12 2008
@@ -45,7 +45,6 @@
 import org.apache.jcs.engine.stats.Stats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.utils.match.KeyMatcherUtil;
 
 import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
 
@@ -326,7 +325,7 @@
             keyArray = purgatory.keySet().toArray();
         }
 
-        Set matchingKeys = KeyMatcherUtil.getMatchingKeysFromArray( pattern, keyArray );
+        Set matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
 
         // call getMultiple with the set
         Map result = processGetMultiple( matchingKeys );

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java Fri Nov 14 14:50:12 2008
@@ -43,7 +43,6 @@
 import org.apache.jcs.engine.stats.Stats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.utils.match.KeyMatcherUtil;
 
 import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
 
@@ -244,7 +243,7 @@
                 storageLock.readLock().release();
             }
             
-            Set matchingKeys = KeyMatcherUtil.getMatchingKeysFromArray( pattern, keyArray );
+            Set matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
             
             Iterator keyIterator = matchingKeys.iterator();
             while ( keyIterator.hasNext() )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Fri Nov 14 14:50:12 2008
@@ -49,7 +49,6 @@
 import org.apache.jcs.engine.stats.Stats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.utils.match.KeyMatcherUtil;
 import org.apache.jcs.utils.struct.SortedPreferentialArray;
 import org.apache.jcs.utils.timing.ElapsedTimer;
 
@@ -600,7 +599,7 @@
                 storageLock.readLock().release();
             }
             
-            Set matchingKeys = KeyMatcherUtil.getMatchingKeysFromArray( pattern, keyArray );
+            Set matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
             
             Iterator keyIterator = matchingKeys.iterator();
             while ( keyIterator.hasNext() )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Fri Nov 14 14:50:12 2008
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -142,17 +143,36 @@
         catch ( Exception e )
         {
             log.error( e );
-            handleException( e, "Failed to get " + key + " from " + this.cattr.getCacheName() );
+            handleException( e, "Failed to get [" + key + "] from " + this.cattr.getCacheName() );
         }
         return obj;
     }
 
-    /** TODO finish */
+    /**
+     * @param pattern
+     * @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
+     * @throws IOException
+     */
     protected Map processGetMatching( String pattern )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        return null;
+        Map elements = new HashMap();
+
+        if ( this.cattr.getPutOnlyMode() )
+        {
+            return Collections.EMPTY_MAP;
+        }
+        try
+        {
+            elements = lateral.getMatching( cacheName, pattern );
+        }
+        catch ( Exception e )
+        {
+            log.error( e );
+            handleException( e, "Failed to getMatching [" + pattern + "] from " + this.cattr.getCacheName() );
+        }
+        return elements;
     }
 
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Fri Nov 14 14:50:12 2008
@@ -149,7 +149,7 @@
         synchronized ( this.caches )
         {
             this.lateralService = lateralService;
-            // need to implment an observer for some types of laterals( http and
+            // need to implement an observer for some types of laterals( http and
             // tcp)
             //this.lateralWatch.setCacheWatch(lateralWatch);
             for ( Iterator en = this.caches.values().iterator(); en.hasNext(); )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java Fri Nov 14 14:50:12 2008
@@ -39,27 +39,25 @@
     private static final boolean DEFAULT_RECEIVE = true;
 
     /** THe type of lateral */
-    String transmissionTypeName = "UDP";
+    private String transmissionTypeName = "UDP";
     
-    int transmissionType = UDP;
-
-    String httpServers;
+    /** indicates the lateral type, this needs to change */
+    private int transmissionType = UDP;
+    
+    /** The heep servers */
+    private String httpServers;
 
     /** used to identify the service that this manager will be operating on */
-    String httpServer = "";
-
-    String httpReceiveServlet = "";
-
-    String httpDeleteServlet = "";
-
-    String udpMulticastAddr = "228.5.6.7";
+    private String httpServer = "";
 
-    int udpMulticastPort = 6789;
+    /** this needs to change */
+    private String udpMulticastAddr = "228.5.6.7";
 
-    int httpListenerPort = 8080;
+    /** this needs to change */
+    private int udpMulticastPort = 6789;
 
-    /** REMOVE THIS: JAVAGROUPS ------------------------- */
-    private String jgChannelProperties = null;
+    /** this needs to change */
+    private int httpListenerPort = 8080;
 
     /** disables gets from laterals */
     boolean putOnlyMode = true;
@@ -184,10 +182,6 @@
         {
             transmissionTypeName = "XMLRPC";
         }
-        else if ( val == JAVAGROUPS )
-        {
-            transmissionTypeName = "JAVAGROUPS";
-        }
     }
 
     /**
@@ -222,11 +216,6 @@
         {
             transmissionType = XMLRPC;
         }
-        else if ( val.equals( "JAVAGROUPS" ) )
-        {
-            transmissionType = JAVAGROUPS;
-        }
-
     }
 
     /**
@@ -257,16 +246,6 @@
         return putOnlyMode;
     }
 
-    public String getJGChannelProperties()
-    {
-        return jgChannelProperties;
-    }
-
-    public void setJGChannelProperties( String channelProperties )
-    {
-        this.jgChannelProperties = channelProperties;
-    }
-
     /**
      * Returns a clone of the attributes.
      * @return Self
@@ -300,10 +279,8 @@
         return receive;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#toString()
+    /**
+     * @return debug string.
      */
     public String toString()
     {
@@ -316,5 +293,4 @@
         buf.append( transmissionTypeName + httpServer + udpMulticastAddr + String.valueOf( udpMulticastPort ) );
         return buf.toString();
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Fri Nov 14 14:50:12 2008
@@ -24,6 +24,7 @@
 import java.rmi.UnmarshalException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -32,7 +33,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
 import org.apache.jcs.engine.CacheAdaptor;
@@ -40,8 +41,6 @@
 import org.apache.jcs.engine.CacheEventQueueFactory;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheEventQueue;
-import org.apache.jcs.engine.behavior.IElementSerializer;
-import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 import org.apache.jcs.engine.stats.StatElement;
 import org.apache.jcs.engine.stats.Stats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
@@ -52,7 +51,7 @@
  * their order of arrival via the cache event queue processor.
  */
 public class LateralCacheNoWait
-    implements AuxiliaryCache
+    extends AbstractAuxiliaryCache
 {
     /** Don't change */
     private static final long serialVersionUID = -7251187566116178475L;
@@ -75,12 +74,6 @@
     /** times put called */
     private int putCount = 0;
 
-    /** An optional event logger */
-    private ICacheEventLogger cacheEventLogger;
-
-    /** The serializer. */
-    private IElementSerializer elementSerializer;
-
     /**
      * Constructs with the given lateral cache, and fires up an event queue for aysnchronous
      * processing.
@@ -203,7 +196,7 @@
      * Synchronously reads from the lateral cache.
      * <p>
      * @param pattern
-     * @return ICacheElement if found, else null
+     * @return ICacheElement if found, else empty
      */
     public Map getMatching( String pattern )
     {
@@ -232,9 +225,9 @@
                 eventQueue.destroy();
             }
         }
-        return null;
+        return Collections.EMPTY_MAP;
     }
-    
+
     /**
      * @param groupName
      * @return Set
@@ -371,38 +364,26 @@
     }
 
     /**
-     * Allows it to be injected.
-     * <p>
-     * @param cacheEventLogger
+     * getStats
+     * @return String
      */
-    public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+    public String getStats()
     {
-        this.cacheEventLogger = cacheEventLogger;
+        return getStatistics().toString();
     }
 
     /**
-     * Allows you to inject a custom serializer. A good example would be a compressing standard
-     * serializer.
+     * this won't be called since we don't do ICache logging here.
      * <p>
-     * @param elementSerializer
-     */
-    public void setElementSerializer( IElementSerializer elementSerializer )
-    {
-        this.elementSerializer = elementSerializer;
-    }
-
-    /**
-     * getStats
      * @return String
      */
-    public String getStats()
+    public String getEventLoggingExtraInfo()
     {
-        return getStatistics().toString();
+        return "Lateral Cache No Wait";
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatistics()
+    /**
+     * @return statistics about this communication
      */
     public IStats getStatistics()
     {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Fri Nov 14 14:50:12 2008
@@ -32,13 +32,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheType;
-import org.apache.jcs.engine.behavior.IElementSerializer;
-import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 import org.apache.jcs.engine.stats.StatElement;
 import org.apache.jcs.engine.stats.Stats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
@@ -51,7 +50,7 @@
  * do this.
  */
 public class LateralCacheNoWaitFacade
-    implements AuxiliaryCache
+    extends AbstractAuxiliaryCache
 {
     /** Don't change */
     private static final long serialVersionUID = -9047687810358008955L;
@@ -69,15 +68,6 @@
     private ILateralCacheAttributes lateralCacheAttributes;
 
     /**
-     * An optional event logger. Only errors are logged here. We don't want to log ICacheEvents
-     * since the noWaits do this.
-     */
-    private ICacheEventLogger cacheEventLogger;
-
-    /** The serializer. */
-    private IElementSerializer elementSerializer;
-
-    /**
      * Constructs with the given lateral cache, and fires events to any listeners.
      * <p>
      * @param noWaits
@@ -375,32 +365,21 @@
     }
 
     /**
-     * Allows it to be injected.
-     * <p>
-     * @param cacheEventLogger
+     * @return "LateralCacheNoWaitFacade: " + cacheName;
      */
-    public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+    public String toString()
     {
-        this.cacheEventLogger = cacheEventLogger;
+        return "LateralCacheNoWaitFacade: " + cacheName;
     }
 
     /**
-     * Allows you to inject a custom serializer. A good example would be a compressing standard
-     * serializer.
+     * this won't be called since we don't do ICache logging here.
      * <p>
-     * @param elementSerializer
-     */
-    public void setElementSerializer( IElementSerializer elementSerializer )
-    {
-        this.elementSerializer = elementSerializer;
-    }
-
-    /**
-     * @return "LateralCacheNoWaitFacade: " + cacheName;
+     * @return String
      */
-    public String toString()
+    public String getEventLoggingExtraInfo()
     {
-        return "LateralCacheNoWaitFacade: " + cacheName;
+        return "Lateral Cache No Wait";
     }
 
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java Fri Nov 14 14:50:12 2008
@@ -49,6 +49,9 @@
     /** Command to return an object. */
     public final static int GET = 5;
 
+    /** Command to return an object. */
+    public final static int GET_MATCHING = 6;
+
     /** The Cache Element that we are distributing. */
     public ICacheElement ce;
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java Fri Nov 14 14:50:12 2008
@@ -19,8 +19,10 @@
  * under the License.
  */
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.util.Collections;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
@@ -81,4 +83,19 @@
     {
         return Collections.EMPTY_SET;
     }
+    
+    /**
+     * The service does not get via this method, so this return empty.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     *         data in cache matching the pattern.
+     * @throws IOException
+     */
+    public Map getMatching( String cacheName, String pattern )
+        throws IOException
+    {
+        return Collections.EMPTY_MAP;
+    }    
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java Fri Nov 14 14:50:12 2008
@@ -24,48 +24,30 @@
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 
 /**
- * This interface defines configuration options common to lateral cache
- * plugins.
+ * This interface defines configuration options common to lateral cache plugins.
  * <p>
- * TODO it needs to be trimmed down.  The old version had features for
- * every lateral.  Now, the individual laterals have their own specific
- * attributes interfaces.
- *
+ * TODO it needs to be trimmed down. The old version had features for every lateral. Now, the
+ * individual laterals have their own specific attributes interfaces.
  */
 public interface ILateralCacheAttributes
     extends Serializable, AuxiliaryCacheAttributes
 {
-
-    /**
-     * HTTP type
-     */
+    /** HTTP type */
     final static int HTTP = 1;
 
-    /**
-     * UDP type
-     */
+    /** UDP type */
     final static int UDP = 2;
 
-    /**
-     * TCP type
-     */
+    /** TCP type */
     final static int TCP = 3;
 
-    /**
-     * XMLRPC type
-     */
+    /** XMLRPC type */
     final static int XMLRPC = 4;
 
     /**
-     * JGROUPS type
-     */
-    final static int JAVAGROUPS = 5;
-
-    /**
      * Sets the httpServer attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new httpServer value
+     * @param val The new httpServer value
      */
     public void setHttpServer( String val );
 
@@ -76,12 +58,10 @@
      */
     public String getHttpServer();
 
-
     /**
      * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new tcpListenerPort value
+     * @param val The new tcpListenerPort value
      */
     public void setHttpListenerPort( int val );
 
@@ -95,8 +75,7 @@
     /**
      * Sets the httpServers attribute of the LateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new httpServers value
+     * @param val The new httpServers value
      */
     public void setHttpServers( String val );
 
@@ -110,8 +89,7 @@
     /**
      * Sets the udpMulticastAddr attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new udpMulticastAddr value
+     * @param val The new udpMulticastAddr value
      */
     public void setUdpMulticastAddr( String val );
 
@@ -125,8 +103,7 @@
     /**
      * Sets the udpMulticastPort attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new udpMulticastPort value
+     * @param val The new udpMulticastPort value
      */
     public void setUdpMulticastPort( int val );
 
@@ -140,8 +117,7 @@
     /**
      * Sets the transmissionType attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new transmissionType value
+     * @param val The new transmissionType value
      */
     public void setTransmissionType( int val );
 
@@ -153,29 +129,25 @@
     public int getTransmissionType();
 
     /**
-     * Sets the transmissionTypeName attribute of the ILateralCacheAttributes
-     * object
+     * Sets the transmissionTypeName attribute of the ILateralCacheAttributes object
      * <p>
-     * @param val
-     *            The new transmissionTypeName value
+     * @param val The new transmissionTypeName value
      */
     public void setTransmissionTypeName( String val );
 
     /**
-     * Gets the transmissionTypeName attribute of the ILateralCacheAttributes
-     * object
+     * Gets the transmissionTypeName attribute of the ILateralCacheAttributes object
      * <p>
      * @return The transmissionTypeName value
      */
     public String getTransmissionTypeName();
 
     /**
-     * Sets the putOnlyMode attribute of the ILateralCacheAttributes. When this
-     * is true the lateral cache will only issue put and remove order and will
-     * not try to retrieve elements from other lateral caches.
+     * Sets the putOnlyMode attribute of the ILateralCacheAttributes. When this is true the lateral
+     * cache will only issue put and remove order and will not try to retrieve elements from other
+     * lateral caches.
      * <p>
-     * @param val
-     *            The new transmissionTypeName value
+     * @param val The new transmissionTypeName value
      */
     public void setPutOnlyMode( boolean val );
 
@@ -185,40 +157,21 @@
     public boolean getPutOnlyMode();
 
     /**
-     *
-     * @return String The Javagroups channel propeties.
-     */
-    public String getJGChannelProperties();
-
-    /**
-     *
-     * Sets the Javagroups channel propeties.
-     *
-     * @param channelProperties
-     *            String
-     */
-    public void setJGChannelProperties( String channelProperties );
-
-    /**
-     * @param receive
-     *            The receive to set.
+     * @param receive The receive to set.
      */
     public void setReceive( boolean receive );
 
     /**
      * Should a listener be created. By default this is true.
      * <p>
-     * If this is false the lateral will connect to others but it will not
-     * create a listener to receive.
+     * If this is false the lateral will connect to others but it will not create a listener to
+     * receive.
+     * <p>
+     * It is possible if two laterals are misconfigured that lateral A may have a region R1 that is
+     * not configured for the lateral but another is. And if cache B has region R1 configured for
+     * lateral distribution, A will get messages for R1 but not send them.
      * <p>
-     * It is possible if two laterals are misconfigured that lateral A may have
-     * a region R1 that is not configured for the lateral but another is. And if
-     * cache B has region R1 configured for lateral distribution, A will get
-     * messages for R1 but not send them.
-     *
      * @return true if we should have a listener conenction
      */
     public boolean isReceive();
-
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java Fri Nov 14 14:50:12 2008
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.jcs.engine.behavior.ICacheElement;
@@ -67,4 +68,16 @@
      * @return keys
      */
     Set getGroupKeys( String cacheName, String groupName );
+    
+    /**
+     * Gets multiple items from the cache matching the pattern.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     *         data in cache matching the pattern.
+     * @throws IOException
+     */
+    Map getMatching( String cacheName, String pattern )
+        throws IOException;    
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Fri Nov 14 14:50:12 2008
@@ -27,6 +27,7 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -294,6 +295,35 @@
     }
 
     /**
+     * Gets the cache that was injected by the lateral factory. Calls get on the cache.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return Map
+     * @throws IOException
+     */
+    public Map handleGetMatching( String cacheName, String pattern )
+        throws IOException
+    {
+        getCnt++;
+        if ( log.isInfoEnabled() )
+        {
+            if ( getGetCnt() % 100 == 0 )
+            {
+                log.info( "GetMatching Count (port " + getTcpLateralCacheAttributes().getTcpListenerPort() + ") = "
+                    + getGetCnt() );
+            }
+        }
+
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "handleGetMatching> cacheName=" + cacheName + ", pattern = " + pattern );
+        }
+
+        return getCache( cacheName ).localGetMatching( pattern );
+    }
+    
+    /**
      * Right now this does nothing.
      * <p>
      * @see org.apache.jcs.engine.behavior.ICacheListener#handleDispose(java.lang.String)
@@ -596,6 +626,18 @@
                     oos.flush();
                 }
             }
+            else if ( led.command == LateralElementDescriptor.GET_MATCHING )
+            {
+                Map obj = handleGetMatching( cacheName, (String)key );
+
+                ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
+
+                if ( oos != null )
+                {
+                    oos.writeObject( obj );
+                    oos.flush();
+                }
+            }
         }
     }
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java Fri Nov 14 14:50:12 2008
@@ -30,7 +30,6 @@
 import org.apache.jcs.auxiliary.lateral.LateralElementDescriptor;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.utils.SocketOpener;
-import org.apache.jcs.engine.behavior.ICacheElement;
 
 /**
  * This class is based on the log4j SocketAppender class. I'm using a differnet repair structure, so
@@ -260,11 +259,9 @@
      * @return ICacheElement
      * @throws IOException
      */
-    public ICacheElement sendAndReceive( LateralElementDescriptor led )
+    public Object sendAndReceive( LateralElementDescriptor led )
         throws IOException
     {
-        ICacheElement ice = null;
-
         if ( led == null )
         {
             return null;
@@ -275,6 +272,8 @@
             throw new IOException( "No remote host is set for LateralTCPSender." );
         }
 
+        Object response = null;
+
         if ( oos != null )
         {
             // Synchronized to insure that the get requests to server from this
@@ -310,13 +309,7 @@
                         // TODO make configurable
                         // socket.setSoTimeout( 2000 );
                         ObjectInputStream ois = new ObjectInputStream( socket.getInputStream() );
-                        Object obj = ois.readObject();
-                        ice = (ICacheElement) obj;
-                        if ( ice == null )
-                        {
-                            // p( "ice is null" );
-                            // TODO: count misses
-                        }
+                        response = ois.readObject();
                     }
                     catch ( IOException ioe )
                     {
@@ -353,7 +346,7 @@
             }
         }
 
-        return ice;
+        return response;
     }
 
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Fri Nov 14 14:50:12 2008
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -232,7 +233,12 @@
             LateralElementDescriptor led = new LateralElementDescriptor( ce );
             // led.requesterId = requesterId; // later
             led.command = LateralElementDescriptor.GET;
-            return sender.sendAndReceive( led );
+            Object response = sender.sendAndReceive( led );
+            if ( response != null )
+            {
+                return (ICacheElement) response;
+            }
+            return null;
         }
         else
         {
@@ -242,6 +248,40 @@
     }
 
     /**
+     * The service does not get via this method, so this return empty.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+     *         data in cache matching the pattern.
+     * @throws IOException
+     */
+    public Map getMatching( String cacheName, String pattern )
+        throws IOException
+    {
+        // if get is not allowed return
+        if ( this.getTcpLateralCacheAttributes().isAllowGet() )
+        {
+            CacheElement ce = new CacheElement( cacheName, pattern, null );
+            LateralElementDescriptor led = new LateralElementDescriptor( ce );
+            // led.requesterId = requesterId; // later
+            led.command = LateralElementDescriptor.GET_MATCHING;
+            
+            Object response = sender.sendAndReceive( led );
+            if ( response != null )
+            {
+                return (Map) response;
+            }
+            return Collections.EMPTY_MAP;
+        }
+        else
+        {
+            // nothing needs to be done
+            return null;
+        }
+    }
+    
+    /**
      * Gets multiple items from the cache based on the given set of keys.
      * <p>
      * @param cacheName

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java Fri Nov 14 14:50:12 2008
@@ -24,9 +24,8 @@
 import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 
 /**
- * This interface defines functions that are particular to the TCP Lateral Cache
- * plugin. It extends the generic LateralCacheAttributes interface which in turn
- * extends the AuxiliaryCache interface.
+ * This interface defines functions that are particular to the TCP Lateral Cache plugin. It extends
+ * the generic LateralCacheAttributes interface which in turn extends the AuxiliaryCache interface.
  */
 public class TCPLateralCacheAttributes
     extends LateralCacheAttributes
@@ -56,214 +55,225 @@
     /** default */
     private static final boolean DEFAULT_FILTER_REMOVE_BY_HASH_CODE = true;
 
-    // TCP --------------------------------------------
+    /** TCP -------------------------------------------- */
     private String tcpServers = "";
 
-    // used to identify the service that this manager will be
-    // operating on
+    /** used to identify the service that this manager will be operating on */
     private String tcpServer = "";
 
+    /** The pot */
     private int tcpListenerPort = 0;
 
-    // udp discovery for tcp server
+    /** udp discovery for tcp server */
     private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
 
+    /** discovery port */
     private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT;
 
+    /** discovery switch */
     private boolean udpDiscoveryEnabled = DEFAULT_UDP_DISCOVERY_ENABLED;
 
+    /** can we put */
     private boolean allowPut = DEFAULT_ALLOW_GET;
 
+    /** can we go laterally for a get */
     private boolean allowGet = DEFAULT_ALLOW_PUT;
 
+    /** call remove when there is a put */
     private boolean issueRemoveOnPut = DEFAULT_ISSUE_REMOVE_FOR_PUT;
 
+    /** don't remove it the hashcode is the same */
     private boolean filterRemoveByHashCode = DEFAULT_FILTER_REMOVE_BY_HASH_CODE;
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServer(java.lang.String)
+    /**
+     * Sets the tcpServer attribute of the ILateralCacheAttributes object
+     * <p>
+     * @param val The new tcpServer value
      */
     public void setTcpServer( String val )
     {
         this.tcpServer = val;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServer()
+    /**
+     * Gets the tcpServer attribute of the ILateralCacheAttributes object
+     * <p>
+     * @return The tcpServer value
      */
     public String getTcpServer()
     {
         return this.tcpServer;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServers(java.lang.String)
+    /**
+     * Sets the tcpServers attribute of the ILateralCacheAttributes object
+     * <p>
+     * @param val The new tcpServers value
      */
     public void setTcpServers( String val )
     {
         this.tcpServers = val;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServers()
+    /**
+     * Gets the tcpServers attribute of the ILateralCacheAttributes object
+     * <p>
+     * @return The tcpServers value
      */
     public String getTcpServers()
     {
         return this.tcpServers;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpListenerPort(int)
+    /**
+     * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object
+     * <p>
+     * @param val The new tcpListenerPort value
      */
     public void setTcpListenerPort( int val )
     {
         this.tcpListenerPort = val;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpListenerPort()
+    /**
+     * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object
+     * <p>
+     * @return The tcpListenerPort value
      */
     public int getTcpListenerPort()
     {
         return this.tcpListenerPort;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryEnabled(boolean)
+    /**
+     * Can setup UDP Discovery. This only works for TCp laterals right now. It allows TCP laterals
+     * to find each other by broadcasting to a multicast port.
+     * <p>
+     * @param udpDiscoveryEnabled The udpDiscoveryEnabled to set.
      */
     public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled )
     {
         this.udpDiscoveryEnabled = udpDiscoveryEnabled;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#isUdpDiscoveryEnabled()
+    /**
+     * Whether or not TCP laterals can try to find each other by multicast communication.
+     * <p>
+     * @return Returns the udpDiscoveryEnabled.
      */
     public boolean isUdpDiscoveryEnabled()
     {
         return this.udpDiscoveryEnabled;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryPort()
+    /**
+     * The port to use if UDPDiscovery is enabled.
+     * <p>
+     * @return Returns the udpDiscoveryPort.
      */
     public int getUdpDiscoveryPort()
     {
         return this.udpDiscoveryPort;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryPort(int)
+    /**
+     * Sets the port to use if UDPDiscovery is enabled.
+     * <p>
+     * @param udpDiscoveryPort The udpDiscoveryPort to set.
      */
     public void setUdpDiscoveryPort( int udpDiscoveryPort )
     {
         this.udpDiscoveryPort = udpDiscoveryPort;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryAddr()
+    /**
+     * The address to broadcast to if UDPDiscovery is enabled.
+     * <p>
+     * @return Returns the udpDiscoveryAddr.
      */
     public String getUdpDiscoveryAddr()
     {
         return this.udpDiscoveryAddr;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryAddr(java.lang.String)
+    /**
+     * Sets the address to broadcast to if UDPDiscovery is enabled.
+     * <p>
+     * @param udpDiscoveryAddr The udpDiscoveryAddr to set.
      */
     public void setUdpDiscoveryAddr( String udpDiscoveryAddr )
     {
         this.udpDiscoveryAddr = udpDiscoveryAddr;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowGet(boolean)
+    /**
+     * Is the lateral allowed to try and get from other laterals.
+     * <p>
+     * This replaces the old putOnlyMode
+     * <p>
+     * @param allowGet
      */
     public void setAllowGet( boolean allowGet )
     {
         this.allowGet = allowGet;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowGet()
+    /**
+     * Is the lateral allowed to try and get from other laterals.
+     * <p>
+     * @return true if the lateral will try to get
      */
     public boolean isAllowGet()
     {
         return this.allowGet;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowPut(boolean)
+    /**
+     * Is the lateral allowed to put objects to other laterals.
+     * <p>
+     * @param allowPut
      */
     public void setAllowPut( boolean allowPut )
     {
         this.allowPut = allowPut;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowPut()
+    /**
+     * Is the lateral allowed to put objects to other laterals.
+     * <p>
+     * @return true if puts are allowed
      */
     public boolean isAllowPut()
     {
         return this.allowPut;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setIssueRemoveOnPut(boolean)
+    /**
+     * Should the client send a remove command rather than a put when update is called. This is a
+     * client option, not a receiver option. This allows you to prevent the lateral from serializing
+     * objects.
+     * <p>
+     * @param issueRemoveOnPut
      */
     public void setIssueRemoveOnPut( boolean issueRemoveOnPut )
     {
         this.issueRemoveOnPut = issueRemoveOnPut;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isIssueRemoveOnPut()
+    /**
+     * Should the client send a remove command rather than a put when update is called. This is a
+     * client option, not a receiver option. This allows you to prevent the lateral from serializing
+     * objects.
+     * <p>
+     * @return true if updates will result in a remove command being sent.
      */
     public boolean isIssueRemoveOnPut()
     {
         return this.issueRemoveOnPut;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#copy()
+    /**
+     * @return AuxiliaryCacheAttributes
      */
     public AuxiliaryCacheAttributes copy()
     {
@@ -278,20 +288,28 @@
         return this;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isFilterRemoveByHashCode()
+    /**
+     * Should the receiver try to match hashcodes. If true, the receiver will see if the client
+     * supplied a hshcode. If it did, then it will try to get the item locally. If the item exists,
+     * then it will compare the hashcode. if they are the same, it will not remove. This isn't
+     * perfect since different objects can have the same hashcode, but it is unlikely of objects of
+     * the same type.
+     * <p>
+     * @return boolean
      */
     public boolean isFilterRemoveByHashCode()
     {
         return this.filterRemoveByHashCode;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setFilterRemoveByHashCode(boolean)
+    /**
+     * Should the receiver try to match hashcodes. If true, the receiver will see if the client
+     * supplied a hshcode. If it did, then it will try to get the item locally. If the item exists,
+     * then it will compare the hashcode. if they are the same, it will not remove. This isn't
+     * perfect since different objects can have the same hashcode, but it is unlikely of objects of
+     * the same type.
+     * <p>
+     * @param filter
      */
     public void setFilterRemoveByHashCode( boolean filter )
     {
@@ -299,9 +317,9 @@
     }
 
     /**
-     * Used to key the instance TODO create another method for this and use
-     * toString for debugging only.
-     *
+     * Used to key the instance TODO create another method for this and use toString for debugging
+     * only.
+     * <p>
      * @return String
      */
     public String toString()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java Fri Nov 14 14:50:12 2008
@@ -195,5 +195,4 @@
      * @param filter
      */
     public void setFilterRemoveByHashCode( boolean filter );
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java Fri Nov 14 14:50:12 2008
@@ -56,8 +56,10 @@
 import EDU.oswego.cs.dl.util.concurrent.TimeoutException;
 
 /**
- * Client proxy for an RMI remote cache. This handles gets, updates, and removes. It also initiates
- * failover recovery when an error is encountered.
+ * Client proxy for an RMI remote cache.
+ * <p>
+ * This handles gets, updates, and removes. It also initiates failover recovery when an error is
+ * encountered.
  */
 public class RemoteCache
     extends AbstractAuxiliaryCacheEventLogging
@@ -81,13 +83,13 @@
     /** The listener */
     private IRemoteCacheListener listener;
 
-    /** Default element attribures */
+    /** Default element attributes */
     private IElementAttributes attr = null;
 
     /** A thread pool for gets if configured. */
     private ThreadPool pool = null;
 
-    /** Should we get asynchonously using a pool. */
+    /** Should we get asynchronously using a pool. */
     private boolean usePoolForGet = false;
 
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheAttributes.java Fri Nov 14 14:50:12 2008
@@ -464,7 +464,7 @@
 
     /**
      * The number of elements the zombie queue will hold. This queue is used to store events if we
-     * loose our conenction with the server.
+     * loose our connection with the server.
      * <p>
      * @param zombieQueueMaxSize The zombieQueueMaxSize to set.
      */
@@ -475,7 +475,7 @@
 
     /**
      * The number of elements the zombie queue will hold. This queue is used to store events if we
-     * loose our conenction with the server.
+     * loose our connection with the server.
      * <p>
      * @return Returns the zombieQueueMaxSize.
      */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java Fri Nov 14 14:50:12 2008
@@ -53,14 +53,15 @@
 
     /**
      * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
-     * with them. We create the RemoteCacheManager, but we do not get a cache. The failover runner
-     * will get a cache from the manager. When the primary is restored it will tell the manager for
-     * the failover to deregister the listener.
+     * with them. We create the RemoteCacheManager, but we do not get a cache.
      * <p>
-     * @param iaca 
-     * @param cacheMgr 
-     * @param cacheEventLogger 
-     * @param elementSerializer 
+     * The failover runner will get a cache from the manager. When the primary is restored it will
+     * tell the manager for the failover to deregister the listener.
+     * <p>
+     * @param iaca
+     * @param cacheMgr
+     * @param cacheEventLogger
+     * @param elementSerializer
      * @return AuxiliaryCache
      */
     public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr,
@@ -86,7 +87,8 @@
 
                 failovers.add( rca.getRemoteHost() + ":" + rca.getRemotePort() );
 
-                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger, elementSerializer );
+                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger,
+                                                                         elementSerializer );
                 ICache ic = rcm.getCache( rca );
                 if ( ic != null )
                 {
@@ -113,7 +115,8 @@
 
                     rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
                     rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
-                    RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger, elementSerializer );
+                    RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger,
+                                                                             elementSerializer );
                     // add a listener if there are none, need to tell rca what
                     // number it is at
                     if ( ( !primayDefined && fCnt == 1 ) || noWaits.size() <= 0 )
@@ -148,7 +151,8 @@
                 // p( "tcp server = " + server );
                 rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
                 rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
-                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger, elementSerializer );
+                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr, cacheEventLogger,
+                                                                         elementSerializer );
                 rca.setRemoteType( RemoteCacheAttributes.CLUSTER );
                 ICache ic = rcm.getCache( rca );
                 if ( ic != null )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java Fri Nov 14 14:50:12 2008
@@ -87,7 +87,8 @@
      * Only need one since it does work for all regions, just reference by multiple region names.
      * <p>
      * The constructor exports this object, making it available to receive incoming calls. The
-     * calback port is anonymous unless a local port value was specified in the configuration.
+     * callback port is anonymous unless a local port value was specified in the configuration.
+     * <p>
      * @param irca
      * @param cacheMgr
      */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Fri Nov 14 14:50:12 2008
@@ -53,7 +53,7 @@
 public class RemoteCacheManager
     implements AuxiliaryCacheManager, IShutdownObserver
 {
-    /** Dont' change */
+    /** Don't change */
     private static final long serialVersionUID = 798077557166389498L;
 
     /** The logger */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java Fri Nov 14 14:50:12 2008
@@ -64,6 +64,7 @@
 
     /**
      * Configures the idle period between repairs.
+     * <p>
      * @param idlePeriod The new idlePeriod value
      */
     public static void setIdlePeriod( long idlePeriod )
@@ -81,7 +82,8 @@
     }
 
     /**
-     * Returns the singleton instance;
+     * Returns the singleton instance.
+     * <p>
      * @return The instance value
      */
     static RemoteCacheMonitor getInstance()
@@ -220,7 +222,7 @@
         while ( true );
     }
 
-    /** Sets the "alright" flag to false in a critial section. */
+    /** Sets the "aright" flag to false in a critical section. */
     private synchronized void bad()
     {
         alright = false;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java Fri Nov 14 14:50:12 2008
@@ -24,6 +24,7 @@
 import java.rmi.UnmarshalException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -32,7 +33,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.AbstractAuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
@@ -69,7 +69,6 @@
  */
 public class RemoteCacheNoWait
     extends AbstractAuxiliaryCache
-    implements AuxiliaryCache
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -3104089136003714717L;
@@ -86,6 +85,9 @@
     /** how many times get has been called. */
     private int getCount = 0;
 
+    /** how many times getMatching has been called. */
+    private int getMatchingCount = 0;
+
     /** how many times getMultiple has been called. */
     private int getMultipleCount = 0;
 
@@ -157,7 +159,7 @@
         {
             if ( log.isDebugEnabled() )
             {
-                log.debug( "Retrying the get owing to UnmarshalException..." );
+                log.debug( "Retrying the get owing to UnmarshalException." );
             }
 
             try
@@ -176,21 +178,57 @@
         {
             // We don't want to destroy the queue on a get failure.
             // The RemoteCache will Zombie and queue.
-            // Since get does not use the queue, I dont want to killing the queue.
+            // Since get does not use the queue, I don't want to kill the queue.
             throw ex;
         }
 
         return null;
     }
 
-    /** TODO fix this */
+    /**
+     * @param pattern 
+     * @return Map
+     * @throws IOException 
+     * 
+     */
     public Map getMatching( String pattern )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        return null;
+        getMatchingCount++;
+        try
+        {
+            return remoteCacheClient.getMatching( pattern );
+        }
+        catch ( UnmarshalException ue )
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Retrying the getMatching owing to UnmarshalException." );
+            }
+
+            try
+            {
+                return remoteCacheClient.getMatching( pattern );
+            }
+            catch ( IOException ex )
+            {
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Failed in retrying the getMatching for the second time. " + ex.getMessage() );
+                }
+            }
+        }
+        catch ( IOException ex )
+        {
+            // We don't want to destroy the queue on a get failure.
+            // The RemoteCache will Zombie and queue.
+            // Since get does not use the queue, I don't want to kill the queue.
+            throw ex;
+        }
+
+        return Collections.EMPTY_MAP;
     }
-    
+
     /**
      * Gets multiple items from the cache based on the given set of keys. Sends the getMultiple
      * request on to the server rather than looping through the requested keys.
@@ -231,7 +269,7 @@
         {
             // We don't want to destroy the queue on a get failure.
             // The RemoteCache will Zombie and queue.
-            // Since get does not use the queue, I dont want to killing the queue.
+            // Since get does not use the queue, I don't want to kill the queue.
             throw ex;
         }
 
@@ -495,6 +533,11 @@
         elems.add( se );
 
         se = new StatElement();
+        se.setName( "GetMatching Count" );
+        se.setData( "" + this.getMatchingCount );
+        elems.add( se );
+
+        se = new StatElement();
         se.setName( "GetMultiple Count" );
         se.setData( "" + this.getMultipleCount );
         elems.add( se );

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Fri Nov 14 14:50:12 2008
@@ -23,6 +23,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -31,6 +32,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.engine.CacheConstants;
@@ -53,7 +55,7 @@
  * RemoteCacheNoWait.
  */
 public class RemoteCacheNoWaitFacade
-    implements AuxiliaryCache
+    extends AbstractAuxiliaryCache
 {
     /** For serialization. Don't change. */
     private static final long serialVersionUID = -4529970797620747110L;
@@ -74,15 +76,6 @@
     private ICompositeCacheManager cacheMgr;
 
     /**
-     * An optional event logger. Only errors are logged here. We don't want to log ICacheEvents
-     * since the noWaits do this.
-     */
-    private ICacheEventLogger cacheEventLogger;
-
-    /** The serializer. */
-    private IElementSerializer elementSerializer;
-
-    /**
      * Gets the remoteCacheAttributes attribute of the RemoteCacheNoWaitFacade object
      * <p>
      * @return The remoteCacheAttributes value
@@ -174,9 +167,7 @@
             // should start a failover thread
             // should probably only failover if there is only one in the noWait
             // list
-            // should start a background thread to set the original as the
-            // primary
-            // if we are in failover state
+            // Should start a background thread to restore the original primary if we are in failover state.
         }
     }
 
@@ -201,21 +192,37 @@
             catch ( Exception ex )
             {
                 log.debug( "Failed to get." );
+                return null;
             }
-            return null;
         }
         return null;
     }
-    
-    /** TODO fix this */
+
+    /**
+     * Synchronously read from the remote cache.
+     * <p>
+     * @param pattern
+     * @return map
+     * @throws IOException
+     */
     public Map getMatching( String pattern )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        return null;
+        for ( int i = 0; i < noWaits.length; i++ )
+        {
+            try
+            {
+                return noWaits[i].getMatching( pattern );
+            }
+            catch ( Exception ex )
+            {
+                log.debug( "Failed to getMatching." );
+                return Collections.EMPTY_MAP;
+            }
+        }
+        return Collections.EMPTY_MAP;
     }
 
-
     /**
      * Gets multiple items from the cache based on the given set of keys.
      * <p>
@@ -236,11 +243,10 @@
                 catch ( Exception ex )
                 {
                     log.debug( "Failed to get." );
-                    return new HashMap();
+                    return Collections.EMPTY_MAP;
                 }
             }
         }
-
         return new HashMap();
     }
 
@@ -270,7 +276,7 @@
      * Adds a remove request to the remote cache.
      * <p>
      * @param key
-     * @return wether or not it was removed, right now it return false.
+     * @return whether or not it was removed, right now it return false.
      */
     public boolean remove( Serializable key )
     {
@@ -289,7 +295,7 @@
     }
 
     /**
-     * Adds a removeAll request to the lateral cache.
+     * Adds a removeAll request to the remote cache.
      */
     public void removeAll()
     {
@@ -306,7 +312,7 @@
         }
     }
 
-    /** Adds a dispose request to the lateral cache. */
+    /** Adds a dispose request to the remote cache. */
     public void dispose()
     {
         try
@@ -323,7 +329,8 @@
     }
 
     /**
-     * No lateral invocation.
+     * No remote invocation.
+     * <p>
      * @return The size value
      */
     public int getSize()
@@ -481,33 +488,12 @@
     }
 
     /**
-     * Allows it to be injected.
+     * This typically returns end point info .
      * <p>
-     * @param cacheEventLogger
+     * @return the name
      */
-    public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+    public String getEventLoggingExtraInfo()
     {
-        this.cacheEventLogger = cacheEventLogger;
-    }
-
-    /**
-     * Allows the failover runner to use this event logger.
-     * <p>
-     * @return ICacheEventLogger
-     */
-    protected ICacheEventLogger getCacheEventLogger()
-    {
-        return cacheEventLogger;
-    }
-
-    /**
-     * Allows you to inject a custom serializer. A good example would be a compressing standard
-     * serializer.
-     * <p>
-     * @param elementSerializer
-     */
-    public void setElementSerializer( IElementSerializer elementSerializer )
-    {
-        this.elementSerializer = elementSerializer;
+        return "Remote Cache No Wait Facade";
     }
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheWatchRepairable.java Fri Nov 14 14:50:12 2008
@@ -25,7 +25,6 @@
 
 /**
  * Same as CacheWatcherWrapper but implements the IRemoteCacheWatch interface.
- *
  */
 public class RemoteCacheWatchRepairable
     extends CacheWatchRepairable

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheService.java Fri Nov 14 14:50:12 2008
@@ -155,12 +155,18 @@
         return null;
     }
 
-    /** TODO finish */
+    /**
+     * @param cacheName 
+     * @param pattern 
+     * @param requesterId 
+     * @return empty map
+     * @throws IOException 
+     * 
+     */
     public Map getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return Collections.EMPTY_MAP;
     }
     
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributes.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributes.java Fri Nov 14 14:50:12 2008
@@ -478,6 +478,8 @@
         buf.append( "\n startRegistry = [" + this.isStartRegistry() + "]" );
         buf.append( "\n useRegistryKeepAlive = [" + this.isUseRegistryKeepAlive() + "]" );
         buf.append( "\n registryKeepAliveDelayMillis = [" + this.getRegistryKeepAliveDelayMillis() + "]" );
+        buf.append( "\n eventQueueType = [" + this.getEventQueueType() + "]" );
+        buf.append( "\n eventQueuePoolName = [" + this.getEventQueuePoolName() + "]" );
         return buf.toString();
     }
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheEventQueueFactory.java Fri Nov 14 14:50:12 2008
@@ -89,6 +89,10 @@
                                                                                     null );
             if ( eventQueue != null )
             {
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Created custom event queue. " + eventQueue );
+                }
                 eventQueue.initialize( listener, listenerId, cacheName, maxFailure, waitBeforeRetry, threadPoolName );
             }
             else

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICache.java Fri Nov 14 14:50:12 2008
@@ -24,6 +24,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.jcs.engine.match.behavior.IKeyMatcher;
+
 /**
  * This is the top level interface for all cache like structures. It defines the methods used
  * internally by JCS to access, modify, and instrument such structures.
@@ -129,4 +131,11 @@
      * @return usually the region name.
      */
     String getCacheName();
+    
+    /**
+     * Sets the key matcher used by get matching. 
+     * <p>
+     * @param keyMatcher
+     */
+    void setKeyMatcher( IKeyMatcher keyMatcher );
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java Fri Nov 14 14:50:12 2008
@@ -47,6 +47,8 @@
 import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
 import org.apache.jcs.engine.control.event.behavior.IElementEventQueue;
 import org.apache.jcs.engine.control.group.GroupId;
+import org.apache.jcs.engine.match.KeyMatcherPatternImpl;
+import org.apache.jcs.engine.match.behavior.IKeyMatcher;
 import org.apache.jcs.engine.memory.MemoryCache;
 import org.apache.jcs.engine.memory.lru.LRUMemoryCache;
 import org.apache.jcs.engine.stats.CacheStats;
@@ -55,7 +57,6 @@
 import org.apache.jcs.engine.stats.behavior.ICacheStats;
 import org.apache.jcs.engine.stats.behavior.IStatElement;
 import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.utils.match.KeyMatcherUtil;
 
 /**
  * This is the primary hub for a single cache/region. It controls the flow of items through the
@@ -120,6 +121,9 @@
      */
     private MemoryCache memCache;
 
+    /** Key matcher used by the getMatching API */
+    protected IKeyMatcher keyMatcher = new KeyMatcherPatternImpl();
+
     /**
      * Constructor for the Cache object
      * <p>
@@ -927,7 +931,7 @@
         // this avoids locking the memory cache, but it uses more memory
         Object[] keyArray = memCache.getKeyArray();
 
-        Set matchingKeys = KeyMatcherUtil.getMatchingKeysFromArray( pattern, keyArray );
+        Set matchingKeys = getKeyMatcher().getMatchingKeysFromArray( pattern, keyArray );
 
         // call get multiple
         return getMultipleFromMemory( matchingKeys );
@@ -1771,6 +1775,29 @@
     }
 
     /**
+     * Sets the key matcher used by get matching.
+     * <p>
+     * @param keyMatcher
+     */
+    public void setKeyMatcher( IKeyMatcher keyMatcher )
+    {
+        if ( keyMatcher != null )
+        {
+            this.keyMatcher = keyMatcher;
+        }
+    }
+
+    /**
+     * Rerturns the key matcher used by get matching.
+     * <p>
+     * @return keyMatcher
+     */
+    public IKeyMatcher getKeyMatcher()
+    {
+        return this.keyMatcher;
+    }
+
+    /**
      * @param updateCount The updateCount to set.
      */
     public void setUpdateCount( int updateCount )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=714178&r1=714177&r2=714178&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Fri Nov 14 14:50:12 2008
@@ -38,6 +38,8 @@
 import org.apache.jcs.engine.behavior.IElementAttributes;
 import org.apache.jcs.engine.behavior.IElementSerializer;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
+import org.apache.jcs.engine.match.KeyMatcherPatternImpl;
+import org.apache.jcs.engine.match.behavior.IKeyMatcher;
 import org.apache.jcs.utils.config.OptionConverter;
 import org.apache.jcs.utils.config.PropertySetter;
 
@@ -74,6 +76,13 @@
     /** .elementattributes */
     final static String ELEMENT_ATTRIBUTE_PREFIX = ".elementattributes";
 
+    /**
+     * jcs.auxiliary.NAME.keymatcher=CLASSNAME
+     * <p>
+     * jcs.auxiliary.NAME.keymatcher.attributes.CUSTOMPROPERTY=VALUE
+     */
+    public final static String KEY_MATCHER_PREFIX = ".keymatcher";
+    
     /** Can't operate on the interface. */
     private CompositeCacheManager compositeCacheManager;
 
@@ -563,6 +572,10 @@
         // CONFIGURE THE ELEMENT SERIALIZER
         IElementSerializer elementSerializer = AuxiliaryCacheConfigurator.parseElementSerializer( props, auxPrefix );
 
+        // CONFIGURE THE KEYMATCHER
+        //IKeyMatcher keyMatcher = parseKeyMatcher( props, auxPrefix );
+        // TODO add to factory interface
+        
         // Consider putting the compositeCache back in the factory interface
         // since the manager may not know about it at this point.
         // need to make sure the manager already has the cache
@@ -571,4 +584,42 @@
 
         return auxCache;
     }
+    
+    /**
+     * Creates a custom key matcher if one is defined.  Else, it uses the default.
+     * <p>
+     * @param props
+     * @param auxPrefix - ex. AUXILIARY_PREFIX + auxName
+     * @return IKeyMatcher
+     */
+    public static IKeyMatcher parseKeyMatcher( Properties props, String auxPrefix )
+    {
+        IKeyMatcher keyMatcher = null;
+
+        // auxFactory was not previously initialized.
+        String keyMatcherClassName = auxPrefix + KEY_MATCHER_PREFIX;
+        keyMatcher = (IKeyMatcher) OptionConverter
+            .instantiateByKey( props, keyMatcherClassName,
+                               IKeyMatcher.class, null );
+        if ( keyMatcher != null )
+        {
+            String attributePrefix = auxPrefix + KEY_MATCHER_PREFIX + ATTRIBUTE_PREFIX;
+            PropertySetter.setProperties( keyMatcher, props, attributePrefix + "." );
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "Using custom key matcher [" + keyMatcher + "] for auxiliary [" + auxPrefix
+                    + "]" );
+            }
+        }
+        else
+        {
+            // use the default standard serializer
+            keyMatcher = new KeyMatcherPatternImpl();
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "Using standard key matcher [" + keyMatcher + "] for auxiliary [" + auxPrefix + "]" );
+            }
+        }
+        return keyMatcher;
+    }    
 }