[teiid-commits] teiid SVN: r4430 - in trunk: build/kits/jboss-as7/bin/scripts and 23 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Sep 11 17:46:53 EDT 2012


Author: rareddy
Date: 2012-09-11 17:46:52 -0400 (Tue, 11 Sep 2012)
New Revision: 4430

Added:
   trunk/engine/src/test/java/org/teiid/cache/DefaultCacheFactory.java
   trunk/runtime/src/main/java/org/teiid/cache/
   trunk/runtime/src/main/java/org/teiid/cache/infinispan/
   trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCache.java
   trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCacheFactory.java
   trunk/runtime/src/main/resources/infinispan-config.xml
   trunk/test-integration/common/src/test/resources/infinispan-replicated-config.xml
Removed:
   trunk/engine/src/main/java/org/teiid/cache/DefaultCache.java
   trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
   trunk/engine/src/test/java/org/teiid/cache/TestDefaultCache.java
   trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java
   trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
   trunk/runtime/src/main/java/org/teiid/runtime/ReplicatedCacheImpl.java
Modified:
   trunk/build/kits/jboss-as7/bin/scripts/teiid-domain-mode-install.cli
   trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
   trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
   trunk/engine/pom.xml
   trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
   trunk/jboss-integration/pom.xml
   trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
   trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
   trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
   trunk/jboss-integration/src/test/resources/teiid-model-config.txt
   trunk/jboss-integration/src/test/resources/teiid-model-json.txt
   trunk/jboss-integration/src/test/resources/teiid-sample-config.xml
   trunk/pom.xml
   trunk/runtime/pom.xml
   trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java
   trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java
   trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java
Log:
TEIID-2168: Replaced the Default Cache factory with Infinispan based cache. The embedded deployment also currently uses the Infinispan as cache and provides the possibility for replication as the server mode.

Modified: trunk/build/kits/jboss-as7/bin/scripts/teiid-domain-mode-install.cli
===================================================================
--- trunk/build/kits/jboss-as7/bin/scripts/teiid-domain-mode-install.cli	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/build/kits/jboss-as7/bin/scripts/teiid-domain-mode-install.cli	2012-09-11 21:46:52 UTC (rev 4430)
@@ -5,13 +5,23 @@
 /server-group=main-server-group:write-attribute(name=profile, value=ha)
 /server-group=main-server-group:write-attribute(name=socket-binding-group, value=ha-sockets)
 
-/profile=ha/subsystem=infinispan/cache-container=teiid-cache:add(default-cache=result-set)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache:add(default-cache=resultset)
 /profile=ha/subsystem=infinispan/cache-container=teiid-cache/transport=TRANSPORT:add(lock-timeout=60000)
-/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset:add(mode=SYNC, batching=true)
-/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset/locking=LOCKING:add(isolation=READ_COMMITTED)
-/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset/expiration=EXPIRATION:add(lifespan=7200000)
-/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset/eviction=EVICTION:add(max-entries=1024, strategy=LRU)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset-repl:add(mode=SYNC, batching=true)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset-repl/locking=LOCKING:add(isolation=READ_COMMITTED)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset-repl/expiration=EXPIRATION:add(lifespan=7200000)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/replicated-cache=resultset-repl/eviction=EVICTION:add(max-entries=1024, strategy=LRU)
 
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=resultset:add(mode=SYNC, batching=true)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=resultset/locking=LOCKING:add(isolation=READ_COMMITTED)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=resultset/expiration=EXPIRATION:add(lifespan=7200000)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=resultset/eviction=EVICTION:add(max-entries=1024, strategy=LRU)
+
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=preparedplan:add(mode=SYNC, batching=true)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=preparedplan/locking=LOCKING:add(isolation=READ_COMMITTED)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=preparedplan/expiration=EXPIRATION:add(lifespan=28800)
+/profile=ha/subsystem=infinispan/cache-container=teiid-cache/local-cache=preparedplan/eviction=EVICTION:add(max-entries=512, strategy=LRU)
+
 /profile=ha/subsystem=security/security-domain=teiid-security:add(cache-type=default)
 /profile=ha/subsystem=security/security-domain=teiid-security/authentication=classic:add(login-modules=[{"code"=>"org.jboss.security.auth.spi.UsersRolesLoginModule", "flag"=>"required", "module-options"=>[("usersProperties"=>"${jboss.domain.config.dir}/teiid-security-users.properties"), ("rolesProperties"=>"${jboss.domain.config.dir}/teiid-security-roles.properties")]}]) 
 /profile=ha/subsystem=threads/bounded-queue-thread-pool=teiid-async:add(name=teiid-async, max-threads=4, queue-length=100)

Modified: trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -38,6 +38,9 @@
         <module name="org.jboss.as.clustering.jgroups"/>
         <module name="org.infinispan"/>
         <module name="asm.asm"/>
+        <module name="org.infinispan"/>
+        <module name="org.jboss.marshalling"/>
+        <module name="org.jboss.marshalling.river"/>
         <!-- These dependencies here for ra.xml description -->
         <module name="org.jboss.as.connector"/>
         <module name="org.jboss.ironjacamar.api"/>

Modified: trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -171,8 +171,16 @@
             <cache-container name="teiid" default-cache="resultset">
                 <local-cache name="resultset">
                     <expiration lifespan="7200000" />
-                    <eviction max-entries="1024" strategy="LRU"/>
+                    <eviction max-entries="1024" strategy="LIRS"/>
                 </local-cache>
+                <local-cache name="resultset-repl">
+                    <expiration lifespan="7200000" />
+                    <eviction max-entries="1024" strategy="LIRS"/>
+                </local-cache>                
+                <local-cache name="preparedplan">
+                    <expiration lifespan="28800" />
+                    <eviction max-entries="512" strategy="LIRS"/>
+                </local-cache>  
             </cache-container>            
         </subsystem>
         <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
@@ -268,7 +276,8 @@
         </subsystem>
         <subsystem xmlns="urn:jboss:domain:teiid:1.0">
             <async-thread-pool>teiid-async</async-thread-pool>
-            <resultset-cache infinispan-container="teiid"/>
+            <resultset-cache infinispan-container="teiid" name="resultset"/>
+            <preparedplan-cache infinispan-container="teiid" name="preparedplan"/>
             
             <transport name="embedded"/>
             <transport name="jdbc" protocol="teiid" socket-binding="teiid-jdbc">

Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/pom.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -98,6 +98,22 @@
             <artifactId>xom</artifactId>
             <version>1.2</version>
         </dependency>
+        <dependency>
+            <groupId>org.infinispan</groupId>
+            <artifactId>infinispan-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.marshalling</groupId>
+            <artifactId>jboss-marshalling-river</artifactId>
+            <scope>test</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>org.jboss.marshalling</groupId>
+            <artifactId>jboss-marshalling</artifactId>
+            <scope>test</scope>
+        </dependency>
 	</dependencies>
 
 </project>

Modified: trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -26,11 +26,10 @@
 	
 	/**
 	 * Create / Get the cache for the give type use
-	 * @param type cache type
-	 * @param config configuration setup for the cache
+	 * @param name - name of the cache 
 	 * @return
 	 */
