commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1570993 [10/24] - in /commons/proper/jcs/trunk/src: assembly/ changes/ conf/ java/org/apache/commons/jcs/access/ java/org/apache/commons/jcs/access/exception/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/auxiliary/ java/o...
Date Sun, 23 Feb 2014 10:37:52 GMT
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheRequest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheRequest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheRequest.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheRequest.java Sun Feb 23 10:37:48 2014
@@ -1,168 +1,187 @@
-package org.apache.commons.jcs.auxiliary.remote.value;
-
-import java.io.Serializable;
-import java.util.Set;
-
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-/**
- * The basic request wrapper. The different types of requests are differentiated by their types.
- * <p>
- * Rather than creating sub object types, I created on object that has values for all types of
- * requests.
- */
-public class RemoteCacheRequest<K extends Serializable, V extends Serializable>
-    implements Serializable
-{
-    /** Don't change. */
-    private static final long serialVersionUID = -8858447417390442569L;
-
-    /** The request type specifies the type of request: get, put, remove, . . */
-    private RemoteRequestType requestType = null;
-
-    /** Used to identify the source. Same as listener id on the client side. */
-    private long requesterId = 0;
-
-    /** The name of the region */
-    private String cacheName;
-
-    /** The key, if this request has a key. */
-    private K key;
-
-    /** The keySet, if this request has a keySet. Only getMultiple requests. */
-    private Set<K> keySet;
-
-    /** The pattern, if this request uses a pattern. Only getMatching requests. */
-    private String pattern;
-
-    /** The ICacheEleemnt, if this request contains a value. Only update requests will have this. */
-    private ICacheElement<K, V> cacheElement;
-
-    /**
-     * @param requestType the requestType to set
-     */
-    public void setRequestType( RemoteRequestType requestType )
-    {
-        this.requestType = requestType;
-    }
-
-    /**
-     * @return the requestType
-     */
-    public RemoteRequestType getRequestType()
-    {
-        return requestType;
-    }
-
-    /**
-     * @param cacheName the cacheName to set
-     */
-    public void setCacheName( String cacheName )
-    {
-        this.cacheName = cacheName;
-    }
-
-    /**
-     * @return the cacheName
-     */
-    public String getCacheName()
-    {
-        return cacheName;
-    }
-
-    /**
-     * @param key the key to set
-     */
-    public void setKey( K key )
-    {
-        this.key = key;
-    }
-
-    /**
-     * @return the key
-     */
-    public K getKey()
-    {
-        return key;
-    }
-
-    /**
-     * @param pattern the pattern to set
-     */
-    public void setPattern( String pattern )
-    {
-        this.pattern = pattern;
-    }
-
-    /**
-     * @return the pattern
-     */
-    public String getPattern()
-    {
-        return pattern;
-    }
-
-    /**
-     * @param cacheElement the cacheElement to set
-     */
-    public void setCacheElement( ICacheElement<K, V> cacheElement )
-    {
-        this.cacheElement = cacheElement;
-    }
-
-    /**
-     * @return the cacheElement
-     */
-    public ICacheElement<K, V> getCacheElement()
-    {
-        return cacheElement;
-    }
-
-    /**
-     * @param requesterId the requesterId to set
-     */
-    public void setRequesterId( long requesterId )
-    {
-        this.requesterId = requesterId;
-    }
-
-    /**
-     * @return the requesterId
-     */
-    public long getRequesterId()
-    {
-        return requesterId;
-    }
-
-    /**
-     * @param keySet the keySet to set
-     */
-    public void setKeySet( Set<K> keySet )
-    {
-        this.keySet = keySet;
-    }
-
-    /**
-     * @return the keySet
-     */
-    public Set<K> getKeySet()
-    {
-        return keySet;
-    }
-
-    /** @return string */
-    @Override
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-        buf.append( "\nRemoteHttpCacheRequest" );
-        buf.append( "\n requesterId [" + getRequesterId() + "]" );
-        buf.append( "\n requestType [" + getRequestType() + "]" );
-        buf.append( "\n cacheName [" + getCacheName() + "]" );
-        buf.append( "\n key [" + getKey() + "]" );
-        buf.append( "\n keySet [" + getKeySet() + "]" );
-        buf.append( "\n pattern [" + getPattern() + "]" );
-        buf.append( "\n cacheElement [" + getCacheElement() + "]" );
-        return buf.toString();
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.value;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+/**
+ * The basic request wrapper. The different types of requests are differentiated by their types.
+ * <p>
+ * Rather than creating sub object types, I created on object that has values for all types of
+ * requests.
+ */
+public class RemoteCacheRequest<K extends Serializable, V extends Serializable>
+    implements Serializable
+{
+    /** Don't change. */
+    private static final long serialVersionUID = -8858447417390442569L;
+
+    /** The request type specifies the type of request: get, put, remove, . . */
+    private RemoteRequestType requestType = null;
+
+    /** Used to identify the source. Same as listener id on the client side. */
+    private long requesterId = 0;
+
+    /** The name of the region */
+    private String cacheName;
+
+    /** The key, if this request has a key. */
+    private K key;
+
+    /** The keySet, if this request has a keySet. Only getMultiple requests. */
+    private Set<K> keySet;
+
+    /** The pattern, if this request uses a pattern. Only getMatching requests. */
+    private String pattern;
+
+    /** The ICacheEleemnt, if this request contains a value. Only update requests will have this. */
+    private ICacheElement<K, V> cacheElement;
+
+    /**
+     * @param requestType the requestType to set
+     */
+    public void setRequestType( RemoteRequestType requestType )
+    {
+        this.requestType = requestType;
+    }
+
+    /**
+     * @return the requestType
+     */
+    public RemoteRequestType getRequestType()
+    {
+        return requestType;
+    }
+
+    /**
+     * @param cacheName the cacheName to set
+     */
+    public void setCacheName( String cacheName )
+    {
+        this.cacheName = cacheName;
+    }
+
+    /**
+     * @return the cacheName
+     */
+    public String getCacheName()
+    {
+        return cacheName;
+    }
+
+    /**
+     * @param key the key to set
+     */
+    public void setKey( K key )
+    {
+        this.key = key;
+    }
+
+    /**
+     * @return the key
+     */
+    public K getKey()
+    {
+        return key;
+    }
+
+    /**
+     * @param pattern the pattern to set
+     */
+    public void setPattern( String pattern )
+    {
+        this.pattern = pattern;
+    }
+
+    /**
+     * @return the pattern
+     */
+    public String getPattern()
+    {
+        return pattern;
+    }
+
+    /**
+     * @param cacheElement the cacheElement to set
+     */
+    public void setCacheElement( ICacheElement<K, V> cacheElement )
+    {
+        this.cacheElement = cacheElement;
+    }
+
+    /**
+     * @return the cacheElement
+     */
+    public ICacheElement<K, V> getCacheElement()
+    {
+        return cacheElement;
+    }
+
+    /**
+     * @param requesterId the requesterId to set
+     */
+    public void setRequesterId( long requesterId )
+    {
+        this.requesterId = requesterId;
+    }
+
+    /**
+     * @return the requesterId
+     */
+    public long getRequesterId()
+    {
+        return requesterId;
+    }
+
+    /**
+     * @param keySet the keySet to set
+     */
+    public void setKeySet( Set<K> keySet )
+    {
+        this.keySet = keySet;
+    }
+
+    /**
+     * @return the keySet
+     */
+    public Set<K> getKeySet()
+    {
+        return keySet;
+    }
+
+    /** @return string */
+    @Override
+    public String toString()
+    {
+        StringBuffer buf = new StringBuffer();
+        buf.append( "\nRemoteHttpCacheRequest" );
+        buf.append( "\n requesterId [" + getRequesterId() + "]" );
+        buf.append( "\n requestType [" + getRequestType() + "]" );
+        buf.append( "\n cacheName [" + getCacheName() + "]" );
+        buf.append( "\n key [" + getKey() + "]" );
+        buf.append( "\n keySet [" + getKeySet() + "]" );
+        buf.append( "\n pattern [" + getPattern() + "]" );
+        buf.append( "\n cacheElement [" + getCacheElement() + "]" );
+        return buf.toString();
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheResponse.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheResponse.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheResponse.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteCacheResponse.java Sun Feb 23 10:37:48 2014
@@ -1,86 +1,105 @@
-package org.apache.commons.jcs.auxiliary.remote.value;
-
-import java.io.Serializable;
-
-/**
- * This is the response wrapper. The servlet wraps all different type of responses in one of these
- * objects.
- */
-public class RemoteCacheResponse<T>
-    implements Serializable
-{
-    /** Don't change. */
-    private static final long serialVersionUID = -8858447417390442568L;
-
-    /** Was the event processed without error */
-    private boolean success = true;
-
-    /** Simple error messaging */
-    private String errorMessage;
-
-    /**
-     * The payload. Typically a key / ICacheElement<K, V> map. A normal get will return a map with one
-     * record.
-     */
-    private T payload;
-
-    /**
-     * @param success the success to set
-     */
-    public void setSuccess( boolean success )
-    {
-        this.success = success;
-    }
-
-    /**
-     * @return the success
-     */
-    public boolean isSuccess()
-    {
-        return success;
-    }
-
-    /**
-     * @param errorMessage the errorMessage to set
-     */
-    public void setErrorMessage( String errorMessage )
-    {
-        this.errorMessage = errorMessage;
-    }
-
-    /**
-     * @return the errorMessage
-     */
-    public String getErrorMessage()
-    {
-        return errorMessage;
-    }
-
-    /**
-     * @param payload the payload to set
-     */
-    public void setPayload( T payload )
-    {
-        this.payload = payload;
-    }
-
-    /**
-     * @return the payload
-     */
-    public T getPayload()
-    {
-        return payload;
-    }
-
-    /** @return string */
-    @Override
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-        buf.append( "\nRemoteHttpCacheResponse" );
-        buf.append( "\n success [" + isSuccess() + "]" );
-        buf.append( "\n payload [" + getPayload() + "]" );
-        buf.append( "\n errorMessage [" + getErrorMessage() + "]" );
-        return buf.toString();
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.value;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+/**
+ * This is the response wrapper. The servlet wraps all different type of responses in one of these
+ * objects.
+ */
+public class RemoteCacheResponse<T>
+    implements Serializable
+{
+    /** Don't change. */
+    private static final long serialVersionUID = -8858447417390442568L;
+
+    /** Was the event processed without error */
+    private boolean success = true;
+
+    /** Simple error messaging */
+    private String errorMessage;
+
+    /**
+     * The payload. Typically a key / ICacheElement<K, V> map. A normal get will return a map with one
+     * record.
+     */
+    private T payload;
+
+    /**
+     * @param success the success to set
+     */
+    public void setSuccess( boolean success )
+    {
+        this.success = success;
+    }
+
+    /**
+     * @return the success
+     */
+    public boolean isSuccess()
+    {
+        return success;
+    }
+
+    /**
+     * @param errorMessage the errorMessage to set
+     */
+    public void setErrorMessage( String errorMessage )
+    {
+        this.errorMessage = errorMessage;
+    }
+
+    /**
+     * @return the errorMessage
+     */
+    public String getErrorMessage()
+    {
+        return errorMessage;
+    }
+
+    /**
+     * @param payload the payload to set
+     */
+    public void setPayload( T payload )
+    {
+        this.payload = payload;
+    }
+
+    /**
+     * @return the payload
+     */
+    public T getPayload()
+    {
+        return payload;
+    }
+
+    /** @return string */
+    @Override
+    public String toString()
+    {
+        StringBuffer buf = new StringBuffer();
+        buf.append( "\nRemoteHttpCacheResponse" );
+        buf.append( "\n success [" + isSuccess() + "]" );
+        buf.append( "\n payload [" + getPayload() + "]" );
+        buf.append( "\n errorMessage [" + getErrorMessage() + "]" );
+        return buf.toString();
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java Sun Feb 23 10:37:48 2014
@@ -1,35 +1,53 @@
-package org.apache.commons.jcs.auxiliary.remote.value;
-
-
-/**
- * The different types of requests
- */
-public enum RemoteRequestType
-{
-    /** Alive check request type. */
-    ALIVE_CHECK,
-
-    /** Get request type. */
-    GET,
-
-    /** Get Multiple request type. */
-    GET_MULTIPLE,
-
-    /** Get Matching request type. */
-    GET_MATCHING,
-
-    /** Update request type. */
-    UPDATE,
-
-    /** Remove request type. */
-    REMOVE,
-
-    /** Remove All request type. */
-    REMOVE_ALL,
-
-    /** Get keys request type. */
-    GET_KEYSET,
-
-    /** Dispose request type. */
-    DISPOSE,
-}
+package org.apache.commons.jcs.auxiliary.remote.value;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The different types of requests
+ */
+public enum RemoteRequestType
+{
+    /** Alive check request type. */
+    ALIVE_CHECK,
+
+    /** Get request type. */
+    GET,
+
+    /** Get Multiple request type. */
+    GET_MULTIPLE,
+
+    /** Get Matching request type. */
+    GET_MATCHING,
+
+    /** Update request type. */
+    UPDATE,
+
+    /** Remove request type. */
+    REMOVE,
+
+    /** Remove All request type. */
+    REMOVE_ALL,
+
+    /** Get keys request type. */
+    GET_KEYSET,
+
+    /** Dispose request type. */
+    DISPOSE,
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java Sun Feb 23 10:37:48 2014
@@ -1,307 +1,307 @@
-package org.apache.commons.jcs.engine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.commons.jcs.utils.struct.BoundedQueue;
-import org.apache.commons.jcs.utils.timing.ElapsedTimer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Zombie adapter for the non local cache services. It just balks if there is no queue configured.
- * <p>
- * If a queue is configured, then events will be added to the queue. The idea is that when proper
- * operation is restored, the non local cache will walk the queue. The queue must be bounded so it
- * does not eat memory.
- * <p>
- * This originated in the remote cache.
- */
-public class ZombieCacheServiceNonLocal<K extends Serializable, V extends Serializable>
-    extends ZombieCacheService<K, V>
-    implements ICacheServiceNonLocal<K, V>
-{
-    /** The logger */
-    private final static Log log = LogFactory.getLog( ZombieCacheServiceNonLocal.class );
-
-    /** How big can the queue grow. */
-    private int maxQueueSize = 0;
-
-    /** The queue */
-    private final BoundedQueue<ZombieEvent> queue;
-
-    /**
-     * Default.
-     */
-    public ZombieCacheServiceNonLocal()
-    {
-        queue = new BoundedQueue<ZombieEvent>( 0 );
-    }
-
-    /**
-     * Sets the maximum number of items that will be allowed on the queue.
-     * <p>
-     * @param maxQueueSize
-     */
-    public ZombieCacheServiceNonLocal( int maxQueueSize )
-    {
-        this.maxQueueSize = maxQueueSize;
-        queue = new BoundedQueue<ZombieEvent>( maxQueueSize );
-    }
-
-    /**
-     * Gets the number of items on the queue.
-     * <p>
-     * @return size of the queue.
-     */
-    public int getQueueSize()
-    {
-        return queue.size();
-    }
-
-    /**
-     * Adds an update event to the queue if the maxSize is greater than 0;
-     * <p>
-     * @param item ICacheElement
-     * @param listenerId - identifies the caller.
-     */
-    public void update( ICacheElement<K, V> item, long listenerId )
-    {
-        if ( maxQueueSize > 0 )
-        {
-            PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
-            queue.add( event );
-        }
-        // Zombies have no inner life
-    }
-
-    /**
-     * Adds a removeAll event to the queue if the maxSize is greater than 0;
-     * <p>
-     * @param cacheName - region name
-     * @param key - item key
-     * @param listenerId - identifies the caller.
-     */
-    public void remove( String cacheName, K key, long listenerId )
-    {
-        if ( maxQueueSize > 0 )
-        {
-            RemoveEvent<K, V> event = new RemoveEvent<K, V>( cacheName, key, listenerId );
-            queue.add( event );
-        }
-        // Zombies have no inner life
-    }
-
-    /**
-     * Adds a removeAll event to the queue if the maxSize is greater than 0;
-     * <p>
-     * @param cacheName - name of the region
-     * @param listenerId - identifies the caller.
-     */
-    public void removeAll( String cacheName, long listenerId )
-    {
-        if ( maxQueueSize > 0 )
-        {
-            RemoveAllEvent event = new RemoveAllEvent( cacheName, listenerId );
-            queue.add( event );
-        }
-        // Zombies have no inner life
-    }
-
-    /**
-     * Does nothing. Gets are synchronous and cannot be added to a queue.
-     * <p>
-     * @param cacheName - region name
-     * @param key - item key
-     * @param requesterId - identifies the caller.
-     * @return null
-     * @throws IOException
-     */
-    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
-        throws IOException
-    {
-        // Zombies have no inner life
-        return null;
-    }
-
-    /**
-     * Does nothing.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @param requesterId
-     * @return empty map
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
-        throws IOException
-    {
-        return Collections.emptyMap();
-    }
-
-    /**
-     * @param cacheName - region name
-     * @param keys - item key
-     * @param requesterId - identity of the caller
-     * @return an empty map. zombies have no internal data
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
-    {
-        return new HashMap<K, ICacheElement<K, V>>();
-    }
-
-    /**
-     * Does nothing.
-     * <p>
-     * @param cacheName - region name
-     * @return empty set
-     */
-    public Set<K> getKeySet( String cacheName )
-    {
-        return Collections.emptySet();
-    }
-
-    /**
-     * Walk the queue, calling the service for each queue operation.
-     * <p>
-     * @param service
-     * @throws Exception
-     */
-    public synchronized void propagateEvents( ICacheServiceNonLocal<K, V> service )
-        throws Exception
-    {
-        int cnt = 0;
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Propagating events to the new ICacheServiceNonLocal." );
-        }
-        ElapsedTimer timer = new ElapsedTimer();
-        while ( !queue.isEmpty() )
-        {
-            cnt++;
-
-            // for each item, call the appropriate service method
-            ZombieEvent event = queue.take();
-
-            if ( event instanceof PutEvent )
-            {
-                @SuppressWarnings("unchecked") // Type checked by instanceof
-                PutEvent<K, V> putEvent = (PutEvent<K, V>) event;
-                service.update( putEvent.element, event.requesterId );
-            }
-            else if ( event instanceof RemoveEvent )
-            {
-                @SuppressWarnings("unchecked") // Type checked by instanceof
-                RemoveEvent<K, V> removeEvent = (RemoveEvent<K, V>) event;
-                service.remove( event.cacheName, removeEvent.key, event.requesterId );
-            }
-            else if ( event instanceof RemoveAllEvent )
-            {
-                service.removeAll( event.cacheName, event.requesterId );
-            }
-        }
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Propagated " + cnt + " events to the new ICacheServiceNonLocal in "
-                + timer.getElapsedTimeString() );
-        }
-    }
-
-    /**
-     * Base of the other events.
-     */
-    protected static abstract class ZombieEvent
-    {
-        /** The name of the region. */
-        String cacheName;
-
-        /** The id of the requester */
-        long requesterId;
-    }
-
-    /**
-     * A basic put event.
-     */
-    private static class PutEvent<K extends Serializable, V extends Serializable>
-        extends ZombieEvent
-    {
-        /** The element to put */
-        ICacheElement<K, V> element;
-
-        /**
-         * Set the element
-         * @param element
-         * @param requesterId
-         */
-        public PutEvent( ICacheElement<K, V> element, long requesterId )
-        {
-            this.requesterId = requesterId;
-            this.element = element;
-        }
-    }
-
-    /**
-     * A basic Remove event.
-     */
-    private static class RemoveEvent<K extends Serializable, V extends Serializable>
-        extends ZombieEvent
-    {
-        /** The key to remove */
-        K key;
-
-        /**
-         * Set the element
-         * @param cacheName
-         * @param key
-         * @param requesterId
-         */
-        public RemoveEvent( String cacheName, K key, long requesterId )
-        {
-            this.cacheName = cacheName;
-            this.requesterId = requesterId;
-            this.key = key;
-        }
-    }
-
-    /**
-     * A basic RemoveAll event.
-     */
-    private static class RemoveAllEvent
-        extends ZombieEvent
-    {
-        /**
-         * @param cacheName
-         * @param requesterId
-         */
-        public RemoveAllEvent( String cacheName, long requesterId )
-        {
-            this.cacheName = cacheName;
-            this.requesterId = requesterId;
-        }
-    }
-}
+package org.apache.commons.jcs.engine;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+import org.apache.commons.jcs.utils.struct.BoundedQueue;
+import org.apache.commons.jcs.utils.timing.ElapsedTimer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Zombie adapter for the non local cache services. It just balks if there is no queue configured.
+ * <p>
+ * If a queue is configured, then events will be added to the queue. The idea is that when proper
+ * operation is restored, the non local cache will walk the queue. The queue must be bounded so it
+ * does not eat memory.
+ * <p>
+ * This originated in the remote cache.
+ */
+public class ZombieCacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends ZombieCacheService<K, V>
+    implements ICacheServiceNonLocal<K, V>
+{
+    /** The logger */
+    private final static Log log = LogFactory.getLog( ZombieCacheServiceNonLocal.class );
+
+    /** How big can the queue grow. */
+    private int maxQueueSize = 0;
+
+    /** The queue */
+    private final BoundedQueue<ZombieEvent> queue;
+
+    /**
+     * Default.
+     */
+    public ZombieCacheServiceNonLocal()
+    {
+        queue = new BoundedQueue<ZombieEvent>( 0 );
+    }
+
+    /**
+     * Sets the maximum number of items that will be allowed on the queue.
+     * <p>
+     * @param maxQueueSize
+     */
+    public ZombieCacheServiceNonLocal( int maxQueueSize )
+    {
+        this.maxQueueSize = maxQueueSize;
+        queue = new BoundedQueue<ZombieEvent>( maxQueueSize );
+    }
+
+    /**
+     * Gets the number of items on the queue.
+     * <p>
+     * @return size of the queue.
+     */
+    public int getQueueSize()
+    {
+        return queue.size();
+    }
+
+    /**
+     * Adds an update event to the queue if the maxSize is greater than 0;
+     * <p>
+     * @param item ICacheElement
+     * @param listenerId - identifies the caller.
+     */
+    public void update( ICacheElement<K, V> item, long listenerId )
+    {
+        if ( maxQueueSize > 0 )
+        {
+            PutEvent<K, V> event = new PutEvent<K, V>( item, listenerId );
+            queue.add( event );
+        }
+        // Zombies have no inner life
+    }
+
+    /**
+     * Adds a removeAll event to the queue if the maxSize is greater than 0;
+     * <p>
+     * @param cacheName - region name
+     * @param key - item key
+     * @param listenerId - identifies the caller.
+     */
+    public void remove( String cacheName, K key, long listenerId )
+    {
+        if ( maxQueueSize > 0 )
+        {
+            RemoveEvent<K, V> event = new RemoveEvent<K, V>( cacheName, key, listenerId );
+            queue.add( event );
+        }
+        // Zombies have no inner life
+    }
+
+    /**
+     * Adds a removeAll event to the queue if the maxSize is greater than 0;
+     * <p>
+     * @param cacheName - name of the region
+     * @param listenerId - identifies the caller.
+     */
+    public void removeAll( String cacheName, long listenerId )
+    {
+        if ( maxQueueSize > 0 )
+        {
+            RemoveAllEvent event = new RemoveAllEvent( cacheName, listenerId );
+            queue.add( event );
+        }
+        // Zombies have no inner life
+    }
+
+    /**
+     * Does nothing. Gets are synchronous and cannot be added to a queue.
+     * <p>
+     * @param cacheName - region name
+     * @param key - item key
+     * @param requesterId - identifies the caller.
+     * @return null
+     * @throws IOException
+     */
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
+        throws IOException
+    {
+        // Zombies have no inner life
+        return null;
+    }
+
+    /**
+     * Does nothing.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @param requesterId
+     * @return empty map
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
+        throws IOException
+    {
+        return Collections.emptyMap();
+    }
+
+    /**
+     * @param cacheName - region name
+     * @param keys - item key
+     * @param requesterId - identity of the caller
+     * @return an empty map. zombies have no internal data
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
+    {
+        return new HashMap<K, ICacheElement<K, V>>();
+    }
+
+    /**
+     * Does nothing.
+     * <p>
+     * @param cacheName - region name
+     * @return empty set
+     */
+    public Set<K> getKeySet( String cacheName )
+    {
+        return Collections.emptySet();
+    }
+
+    /**
+     * Walk the queue, calling the service for each queue operation.
+     * <p>
+     * @param service
+     * @throws Exception
+     */
+    public synchronized void propagateEvents( ICacheServiceNonLocal<K, V> service )
+        throws Exception
+    {
+        int cnt = 0;
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Propagating events to the new ICacheServiceNonLocal." );
+        }
+        ElapsedTimer timer = new ElapsedTimer();
+        while ( !queue.isEmpty() )
+        {
+            cnt++;
+
+            // for each item, call the appropriate service method
+            ZombieEvent event = queue.take();
+
+            if ( event instanceof PutEvent )
+            {
+                @SuppressWarnings("unchecked") // Type checked by instanceof
+                PutEvent<K, V> putEvent = (PutEvent<K, V>) event;
+                service.update( putEvent.element, event.requesterId );
+            }
+            else if ( event instanceof RemoveEvent )
+            {
+                @SuppressWarnings("unchecked") // Type checked by instanceof
+                RemoveEvent<K, V> removeEvent = (RemoveEvent<K, V>) event;
+                service.remove( event.cacheName, removeEvent.key, event.requesterId );
+            }
+            else if ( event instanceof RemoveAllEvent )
+            {
+                service.removeAll( event.cacheName, event.requesterId );
+            }
+        }
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Propagated " + cnt + " events to the new ICacheServiceNonLocal in "
+                + timer.getElapsedTimeString() );
+        }
+    }
+
+    /**
+     * Base of the other events.
+     */
+    protected static abstract class ZombieEvent
+    {
+        /** The name of the region. */
+        String cacheName;
+
+        /** The id of the requester */
+        long requesterId;
+    }
+
+    /**
+     * A basic put event.
+     */
+    private static class PutEvent<K extends Serializable, V extends Serializable>
+        extends ZombieEvent
+    {
+        /** The element to put */
+        ICacheElement<K, V> element;
+
+        /**
+         * Set the element
+         * @param element
+         * @param requesterId
+         */
+        public PutEvent( ICacheElement<K, V> element, long requesterId )
+        {
+            this.requesterId = requesterId;
+            this.element = element;
+        }
+    }
+
+    /**
+     * A basic Remove event.
+     */
+    private static class RemoveEvent<K extends Serializable, V extends Serializable>
+        extends ZombieEvent
+    {
+        /** The key to remove */
+        K key;
+
+        /**
+         * Set the element
+         * @param cacheName
+         * @param key
+         * @param requesterId
+         */
+        public RemoveEvent( String cacheName, K key, long requesterId )
+        {
+            this.cacheName = cacheName;
+            this.requesterId = requesterId;
+            this.key = key;
+        }
+    }
+
+    /**
+     * A basic RemoveAll event.
+     */
+    private static class RemoveAllEvent
+        extends ZombieEvent
+    {
+        /**
+         * @param cacheName
+         * @param requesterId
+         */
+        public RemoveAllEvent( String cacheName, long requesterId )
+        {
+            this.cacheName = cacheName;
+            this.requesterId = requesterId;
+        }
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheManager.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheManager.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheManager.java Sun Feb 23 10:37:48 2014
@@ -1,7 +1,5 @@
 package org.apache.commons.jcs.engine.behavior;
 
-import java.io.Serializable;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,6 +19,9 @@ import java.io.Serializable;
  * under the License.
  */
 
+import java.io.Serializable;
+
+
 /**
  * Interface implemented by a specific cache.
  *

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java Sun Feb 23 10:37:48 2014
@@ -1,119 +1,119 @@
-package org.apache.commons.jcs.engine.behavior;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.rmi.Remote;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Used to retrieve and update non local caches, such as the remote and lateral caches. Unlike
- * ICacheService, the methods here have a requester id. This allows us to avoid propagating events
- * to ourself.
- * <p>
- * TODO consider not extending ICacheService
- */
-public interface ICacheServiceNonLocal<K extends Serializable, V extends Serializable>
-    extends Remote, ICacheService<K, V>
-{
-    /**
-     * Puts a cache item to the cache.
-     * <p>
-     * @param item
-     * @param requesterId
-     * @throws IOException
-     */
-    void update( ICacheElement<K, V> item, long requesterId )
-        throws IOException;
-
-    /**
-     * Removes the given key from the specified cache.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @throws IOException
-     */
-    void remove( String cacheName, K key, long requesterId )
-        throws IOException;
-
-    /**
-     * Remove all keys from the specified cache.
-     * <p>
-     * @param cacheName
-     * @param requesterId
-     * @throws IOException
-     */
-    void removeAll( String cacheName, long requesterId )
-        throws IOException;
-
-    /**
-     * Returns a cache bean from the specified cache; or null if the key does not exist.
-     * <p>
-     * Adding the requestor id, allows the cache to determine the source of the get.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @return ICacheElement
-     * @throws IOException
-     */
-    ICacheElement<K, V> get( String cacheName, K key, long requesterId )
-        throws IOException;
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * @param cacheName
-     * @param keys
-     * @param requesterId
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     * @throws IOException
-     */
-    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
-        throws IOException;
-
-    /**
-     * Gets multiple items from the cache matching the pattern.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @param requesterId
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache matching the pattern.
-     * @throws IOException
-     */
-    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
-        throws IOException;
-
-    /**
-     * Get a set of the keys for all elements in the cache.
-     * <p>
-     * @param cacheName the name of the cache
-     * @return a set of the key type
-     * @TODO This should probably be done in chunks with a range passed in. This
-     *       will be a problem if someone puts a 1,000,000 or so items in a
-     *       region.
-     */
-    Set<K> getKeySet( String cacheName ) throws IOException;
-}
+package org.apache.commons.jcs.engine.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Used to retrieve and update non local caches, such as the remote and lateral caches. Unlike
+ * ICacheService, the methods here have a requester id. This allows us to avoid propagating events
+ * to ourself.
+ * <p>
+ * TODO consider not extending ICacheService
+ */
+public interface ICacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    extends Remote, ICacheService<K, V>
+{
+    /**
+     * Puts a cache item to the cache.
+     * <p>
+     * @param item
+     * @param requesterId
+     * @throws IOException
+     */
+    void update( ICacheElement<K, V> item, long requesterId )
+        throws IOException;
+
+    /**
+     * Removes the given key from the specified cache.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @throws IOException
+     */
+    void remove( String cacheName, K key, long requesterId )
+        throws IOException;
+
+    /**
+     * Remove all keys from the specified cache.
+     * <p>
+     * @param cacheName
+     * @param requesterId
+     * @throws IOException
+     */
+    void removeAll( String cacheName, long requesterId )
+        throws IOException;
+
+    /**
+     * Returns a cache bean from the specified cache; or null if the key does not exist.
+     * <p>
+     * Adding the requestor id, allows the cache to determine the source of the get.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @return ICacheElement
+     * @throws IOException
+     */
+    ICacheElement<K, V> get( String cacheName, K key, long requesterId )
+        throws IOException;
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * @param cacheName
+     * @param keys
+     * @param requesterId
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     * @throws IOException
+     */
+    Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
+        throws IOException;
+
+    /**
+     * Gets multiple items from the cache matching the pattern.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @param requesterId
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache matching the pattern.
+     * @throws IOException
+     */
+    Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
+        throws IOException;
+
+    /**
+     * Get a set of the keys for all elements in the cache.
+     * <p>
+     * @param cacheName the name of the cache
+     * @return a set of the key type
+     * @TODO This should probably be done in chunks with a range passed in. This
+     *       will be a problem if someone puts a 1,000,000 or so items in a
+     *       region.
+     */
+    Set<K> getKeySet( String cacheName ) throws IOException;
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheType.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheType.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheType.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheType.java Sun Feb 23 10:37:48 2014
@@ -19,7 +19,6 @@ package org.apache.commons.jcs.engine.be
  * under the License.
  */
 
-
 /**
  * Interface implemented by a specific cache.
  *

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IProvideScheduler.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IProvideScheduler.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IProvideScheduler.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IProvideScheduler.java Sun Feb 23 10:37:48 2014
@@ -1,7 +1,5 @@
 package org.apache.commons.jcs.engine.behavior;
 
-import java.util.concurrent.ScheduledExecutorService;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,6 +19,9 @@ import java.util.concurrent.ScheduledExe
  * under the License.
  */
 
+import java.util.concurrent.ScheduledExecutorService;
+
+
 /**
  * Marker interface for providers of the central ScheduledExecutorService
  * <p>

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IRequireScheduler.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IRequireScheduler.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IRequireScheduler.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/IRequireScheduler.java Sun Feb 23 10:37:48 2014
@@ -1,7 +1,5 @@
 package org.apache.commons.jcs.engine.behavior;
 
-import java.util.concurrent.ScheduledExecutorService;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,6 +19,9 @@ import java.util.concurrent.ScheduledExe
  * under the License.
  */
 
+import java.util.concurrent.ScheduledExecutorService;
+
+
 /**
  * Marker interface to allow the injection of a central ScheduledExecutorService
  * for all modules requiring scheduled background operations.

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEvent.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEvent.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEvent.java Sun Feb 23 10:37:48 2014
@@ -1,159 +1,178 @@
-package org.apache.commons.jcs.engine.logging;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
-
-/** It's returned from create and passed into log. */
-public class CacheEvent<K extends Serializable>
-    implements ICacheEvent<K>
-{
-    /** Don't change. */
-    private static final long serialVersionUID = -5913139566421714330L;
-
-    /** The time at which this object was created. */
-    private final long createTime = System.currentTimeMillis();
-
-    /** The auxiliary or other source of the event. */
-    private String source;
-
-    /** The cache region */
-    private String region;
-
-    /** The event name: update, get, remove, etc. */
-    private String eventName;
-
-    /** disk location, ip, etc. */
-    private String optionalDetails;
-
-    /** The key that was put or retrieved. */
-    private K key;
-
-    /**
-     * @param source the source to set
-     */
-    @Override
-	public void setSource( String source )
-    {
-        this.source = source;
-    }
-
-    /**
-     * @return the source
-     */
-    @Override
-	public String getSource()
-    {
-        return source;
-    }
-
-    /**
-     * @param region the region to set
-     */
-    @Override
-	public void setRegion( String region )
-    {
-        this.region = region;
-    }
-
-    /**
-     * @return the region
-     */
-    @Override
-	public String getRegion()
-    {
-        return region;
-    }
-
-    /**
-     * @param eventName the eventName to set
-     */
-    @Override
-	public void setEventName( String eventName )
-    {
-        this.eventName = eventName;
-    }
-
-    /**
-     * @return the eventName
-     */
-    @Override
-	public String getEventName()
-    {
-        return eventName;
-    }
-
-    /**
-     * @param optionalDetails the optionalDetails to set
-     */
-    @Override
-	public void setOptionalDetails( String optionalDetails )
-    {
-        this.optionalDetails = optionalDetails;
-    }
-
-    /**
-     * @return the optionalDetails
-     */
-    @Override
-	public String getOptionalDetails()
-    {
-        return optionalDetails;
-    }
-
-    /**
-     * @param key the key to set
-     */
-    @Override
-	public void setKey( K key )
-    {
-        this.key = key;
-    }
-
-    /**
-     * @return the key
-     */
-    @Override
-	public K getKey()
-    {
-        return key;
-    }
-
-    /**
-     * The time at which this object was created.
-     * <p>
-     * @return the createTime
-     */
-    public long getCreateTime()
-    {
-        return createTime;
-    }
-
-    /**
-     * @return reflection toString
-     */
-    @Override
-    public String toString()
-    {
-    	StringBuilder sb = new StringBuilder();
-    	sb.append("CacheEvent: ").append(eventName).append(" Created: ").append(new Date(createTime));
-    	if (source != null)
-    	{
-        	sb.append(" Source: ").append(source);
-    	}
-    	if (region != null)
-    	{
-        	sb.append(" Region: ").append(region);
-    	}
-    	if (key != null)
-    	{
-        	sb.append(" Key: ").append(key);
-    	}
-    	if (optionalDetails != null)
-    	{
-        	sb.append(" Details: ").append(optionalDetails);
-    	}
-        return sb.toString();
-    }
-}
+package org.apache.commons.jcs.engine.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
+
+/** It's returned from create and passed into log. */
+public class CacheEvent<K extends Serializable>
+    implements ICacheEvent<K>
+{
+    /** Don't change. */
+    private static final long serialVersionUID = -5913139566421714330L;
+
+    /** The time at which this object was created. */
+    private final long createTime = System.currentTimeMillis();
+
+    /** The auxiliary or other source of the event. */
+    private String source;
+
+    /** The cache region */
+    private String region;
+
+    /** The event name: update, get, remove, etc. */
+    private String eventName;
+
+    /** disk location, ip, etc. */
+    private String optionalDetails;
+
+    /** The key that was put or retrieved. */
+    private K key;
+
+    /**
+     * @param source the source to set
+     */
+    @Override
+	public void setSource( String source )
+    {
+        this.source = source;
+    }
+
+    /**
+     * @return the source
+     */
+    @Override
+	public String getSource()
+    {
+        return source;
+    }
+
+    /**
+     * @param region the region to set
+     */
+    @Override
+	public void setRegion( String region )
+    {
+        this.region = region;
+    }
+
+    /**
+     * @return the region
+     */
+    @Override
+	public String getRegion()
+    {
+        return region;
+    }
+
+    /**
+     * @param eventName the eventName to set
+     */
+    @Override
+	public void setEventName( String eventName )
+    {
+        this.eventName = eventName;
+    }
+
+    /**
+     * @return the eventName
+     */
+    @Override
+	public String getEventName()
+    {
+        return eventName;
+    }
+
+    /**
+     * @param optionalDetails the optionalDetails to set
+     */
+    @Override
+	public void setOptionalDetails( String optionalDetails )
+    {
+        this.optionalDetails = optionalDetails;
+    }
+
+    /**
+     * @return the optionalDetails
+     */
+    @Override
+	public String getOptionalDetails()
+    {
+        return optionalDetails;
+    }
+
+    /**
+     * @param key the key to set
+     */
+    @Override
+	public void setKey( K key )
+    {
+        this.key = key;
+    }
+
+    /**
+     * @return the key
+     */
+    @Override
+	public K getKey()
+    {
+        return key;
+    }
+
+    /**
+     * The time at which this object was created.
+     * <p>
+     * @return the createTime
+     */
+    public long getCreateTime()
+    {
+        return createTime;
+    }
+
+    /**
+     * @return reflection toString
+     */
+    @Override
+    public String toString()
+    {
+    	StringBuilder sb = new StringBuilder();
+    	sb.append("CacheEvent: ").append(eventName).append(" Created: ").append(new Date(createTime));
+    	if (source != null)
+    	{
+        	sb.append(" Source: ").append(source);
+    	}
+    	if (region != null)
+    	{
+        	sb.append(" Region: ").append(region);
+    	}
+    	if (key != null)
+    	{
+        	sb.append(" Key: ").append(key);
+    	}
+    	if (optionalDetails != null)
+    	{
+        	sb.append(" Details: ").append(optionalDetails);
+    	}
+        return sb.toString();
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java Sun Feb 23 10:37:48 2014
@@ -1,92 +1,111 @@
-package org.apache.commons.jcs.engine.logging;
-
-import java.io.Serializable;
-
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This implementation simple logs to a commons logger at debug level, for all events. It's mainly
- * for testing. It isn't very useful otherwise.
- */
-public class CacheEventLoggerDebugLogger
-    implements ICacheEventLogger
-{
-    /** This is the name of the category. */
-    private String logCategoryName = CacheEventLoggerDebugLogger.class.getName();
-
-    /** The logger. This is recreated on set logCategoryName */
-    private Log log = LogFactory.getLog( logCategoryName );
-
-    /**
-     * @param source
-     * @param region
-     * @param eventName
-     * @param optionalDetails
-     * @param key
-     * @return ICacheEvent
-     */
-    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region, String eventName,
-            String optionalDetails, T key )
-    {
-        ICacheEvent<T> event = new CacheEvent<T>();
-        event.setSource( source );
-        event.setRegion( region );
-        event.setEventName( eventName );
-        event.setOptionalDetails( optionalDetails );
-        event.setKey( key );
-
-        return event;
-    }
-
-    /**
-     * @param source
-     * @param eventName
-     * @param optionalDetails
-     */
-    public void logApplicationEvent( String source, String eventName, String optionalDetails )
-    {
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( source + " | " + eventName + " | " + optionalDetails );
-        }
-    }
-
-    /**
-     * @param source
-     * @param eventName
-     * @param errorMessage
-     */
-    public void logError( String source, String eventName, String errorMessage )
-    {
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( source + " | " + eventName + " | " + errorMessage );
-        }
-    }
-
-    /**
-     * @param event
-     */
-    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
-    {
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( event );
-        }
-    }
-
-    /**
-     * @param logCategoryName
-     */
-    public synchronized void setLogCategoryName( String logCategoryName )
-    {
-        if ( logCategoryName != null && !logCategoryName.equals( this.logCategoryName ) )
-        {
-            this.logCategoryName = logCategoryName;
-            log = LogFactory.getLog( logCategoryName );
-        }
-    }
-}
+package org.apache.commons.jcs.engine.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This implementation simple logs to a commons logger at debug level, for all events. It's mainly
+ * for testing. It isn't very useful otherwise.
+ */
+public class CacheEventLoggerDebugLogger
+    implements ICacheEventLogger
+{
+    /** This is the name of the category. */
+    private String logCategoryName = CacheEventLoggerDebugLogger.class.getName();
+
+    /** The logger. This is recreated on set logCategoryName */
+    private Log log = LogFactory.getLog( logCategoryName );
+
+    /**
+     * @param source
+     * @param region
+     * @param eventName
+     * @param optionalDetails
+     * @param key
+     * @return ICacheEvent
+     */
+    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region, String eventName,
+            String optionalDetails, T key )
+    {
+        ICacheEvent<T> event = new CacheEvent<T>();
+        event.setSource( source );
+        event.setRegion( region );
+        event.setEventName( eventName );
+        event.setOptionalDetails( optionalDetails );
+        event.setKey( key );
+
+        return event;
+    }
+
+    /**
+     * @param source
+     * @param eventName
+     * @param optionalDetails
+     */
+    public void logApplicationEvent( String source, String eventName, String optionalDetails )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( source + " | " + eventName + " | " + optionalDetails );
+        }
+    }
+
+    /**
+     * @param source
+     * @param eventName
+     * @param errorMessage
+     */
+    public void logError( String source, String eventName, String errorMessage )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( source + " | " + eventName + " | " + errorMessage );
+        }
+    }
+
+    /**
+     * @param event
+     */
+    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( event );
+        }
+    }
+
+    /**
+     * @param logCategoryName
+     */
+    public synchronized void setLogCategoryName( String logCategoryName )
+    {
+        if ( logCategoryName != null && !logCategoryName.equals( this.logCategoryName ) )
+        {
+            this.logCategoryName = logCategoryName;
+            log = LogFactory.getLog( logCategoryName );
+        }
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEvent.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEvent.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEvent.java Sun Feb 23 10:37:48 2014
@@ -1,58 +1,77 @@
-package org.apache.commons.jcs.engine.logging.behavior;
-
-import java.io.Serializable;
-
-/** Defines the common fields required by a cache event. */
-public interface ICacheEvent<K extends Serializable>
-    extends Serializable
-{
-    /**
-     * @param source the source to set
-     */
-    public void setSource( String source );
-
-    /**
-     * @return the source
-     */
-    public String getSource();
-
-    /**
-     * @param region the region to set
-     */
-    public void setRegion( String region );
-
-    /**
-     * @return the region
-     */
-    public String getRegion();
-
-    /**
-     * @param eventName the eventName to set
-     */
-    public void setEventName( String eventName );
-
-    /**
-     * @return the eventName
-     */
-    public String getEventName();
-
-    /**
-     * @param optionalDetails the optionalDetails to set
-     */
-    public void setOptionalDetails( String optionalDetails );
-
-    /**
-     * @return the optionalDetails
-     */
-    public String getOptionalDetails();
-
-    /**
-     * @param key the key to set
-     */
-    public void setKey( K key );
-
-    /**
-     * @return the key
-     */
-    public K getKey();
-}
+package org.apache.commons.jcs.engine.logging.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+/** Defines the common fields required by a cache event. */
+public interface ICacheEvent<K extends Serializable>
+    extends Serializable
+{
+    /**
+     * @param source the source to set
+     */
+    public void setSource( String source );
+
+    /**
+     * @return the source
+     */
+    public String getSource();
+
+    /**
+     * @param region the region to set
+     */
+    public void setRegion( String region );
+
+    /**
+     * @return the region
+     */
+    public String getRegion();
+
+    /**
+     * @param eventName the eventName to set
+     */
+    public void setEventName( String eventName );
+
+    /**
+     * @return the eventName
+     */
+    public String getEventName();
+
+    /**
+     * @param optionalDetails the optionalDetails to set
+     */
+    public void setOptionalDetails( String optionalDetails );
+
+    /**
+     * @return the optionalDetails
+     */
+    public String getOptionalDetails();
+
+    /**
+     * @param key the key to set
+     */
+    public void setKey( K key );
+
+    /**
+     * @return the key
+     */
+    public K getKey();
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEventLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEventLogger.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEventLogger.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/logging/behavior/ICacheEventLogger.java Sun Feb 23 10:37:48 2014
@@ -1,74 +1,93 @@
-package org.apache.commons.jcs.engine.logging.behavior;
-
-import java.io.Serializable;
-
-/**
- * This defines the behavior for event logging. Auxiliaries will send events to injected event
- * loggers.
- * <p>
- * In general all ICache interface methods should call the logger if one is configured. This will be
- * done on an ad hoc basis for now. Various auxiliaries may have additional events.
- */
-public interface ICacheEventLogger
-{
-    /** ICache update */
-    static final String UPDATE_EVENT = "update";
-
-    /** ICache get */
-    static final String GET_EVENT = "get";
-
-    /** ICache getMultiple */
-    static final String GETMULTIPLE_EVENT = "getMultiple";
-
-    /** ICache getMatching */
-    static final String GETMATCHING_EVENT = "getMatching";
-
-    /** ICache remove */
-    static final String REMOVE_EVENT = "remove";
-
-    /** ICache removeAll */
-    static final String REMOVEALL_EVENT = "removeAll";
-
-    /** ICache dispose */
-    static final String DISPOSE_EVENT = "dispose";
-
-    /** ICache enqueue. The time in the queue. */
-    //static final String ENQUEUE_EVENT = "enqueue";
-    /**
-     * Creates an event.
-     * <p>
-     * @param source - e.g. RemoteCacheServer
-     * @param region - the name of the region
-     * @param eventName - e.g. update, get, put, remove
-     * @param optionalDetails - any extra message
-     * @param key - the cache key
-     * @return ICacheEvent
-     */
-    <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region,
-            String eventName, String optionalDetails, T key );
-
-    /**
-     * Logs an event.
-     * <p>
-     * @param event - the event created in createICacheEvent
-     */
-    <T extends Serializable> void logICacheEvent( ICacheEvent<T> event );
-
-    /**
-     * Logs an event. These are internal application events that do not correspond to ICache calls.
-     * <p>
-     * @param source - e.g. RemoteCacheServer
-     * @param eventName - e.g. update, get, put, remove
-     * @param optionalDetails - any extra message
-     */
-    void logApplicationEvent( String source, String eventName, String optionalDetails );
-
-    /**
-     * Logs an error.
-     * <p>
-     * @param source - e.g. RemoteCacheServer
-     * @param eventName - e.g. update, get, put, remove
-     * @param errorMessage - any error message
-     */
-    void logError( String source, String eventName, String errorMessage );
-}
+package org.apache.commons.jcs.engine.logging.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+/**
+ * This defines the behavior for event logging. Auxiliaries will send events to injected event
+ * loggers.
+ * <p>
+ * In general all ICache interface methods should call the logger if one is configured. This will be
+ * done on an ad hoc basis for now. Various auxiliaries may have additional events.
+ */
+public interface ICacheEventLogger
+{
+    /** ICache update */
+    static final String UPDATE_EVENT = "update";
+
+    /** ICache get */
+    static final String GET_EVENT = "get";
+
+    /** ICache getMultiple */
+    static final String GETMULTIPLE_EVENT = "getMultiple";
+
+    /** ICache getMatching */
+    static final String GETMATCHING_EVENT = "getMatching";
+
+    /** ICache remove */
+    static final String REMOVE_EVENT = "remove";
+
+    /** ICache removeAll */
+    static final String REMOVEALL_EVENT = "removeAll";
+
+    /** ICache dispose */
+    static final String DISPOSE_EVENT = "dispose";
+
+    /** ICache enqueue. The time in the queue. */
+    //static final String ENQUEUE_EVENT = "enqueue";
+    /**
+     * Creates an event.
+     * <p>
+     * @param source - e.g. RemoteCacheServer
+     * @param region - the name of the region
+     * @param eventName - e.g. update, get, put, remove
+     * @param optionalDetails - any extra message
+     * @param key - the cache key
+     * @return ICacheEvent
+     */
+    <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region,
+            String eventName, String optionalDetails, T key );
+
+    /**
+     * Logs an event.
+     * <p>
+     * @param event - the event created in createICacheEvent
+     */
+    <T extends Serializable> void logICacheEvent( ICacheEvent<T> event );
+
+    /**
+     * Logs an event. These are internal application events that do not correspond to ICache calls.
+     * <p>
+     * @param source - e.g. RemoteCacheServer
+     * @param eventName - e.g. update, get, put, remove
+     * @param optionalDetails - any extra message
+     */
+    void logApplicationEvent( String source, String eventName, String optionalDetails );
+
+    /**
+     * Logs an error.
+     * <p>
+     * @param source - e.g. RemoteCacheServer
+     * @param eventName - e.g. update, get, put, remove
+     * @param errorMessage - any error message
+     */
+    void logError( String source, String eventName, String errorMessage );
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpl.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpl.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/KeyMatcherPatternImpl.java Sun Feb 23 10:37:48 2014
@@ -1,47 +1,66 @@
-package org.apache.commons.jcs.engine.match;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.jcs.engine.match.behavior.IKeyMatcher;
-
-/** This implementation of the KeyMatcher uses standard Java Pattern matching. */
-public class KeyMatcherPatternImpl<K extends Serializable>
-    implements IKeyMatcher<K>
-{
-    /** TODO serialVersionUID */
-    private static final long serialVersionUID = 6667352064144381264L;
-
-    /**
-     * Creates a pattern and find matches on the array.
-     * <p>
-     * @param pattern
-     * @param keyArray
-     * @return Set of the matching keys
-     */
-    public Set<K> getMatchingKeysFromArray( String pattern, Set<K> keyArray )
-    {
-        Pattern compiledPattern = Pattern.compile( pattern );
-
-        Set<K> matchingKeys = new HashSet<K>();
-
-        // Look for matches
-        for (K key : keyArray)
-        {
-            // TODO we might want to match on the toString.
-            if ( key instanceof String )
-            {
-                Matcher matcher = compiledPattern.matcher( (String) key );
-                if ( matcher.matches() )
-                {
-                    matchingKeys.add( key );
-                }
-            }
-        }
-
-        return matchingKeys;
-    }
-}
+package org.apache.commons.jcs.engine.match;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.jcs.engine.match.behavior.IKeyMatcher;
+
+/** This implementation of the KeyMatcher uses standard Java Pattern matching. */
+public class KeyMatcherPatternImpl<K extends Serializable>
+    implements IKeyMatcher<K>
+{
+    /** TODO serialVersionUID */
+    private static final long serialVersionUID = 6667352064144381264L;
+
+    /**
+     * Creates a pattern and find matches on the array.
+     * <p>
+     * @param pattern
+     * @param keyArray
+     * @return Set of the matching keys
+     */
+    public Set<K> getMatchingKeysFromArray( String pattern, Set<K> keyArray )
+    {
+        Pattern compiledPattern = Pattern.compile( pattern );
+
+        Set<K> matchingKeys = new HashSet<K>();
+
+        // Look for matches
+        for (K key : keyArray)
+        {
+            // TODO we might want to match on the toString.
+            if ( key instanceof String )
+            {
+                Matcher matcher = compiledPattern.matcher( (String) key );
+                if ( matcher.matches() )
+                {
+                    matchingKeys.add( key );
+                }
+            }
+        }
+
+        return matchingKeys;
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/behavior/IKeyMatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/behavior/IKeyMatcher.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/behavior/IKeyMatcher.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/match/behavior/IKeyMatcher.java Sun Feb 23 10:37:48 2014
@@ -1,17 +1,36 @@
-package org.apache.commons.jcs.engine.match.behavior;
-
-import java.io.Serializable;
-import java.util.Set;
-
-/** Key matchers need to implement this interface. */
-public interface IKeyMatcher<K extends Serializable> extends Serializable
-{
-    /**
-     * Creates a pattern and find matches on the array.
-     * <p>
-     * @param pattern
-     * @param keyArray
-     * @return Set of the matching keys
-     */
-    Set<K> getMatchingKeysFromArray( String pattern, Set<K> keyArray );
-}
+package org.apache.commons.jcs.engine.match.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.Set;
+
+/** Key matchers need to implement this interface. */
+public interface IKeyMatcher<K extends Serializable> extends Serializable
+{
+    /**
+     * Creates a pattern and find matches on the array.
+     * <p>
+     * @param pattern
+     * @param keyArray
+     * @return Set of the matching keys
+     */
+    Set<K> getMatchingKeysFromArray( String pattern, Set<K> keyArray );
+}



Mime
View raw message