-	<K,V> Cache<K, V> get(String location, CacheConfiguration config);
+	<K,V> Cache<K, V> get(String name);
 
 	/**
 	 * Destroy the cache factory and any caches underneath.

Deleted: trunk/engine/src/main/java/org/teiid/cache/DefaultCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/DefaultCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/main/java/org/teiid/cache/DefaultCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,240 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.teiid.core.util.LRUCache;
-
-public class DefaultCache<K, V> implements Cache<K, V>, Serializable {
-	private static final long serialVersionUID = -511120208522577206L;
-	public static final int DEFAULT_MAX_SIZE_TOTAL = 250;
-	public static final int DEFAULT_MAX_AGE = 1000 * 60 * 60 * 2;
-	
-	private static class ExpirationEntry<K, V> {
-		long expiration;
-		K key;
-		V value;
-		
-		public ExpirationEntry(long expiration, K key, V value) {
-			this.expiration = expiration;
-			this.key = key;
-			this.value = value;
-		}
-
-		@Override
-		public int hashCode() {
-			return key.hashCode();
-		}
-		
-		@Override
-		public boolean equals(Object obj) {
-			if (obj == this) {
-				return true;
-			}
-			if (!(obj instanceof ExpirationEntry<?, ?>)) {
-				return false;
-			}
-			ExpirationEntry<K, V> other = (ExpirationEntry<K, V>)obj;
-			return this.key.equals(other.key);
-		}
-	}
-	
-	protected LRUCache<K, ExpirationEntry<K, V>> map;
-	protected Map<String, Cache> children = new ConcurrentHashMap<String, Cache>();
-	protected String name;
-	protected long ttl;
-	protected Set<ExpirationEntry<K, V>> expirationQueue;
-	
-	public DefaultCache(String name) {
-		this(name, DEFAULT_MAX_SIZE_TOTAL, -1);
-	}
-	
-	public DefaultCache(String name, int maxEntries, long ttl) {
-		this.map = new LRUCache<K, ExpirationEntry<K, V>>(maxEntries) {
-			@Override
-			protected boolean removeEldestEntry(java.util.Map.Entry<K, ExpirationEntry<K, V>> eldest) {
-				if (super.removeEldestEntry(eldest)) {
-					Iterator<ExpirationEntry<K, V>> iter = expirationQueue.iterator();
-					if (validate(iter.next()) != null) {
-						DefaultCache.this.remove(eldest.getKey());
-					}
-				}
-				return false;
-			}
-		};
-		this.expirationQueue = Collections.newSetFromMap(new LRUCache<ExpirationEntry<K, V>, Boolean>(maxEntries));
-		this.name = name;
-		this.ttl = ttl;
-	}
-	
-	public void addListener(CacheListener listener) {
-		throw new UnsupportedOperationException();
-	}
-
-	public void clear() {
-		synchronized (map) {
-			map.clear();
-			expirationQueue.clear();
-		}
-	}
-
-	public V get(K key) {
-		synchronized (map) {
-			ExpirationEntry<K, V> result = map.get(key);
-			if (result != null) {
-				return validate(result);
-			}
-			return null;
-		}
-	}
-
-	private V validate(ExpirationEntry<K, V> result) {
-		if (result.expiration < System.currentTimeMillis()) {
-			remove(result.key);
-			return null;
-		}
-		return result.value;
-	}
-
-	public Set<K> keySet() {
-		synchronized (map) {
-			return new HashSet<K>(map.keySet());
-		}
-	}
-
-	public V put(K key, V value) {
-		return this.put(key, value, ttl);
-	}
-	
-	public static long getExpirationTime(long defaultTtl, Long ttl) {
-		if (ttl == null) {
-			ttl = defaultTtl;
-		}
-		if (ttl < 0) {
-			return Long.MAX_VALUE;
-		}
-		long result = System.currentTimeMillis() + ttl;
-		if (result < ttl) {
-			result = Long.MAX_VALUE;
-		}
-		return result;
-	}
-	
-	public V put(K key, V value, Long timeToLive) {
-		if (this.map.getSpaceLimit() == 0) {
-			return null;
-		}
-		synchronized (map) {
-			ExpirationEntry<K, V> entry = new ExpirationEntry<K, V>(getExpirationTime(ttl, timeToLive), key, value);
-			ExpirationEntry<K, V> result = map.put(key, entry);
-			expirationQueue.add(entry);
-			if (result != null) {
-				return result.value;
-			}
-			return null;
-		}
-	}
-
-	public V remove(K key) {
-		synchronized (map) {
-			ExpirationEntry<K, V> result = map.remove(key);
-			if (result != null) {
-				expirationQueue.remove(result);
-				return result.value;
-			}
-			return null;
-		}
-	}
-
-	public int size() {
-		synchronized (map) {
-			return map.size();
-		}
-	}
-	
-	public Collection<V> values() {
-		synchronized (map) {
-			ArrayList<V> result = new ArrayList<V>(map.size());
-			for (ExpirationEntry<K, V> entry : new ArrayList<ExpirationEntry<K, V>>(map.values())) {
-				V value = validate(entry);
-				if (value != null) {
-					result.add(value);
-				}
-			}
-			return result;
-		}
-	}
-
-	public Cache addChild(String name) {
-		Cache c = children.get(name);
-		if (c != null) {
-			return c;
-		}
-		
-		c = new DefaultCache(name, map.getSpaceLimit(), ttl);
-		children.put(name, c);
-		return c;
-	}
-
-	public Cache getChild(String name) {
-		return children.get(name);
-	}
-
-	public Collection<Cache> getChildren() {
-		return children.values();
-	}
-
-	public boolean removeChild(String name) {
-		Object obj = children.remove(name);
-		return obj != null;
-	}
-
-	@Override
-	public String getName() {
-		return name;
-	}
-
-	@Override
-	public Set<K> keys() {
-		synchronized(this.map) {
-			return new HashSet<K>(map.keySet());
-		}
-	}
-	
-	Set<ExpirationEntry<K, V>> getExpirationQueue() {
-		return expirationQueue;
-	}
-	
-	LRUCache<K, ExpirationEntry<K, V>> getCacheMap() {
-		return map;
-	}
-	
-}
\ No newline at end of file

Deleted: trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache;
-
-import java.io.Serializable;
-
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.query.QueryPlugin;
-
-
-public class DefaultCacheFactory implements CacheFactory, Serializable {
-	private static final long serialVersionUID = -5541424157695857527L;
-	private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
-	
-	DefaultCache cacheRoot;
-	private volatile boolean destroyed = false;
-	
-	public DefaultCacheFactory() {
-		this(DEFAULT);
-	}
-		
-	public DefaultCacheFactory(CacheConfiguration config) {
-		this.cacheRoot = new DefaultCache("Teiid", config.getMaxEntries(), config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
-	}
-	
-	@Override
-	public void destroy() {
-		this.destroyed = true;
-	}
-
-	@Override
-	public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
-		if (!destroyed) {
-			return cacheRoot.addChild(location);
-		}
-		 throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30562, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30562));
-	}
-	
-	@Override
-	public boolean isReplicated() {
-		return false;
-	}
-}

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -32,11 +32,7 @@
 import org.teiid.adminapi.Admin;
 import org.teiid.cache.Cachable;
 import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
 import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCache;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
 import org.teiid.common.buffer.TupleBufferCache;
 import org.teiid.core.util.Assertion;
 import org.teiid.core.util.EquivalenceUtil;
@@ -61,7 +57,6 @@
 	private Cache<CacheID, T> localCache;
 	private Cache<CacheID, T> distributedCache;
 	
-	private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
 	private long modTime;
 	private Type type;
 	
@@ -71,30 +66,25 @@
 	
 	private TupleBufferCache bufferManager;
 	
-	public SessionAwareCache(){
-		this(DEFAULT_MAX_SIZE_TOTAL);
-	}
-	
-	SessionAwareCache(int maxSize){
-		this(new DefaultCacheFactory(), Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize, "default")); //$NON-NLS-1$
-	}
-	
-	public SessionAwareCache (final CacheFactory cacheFactory, final Type type, final CacheConfiguration config){
-		this.maxSize = config.getMaxEntries();
-		if(this.maxSize < 0){
-			this.maxSize = Integer.MAX_VALUE;
-		}		
-		this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
+	public SessionAwareCache (String cacheName, final CacheFactory cacheFactory, final Type type, int maxStaleness) {
+		assert (cacheFactory != null);
 		
+		this.localCache = cacheFactory.get(cacheName); 
+		
 		if (type == Type.PREPAREDPLAN) {
 			this.distributedCache = localCache;
 		}
 		else {
-			String location = config.getLocation()+"/"+type.name(); //$NON-NLS-1$
-			this.distributedCache = cacheFactory.get(location, config);
+			this.distributedCache = cacheFactory.get(cacheName+"-repl"); //$NON-NLS-1$
+			if (this.distributedCache == null && this.localCache != null) {
+				this.distributedCache = this.localCache;
+			}
 		}
-		this.modTime = config.getMaxStaleness()*1000;
+		this.modTime = maxStaleness * 1000;
 		this.type = type;
+		
+		assert (this.localCache != null);
+		assert (this.distributedCache != null);
 	}	
 	
 	public T get(CacheID id){
@@ -315,10 +305,6 @@
 	    
 	}
 	
-    int getSpaceAllowed() {
-        return maxSize;
-    }
-    
     public void setTupleBufferCache(TupleBufferCache bufferManager) {
     	this.bufferManager = bufferManager;
     }

Copied: trunk/engine/src/test/java/org/teiid/cache/DefaultCacheFactory.java (from rev 4399, trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java)
===================================================================
--- trunk/engine/src/test/java/org/teiid/cache/DefaultCacheFactory.java	                        (rev 0)
+++ trunk/engine/src/test/java/org/teiid/cache/DefaultCacheFactory.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.cache;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.eviction.EvictionStrategy;
+import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.query.QueryPlugin;
+
+ at SuppressWarnings("nls")
+public class DefaultCacheFactory implements CacheFactory, Serializable {
+	private static final long serialVersionUID = -5541424157695857527L;
+	private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
+	
+	public static DefaultCacheFactory INSTANCE = new DefaultCacheFactory(DEFAULT);
+	
+	private volatile boolean destroyed = false;
+	EmbeddedCacheManager manager;
+	
+		
+	public DefaultCacheFactory(CacheConfiguration config) {
+		Configuration cacheConfig = new ConfigurationBuilder().eviction()
+				.strategy(config.getPolicy()==Policy.LRU?EvictionStrategy.LRU:EvictionStrategy.NONE)
+				.maxEntries(config.getMaxEntries())
+				.expiration().lifespan(config.getMaxAgeInSeconds()*1000)
+				.wakeUpInterval(200)
+				.build();
+		this.manager = new DefaultCacheManager(cacheConfig);
+		this.manager.start();		
+		this.manager.defineConfiguration("resultset", cacheConfig);
+		this.manager.defineConfiguration("resultset-repl", cacheConfig);
+		this.manager.defineConfiguration("preparedplan", cacheConfig);
+		this.manager.getCache("resultset");
+		this.manager.getCache("preparedplan");
+		this.manager.getCache("resultset-repl");
+	}
+	
+	@Override
+	public void destroy() {
+		this.destroyed = true;
+		if (this.manager != null) {
+			this.manager.stop();
+		}
+	}
+
+	@Override
+	public <K, V> Cache<K, V> get(String cacheName) {
+		if (!destroyed) {
+			manager.getCache(cacheName).clear();
+			return new IspnCache(manager.getCache(cacheName), cacheName, getClass().getClassLoader());
+		}
+		 throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30562, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30562));
+	}
+	
+	@Override
+	public boolean isReplicated() {
+		return false;
+	}
+
+
+	private static  class IspnCache<K, V> implements Cache<K, V> {
+	
+		protected org.infinispan.AdvancedCache<K, V> cacheStore;
+		private final String name; 
+		private ClassLoader classloader;
+		
+		public IspnCache(org.infinispan.Cache<K, V> cacheStore, String cacheName, ClassLoader classloader) {
+			assert(cacheStore != null);
+			this.cacheStore = cacheStore.getAdvancedCache();
+			this.name = cacheName;
+			this.classloader = classloader;
+		}
+		
+		@Override
+		public V get(K key) {
+			return this.cacheStore.with(this.classloader).get(key);
+		}
+		
+		@Override
+		public V put(K key, V value, Long ttl) {
+			if (ttl != null) {
+				return this.cacheStore.with(this.classloader).put(key, value, ttl, TimeUnit.MILLISECONDS);
+			}
+			return this.cacheStore.with(this.classloader).put(key, value);
+		}
+	
+		@Override
+		public V remove(K key) {
+			return this.cacheStore.with(this.classloader).remove(key);
+		}
+		
+		@Override
+		public int size() {
+			return this.cacheStore.with(this.classloader).size();
+		}
+		
+		@Override
+		public void clear() {
+			this.cacheStore.with(this.classloader).clear();
+		}
+		
+		@Override
+		public String getName() {
+			return this.name;
+		}
+	
+		@Override
+		public Set<K> keys() {
+			return this.cacheStore.with(this.classloader).keySet();
+		}
+	}
+}

Deleted: trunk/engine/src/test/java/org/teiid/cache/TestDefaultCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/cache/TestDefaultCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/cache/TestDefaultCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
- at SuppressWarnings("nls")
-public class TestDefaultCache {
-	
-	@Test public void testExpiration() throws InterruptedException {
-		DefaultCache<Integer, Integer> cache = new DefaultCache<Integer, Integer>("foo", 2, 70);
-		cache.put(1, 1);
-		Thread.sleep(100);
-		assertNull(cache.get(1));
-		cache.put(2, 2);
-		Thread.sleep(50);
-		cache.put(3, 3);
-		assertNotNull(cache.get(2));
-		Thread.sleep(50);
-		cache.put(4, 4);
-		//preferred to purge 2 instead of 3
-		assertNotNull(cache.get(3));
-	}
-	
-	@Test public void testExpirationAtMaxSize() throws Exception {
-		DefaultCache<Integer, Integer> cache = new DefaultCache<Integer, Integer>("foo", 2, 70);
-		cache.put(1, 1);
-		cache.put(2, 2);
-		cache.put(3, 3);
-		assertEquals(2, cache.getCacheMap().size());
-		assertEquals(2, cache.getExpirationQueue().size());
-		Thread.sleep(100);
-		cache.put(4, 4);
-		cache.put(5, 5);
-		cache.get(4);
-		cache.put(6, 6);
-		assertEquals(2, cache.getCacheMap().size());
-		assertEquals(2, cache.getExpirationQueue().size());
-		assertNotNull(cache.get(4));
-		assertNotNull(cache.get(6));
-	}
-	
-	@Test public void testZeroSize() throws Exception {
-		DefaultCache<Integer, Integer> cache = new DefaultCache<Integer, Integer>("foo", 0, 70);
-		cache.put(1, 1);
-		assertEquals(0, cache.size());
-	}
-
-}

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -29,8 +29,6 @@
 import java.util.List;
 
 import org.junit.Test;
-import org.teiid.cache.Cache;
-import org.teiid.cache.DefaultCache;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.common.buffer.BufferManager.TupleSourceType;
 import org.teiid.common.buffer.BufferManagerFactory;
@@ -81,12 +79,12 @@
 		plan.setContext(cc);
 		results.setResults(tb, plan);
 		results.setCommand(new Query());
-		Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
+		//Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
 		long ts = results.getAccessInfo().getCreationTime();
 		// simulate the jboss-cache remote transport, where the batches are remotely looked up
 		// in cache
 		for (int row=1; row<=tb.getRowCount();row+=4) {
-			cache.put(results.getId()+","+row, tb.getBatch(row), null); //$NON-NLS-1$ 
+			//cache.put(results.getId()+","+row, tb.getBatch(row), null); //$NON-NLS-1$ 
 		}
 		
 		results.prepare(bm);
@@ -104,7 +102,7 @@
 		assertTrue(cachedResults.restore(bm2));
 		
 		// since restored, simulate a async cache flush
-		cache.clear();
+		//cache.clear();
 		
 		TupleBuffer cachedTb = cachedResults.getResults();
 		

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -31,6 +31,7 @@
 
 import org.junit.Test;
 import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
@@ -88,7 +89,7 @@
 	private void helpProcess(String sql, List values, List[] expected,
 			HardcodedDataManager dataManager) throws TeiidComponentException,
 			TeiidProcessingException, Exception {
-		SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); //$NON-NLS-1$
 		PreparedStatementRequest plan = TestPreparedStatement.helpGetProcessorPlan(sql, values, new DefaultCapabilitiesFinder(), RealMetadataFactory.exampleBQTCached(), planCache, 1, true, false, RealMetadataFactory.exampleBQTVDB());
         TestProcessor.doProcess(plan.processPlan, dataManager, expected, plan.context);
         

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -119,8 +119,8 @@
 		FakeBufferService bs = new FakeBufferService(bm, bm);
         core = new DQPCore();
         core.setBufferManager(bs.getBufferManager());
-        core.setResultsetCache(new SessionAwareCache<CachedResults>(new DefaultCacheFactory(), SessionAwareCache.Type.RESULTSET, new CacheConfiguration()));
-        core.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>(new DefaultCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration()));
+        core.setResultsetCache(new SessionAwareCache<CachedResults>("resultset", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.RESULTSET, 0));
+        core.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0));
         core.setTransactionService(new FakeTransactionService());
         
         config = new DQPConfiguration();
@@ -524,7 +524,8 @@
         reqMsg.setUseResultSetCache(true);
         ResultsMessage rm = execute(userName, sessionid, reqMsg);
         assertEquals(10, rm.getResultsList().size()); //$NON-NLS-1$
-                
+        assertEquals(0, this.core.getRsCache().getCacheHitCount());        
+        
         sql = "select * FROM vqt.SmallB"; //$NON-NLS-1$
         reqMsg = exampleRequestMessage(sql);
         reqMsg.setUseResultSetCache(true);

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -134,8 +134,8 @@
         rm.setBufferManager(bs.getBufferManager());
         CacheConfiguration config = new CacheConfiguration();
         config.setMaxAgeInSeconds(-1);
-		rm.setResultsetCache(new SessionAwareCache<CachedResults>(new DefaultCacheFactory(), SessionAwareCache.Type.RESULTSET, config));
-        rm.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>(new DefaultCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, config));
+		rm.setResultsetCache(new SessionAwareCache<CachedResults>("resultset", new DefaultCacheFactory(config), SessionAwareCache.Type.RESULTSET, 0));
+        rm.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0));
         rm.start(new DQPConfiguration());
 
         ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -32,6 +32,8 @@
 import org.junit.Test;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.client.RequestMessage;
 import org.teiid.client.metadata.MetadataResult;
 import org.teiid.client.metadata.ResultsMetadataConstants;
@@ -66,7 +68,7 @@
         QueryResolver.resolveCommand(command, metadata);
         
         // Create components
-        SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+        SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
         DQPCore requestMgr = new DQPCore();
         requestMgr.setTransactionService(new FakeTransactionService());
 
@@ -138,7 +140,7 @@
     
     private MetadataResult helpTestQuery(QueryMetadataInterface metadata, String sql, VDBMetaData vdb) throws Exception {
         // Create components
-        SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+        SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
         
         // Initialize components
         MetaDataProcessor mdProc = new MetaDataProcessor(new DQPCore(), prepPlanCache, "MyVDB", 1);

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -29,6 +29,9 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.api.exception.query.QueryParserException;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
 import org.teiid.metadata.FunctionMethod.Determinism;
 import org.teiid.query.analysis.AnalysisRecord;
@@ -40,7 +43,7 @@
 import org.teiid.query.sql.symbol.Reference;
 import org.teiid.query.util.CommandContext;
 
-
+ at SuppressWarnings("nls")
 public class TestPreparedPlanCache {
     private static final String EXAMPLE_QUERY = "SELECT * FROM table"; //$NON-NLS-1$
 	private final static DQPWorkContext token = new DQPWorkContext();
@@ -57,7 +60,7 @@
     
     //====Tests====//
     @Test public void testPutPreparedPlan(){
-    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
+    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
     	
     	CacheID id = new CacheID(token, pi, EXAMPLE_QUERY + 1);
     	
@@ -70,7 +73,7 @@
     }
     
     @Test public void testGet(){
-    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
+    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
     	helpPutPreparedPlans(cache, token, 0, 10);
     	helpPutPreparedPlans(cache, token2, 0, 15);
     	
@@ -84,7 +87,7 @@
     }
     
     @Test public void testClearAll(){
-    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
+    	SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
     	
     	//create one for each session token
     	helpPutPreparedPlans(cache, token, 1, 1);
@@ -98,43 +101,57 @@
     	assertNull("Unable to get prepared plan from cache for token2", cache.get(new CacheID(token2, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ 
     }
     
-    @Test public void testMaxSize(){
-        SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>(100);
+    @Test public void testMaxSize() throws Exception {
+    	CacheConfiguration config = new CacheConfiguration();
+    	config.setType(Policy.LRU.name());
+    	config.setMaxEntries(100);    
+    	config.setMaxAgeInSeconds(60);
+        SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0);
+        
         helpPutPreparedPlans(cache, token, 0, 101);
-        //the first one should be gone because the max size is 100
-        assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 0))); 
+        assertTrue(cache.getTotalCacheEntries() <= 100);
         
-        assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 12))); 
+        // find a entry that has not been evicted.
+        int i = 0;
+        while (true) {
+        	PreparedPlan plan = cache.get(new CacheID(token, pi, EXAMPLE_QUERY + i));
+        	if (plan != null) {
+        		break;
+        	}
+        	i++;
+        	if (i > 100) break;
+        }
+        assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + i))); 
+        
         helpPutPreparedPlans(cache, token, 102, 50);
+       
         //"sql12" should still be there based on lru  policy
-        assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 12))); 
+        assertNotNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + i))); 
         
         helpPutPreparedPlans(cache, token2, 0, 121);
         helpPutPreparedPlans(cache, token, 0, 50);
         assertTrue(cache.getTotalCacheEntries() <= 100);
     }
     
-    @Test public void testZeroSizeCache() {
-        // Create with 0 size cache
-        SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>(0);
-        assertEquals(0, cache.getSpaceAllowed());
-        
-        // Add 1 plan and verify it is not in the cache
-        helpPutPreparedPlans(cache, token, 0, 1);
-        assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 0))); 
-        assertEquals(0, cache.getTotalCacheEntries());
-        
-        // Add another plan and verify it is not in the cache
-        helpPutPreparedPlans(cache, token, 1, 1);
-        assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 1))); 
-        assertEquals(0, cache.getTotalCacheEntries());        
+    @Test public void testZeroSizeCache() throws Exception {
+    	CacheConfiguration config = new CacheConfiguration();
+    	config.setMaxEntries(0);
+    	config.setType(Policy.LRU.name());
+    	
+        try {
+			// Create with 0 size cache
+			SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0);
+			fail("should have failed to create zero sized cache store");
+		} catch (Exception e) {
+		}
     }
     
     // set init size to negative number, which should default to max
     @Test public void testNegativeSizeCacheUsesDefault() {
-        SessionAwareCache<PreparedPlan> negativeSizedCache = new SessionAwareCache<PreparedPlan>(-1);
-        
-        assertEquals(Integer.MAX_VALUE, negativeSizedCache.getSpaceAllowed());                       
+    	CacheConfiguration config = new CacheConfiguration();
+    	config.setMaxEntries(-1);    	
+        SessionAwareCache<PreparedPlan> negativeSizedCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0);
+        // -1 means unlimited in the infinispan
     }
     
     //====Help methods====//

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -33,6 +33,7 @@
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.api.exception.query.QueryResolverException;
 import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.client.RequestMessage;
 import org.teiid.client.RequestMessage.StatementType;
 import org.teiid.common.buffer.BufferManagerFactory;
@@ -79,7 +80,7 @@
         }
         
         if ( prepPlanCache == null ) {
-        	prepPlanCache = new SessionAwareCache<PreparedPlan>();
+        	prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); //$NON-NLS-1$
         }
         
 		// expected cache hit count
@@ -194,7 +195,7 @@
         
         List values = Arrays.asList(0);
 
-        PreparedStatementRequest plan = helpGetProcessorPlan(preparedSql, values, capFinder, metadata, new SessionAwareCache<PreparedPlan>(), SESSION_ID, false, false,RealMetadataFactory.example1VDB());
+        PreparedStatementRequest plan = helpGetProcessorPlan(preparedSql, values, capFinder, metadata, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0), SESSION_ID, false, false,RealMetadataFactory.example1VDB());
         
         TestOptimizer.checkNodeTypes(plan.processPlan, TestOptimizer.FULL_PUSHDOWN);  
     }
@@ -256,7 +257,7 @@
         List values = Arrays.asList("a"); //$NON-NLS-1$
 		
         //Create plan
-        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>());
+        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
 	}	
 
 	/** SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?)*/
@@ -267,7 +268,7 @@
 		List values = Arrays.asList("a"); //$NON-NLS-1$
 		
         //Create plan
-        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>());
+        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
 	}	
 
 	/** SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = ? AND pm1.g1.e2 IN (SELECT pm1.g2.e2 FROM pm1.g2 WHERE pm1.g2.e1 = ?) */
@@ -278,7 +279,7 @@
 		List values = Arrays.asList("d", "c"); //$NON-NLS-1$ //$NON-NLS-2$
 				
         //Create plan
-        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>());
+        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
 	}	
 
 	/** SELECT X.e1 FROM (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = ?) as X */
@@ -290,13 +291,13 @@
 		List values = Arrays.asList("d"); //$NON-NLS-1$
 		
         //Create plan
-        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>());
+        helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
 	}	
 	
 	@Test public void testValidateWrongValues() throws Exception {
 		// Create query 
 	    String preparedSql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 WHERE pm1.g1.e2=?"; //$NON-NLS-1$
-	    SessionAwareCache<PreparedPlan> prepCache = new SessionAwareCache<PreparedPlan>();
+	    SessionAwareCache<PreparedPlan> prepCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); //$NON-NLS-1$
 
 	    //wrong type
 		try{         	        
@@ -342,7 +343,7 @@
         
         List values = Arrays.asList("0"); //$NON-NLS-1$
         
-		helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>());
+		helpGetProcessorPlan(preparedSql, values, new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
     }
     
     @Test public void testLimit() throws Exception {
@@ -351,7 +352,7 @@
         
         List values = Arrays.asList("0"); //$NON-NLS-1$
         
-        SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>();
+        SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); //$NON-NLS-1$
         
 		helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), planCache, SESSION_ID, false, true, RealMetadataFactory.example1VDB());
 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -29,6 +29,7 @@
 import java.util.List;
 
 import org.junit.Test;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.query.optimizer.TestOptimizer;
 import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
 import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
@@ -46,6 +47,7 @@
  * plans that contain batched updates.
  *
  */
+ at SuppressWarnings("nls")
 public class TestPreparedStatementBatchedUpdate {
 
     @Test public void testBatchedUpdatePushdown() throws Exception {
@@ -53,7 +55,7 @@
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
         
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -84,7 +86,7 @@
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
         
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -146,7 +148,7 @@
         // Create query 
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         FakeDataManager dataManager = new FakeDataManager();
@@ -242,7 +244,7 @@
         // Create query 
 		String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e2=? WHERE vm1.g1.e1=?"; //$NON-NLS-1$
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         FakeDataManager dataManager = new FakeDataManager();
@@ -335,7 +337,7 @@
         // Create query 
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         FakeDataManager dataManager = new FakeDataManager();
@@ -458,7 +460,7 @@
         // Create query 
 		String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e1=?, vm1.g1.e3=? WHERE vm1.g1.e2=?"; //$NON-NLS-1$
 		// Create a testable prepared plan cache
-		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>();
+		SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
 		
 		// Construct data manager with data
         FakeDataManager dataManager = new FakeDataManager();

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -28,6 +28,7 @@
 
 import org.junit.Test;
 import org.mockito.Mockito;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.client.RequestMessage;
 import org.teiid.client.RequestMessage.StatementType;
 import org.teiid.common.buffer.BufferManager;
@@ -47,6 +48,7 @@
 import org.teiid.query.tempdata.TempTableStore.TransactionMode;
 import org.teiid.query.unittest.RealMetadataFactory;
 
+ at SuppressWarnings("nls")
 public class TestRequest {
 
     private static final TempTableStore TEMP_TABLE_STORE = new TempTableStore("1", TransactionMode.ISOLATE_WRITES); //$NON-NLS-1$
@@ -143,7 +145,7 @@
      */
     @Test public void testProcessRequestPreparedStatement() throws Exception {
         QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
-        SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
+        SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
         
 
         //Try before plan is cached.

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -30,6 +30,7 @@
 import org.mockito.Mockito;
 import org.teiid.adminapi.impl.SessionMetadata;
 import org.teiid.cache.Cachable;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
 import org.teiid.metadata.FunctionMethod.Determinism;
@@ -42,7 +43,7 @@
 	@Test
 	public void testSessionSpecfic() {
 		
-		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 		
 		CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
 		
@@ -65,7 +66,7 @@
 	@Test
 	public void testUserSpecfic() {
 		
-		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 		
 		CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
 		
@@ -91,7 +92,7 @@
 	@Test
 	public void testNoScope() {
 		
-		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 		
 		CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
 		
@@ -117,7 +118,7 @@
 	@Test
 	public void testVDBRemoval() {
 		
-		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+		SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 		
 		CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
 		

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -32,6 +32,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.common.buffer.BufferManagerFactory;
 import org.teiid.core.TeiidProcessingException;
@@ -72,7 +73,7 @@
 		hdm.addData("SELECT MatTable.info.e1, MatTable.info.e2 FROM MatTable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
 		hdm.addData("SELECT MatTable.info.e2, MatTable.info.e1 FROM MatTable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
 		
-	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 	    cache.setTupleBufferCache(bm);
 		dataManager = new TempTableDataManager(hdm, bm, cache);
 	}

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -33,6 +33,7 @@
 
 import org.junit.Test;
 import org.teiid.api.exception.query.QueryPlannerException;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.client.metadata.ParameterInfo;
 import org.teiid.common.buffer.BlockedException;
 import org.teiid.common.buffer.BufferManager;
@@ -244,7 +245,7 @@
         	context.setGlobalTableStore(gts);
         }
         if (!(dataManager instanceof TempTableDataManager)) {
-    	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+    	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
     	    cache.setTupleBufferCache(bufferMgr);
         	dataManager = new TempTableDataManager(dataManager, bufferMgr, cache);
         }        
@@ -352,7 +353,7 @@
 		CommandContext context = new CommandContext("0", "test", "user", null, "myvdb", 1, DEBUG); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         context.setProcessorBatchSize(BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE);
         context.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
-        context.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>());
+        context.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0));
 		return context;
 	}   
     	

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -22,7 +22,10 @@
 
 package org.teiid.query.processor;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.util.Arrays;
@@ -40,6 +43,7 @@
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
+import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.common.buffer.BufferManagerFactory;
 import org.teiid.core.TeiidProcessingException;
@@ -83,7 +87,7 @@
 		TestProcessor.doProcess(processorPlan, dataManager, expectedResults, cc);
 		assertTrue(Determinism.SESSION_DETERMINISTIC.compareTo(cc.getDeterminismLevel()) <= 0);
 	}
-
+	
 	@Before public void setUp() {
 		tempStore = new TempTableStore("1", TransactionMode.ISOLATE_WRITES); //$NON-NLS-1$
 		metadata = new TempMetadataAdapter(RealMetadataFactory.example1Cached(), tempStore.getMetadataStore());
@@ -91,7 +95,8 @@
 		FakeDataManager fdm = new FakeDataManager();
 	    TestProcessor.sampleData1(fdm);
 	    BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
-	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+	    
+	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0);
 	    cache.setTupleBufferCache(bm);
 		dataManager = new TempTableDataManager(fdm, bm, cache);
 	}

Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/pom.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -14,6 +14,28 @@
     <dependency>
       <groupId>org.jboss.teiid</groupId>
       <artifactId>teiid-runtime</artifactId>
+      <exclusions>
+        <exclusion>
+            <groupId>org.infinispan</groupId>
+            <artifactId>infinispan-core</artifactId>
+        </exclusion>
+        <exclusion>
+            <groupId>org.jboss.marshalling</groupId>
+            <artifactId>jboss-marshalling-river</artifactId>
+        </exclusion>
+        <exclusion>
+            <groupId>org.jboss.marshalling</groupId>
+            <artifactId>jboss-marshalling</artifactId>
+        </exclusion>        
+        <exclusion>
+            <groupId>org.jgroups</groupId>
+            <artifactId>jgroups</artifactId>
+        </exclusion>
+        <exclusion>
+            <groupId>org.jboss.logging</groupId>
+            <artifactId>jboss-logging</artifactId>
+        </exclusion>        
+      </exclusions>
     </dependency>
     
     <dependency>
@@ -72,7 +94,6 @@
     <dependency>
         <groupId>asm</groupId>
         <artifactId>asm</artifactId>
-        <version>3.3.1</version>
         <scope>provided</scope>
     </dependency>
     

Deleted: trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache.jboss;
-
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.teiid.cache.Cache;
-
-
-/**
- * Implementation of Cache using Infinispan
- */
-public class JBossCache<K, V> implements Cache<K, V> {
-
-	protected org.infinispan.AdvancedCache<K, V> cacheStore;
-	private final String name; 
-	private ClassLoader classloader;
-	
-	public JBossCache(org.infinispan.Cache<K, V> cacheStore, String cacheName, ClassLoader classloader) {
-		this.cacheStore = cacheStore.getAdvancedCache();
-		this.name = cacheName;
-		this.classloader = classloader;
-	}
-	
-	@Override
-	public V get(K key) {
-		return this.cacheStore.with(this.classloader).get(key);
-	}
-	
-	public V put(K key, V value) {
-		return this.cacheStore.with(this.classloader).put(key, value);
-	}
-	
-	@Override
-	public V put(K key, V value, Long ttl) {
-		if (ttl != null) {
-			return this.cacheStore.with(this.classloader).put(key, value, ttl, TimeUnit.MILLISECONDS);
-		}
-		return this.cacheStore.with(this.classloader).put(key, value);
-	}
-
-	@Override
-	public V remove(K key) {
-		return this.cacheStore.with(this.classloader).remove(key);
-	}
-	
-	@Override
-	public int size() {
-		return this.cacheStore.with(this.classloader).size();
-	}
-	
-	@Override
-	public void clear() {
-		this.cacheStore.with(this.classloader).clear();
-	}
-	
-	@Override
-	public String getName() {
-		return this.name;
-	}
-
-	@Override
-	public Set<K> keys() {
-		return this.cacheStore.with(this.classloader).keySet();
-	}
-}

Deleted: trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache.jboss;
-
-import java.io.Serializable;
-
-import org.infinispan.manager.CacheContainer;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.jboss.IntegrationPlugin;
-
-
-public class JBossCacheFactory implements CacheFactory, Serializable{
-	private static final long serialVersionUID = -2767452034178675653L;
-	private transient org.infinispan.Cache cacheStore;
-	private volatile boolean destroyed = false;
-	private ClassLoader classLoader;
-	
-
-	public JBossCacheFactory(String name, CacheContainer cm, ClassLoader classLoader) {
-		if (name != null) {
-			this.cacheStore = cm.getCache(name);
-		}
-		else {
-			this.cacheStore = cm.getCache();
-		}
-		this.classLoader = classLoader;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public Cache get(String location, CacheConfiguration config) {
-		if (!destroyed) {
-			return new JBossCache(this.cacheStore, config.getLocation(), this.classLoader);	
-		}
-		 throw new TeiidRuntimeException(IntegrationPlugin.Event.TEIID50066, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50066));
-	}
-	
-	public void destroy() {
-		this.destroyed = true;		
-	}	
-	
-	public void stop() {
-		destroy();
-	}
-	
-	@Override
-	public boolean isReplicated() {
-		return true;
-	}
-}

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -29,26 +29,20 @@
 import org.jboss.msc.service.StopContext;
 import org.jboss.msc.value.InjectedValue;
 import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.jboss.JBossCacheFactory;
+import org.teiid.cache.infinispan.InfinispanCacheFactory;
 
 class CacheFactoryService implements Service<CacheFactory> {
 	protected InjectedValue<CacheContainer> cacheContainerInjector = new InjectedValue<CacheContainer>();
-	private String cacheName;
 	private CacheFactory cacheFactory;
 	
-	public CacheFactoryService(String cacheName){
-		this.cacheName = cacheName;
-	}
-	
 	@Override
 	public void start(StartContext context) throws StartException {
 		CacheContainer cc = cacheContainerInjector.getValue();
 		if (cc != null) {
-			this.cacheFactory = new JBossCacheFactory(this.cacheName, cc, Module.getCallerModule().getClassLoader());
+			this.cacheFactory = new InfinispanCacheFactory(cc, Module.getCallerModule().getClassLoader());
 		}
 		else {
-			this.cacheFactory = new DefaultCacheFactory();
+			throw new StartException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50093));
 		}
 	}
 

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -26,7 +26,6 @@
 import org.jboss.msc.service.StartException;
 import org.jboss.msc.service.StopContext;
 import org.jboss.msc.value.InjectedValue;
-import org.teiid.cache.CacheConfiguration;
 import org.teiid.cache.CacheFactory;
 import org.teiid.common.buffer.TupleBufferCache;
 import org.teiid.dqp.internal.process.SessionAwareCache;
@@ -38,16 +37,18 @@
 	protected InjectedValue<CacheFactory> cacheFactoryInjector = new InjectedValue<CacheFactory>();
 
 	private SessionAwareCache.Type type;
-	private CacheConfiguration config;
+	private String cacheName;
+	private int maxStaleness;
 	
-	public CacheService(SessionAwareCache.Type type, CacheConfiguration config){
+	public CacheService(String cacheName, SessionAwareCache.Type type, int maxStaleness){
+		this.cacheName = cacheName;
 		this.type = type;
-		this.config = config;
+		this.maxStaleness = maxStaleness;
 	}
 	
 	@Override
 	public void start(StartContext context) throws StartException {
-		this.cache = new SessionAwareCache<T>(cacheFactoryInjector.getValue(), this.type, this.config);
+		this.cache = new SessionAwareCache<T>(this.cacheName, cacheFactoryInjector.getValue(), this.type, this.maxStaleness);
 		this.cache.setTupleBufferCache(this.tupleBufferCacheInjector.getValue());
 	}
 

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -76,8 +76,9 @@
 	
 	//prepared-plan-cache-config
 	PREPAREDPLAN_CACHE_ELEMENT("preparedplan-cache"),
-	PPC_MAX_ENTRIES_ATTRIBUTE("max-entries", "preparedplan-cache-max-entries", ModelType.INT, false, "512"),
-	PPC_MAX_AGE_IN_SECS_ATTRIBUTE("max-age-in-seconds", "preparedplan-cache-max-age-in-seconds", ModelType.INT, false, "28800"),
+	PPC_ENABLE_ATTRIBUTE("enable", "preparedplan-cache-enable", ModelType.BOOLEAN, false, "true"),
+	PPC_NAME_ELEMENT("name", "preparedplan-cache-name", ModelType.STRING, false, "preparedplan"),
+	PPC_CONTAINER_NAME_ELEMENT("infinispan-container", "preparedplan-cache-infinispan-container", ModelType.STRING, false, null),
 	
 	// Object Replicator
 	DISTRIBUTED_CACHE("distributed-cache"),
@@ -86,7 +87,7 @@
 	// Result set cache	
 	RESULTSET_CACHE_ELEMENT("resultset-cache"),
 	RSC_ENABLE_ATTRIBUTE("enable", "resultset-cache-enable", ModelType.BOOLEAN, false, "true"),
-	RSC_NAME_ELEMENT("name", "resultset-cache-name", ModelType.STRING, false, null),
+	RSC_NAME_ELEMENT("name", "resultset-cache-name", ModelType.STRING, false, "resultset"),
 	RSC_CONTAINER_NAME_ELEMENT("infinispan-container", "resultset-cache-infinispan-container", ModelType.STRING, false, null),
 	RSC_MAX_STALENESS_ELEMENT("max-staleness", "resultset-cache-max-staleness", ModelType.INT, false, "60"),
 	

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -82,7 +82,6 @@
     	TEIID50055,
     	TEIID50056,
     	TEIID50057,
-    	TEIID50066,    	
     	TEIID50067,
     	TEIID50069,
     	TEIID50070,
@@ -98,5 +97,8 @@
     	TEIID50090, //Missing context
     	TEIID50091, // rest different # of param count
     	TEIID50092, // rest procedure execution
+    	TEIID50093,
+    	TEIID50094,
+    	TEIID50095,
     }
 }

Deleted: trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.msc.value.InjectedValue;
-import org.jboss.msc.value.Value;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.dqp.internal.process.PreparedPlan;
-import org.teiid.dqp.internal.process.SessionAwareCache;
-
-
-class PreparedPlanCacheService extends CacheService<PreparedPlan> {
-	public PreparedPlanCacheService(SessionAwareCache.Type type, CacheConfiguration config) {
-		super(type, config);
-		this.cacheFactoryInjector = new InjectedValue<CacheFactory>();
-		this.cacheFactoryInjector.setValue(new Value() {
-			@Override
-			public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException {
-				return new DefaultCacheFactory();
-			}
-		});
-	}
-	
-}

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -22,7 +22,10 @@
 
 package org.teiid.jboss;
 
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
 
 import java.util.Iterator;
 import java.util.List;
@@ -42,8 +45,8 @@
 import org.jboss.as.controller.OperationFailedException;
 import org.jboss.as.controller.ServiceVerificationHandler;
 import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.as.controller.registry.ManagementResourceRegistration;
 import org.jboss.as.controller.registry.AttributeAccess.Storage;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
 import org.jboss.as.controller.services.path.RelativePathService;
 import org.jboss.as.naming.ManagedReferenceFactory;
 import org.jboss.as.naming.ServiceBasedNamingStore;
@@ -58,17 +61,15 @@
 import org.jboss.modules.ModuleIdentifier;
 import org.jboss.modules.ModuleLoadException;
 import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
 import org.jboss.msc.service.ServiceContainer;
 import org.jboss.msc.service.ServiceController;
 import org.jboss.msc.service.ServiceName;
 import org.jboss.msc.service.ServiceTarget;
 import org.jboss.msc.service.ValueService;
-import org.jboss.msc.service.ServiceBuilder.DependencyType;
 import org.jboss.msc.value.InjectedValue;
 import org.teiid.PolicyDecider;
-import org.teiid.cache.CacheConfiguration;
 import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.common.buffer.TupleBufferCache;
 import org.teiid.deployers.VDBRepository;
@@ -126,8 +127,9 @@
 		Element.MAX_STORAGE_OBJECT_SIZE_ATTRIBUTE,
 		
 		// prepared plan cache
-		Element.PPC_MAX_ENTRIES_ATTRIBUTE,
-		Element.PPC_MAX_AGE_IN_SECS_ATTRIBUTE,
+		Element.PPC_NAME_ELEMENT,
+		Element.PPC_CONTAINER_NAME_ELEMENT,
+		Element.PPC_ENABLE_ATTRIBUTE,
 		
 		// resultset cache
 		Element.RSC_NAME_ELEMENT,
@@ -303,41 +305,68 @@
     		rsCache = false;
     	}
     		
-		String infinispanCacheContainer = null;
-    	if (Element.RSC_CONTAINER_NAME_ELEMENT.isDefined(operation)) {
-    		infinispanCacheContainer = Element.RSC_CONTAINER_NAME_ELEMENT.asString(operation);
+    	if (!Element.RSC_CONTAINER_NAME_ELEMENT.isDefined(operation)) {
+    		throw new OperationFailedException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50094));
     	}
 
-    	String cacheName = null;
+    	String cacheName = "resultset"; //$NON-NLS-1$
     	if (Element.RSC_NAME_ELEMENT.isDefined(operation)) {
     		// if null; default cache will be used
     		cacheName = Element.RSC_NAME_ELEMENT.asString(operation);
     	}	 
     	
     	if (rsCache) {
-	    	ServiceName cfName = ServiceName.JBOSS.append("teiid", "infinispan-cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
-	    	CacheFactoryService cfs = new CacheFactoryService(cacheName);
+	    	ServiceName cfName = ServiceName.JBOSS.append("teiid", "infinispan-rs-cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
+	    	CacheFactoryService cfs = new CacheFactoryService();
 	    	ServiceBuilder<CacheFactory> cacheFactoryBuilder = target.addService(cfName, cfs);
 	    	
-	    	if (infinispanCacheContainer != null) {
-	    		cacheFactoryBuilder.addDependency(ServiceName.JBOSS.append("infinispan", infinispanCacheContainer), CacheContainer.class, cfs.cacheContainerInjector); //$NON-NLS-1$
-	    	}
+	    	String ispnName = Element.RSC_CONTAINER_NAME_ELEMENT.asString(operation);
+	    	cacheFactoryBuilder.addDependency(ServiceName.JBOSS.append("infinispan", ispnName), CacheContainer.class, cfs.cacheContainerInjector); //$NON-NLS-1$
 	    	newControllers.add(cacheFactoryBuilder.install());
 	    	
-	    	CacheService<CachedResults> resultSetService = new CacheService<CachedResults>(SessionAwareCache.Type.RESULTSET, buildCacheConfig(operation));
+	    	int maxStaleness = 60;
+	    	if (Element.RSC_MAX_STALENESS_ELEMENT.isDefined(operation)) {
+	    		maxStaleness = Element.RSC_MAX_STALENESS_ELEMENT.asInt(operation);
+	    	}
+	    	
+	    	CacheService<CachedResults> resultSetService = new CacheService<CachedResults>(cacheName, SessionAwareCache.Type.RESULTSET, maxStaleness);
 	    	ServiceBuilder<SessionAwareCache<CachedResults>> resultsCacheBuilder = target.addService(TeiidServiceNames.CACHE_RESULTSET, resultSetService);
 	    	resultsCacheBuilder.addDependency(TeiidServiceNames.TUPLE_BUFFER, TupleBufferCache.class, resultSetService.tupleBufferCacheInjector);
 	    	resultsCacheBuilder.addDependency(cfName, CacheFactory.class, resultSetService.cacheFactoryInjector);
 	    	newControllers.add(resultsCacheBuilder.install());
     	}
     	
-    	// prepared-plan cache (note that there is no dependency on the cache factory for 
-    	// prepared plan cache, as it is always local)
-    	CacheService<PreparedPlan> preparedPlanService = new PreparedPlanCacheService(SessionAwareCache.Type.PREPAREDPLAN, buildPreparedPlanCacheConfig(operation));
-    	ServiceBuilder<SessionAwareCache<PreparedPlan>> preparedPlanCacheBuilder = target.addService(TeiidServiceNames.CACHE_PREPAREDPLAN, preparedPlanService);
-    	preparedPlanCacheBuilder.addDependency(TeiidServiceNames.TUPLE_BUFFER, TupleBufferCache.class, preparedPlanService.tupleBufferCacheInjector);
-    	newControllers.add(preparedPlanCacheBuilder.install());
+    	// prepared-plan cache
+    	boolean ppCache = true;
+    	if (Element.PPC_ENABLE_ATTRIBUTE.isDefined(operation)) {
+    		ppCache = Element.PPC_ENABLE_ATTRIBUTE.asBoolean(operation);
+    	}
+    		
+    	if (!Element.PPC_CONTAINER_NAME_ELEMENT.isDefined(operation)) {
+    		throw new OperationFailedException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50095));
+    	}
+
+    	cacheName = "preparedplan"; //$NON-NLS-1$
+    	if (Element.PPC_NAME_ELEMENT.isDefined(operation)) {
+    		cacheName = Element.PPC_NAME_ELEMENT.asString(operation);
+    	}	 
     	
+    	if (ppCache) {
+	    	ServiceName cfName = ServiceName.JBOSS.append("teiid", "infinispan-pp-cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
+	    	CacheFactoryService cfs = new CacheFactoryService();
+	    	ServiceBuilder<CacheFactory> cacheFactoryBuilder = target.addService(cfName, cfs);
+	    	
+	    	String ispnName = Element.PPC_CONTAINER_NAME_ELEMENT.asString(operation);
+    		cacheFactoryBuilder.addDependency(ServiceName.JBOSS.append("infinispan", ispnName), CacheContainer.class, cfs.cacheContainerInjector); //$NON-NLS-1$
+	    	newControllers.add(cacheFactoryBuilder.install());
+	    	
+	    	CacheService<PreparedPlan> preparedPlanService = new CacheService<PreparedPlan>(cacheName, SessionAwareCache.Type.PREPAREDPLAN, 0);
+	    	ServiceBuilder<SessionAwareCache<PreparedPlan>> preparedPlanCacheBuilder = target.addService(TeiidServiceNames.CACHE_PREPAREDPLAN, preparedPlanService);
+	    	preparedPlanCacheBuilder.addDependency(TeiidServiceNames.TUPLE_BUFFER, TupleBufferCache.class, preparedPlanService.tupleBufferCacheInjector);
+	    	preparedPlanCacheBuilder.addDependency(cfName, CacheFactory.class, preparedPlanService.cacheFactoryInjector);
+	    	newControllers.add(preparedPlanCacheBuilder.install());
+    	}    	
+    	
     	// Query Engine
     	final DQPCoreService engine = buildQueryEngine(operation);
     	String workManager = "default"; //$NON-NLS-1$
@@ -467,48 +496,7 @@
     	
     	return bufferManger;
     }	
-
-    private CacheConfiguration buildCacheConfig(ModelNode node) {
-
-    	CacheConfiguration cacheConfig = new CacheConfiguration();
-    	cacheConfig.setMaxEntries(1024);
-   		cacheConfig.setMaxAgeInSeconds(7200);
-   		cacheConfig.setType(Policy.EXPIRATION.name());
-    	cacheConfig.setLocation("resultset"); //$NON-NLS-1$
-    	cacheConfig.setMaxStaleness(60);
-    	
-   		if (Element.RSC_MAX_STALENESS_ELEMENT.isDefined(node)) {
-    		cacheConfig.setMaxStaleness(Element.RSC_MAX_STALENESS_ELEMENT.asInt(node));
-    	}
-
-   		return cacheConfig;
-	}	      
     
-    
-    private CacheConfiguration buildPreparedPlanCacheConfig(ModelNode node) {
-    	CacheConfiguration cacheConfig = new CacheConfiguration();
-    	if (Element.PPC_MAX_ENTRIES_ATTRIBUTE.isDefined(node)) {
-    		cacheConfig.setMaxEntries(Element.PPC_MAX_ENTRIES_ATTRIBUTE.asInt(node));
-    	}
-    	else {
-    		cacheConfig.setMaxEntries(512);
-    	}
-    	
-    	if (Element.PPC_MAX_AGE_IN_SECS_ATTRIBUTE.isDefined(node)) {
-    		cacheConfig.setMaxAgeInSeconds(Element.PPC_MAX_AGE_IN_SECS_ATTRIBUTE.asInt(node));
-    	}
-    	else {
-    		cacheConfig.setMaxAgeInSeconds(28800);
-    	}
-    	
-		cacheConfig.setType(Policy.LRU.name());
-    	
-    	cacheConfig.setLocation("prepared"); //$NON-NLS-1$
-    	
-    	return cacheConfig;
-	}	    
-    
-    
 	private DQPCoreService buildQueryEngine(ModelNode node) {
 		DQPCoreService engine = new DQPCoreService();
     	

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -204,8 +204,9 @@
 	}
 
 	private void writePreparedPlanCacheConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
-		writeAttribute(writer, Element.PPC_MAX_ENTRIES_ATTRIBUTE, node);
-		writeAttribute(writer, Element.PPC_MAX_AGE_IN_SECS_ATTRIBUTE, node);
+		writeAttribute(writer, Element.PPC_NAME_ELEMENT, node);
+		writeAttribute(writer, Element.PPC_CONTAINER_NAME_ELEMENT, node);
+		writeAttribute(writer, Element.PPC_ENABLE_ATTRIBUTE, node);
 	}
 
 	private boolean has(ModelNode node, String name) {
@@ -637,17 +638,18 @@
     			String attrValue = reader.getAttributeValue(i);
     			Element element = Element.forName(attrName, Element.PREPAREDPLAN_CACHE_ELEMENT);
     			switch(element) {
-                case PPC_MAX_ENTRIES_ATTRIBUTE:
-                	node.get(element.getModelName()).set(Integer.parseInt(attrValue));
-                	break;
-                	
-                case PPC_MAX_AGE_IN_SECS_ATTRIBUTE:
-                	node.get(element.getModelName()).set(Integer.parseInt(attrValue));
-                	break;
-                	
-                default: 
-                    throw ParseUtils.unexpectedAttribute(reader, i);
-    			}
+    			case PPC_CONTAINER_NAME_ELEMENT:
+    				node.get(element.getModelName()).set(attrValue);
+    				break;
+    			case PPC_ENABLE_ATTRIBUTE:
+    				node.get(element.getModelName()).set(Boolean.parseBoolean(attrValue));
+    				break;
+    			case PPC_NAME_ELEMENT:
+    				node.get(element.getModelName()).set(attrValue);
+    				break;
+    			default: 
+                	throw ParseUtils.unexpectedAttribute(reader, i);
+    			} 
     		}
     	}    	
         while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT));

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -139,6 +139,16 @@
 		this.logon = new LogonImpl(this.sessionService, "teiid-cluster"); //$NON-NLS-1$
 		
     	if (this.socketConfig != null) {
+    		/*
+    		try {
+				// this is to show the bound socket port in the JMX console
+				SocketBinding socketBinding = getSocketBindingInjector().getValue();
+				ManagedServerSocketBinding ss = (ManagedServerSocketBinding)socketBinding.getSocketBindings().getServerSocketFactory().createServerSocket(socketBinding.getName());
+				socketBinding.getSocketBindings().getNamedRegistry().registerBinding(ss);
+			}  catch (IOException e) {
+				throw new StartException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50013));
+			}
+    		*/
     		this.address = getSocketBindingInjector().getValue().getSocketAddress();
     		Protocol protocol = Protocol.valueOf(socketConfig.getProtocol());
     		boolean sslEnabled = false;

Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2012-09-11 21:46:52 UTC (rev 4430)
@@ -30,7 +30,6 @@
 TEIID50002=Teiid Engine stopped {0}
 event_distributor_bound=org.teiid.events.EventDistributorFactory is bound to {0} for manual control of Teiid events. 
 TEIID50019=Re-deploying VDB {0}
-TEIID50066=Cache system has been shutdown
 TEIID50054=Model {0} not found in VDB {1}.{2}
 TEIID50055=Source name {0} not found in Model {1} in VDB {1}.{2}  
  
@@ -70,6 +69,9 @@
 TEIID50090=No context associated.  More than likely either pass-through authentication should not be used or there are no security domains defined on the embedded transport.
 TEIID50091=The URI parameters defined on procedure {0}, do not match to number of parameters defined on procedure. Correct and reploy VDB to expose this procedure through REST. 
 TEIID50092=Only result produceing procedures are allowed
+TEIID50093=Cache factory not found; Make sure the Infinispan based cache factory is correctly configured for Teiid.
+TEIID50094=Resultset cache configured without the Infinispan's Cache Container name. Check and provide <resultset-cache infinispan-container="{name}"/> in configuration.
+TEIID50095=PreparedPlan cache configured without the Infinispan's Cache Container name. Check and provide <preparedplan-cache infinispan-container="{name}"/> in configuration.
 wrong_vdb= Wrong VDB name and/or version supplied, or VDB is not active, or not available.
 
 # subsystem description
@@ -115,14 +117,15 @@
 buffer-service-inline-lobs.describe=Set to true to allow inlining of memory based and small lobs into results. However inline lob values are not supported by pre-7.6 clients, so disable this property if using older clients utilizing lobs. (default true)	
 
 #prepared-plan
-preparedplan-cache-max-entries.describe=Max Entries allowed
-preparedplan-cache-max-age-in-seconds.describe=Max age in seconds
+preparedplan-cache-enable.describe= Prepared Plan cache enabled (default true)
+preparedplan-cache-infinispan-container.describe=Infinispan cache container name
+preparedplan-cache-name.describe = Infinispan cache name for prepared plans
+preparedplan-cache-max-staleness.describe=Max staleness in seconds.  Modifications are based upon data updates -1 indicates no max. (default 60 - 1 minute)
 
 #resultset cache
 resultset-cache-enable.describe= Resultset cache enabled (default true)
 resultset-cache-infinispan-container.describe=Infinispan cache container name
 resultset-cache-name.describe = Infinispan cache name for resultset; if not specified default cache on infinispan container is used.
-resultset-cache-max-age-in-seconds.describe=Max age in seconds
 resultset-cache-max-staleness.describe=Max staleness in seconds.  Modifications are based upon data updates -1 indicates no max. (default 60 - 1 minute)
 
 #object replicator

Modified: trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd	2012-09-11 21:46:52 UTC (rev 4430)
@@ -227,10 +227,10 @@
                     <xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
                 </xs:annotation>
                 <xs:complexType>
-                    <xs:attribute name="max-entries" type="xs:int" default="512"/>
-                    <xs:attribute name="max-age-in-seconds" type="xs:int" default="28800"/>
-                    <xs:attribute name="max-staleness" type="xs:int" default="0"/>    
-                </xs:complexType>            
+                    <xs:attribute name="name" type="xs:string"/>
+                    <xs:attribute name="infinispan-container" type="xs:string" use="required"/>
+                    <xs:attribute name="enable" type="xs:boolean" default="true"/>
+                </xs:complexType>
             </xs:element>
             
             <xs:element name="distributed-cache" maxOccurs="1" minOccurs="0">

Modified: trunk/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-model-config.txt	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/test/resources/teiid-model-config.txt	2012-09-11 21:46:52 UTC (rev 4430)
@@ -169,22 +169,28 @@
         "required" => false,
         "default" => 8388608
     },
-    "preparedplan-cache-max-entries" => {
-        "type" => INT,
-        "description" => "Max Entries allowed",
+    "preparedplan-cache-name" => {
+        "type" => STRING,
+        "description" => "Infinispan cache name for prepared plans",
         "required" => false,
-        "default" => 512
+        "default" => "preparedplan"
     },
-    "preparedplan-cache-max-age-in-seconds" => {
-        "type" => INT,
-        "description" => "Max age in seconds",
+    "preparedplan-cache-infinispan-container" => {
+        "type" => STRING,
+        "description" => "Infinispan cache container name",
+        "required" => false
+    },
+    "preparedplan-cache-enable" => {
+        "type" => BOOLEAN,
+        "description" => "Prepared Plan cache enabled (default true)",
         "required" => false,
-        "default" => 28800
+        "default" => true
     },
     "resultset-cache-name" => {
         "type" => STRING,
         "description" => "Infinispan cache name for resultset; if not specified default cache on infinispan container is used.",
-        "required" => false
+        "required" => false,
+        "default" => "resultset"
     },
     "resultset-cache-infinispan-container" => {
         "type" => STRING,

Modified: trunk/jboss-integration/src/test/resources/teiid-model-json.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-model-json.txt	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/test/resources/teiid-model-json.txt	2012-09-11 21:46:52 UTC (rev 4430)
@@ -23,8 +23,9 @@
     "max-source-rows-allowed" : -1,
     "max-threads" : 64,
     "distributed-cache-jgroups-stack" : "stack",
-    "preparedplan-cache-max-age-in-seconds" : 28800,
-    "preparedplan-cache-max-entries" : 512,
+    "preparedplan-cache-infinispan-container" : "prep-container",
+    "preparedplan-cache-enable" : false,
+    "preparedplan-cache-name" : "prepcache",
     "query-threshold-in-seconds" : 600,
     "resultset-cache-infinispan-container" : "container",
     "resultset-cache-enable" : false,

Modified: trunk/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-sample-config.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/jboss-integration/src/test/resources/teiid-sample-config.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -26,7 +26,7 @@
     
     <resultset-cache name="cache" infinispan-container="container" enable="false" max-staleness="90"/>
     
-    <preparedplan-cache max-entries="512" max-age-in-seconds="28800"/>
+    <preparedplan-cache name="prepcache" infinispan-container="prep-container" enable="false"/>
     
     <distributed-cache jgroups-stack="stack"/>
     

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/pom.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -25,6 +25,10 @@
         <version.org.picketbox>4.0.6.final</version.org.picketbox>
         <version.org.picketbox.jbosssx-client>3.0.0.CR2</version.org.picketbox.jbosssx-client>
         <version.org.jboss.logging.jboss-logging>3.1.0.GA</version.org.jboss.logging.jboss-logging>
+        <version.org.infinispan>5.1.2.FINAL</version.org.infinispan>
+        <version.org.jboss.marshalling.jboss-marshalling>1.3.11.GA</version.org.jboss.marshalling.jboss-marshalling>
+        <version.org.jboss.marshalling.jboss-marshalling-river>1.3.11.GA</version.org.jboss.marshalling.jboss-marshalling-river>
+        <version.asm>3.3.1</version.asm>
         <version.org.jboss.arquillian.core>1.0.0.CR7</version.org.jboss.arquillian.core>
         <version.javax.enterprise>1.0-SP4</version.javax.enterprise>
         <version.org.jboss.netty>3.2.6.Final</version.org.jboss.netty>
@@ -602,7 +606,70 @@
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>${version.junit}</version>
-            </dependency>            
+            </dependency> 
+            <dependency>
+                <groupId>org.infinispan</groupId>
+                <artifactId>infinispan-core</artifactId>
+                <version>${version.org.infinispan}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.jgroups</groupId>
+                        <artifactId>jgroups</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.javaee</groupId>
+                        <artifactId>jboss-transaction-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.marshalling</groupId>
+                        <artifactId>jboss-marshalling</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.marshalling</groupId>
+                        <artifactId>jboss-marshalling-river</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss.logging</groupId>
+                        <artifactId>jboss-logging</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss</groupId>
+                        <artifactId>jandex</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.codehaus.woodstox</groupId>
+                        <artifactId>woodstox-core-asl</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.codehaus.woodstox</groupId>
+                        <artifactId>woodstox-core-asl</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.codehaus.woodstox</groupId>
+                        <artifactId>stax2-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.jboss</groupId>
+                        <artifactId>staxmapper</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>     
+            <dependency>
+                <groupId>asm</groupId>
+                <artifactId>asm</artifactId>
+                <version>${version.asm}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.marshalling</groupId>
+                <artifactId>jboss-marshalling-river</artifactId>
+                <version>${version.org.jboss.marshalling.jboss-marshalling-river}</version>
+            </dependency>
+        
+            <dependency>
+                <groupId>org.jboss.marshalling</groupId>
+                <artifactId>jboss-marshalling</artifactId>
+                <version>${version.org.jboss.marshalling.jboss-marshalling}</version>
+            </dependency>                                       
 		</dependencies>
 	</dependencyManagement>
 	<modules>

Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/pom.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -54,5 +54,31 @@
         <groupId>javax.resource</groupId>
         <artifactId>connector-api</artifactId>
     </dependency>
+    <dependency>
+        <groupId>org.infinispan</groupId>
+        <artifactId>infinispan-core</artifactId>
+        <exclusions>
+            <exclusion>
+              <groupId>org.jboss.spec.javax.transaction</groupId>
+              <artifactId>jboss-transaction-api_1.1_spec</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>    
+    <dependency>
+        <groupId>org.jboss.marshalling</groupId>
+        <artifactId>jboss-marshalling-river</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.jboss.marshalling</groupId>
+        <artifactId>jboss-marshalling</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.jgroups</groupId>
+        <artifactId>jgroups</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging</artifactId>
+    </dependency>    
   </dependencies>
 </project>
\ No newline at end of file

Copied: trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCache.java (from rev 4399, trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java)
===================================================================
--- trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCache.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCache.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.cache.infinispan;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.teiid.cache.Cache;
+
+
+/**
+ * Implementation of Cache using Infinispan
+ */
+public class InfinispanCache<K, V> implements Cache<K, V> {
+
+	protected org.infinispan.AdvancedCache<K, V> cacheStore;
+	private final String name; 
+	private ClassLoader classloader;
+	
+	public InfinispanCache(org.infinispan.Cache<K, V> cacheStore, String cacheName, ClassLoader classloader) {
+		assert(cacheStore != null);
+		this.cacheStore = cacheStore.getAdvancedCache();
+		this.name = cacheName;
+		this.classloader = classloader;
+	}
+	
+	@Override
+	public V get(K key) {
+		return this.cacheStore.with(this.classloader).get(key);
+	}
+	
+	public V put(K key, V value) {
+		return this.cacheStore.with(this.classloader).put(key, value);
+	}
+	
+	@Override
+	public V put(K key, V value, Long ttl) {
+		if (ttl != null) {
+			return this.cacheStore.with(this.classloader).put(key, value, ttl, TimeUnit.MILLISECONDS);
+		}
+		return this.cacheStore.with(this.classloader).put(key, value);
+	}
+
+	@Override
+	public V remove(K key) {
+		return this.cacheStore.with(this.classloader).remove(key);
+	}
+	
+	@Override
+	public int size() {
+		return this.cacheStore.with(this.classloader).size();
+	}
+	
+	@Override
+	public void clear() {
+		this.cacheStore.with(this.classloader).clear();
+	}
+	
+	@Override
+	public String getName() {
+		return this.name;
+	}
+
+	@Override
+	public Set<K> keys() {
+		return this.cacheStore.with(this.classloader).keySet();
+	}
+}

Copied: trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCacheFactory.java (from rev 4399, trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java)
===================================================================
--- trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCacheFactory.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/cache/infinispan/InfinispanCacheFactory.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.cache.infinispan;
+
+import java.io.Serializable;
+
+import org.infinispan.manager.CacheContainer;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheFactory;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class InfinispanCacheFactory implements CacheFactory, Serializable{
+	private static final long serialVersionUID = -2767452034178675653L;
+	private transient org.infinispan.manager.CacheContainer cacheStore;
+	private volatile boolean destroyed = false;
+	private ClassLoader classLoader;
+	
+
+	public InfinispanCacheFactory(CacheContainer cm, ClassLoader classLoader) {
+		this.cacheStore = cm;
+		this.classLoader = classLoader;
+	}
+	
+	public Cache get(String cacheName) {
+		if (!destroyed) {
+			org.infinispan.Cache cache = this.cacheStore.getCache(cacheName);
+			if (cache != null) {
+				return new InfinispanCache(cache, cacheName, this.classLoader);
+			}
+			return null;
+		}
+		throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40099, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40099));
+	}
+	
+	public void destroy() {
+		this.destroyed = true;		
+	}	
+	
+	public void stop() {
+		destroy();
+	}
+	
+	@Override
+	public boolean isReplicated() {
+		return true;
+	}
+}

Modified: trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -22,11 +22,16 @@
 
 package org.teiid.runtime;
 
+import java.io.IOException;
 import java.util.List;
 
 import javax.resource.spi.work.WorkManager;
 import javax.transaction.TransactionManager;
 
+import org.infinispan.manager.DefaultCacheManager;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.infinispan.InfinispanCacheFactory;
+import org.teiid.core.TeiidRuntimeException;
 import org.teiid.dqp.internal.process.DQPConfiguration;
 import org.teiid.dqp.internal.process.TeiidExecutor;
 import org.teiid.dqp.internal.process.ThreadReuseExecutor;
@@ -42,6 +47,8 @@
 	private WorkManager workManager;
 	private boolean useDisk = true;
 	private String bufferDirectory;
+	private CacheFactory cacheFactory;
+	private int maxResultSetCacheStaleness = 60;
 	
 	public SecurityHelper getSecurityHelper() {
 		return securityHelper;
@@ -113,4 +120,26 @@
 	public String getBufferDirectory() {
 		return this.bufferDirectory;
 	}
+	
+	public CacheFactory getCacheFactory() {
+		if (this.cacheFactory == null) {
+			try {
+				DefaultCacheManager manager =   new DefaultCacheManager("infinispan-config.xml"); //$NON-NLS-1$
+				this.cacheFactory = new InfinispanCacheFactory(manager, this.getClass().getClassLoader());
+			} catch (IOException e) {
+				throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40100, e);
+			}
+		}
+		return this.cacheFactory;
+	}
+	
+	public void setCacheFactory(CacheFactory cacheFactory) {
+		this.cacheFactory = cacheFactory;
+	}
+	public int getMaxResultSetCacheStaleness() {
+		return maxResultSetCacheStaleness;
+	}
+	public void setMaxResultSetCacheStaleness(int maxResultSetCacheStaleness) {
+		this.maxResultSetCacheStaleness = maxResultSetCacheStaleness;
+	}	
 }

Modified: trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -29,10 +29,8 @@
 import java.sql.CallableStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
@@ -44,20 +42,14 @@
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import org.teiid.Replicated;
-import org.teiid.Replicated.ReplicationMode;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
 import org.teiid.client.DQP;
 import org.teiid.client.security.ILogon;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.common.buffer.TupleBufferCache;
-import org.teiid.core.TeiidRuntimeException;
 import org.teiid.core.BundleUtil.Event;
+import org.teiid.core.TeiidRuntimeException;
 import org.teiid.deployers.CompositeVDB;
 import org.teiid.deployers.UDFMetaData;
 import org.teiid.deployers.VDBLifeCycleListener;
@@ -210,24 +202,6 @@
 		T getConnectionFactory() throws TranslatorException;
 	}
 	
-	/**
-	 * Annotated cache for use with the {@link EmbeddedServer} with an {@link ObjectReplicator} instead of Infinispan.
-	 * @param <K> key
-	 * @param <V> value
-	 */
-	public interface ReplicatedCache<K, V> extends Cache<K, V> {
-
-		@Replicated(replicateState = ReplicationMode.PULL)
-		public V get(K key);
-
-		@Replicated(replicateState = ReplicationMode.PUSH)
-		V put(K key, V value, Long ttl);
-
-		@Replicated()
-		V remove(K key);
-
-	}
-	
 	private static class VDBValidationError extends TeiidRuntimeException {
 		
 		private VDBValidationError(Event event, String message) {
@@ -272,42 +246,7 @@
 	protected LogonImpl logon;
 	private TeiidDriver driver = new TeiidDriver();
 	protected ConnectorManagerRepository cmr = new ProviderAwareConnectorManagerRepository();
-	protected DefaultCacheFactory dcf = new DefaultCacheFactory() {
-		
-		List<ReplicatedCache<?, ?>> caches = new ArrayList<ReplicatedCache<?, ?>>();
-		
-		public boolean isReplicated() {
-			return true;
-		}
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public <K, V> Cache<K, V> get(String location,
-				CacheConfiguration config) {
-			Cache<K, V> result = super.get(location, config);
-			if (replicator != null) {
-				try {
-					ReplicatedCache cache = replicator.replicate("$RS$", ReplicatedCache.class, new ReplicatedCacheImpl(result), 0); //$NON-NLS-1$
-					caches.add(cache);
-					return cache;
-				} catch (Exception e) {
-					throw new TeiidRuntimeException(e);
-				}
-			}
-			return result;
-		}
-		
-		@Override
-		public void destroy() {
-			if (replicator != null) {
-				for (ReplicatedCache<?, ?> cache : caches) {
-					replicator.stop(cache);
-				}
-				caches.clear();
-			}
-			super.destroy();
-		}
-	};
+	
 	protected AbstractEventDistributorFactoryService eventDistributorFactoryService = new AbstractEventDistributorFactoryService() {
 		
 		@Override
@@ -335,14 +274,14 @@
 		this.connectionFactoryProviders.put(name, connectionFactoryProvider);
 	}
 
-	public synchronized void start(EmbeddedConfiguration dqpConfiguration) {
+	public synchronized void start(EmbeddedConfiguration config) {
 		if (running != null) {
 			throw new IllegalStateException();
 		}
 		this.eventDistributorFactoryService.start();
 		this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor());
-		this.replicator = dqpConfiguration.getObjectReplicator();
-		if (dqpConfiguration.getTransactionManager() == null) {
+		this.replicator = config.getObjectReplicator();
+		if (config.getTransactionManager() == null) {
 			LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089));
 			this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() {
 				
@@ -354,34 +293,34 @@
 			}));
 			this.detectTransactions = false;
 		} else {
-			this.transactionService.setTransactionManager(dqpConfiguration.getTransactionManager());
+			this.transactionService.setTransactionManager(config.getTransactionManager());
 		}
-		if (dqpConfiguration.getSecurityHelper() != null) {
-			this.sessionService.setSecurityHelper(dqpConfiguration.getSecurityHelper());
+		if (config.getSecurityHelper() != null) {
+			this.sessionService.setSecurityHelper(config.getSecurityHelper());
 		} else {
 			this.sessionService.setSecurityHelper(new DoNothingSecurityHelper());
 		}
-		if (dqpConfiguration.getSecurityDomains() != null) {
-			this.sessionService.setSecurityDomains(dqpConfiguration.getSecurityDomains());
+		if (config.getSecurityDomains() != null) {
+			this.sessionService.setSecurityDomains(config.getSecurityDomains());
 		} else {
 			this.sessionService.setSecurityDomains(Arrays.asList("teiid-security")); //$NON-NLS-1$
 		}
 
 		this.sessionService.setVDBRepository(repo);
-		this.bufferService.setUseDisk(dqpConfiguration.isUseDisk());
-		if (dqpConfiguration.isUseDisk()) {
-			if (dqpConfiguration.getBufferDirectory() == null) {
-				dqpConfiguration.setBufferDirectory(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
+		this.bufferService.setUseDisk(config.isUseDisk());
+		if (config.isUseDisk()) {
+			if (config.getBufferDirectory() == null) {
+				config.setBufferDirectory(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
 			}
-			this.bufferService.setDiskDirectory(dqpConfiguration.getBufferDirectory());
+			this.bufferService.setDiskDirectory(config.getBufferDirectory());
 		}
 		BufferService bs = getBufferService();
 		this.dqp.setBufferManager(bs.getBufferManager());
 
 		startVDBRepository();
 
-		SessionAwareCache<CachedResults> rs = new SessionAwareCache<CachedResults>(dcf, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
-		SessionAwareCache<PreparedPlan> ppc = new SessionAwareCache<PreparedPlan>(dcf, SessionAwareCache.Type.PREPAREDPLAN,	new CacheConfiguration());
+		SessionAwareCache<CachedResults> rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); //$NON-NLS-1$
+		SessionAwareCache<PreparedPlan> ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); //$NON-NLS-1$
 		rs.setTupleBufferCache(bs.getTupleBufferCache());
 		this.dqp.setResultsetCache(rs);
 
@@ -390,7 +329,7 @@
 
 		this.dqp.setTransactionService(this.transactionService);
 
-		this.dqp.start(dqpConfiguration);
+		this.dqp.start(config);
 		this.sessionService.setDqp(this.dqp);
 		this.services.setSecurityHelper(this.sessionService.getSecurityHelper());
 		this.logon = new LogonImpl(sessionService, null);

Deleted: trunk/runtime/src/main/java/org/teiid/runtime/ReplicatedCacheImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/ReplicatedCacheImpl.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/src/main/java/org/teiid/runtime/ReplicatedCacheImpl.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.runtime;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Set;
-
-import org.teiid.cache.Cache;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.query.ReplicatedObject;
-import org.teiid.runtime.EmbeddedServer.ReplicatedCache;
-
-class ReplicatedCacheImpl<K extends Serializable, V>
-		implements ReplicatedCache<K, V>, ReplicatedObject<K> {
-	private Cache<K, V> cache;
-
-	public ReplicatedCacheImpl(Cache<K, V> cache) {
-		this.cache = cache;
-	}
-
-	public void clear() {
-		cache.clear();
-	}
-
-	public V get(K key) {
-		return cache.get(key);
-	}
-
-	public String getName() {
-		return cache.getName();
-	}
-
-	public Set<K> keys() {
-		return cache.keys();
-	}
-
-	public V put(K key, V value, Long ttl) {
-		return cache.put(key, value, ttl);
-	}
-
-	public V remove(K key) {
-		return cache.remove(key);
-	}
-
-	public int size() {
-		return cache.size();
-	}
-
-	@Override
-	public void getState(K stateId, OutputStream ostream) {
-		V value = get(stateId);
-		if (value != null) {
-			try {
-				ObjectOutputStream oos = new ObjectOutputStream(ostream);
-				oos.writeObject(value);
-				oos.close();
-			} catch (IOException e) {
-				throw new TeiidRuntimeException(e);
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public void setState(K stateId, InputStream istream) {
-		try {
-			ObjectInputStream ois = new ObjectInputStream(istream);
-			V value = (V) ois.readObject();
-			this.put(stateId, value, null);
-		} catch (IOException e) {
-			throw new TeiidRuntimeException(e);
-		} catch (ClassNotFoundException e) {
-			throw new TeiidRuntimeException(e);
-		}
-	}
-
-	@Override
-	public boolean hasState(K stateId) {
-		return cache.get(stateId) != null;
-	}
-
-	@Override
-	public void droppedMembers(Collection<Serializable> addresses) {
-	}
-
-	@Override
-	public void getState(OutputStream ostream) {
-	}
-
-	@Override
-	public void setAddress(Serializable address) {
-	}
-
-	@Override
-	public void setState(InputStream istream) {
-	}
-
-}
\ No newline at end of file

Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -110,5 +110,7 @@
     	TEIID40096, //vdb deploy timeout
     	TEIID40097, //vdb finish timeout  
     	TEIID40098,
+    	TEIID40099,
+    	TEIID40100,
     }
 }

Added: trunk/runtime/src/main/resources/infinispan-config.xml
===================================================================
--- trunk/runtime/src/main/resources/infinispan-config.xml	                        (rev 0)
+++ trunk/runtime/src/main/resources/infinispan-config.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+~ JBoss, Home of Professional Open Source
+~ Copyright 2010 Red Hat Inc. and/or its affiliates and other
+~ contributors as indicated by the @author tags. All rights reserved.
+~ See the copyright.txt in the distribution for a full listing of
+~ individual contributors.
+~
+~ This is free software; you can redistribute it and/or modify it
+~ under the terms of the GNU Lesser General Public License as
+~ published by the Free Software Foundation; either version 2.1 of
+~ the License, or (at your option) any later version.
+~
+~ This software is distributed in the hope that it will be useful,
+~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+~ Lesser General Public License for more details.
+~
+~ You should have received a copy of the GNU Lesser General Public
+~ License along with this software; if not, write to the Free
+~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<infinispan
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
+      xmlns="urn:infinispan:config:5.1">
+
+    <global/>
+
+    <namedCache name="resultset">
+        <eviction maxEntries="1024" strategy="LIRS" />
+        <expiration lifespan="7200000" />
+        <clustering mode="local"/>
+    </namedCache>
+    
+    <namedCache name="resultset-repl">
+        <eviction maxEntries="1024" strategy="LIRS" />
+        <expiration lifespan="7200000" />
+        <clustering mode="local"/>
+    </namedCache>    
+        
+    <namedCache name="preparedplan">
+        <eviction maxEntries="512" strategy="LIRS"/>
+        <expiration lifespan="28800"/>
+        <clustering mode="local"/>
+    </namedCache> 
+    
+</infinispan>
\ No newline at end of file


Property changes on: trunk/runtime/src/main/resources/infinispan-config.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2012-09-11 21:46:52 UTC (rev 4430)
@@ -99,4 +99,5 @@
 
 TEIID40096=Waited {0} for VDB {1}.{2} to be deployed, but it never was.  Please check to see if the deployment is missing or is in error.
 TEIID40097=Waited {0} for VDB {1}.{2} to be ACTIVE, but it never was.  Please check it's sources - {3}.
-TEIID40098=Reached end of results; use hasNext() call to check if there are more results before calling next()
\ No newline at end of file
+TEIID40098=Reached end of results; use hasNext() call to check if there are more results before calling next()
+TEIID40099=Cache system has been shutdown
\ No newline at end of file

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java	2012-09-11 15:40:12 UTC (rev 4429)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java	2012-09-11 21:46:52 UTC (rev 4430)
@@ -31,12 +31,14 @@
 import java.util.Collection;
 import java.util.HashMap;
 
+import org.infinispan.manager.DefaultCacheManager;
 import org.jboss.as.clustering.jgroups.ChannelFactory;
 import org.jboss.as.server.ServerEnvironment;
 import org.jgroups.Channel;
 import org.jgroups.JChannel;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.teiid.cache.infinispan.InfinispanCacheFactory;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.UnitTestUtil;
 import org.teiid.jdbc.FakeServer;
@@ -144,6 +146,9 @@
 
 		EmbeddedConfiguration config = new EmbeddedConfiguration();
 		config.setObjectReplicator(jor);
+		DefaultCacheManager manager = new DefaultCacheManager(UnitTestUtil.getTestDataPath()+"/infinispan-replicated-config.xml");
+		config.setCacheFactory(new InfinispanCacheFactory(manager, this.getClass().getClassLoader()));
+		
 		server.start(config, true);
     	HashMap<String, Collection<FunctionMethod>> udfs = new HashMap<String, Collection<FunctionMethod>>();
     	udfs.put("funcs", Arrays.asList(new FunctionMethod("pause", null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause", null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER), true, Determinism.NONDETERMINISTIC)));

Added: trunk/test-integration/common/src/test/resources/infinispan-replicated-config.xml
===================================================================
--- trunk/test-integration/common/src/test/resources/infinispan-replicated-config.xml	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/infinispan-replicated-config.xml	2012-09-11 21:46:52 UTC (rev 4430)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd" xmlns="urn:infinispan:config:5.1">
+
+    <global>
+        <transport clusterName="teiid-cluster" machineId="m1" rackId="r1" nodeName="Node-A">
+         <properties>
+            <property name="configurationFile" value="tcp.xml"/>
+         </properties>        
+        </transport>
+    </global>
+
+    <namedCache name="resultset">
+        <eviction maxEntries="1024" strategy="LIRS" />
+        <expiration lifespan="7200000"/>
+        <clustering mode="local"/>
+    </namedCache>
+    
+    <namedCache name="resultset-repl">
+        <eviction maxEntries="1024" strategy="LIRS" />
+        <expiration lifespan="7200000"/>
+        <clustering mode="replication">
+            <sync/>
+        </clustering>
+    </namedCache>
+        
+    <namedCache name="preparedplan">
+        <eviction maxEntries="512" strategy="LIRS"/>
+        <expiration lifespan="28800"/>    
+        <clustering mode="local"/>
+    </namedCache>         
+
+</infinispan>
\ No newline at end of file


Property changes on: trunk/test-integration/common/src/test/resources/infinispan-replicated-config.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the teiid-commits mailing list