[teiid-commits] teiid SVN: r4459 - in trunk/connectors/translator-object: .settings and 13 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Sep 21 09:01:05 EDT 2012


Author: van.halbert
Date: 2012-09-21 09:01:05 -0400 (Fri, 21 Sep 2012)
New Revision: 4459

Added:
   trunk/connectors/translator-object/examples
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanBaseExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanConnectionImpl.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheConnection.java
   trunk/connectors/translator-object/src/test/example_vdbs/
   trunk/connectors/translator-object/src/test/example_vdbs/infinispancache-vdb.xml
   trunk/connectors/translator-object/src/test/example_vdbs/infinispanremotecache-vdb.xml
   trunk/connectors/translator-object/src/test/example_vdbs/mapcache-vdb.xml
Removed:
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheSearchByKey.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/FakeStrategy.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestSelectProjections.java
Modified:
   trunk/connectors/translator-object/.settings/org.maven.ide.eclipse.prefs
   trunk/connectors/translator-object/pom.xml
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/LuceneSearch.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/SearchByKey.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/BasicKeySearchCriteria.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/SearchCriterion.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectUtil.java
   trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/RemoteInfinispanTestHelper.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanConfigFileKeySearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiILuceneSearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiKeySearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanRemoteJndiKeySearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/mapcache/TestMapCacheKeySearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/search/TestBasicKeySearchCriteria.java
Log:
TEIID-2211 and TEIID-2213, adding translator to the dist kit and related changes to the translator to fix integration.  Also, removed unneeded code with the advent of the OBJECTTABLE which removed the need to parse the whole SELECT command.  Also, included a couple of dynamic vdb examples for each of the translator types.

Modified: trunk/connectors/translator-object/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/connectors/translator-object/.settings/org.maven.ide.eclipse.prefs	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/.settings/org.maven.ide.eclipse.prefs	2012-09-21 13:01:05 UTC (rev 4459)
@@ -1,9 +1,6 @@
-#Wed Jan 25 12:40:16 CST 2012
-activeProfiles=
+#Wed Jan 25 12:40:49 CST 2012
 eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-includeModules=false
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-skipCompilerPlugin=true
-version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6

Added: trunk/connectors/translator-object/examples
===================================================================
--- trunk/connectors/translator-object/examples	                        (rev 0)
+++ trunk/connectors/translator-object/examples	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,9 @@
+
+
+Chaining objecttables using JDG Team example:
+
+SELECT o.TeamName, c.Name 
+FROM object, OBJECTTABLE('x' PASSING ocol AS x COLUMNS TeamName varchar(255) 'teiid_row.foo', members object 'teiid_row.teamMembers') as o, 
+OBJECTABLE('m' PASSING o.members as m COLUMNS Name string 'teiid_row.name') as c
+
+Would produce a list of every team/member name.
\ No newline at end of file

Modified: trunk/connectors/translator-object/pom.xml
===================================================================
--- trunk/connectors/translator-object/pom.xml	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/pom.xml	2012-09-21 13:01:05 UTC (rev 4459)
@@ -54,22 +54,26 @@
 	        <groupId>org.infinispan</groupId>
     	    <artifactId>infinispan-core</artifactId>
        		<version>${version.org.infinispan}</version>
-       	</dependency>	 
+       		<scope>provided</scope>
+		</dependency>	 
 	 	<dependency>
 	      <groupId>org.infinispan</groupId>
 	      <artifactId>infinispan-query</artifactId>
 	      <version>${version.org.infinispan}</version>
-    	</dependency>  
+	      <scope>provided</scope>
+	 	</dependency>  
 		<dependency>
 		   <groupId>org.hibernate</groupId>
 		   <artifactId>hibernate-search</artifactId>
 		   <version>${version.hibernate.search}</version>
+		   <scope>provided</scope>
 		</dependency>
 		
 	    <dependency>
 	      <groupId>org.infinispan</groupId>
 	      <artifactId>infinispan-client-hotrod</artifactId>
 	      <version>${version.org.infinispan}</version>
+	      <scope>provided</scope>
 	    </dependency> 
 	    <dependency>
 	      <groupId>org.infinispan</groupId>
@@ -87,10 +91,12 @@
      	<dependency>
               <groupId>org.jgroups</groupId>
               <artifactId>jgroups</artifactId>
+              <scope>test</scope>
      	</dependency>
         <dependency>
             <groupId>org.jboss.marshalling</groupId>
             <artifactId>jboss-marshalling-river</artifactId>
+            <scope>test</scope>
         </dependency>
 	    <dependency>
 		    <groupId>org.mockito</groupId>

Added: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,46 @@
+/*
+ * 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.translator.object;
+
+import java.util.List;
+
+import org.teiid.language.Select;
+import org.teiid.translator.TranslatorException;
+
+/**
+ * Each ObjectConnection implementation represents a connection instance and is responsible for
+ * implementing the data source search language specifics for searching its cache.
+ * 
+ * @author vhalbert
+ *
+ */
+public interface ObjectConnection  {
+	
+	/**
+	 * Call to perform the search on the cache identified by this connection instance
+	 * @param command
+	 * @return List of Objects
+	 * @throws TranslatorException
+	 */
+	public List<Object> performSearch(Select command) throws TranslatorException;
+
+}

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -41,16 +41,14 @@
 public class ObjectExecution implements ResultSetExecution {
 
 	private Select query;
-	private Object connection;
-	private ObjectExecutionFactory config;
+	private ObjectConnection connection;
 
 	private Iterator<Object> resultsIt = null;
 
 	public ObjectExecution(Select query, RuntimeMetadata metadata,
-			ObjectExecutionFactory factory, Object connection) {
+			ObjectExecutionFactory factory, ObjectConnection connection) {
 		this.query = query;
 		this.connection = connection;
-		this.config = factory;
 	}
 
 	@Override
@@ -59,11 +57,8 @@
 		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
 				"ObjectExecution command: " + query.toString()); //$NON-NLS-1$
 
-		SelectProjections projections = SelectProjections.create(config);
-		projections.parse(query);
+		List<Object> results = executeQuery();
 
-		List<Object> results = executeQuery(projections);
-
 		if (results != null && results.size() > 0) {
 			LogManager.logDetail(LogConstants.CTX_CONNECTOR,
 					"ObjectExecution number of returned objects is : " + results.size()); //$NON-NLS-1$
@@ -78,17 +73,15 @@
 		this.resultsIt = results.iterator();
 	}
 
-	protected List<Object> executeQuery(SelectProjections projections)
+	protected List<Object> executeQuery()
 			throws TranslatorException {
 
-		SearchStrategy is = this.config.getSearchStrategy();
 		LogManager
 				.logTrace(
 						LogConstants.CTX_CONNECTOR,
-						"ObjectExecution calling search strategy : " + is.getClass().getName()); //$NON-NLS-1$
+						"ObjectExecution calling search strategy : " + connection.getClass().getName()); //$NON-NLS-1$
 
-		return is.performSearch((Select) query, projections, this.config,
-				this.connection);
+		return connection.performSearch((Select) query);
 
 	}
 
@@ -108,7 +101,6 @@
 	public void close() {
 		this.query = null;
 		this.connection = null;
-		this.config = null;
 		this.resultsIt = null;
 	}
 

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -24,7 +24,11 @@
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import javax.resource.cci.ConnectionFactory;
 
 import org.teiid.language.QueryExpression;
@@ -35,46 +39,38 @@
 import org.teiid.translator.ResultSetExecution;
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.object.infinispan.search.SearchByKey;
-import org.teiid.translator.object.util.ObjectUtil;
 
+
 /**
  * The ObjectExecutionFactory is a base implementation for connecting to an
- * Object data source that's stored in a cache.
+ * Object cache.  It provides the core features and behavior common to all implementations.
  * 
- * 
  * @author vhalbert
  * 
  */
 public abstract class ObjectExecutionFactory extends
-		ExecutionFactory<ConnectionFactory, Object> {
+		ExecutionFactory<ConnectionFactory, ObjectConnection> {
 
 	public static final int MAX_SET_SIZE = 1000;
 
-	/*
-	 * SearchStrategy is the implementation that will perform a specific cache
-	 * lookup algorithm
-	 */
-	private SearchStrategy searchStrategy = null;
-	private String searchStrategyClassName = null;
-
 	// rootClassName identifies the name of the class that is identified by the
 	// unique key in the cache
 	private String rootClassName = null;
 	private Class<?> rootClass = null;
+	private String cacheJndiName;
 
+
 	public ObjectExecutionFactory() {
-		super();
 
-		this.setSourceRequiredForMetadata(false);
-		this.setMaxInCriteriaSize(MAX_SET_SIZE);
-		this.setMaxDependentInPredicates(1);
+		setSourceRequiredForMetadata(false);
+		setMaxInCriteriaSize(MAX_SET_SIZE);
+		setMaxDependentInPredicates(1);
 
-		this.setSupportsOrderBy(false);
-		this.setSupportsSelectDistinct(false);
-		this.setSupportsInnerJoins(false);
-		this.setSupportsFullOuterJoins(false);
-		this.setSupportsOuterJoins(false);
+		setSupportsOrderBy(false);
+		setSupportsSelectDistinct(false);
+		setSupportsInnerJoins(false);
+		setSupportsFullOuterJoins(false);
+		setSupportsOuterJoins(false);
 
 	}
 
@@ -94,10 +90,6 @@
 			rootClass = Class.forName(rootClassName.trim(), true, getClass()
 					.getClassLoader());
 
-			searchStrategy = (SearchStrategy) ObjectUtil.createObject(
-					searchStrategyClassName, Collections.EMPTY_LIST, getClass()
-							.getClassLoader());
-
 		} catch (ClassNotFoundException e) {
 			String msg = ObjectPlugin.Util.getString(
 					"ObjectExecutionFactory.rootClassNotFound",
@@ -110,12 +102,15 @@
 	@Override
 	public ResultSetExecution createResultSetExecution(QueryExpression command,
 			ExecutionContext executionContext, RuntimeMetadata metadata,
-			Object connection) throws TranslatorException {
+			ObjectConnection connection) throws TranslatorException {
 
-		return new ObjectExecution((Select) command, metadata, this, connection);
+		
+		return new ObjectExecution((Select) command, metadata, this, (connection == null ? getConnection(null, executionContext) : connection) );
 
 	}
 
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
 	public List getSupportedFunctions() {
 		return Collections.EMPTY_LIST;
 	}
@@ -172,38 +167,8 @@
 	public boolean supportsOrderBy() {
 		return false;
 	}
-
+	
 	/**
-	 * Get the class name for the search strategy that will be used to perform
-	 * object lookups in the cache.
-	 * 
-	 * @return String class name
-	 * @see #setSearchStrategyClassName(String)
-	 */
-	public String getSearchStrategyClassName() {
-		return this.searchStrategyClassName;
-	}
-
-	/**
-	 * Set the class name for the search strategy that will be used to perform
-	 * object lookups in the cache.
-	 * <p>
-	 * Default is {@link SearchByKey}
-	 * 
-	 * @param searchStrategyClassName
-	 * @see #getSearchStrategyClassName()
-	 */
-
-	public void setSearchStrategyClassName(String searchStrategyClassName) {
-		this.searchStrategyClassName = searchStrategyClassName;
-	}
-
-	protected SearchStrategy getSearchStrategy() {
-		return this.searchStrategy;
-	}
-
-
-	/**
 	 * Call to get the class name of the root object in the cache. This
 	 * identifies the name of the class that is identified by the unique key in
 	 * the cache
@@ -230,7 +195,30 @@
 
 		}
 	}
+	
+	 /**
+     * Get the JNDI name for the  {@link Map cache}  instance that should be used as the data source.
+     * 
+     * @return the JNDI name of the {@link Map cache} instance that should be used,
+     * @see #setCacheJndiName(String)
+     */
+	@TranslatorProperty(display = "CacheJndiName", advanced = true)
+    public String getCacheJndiName() {
+        return cacheJndiName;
+    }
 
+    /**
+     * Set the JNDI name to a {@link Map cache} instance that should be used as this source.
+     * 
+     * @param jndiName the JNDI name of the {@link Map cache} instance that should be used
+     * @see #setCacheJndiName(String)
+     */
+    public synchronized void setCacheJndiName( String jndiName ) {
+        if (this.cacheJndiName == jndiName || this.cacheJndiName != null
+            && this.cacheJndiName.equals(jndiName)) return; // unchanged
+        this.cacheJndiName = jndiName;
+    }
+
 	/**
 	 * Call to get the class specified by calling
 	 * {@link #setRootClassName(String)}
@@ -240,5 +228,41 @@
 	public Class<?> getRootClass() {
 		return this.rootClass;
 	}
+	
+	/**
+	 * Utility method available to all implementations to find the Cache via JNDI.
+	 * @return Object located via JNDI
+	 * @throws TranslatorException
+	 */
+	protected Object findCacheUsingJNDIName() throws TranslatorException {
+		  	
+		    Object cache = null;
+		    String jndiName = getCacheJndiName();
+		    if (jndiName != null && jndiName.trim().length() != 0) {
+		        try {
+		            Context context = null;
+		            if (context == null) {
+		                try {
+		                    context = new InitialContext();
+		                } catch (NamingException err) {
+		                    throw new TranslatorException(err);
+		                }
+		            }
+		            cache = context.lookup(jndiName);
+		            
+		            if (cache == null) {
+		    			String msg = ObjectPlugin.Util.getString(
+		    					"ObjectExecutionFactory.cacheNotFoundinJNDI",
+		    					new Object[] { jndiName });
+		    			throw new TranslatorException(msg); //$NON-NLS-1$
+		            	
+		            } 		
+		        } catch (Throwable err) {
+		            if (err instanceof RuntimeException) throw (RuntimeException)err;
+		            throw new TranslatorException(err);
+		        }
+		    } 
+		    return cache;
+	    }	
 
 }

Added: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanBaseExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanBaseExecutionFactory.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanBaseExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,198 @@
+/*
+ * 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.translator.object.infinispan;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.resource.cci.ConnectionFactory;
+
+import org.infinispan.Cache;
+import org.infinispan.api.BasicCache;
+import org.infinispan.api.BasicCacheContainer;
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.manager.DefaultCacheManager;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TranslatorProperty;
+import org.teiid.translator.object.ObjectConnection;
+import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectPlugin;
+
+/**
+ * 
+ * @author vhalbert
+ *
+ */
+public abstract class InfinispanBaseExecutionFactory extends ObjectExecutionFactory {
+	public static final String PROPERTIES_FILE = "META-INF" + File.separator
+			+ "datagrid.properties";
+
+	private String cacheName = null;
+	private String configurationFileName = null;
+
+	public InfinispanBaseExecutionFactory() {
+		super();
+	}
+
+	@Override
+	public void start() throws TranslatorException {
+		super.start();
+		
+		if (this.getCacheName() == null || this.getCacheName().isEmpty()) {
+			String msg = ObjectPlugin.Util.getString(
+					"InfinispanBaseExecutionFactory.cacheNameNotDefined",
+					new Object[] {});
+			throw new TranslatorException(msg); //$NON-NLS-1$
+		}
+
+	}
+	
+	/**
+	 * Will return <code>true</code> if FullText searching is supported for this implementation.
+	 * 
+	 * @return True if full text searching is reported.
+	 */
+	public abstract boolean isFullTextSearchingSupported();
+	
+	/** 
+	 * Will return <code>true</code> if access to the cache is still allowed.
+	 * @return True if access is alive
+	 */
+	public abstract boolean isAlive();
+
+	/**
+	 * Method for obtaining the CacheContainer by {@link InfinispanConnectionImpl#getCache() the connection}.
+	 * 
+	 * @return BasicCacheContainer
+	 * @throws TranslatorException
+	 *             if there an issue obtaining the cache
+	 * @see #getCache()
+	 */
+	protected abstract BasicCacheContainer getCacheContainer() throws TranslatorException;
+
+	
+
+	/**
+	 * Get the cacheName that will be used by this factory instance to access
+	 * the named cache. However, if not specified a default configuration will
+	 * be created.
+	 * 
+	 * @return
+	 * @see #setCacheName(String)
+	 */
+	@TranslatorProperty(display = "CacheName", advanced = true)
+	public String getCacheName() {
+		return this.cacheName;
+	}
+
+	/**
+	 * Set the cacheName that will be used to find the named cache.
+	 * 
+	 * @param cacheName
+	 * @see #getCacheName()
+	 */
+
+	public void setCacheName(String cacheName) {
+		this.cacheName = cacheName;
+	}
+
+
+	/**
+	 * Get the name of the configuration resource or file that should be used if
+	 * a {@link Cache cache} is to be created using the
+	 * {@link DefaultCacheManager}. If not specified, a default configuration
+	 * will be used.
+	 * 
+	 * @return the name of the resource or file configuration that should be
+	 *         passed to the {@link CacheContainer}, or null if the default
+	 *         configuration should be used
+	 * @see #setConfigurationFileName(String)
+	 */
+	@TranslatorProperty(display = "ConfigurationFileName", advanced = true)
+	public String getConfigurationFileName() {
+		return configurationFileName;
+	}
+
+	/**
+	 * Set the name of the configuration that should be used if a {@link Cache
+	 * cache} is to be created using the {@link DefaultCacheManager}.
+	 * 
+	 * @param configurationFileName
+	 *            the name of the configuration file that should be used to load
+	 *            the {@link CacheContainer}, or null if the default
+	 *            configuration should be used
+	 * @see #getConfigurationFileName()
+	 */
+	public synchronized void setConfigurationFileName(
+			String configurationFileName) {
+		if (this.configurationFileName == configurationFileName
+				|| this.configurationFileName != null
+				&& this.configurationFileName.equals(configurationFileName))
+			return; // unchanged
+		this.configurationFileName = configurationFileName;
+	}
+	
+	public BasicCache<String, Object> getCache() throws TranslatorException {
+		BasicCache<String, Object> cache = null;
+		BasicCacheContainer container = getCacheContainer();
+		if (getCacheName() != null) {
+			cache = container.getCache(getCacheName());
+		} else {
+			cache = container.getCache();
+		}
+
+		if (cache == null) {
+			String msg = ObjectPlugin.Util.getString(
+					"InfinispanBaseExecutionFactory.cacheNotFound", new Object[] { (getCacheName() != null ? getCacheName()
+							: "DefaultCache") });
+			throw new TranslatorException(msg); //$NON-NLS-1$
+		}
+
+		return cache;
+
+	}
+	
+
+	@Override
+	public ObjectConnection getConnection(ConnectionFactory factory,
+			ExecutionContext executionContext) throws TranslatorException {
+				
+		return new InfinispanConnectionImpl(this);
+	}
+	
+	protected String jdgProperty(String name) {
+		Properties props = new Properties();
+		try {
+			props.load(this.getClass().getClassLoader()
+					.getResourceAsStream(PROPERTIES_FILE));
+		} catch (IOException ioe) {
+			throw new RuntimeException(ioe);
+		}
+		return props.getProperty(name);
+	}
+
+	public void cleanUp() {
+
+	}
+}

Added: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanConnectionImpl.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanConnectionImpl.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanConnectionImpl.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,107 @@
+/*
+ * 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.translator.object.infinispan;
+
+import java.util.List;
+
+import org.infinispan.api.BasicCache;
+import org.teiid.language.Select;
+import org.teiid.resource.spi.BasicConnection;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectConnection;
+import org.teiid.translator.object.infinispan.search.LuceneSearch;
+import org.teiid.translator.object.infinispan.search.SearchByKey;
+
+
+/** 
+ * Represents an instance of a connection to an Infinispan cache.  More than one connection can
+ * be created to query to the cache.
+ */
+public  class InfinispanConnectionImpl extends BasicConnection implements ObjectConnection { 
+
+	private InfinispanBaseExecutionFactory factory = null;
+	
+	protected InfinispanConnectionImpl() {
+		super();
+	}
+	public InfinispanConnectionImpl(InfinispanBaseExecutionFactory factory) {
+		super();
+		this.factory = factory;
+	}
+
+	
+	/** 
+	 * Close the connection, if a connection requires closing.
+	 * (non-Javadoc)
+	 */
+	@Override
+    public void close() {
+		factory = null;
+	}
+
+	/** 
+	 * Currently, this method always returns alive. We assume the connection is alive,
+	 * and rely on proper timeout values to automatically clean up connections before
+	 * any server-side timeout occurs. Rather than incur overhead by rebinding,
+	 * we'll assume the connection is always alive, and throw an error when it is actually used,
+	 * if the connection fails. This may be a more efficient way of handling failed connections,
+	 * with the one tradeoff that stale connections will not be detected until execution time. In
+	 * practice, there is no benefit to detecting stale connections before execution time.
+	 * 
+	 * One possible extension is to implement a UnsolicitedNotificationListener.
+	 * (non-Javadoc)
+	 */
+	public boolean isAlive() {
+		return factory.isAlive();
+	}
+
+
+	@Override
+	public void cleanUp() {
+		factory = null;
+
+	}
+	
+	public InfinispanBaseExecutionFactory getFactory() {
+		return this.factory;
+	}
+	
+	@Override
+	public List<Object> performSearch(Select command)
+			throws TranslatorException {
+		if (factory.isFullTextSearchingSupported()) {
+			return LuceneSearch.performSearch(command, this);
+		} else {
+		    return SearchByKey.performSearch(command, this);	
+		}
+		
+	}
+	
+	public BasicCache<String, Object> getCache()
+			throws TranslatorException {
+		return factory.getCache();
+
+	}
+	
+	
+}

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanExecutionFactory.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -25,193 +25,96 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import org.infinispan.Cache;
-import org.infinispan.api.BasicCache;
 import org.infinispan.api.BasicCacheContainer;
-import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.Select;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
-import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.ResultSetExecution;
 import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.object.ObjectExecution;
-import org.teiid.translator.object.ObjectExecutionFactory;
 import org.teiid.translator.object.ObjectPlugin;
-import org.teiid.translator.object.infinispan.search.LuceneSearch;
-import org.teiid.translator.object.infinispan.search.SearchByKey;
 
+/**
+ * InfinispanExecutionFactory is the translator that will access an Infinispan local cache.
+ * <p>
+ * The default settings are:
+ * <li>{@link #supportsLuceneSearching dynamic Searching} - will be set to <code>false</code>, supporting only Key searching.
+ * This is because you must have your objects in your cache annotated before Hibernate/Lucene searching will work.
+ * </li>
+ * <p>
+ * The required settings are:
+ * <li>{@link #setCacheJndiName(String) jndiName} OR {@link #setConfigurationFileName(String) configFileName} - 
+ * must be specified to indicate how the Infinispan container will be obtained</li>
+ * <li>{@link #setCacheName(String) cacheName} - identifies the cache located in the Infinispan container</li>
+ * <p>
+ * Optional settings are:
+ * <li>{@link #setSupportsLuceneSearching(boolean) dynamic Searching} - when <code>true</code>, will use the 
+ * Hibernate/Lucene searching to locate objects in the cache</li>
+ * 
+ * @author vhalbert
+ *
+ */
 @Translator(name = "infinispan-cache", description = "The Infinispan Cache Translator")
-public class InfinispanExecutionFactory extends ObjectExecutionFactory {
+public class InfinispanExecutionFactory extends InfinispanBaseExecutionFactory {
 	public static final String PROPERTIES_FILE = "META-INF" + File.separator
 			+ "datagrid.properties";
 
-	private boolean useLeceneSearching = false;
-	private String cacheName = null;
-	private String configurationFileName = null;
+	private boolean supportsLuceneSearching = false;
 
-	private BasicCacheContainer cacheContainer = null;
-
+	protected BasicCacheContainer cacheContainer = null;
+	private boolean useJndi = true;
+	
 	public InfinispanExecutionFactory() {
 		super();
-
-		this.setSearchStrategyClassName(SearchByKey.class.getName());
 	}
-
+	
 	@Override
 	public void start() throws TranslatorException {
-
-		if (this.getCacheName() == null || this.getCacheName().isEmpty()) {
-			String msg = ObjectPlugin.Util.getString(
-					"InfinispanExecutionFactory.cacheNameNotDefined",
-					new Object[] {});
-			throw new TranslatorException(msg); //$NON-NLS-1$
-		}
-
 		super.start();
+		
+		String configFile = this.getConfigurationFileName();
+		String jndiName = getCacheJndiName();
+		if ( jndiName == null || jndiName.trim().length() == 0) {
+			if (configFile == null || configFile.trim().length() == 0) {
+	   			String msg = ObjectPlugin.Util
+    			.getString(
+    					"InfinispanExecutionFactory.undefinedHowToGetCache");
+        		throw new TranslatorException(msg); //$NON-NLS-1$	
+			}
+			useJndi = false;
+			
+		} else {
+			useJndi = true;
+		}			
 
-		if (createCacheContainer()) {
-			cacheContainer = this.getCacheContainer();
-		}
 	}
-
-	@Override
-	public ResultSetExecution createResultSetExecution(QueryExpression command,
-			ExecutionContext executionContext, RuntimeMetadata metadata,
-			Object connection) throws TranslatorException {
-
-		return new ObjectExecution((Select) command, metadata, this,
-				(cacheContainer != null ? cacheContainer : connection));
-
+	
+	public boolean isAlive() {
+		return (cacheContainer != null ? true : false);
 	}
-
-	protected boolean createCacheContainer() {
-		if (this.getConfigurationFileName() != null) {
-			return true;
-		}
-		return false;
-
+	
+	public boolean isFullTextSearchingSupported() {
+		return this.supportsLuceneSearching;
 	}
 
-	/**
-	 * Get the cacheName that will be used by this factory instance to access
-	 * the named cache. However, if not specified a default configuration will
-	 * be created.
-	 * 
-	 * @return
-	 * @see #setCacheName(String)
-	 */
-	@TranslatorProperty(display = "CacheName", advanced = true)
-	public String getCacheName() {
-		return this.cacheName;
-	}
 
 	/**
-	 * Set the cacheName that will be used to find the named cache.
-	 * 
-	 * @param cacheName
-	 * @see #getCacheName()
-	 */
-
-	public void setCacheName(String cacheName) {
-		this.cacheName = cacheName;
-	}
-
-	/**
 	 * Indicates if Hibernate Search and Apache Lucene are used to index and
 	 * search objects
 	 * 
 	 * @since 6.1.0
 	 */
-	@TranslatorProperty(display = "Use Lucene Searching", description = "True, assumes objects have Hibernate Search annotations", advanced = true)
-	public boolean useLuceneSearching() {
-		return useLeceneSearching;
+	@TranslatorProperty(display = "Support Using Lucene Searching", description = "True, assumes objects have Hibernate Search annotations", advanced = true)
+	public boolean supportsLuceneSearching() {
+		return this.supportsLuceneSearching;
 	}
 
-	public void setUseLeceneSearching(boolean useLeceneSearching) {
-		this.useLeceneSearching = useLeceneSearching;
-		if (useLeceneSearching) {
-			this.setSearchStrategyClassName(LuceneSearch.class.getName());
-		} else {
-			this.setSearchStrategyClassName(SearchByKey.class.getName());
-		}
+	public void setSupportsLuceneSearching(boolean supportsLuceneSearching) {
+		this.supportsLuceneSearching = supportsLuceneSearching;
 	}
 
-	/**
-	 * Get the name of the configuration resource or file that should be used if
-	 * a {@link Cache cache} is to be created using the
-	 * {@link DefaultCacheManager}. If not specified, a default configuration
-	 * will be used.
-	 * 
-	 * @return the name of the resource or file configuration that should be
-	 *         passed to the {@link CacheContainer}, or null if the default
-	 *         configuration should be used
-	 * @see #setConfigurationFileName(String)
-	 */
-	@TranslatorProperty(display = "ConfigurationFileName", advanced = true)
-	public String getConfigurationFileName() {
-		return configurationFileName;
-	}
 
 	/**
-	 * Set the name of the configuration that should be used if a {@link Cache
-	 * cache} is to be created using the {@link DefaultCacheManager}.
-	 * 
-	 * @param configurationFileName
-	 *            the name of the configuration file that should be used to load
-	 *            the {@link CacheContainer}, or null if the default
-	 *            configuration should be used
-	 * @see #getConfigurationFileName()
-	 */
-	public synchronized void setConfigurationFileName(
-			String configurationFileName) {
-		if (this.configurationFileName == configurationFileName
-				|| this.configurationFileName != null
-				&& this.configurationFileName.equals(configurationFileName))
-			return; // unchanged
-		this.configurationFileName = configurationFileName;
-	}
-
-	public BasicCache<String, Object> getCache(Object connection)
-			throws TranslatorException {
-		BasicCache<String, Object> cache = null;
-		if (connection instanceof BasicCacheContainer) {
-			BasicCacheContainer bc = (BasicCacheContainer) connection;
-
-			if (this.getCacheName() != null) {
-				cache = bc.getCache(this.getCacheName());
-			} else {
-				cache = bc.getCache();
-			}
-		} else if (connection instanceof BasicCache) {
-			cache = (BasicCache) connection;
-		} else {
-			String msg = ObjectPlugin.Util.getString(
-					"InfinispanExecutionFactory.unsupportedConnectionType",
-					new Object[] { connection.getClass().getName(),
-							"either BasicCache or BasicCacheContainer" });
-			throw new TranslatorException(msg); //$NON-NLS-1$
-
-		}
-
-		if (cache == null) {
-			String msg = ObjectPlugin.Util.getString(
-					"InfinispanExecutionFactory.noCache", new Object[] { (this
-							.getCacheName() != null ? this.getCacheName()
-							: "DefaultCache") });
-			throw new TranslatorException(msg); //$NON-NLS-1$
-		}
-
-		return cache;
-
-	}
-
-	/**
 	 * Method for obtaining the CacheContainer. This method will be called to
 	 * create a container based on the <code>configurationFileName</code>
 	 * specified.
@@ -223,8 +126,34 @@
 	 */
 	protected synchronized BasicCacheContainer getCacheContainer()
 			throws TranslatorException {
+		if (this.cacheContainer != null) return this.cacheContainer;
+		
+		this.cacheContainer = createCacheContainer();
+		
+		return this.cacheContainer;
+
+	}
+	
+	private BasicCacheContainer createCacheContainer() throws TranslatorException {
 		BasicCacheContainer container = null;
 
+		if (useJndi) {
+			Object object = findCacheUsingJNDIName();
+			if (object instanceof BasicCacheContainer) {
+				LogManager
+				.logInfo(LogConstants.CTX_CONNECTOR,
+						"=== Using CacheContainer (loaded from Jndi) ==="); //$NON-NLS-1$
+
+				return (BasicCacheContainer) object;
+			}
+			String msg = ObjectPlugin.Util.getString(
+			"InfinispanExecutionFactory.unsupportedContainerType",
+			new Object[] { object.getClass().getName(),
+					"BasicCacheContainer" });
+			throw new TranslatorException(msg); //$NON-NLS-1$
+			
+			
+		}
 		try {
 			container = new DefaultCacheManager(
 					this.getConfigurationFileName());
@@ -249,4 +178,7 @@
 		return props.getProperty(name);
 	}
 
+	public void cleanUp() {
+		this.cacheContainer = null;
+	}
 }

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -27,6 +27,7 @@
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
 import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorProperty;
 
 /**
  * The InfinispanRemoteExecutionFactory is used to obtain a remote
@@ -40,38 +41,28 @@
 
 @Translator(name = "infinispanremote-cache", description = "The Execution Factory for Remote Infinispan Cache")
 public class InfinispanRemoteExecutionFactory extends
-		InfinispanExecutionFactory {
-	// public static final String DATAGRID_HOST = "datagrid.host";
-	// public static final String HOTROD_PORT = "datagrid.hotrod.port";
+		InfinispanBaseExecutionFactory {
 
-	private BasicCacheContainer manager;
+	private RemoteCacheManager manager;
 
-	private volatile String remoteServerList;
+	private String remoteServerList;
 
 	public InfinispanRemoteExecutionFactory() {
 		super();
-		this.setSourceRequired(false);
 	}
-
-
-	protected boolean createCacheContainer() {
-		if (this.getConfigurationFileName() != null) {
-			return true;
-		}
-
-		if (this.getRemoteServerList() != null
-				|| this.getRemoteServerList().length() > 0) {
-			return true;
-		}
-
-		return false;
-
-	}
-
+	
 	@Override
 	public boolean isSourceRequired() {
-		return true;
+		return false;
 	}
+	
+	public boolean isAlive() {
+		return (manager.isStarted());
+	}
+	
+	public boolean isFullTextSearchingSupported() {
+		return false;
+	}
 
 	/**
 	 * Get the list of remote servers that make up the Infinispan cluster. The
@@ -82,6 +73,7 @@
 	 * 
 	 * @return the names of the remote servers
 	 */
+	@TranslatorProperty(display = "Server List", description = "Server List (host:port[;host:port...]) to connect to", advanced = true)
 	public String getRemoteServerList() {
 		return remoteServerList;
 	}
@@ -99,7 +91,7 @@
 	 * 
 	 * @see #getRemoteServerList()
 	 */
-	public synchronized void setRemoteServerList(
+	public void setRemoteServerList(
 			String remoteInfinispanServerList) {
 		if (this.remoteServerList == remoteInfinispanServerList
 				|| this.remoteServerList != null
@@ -110,6 +102,8 @@
 
 	@Override
 	protected synchronized BasicCacheContainer getCacheContainer() {
+		if (this.manager != null) return this.manager;
+		
 		RemoteCacheManager container = null;
 		if (this.getConfigurationFileName() != null) {
 			container = new RemoteCacheManager(this.getConfigurationFileName());
@@ -123,27 +117,30 @@
 					|| this.getRemoteServerList().isEmpty()
 					|| this.getRemoteServerList().equals("")) {
 				container = new RemoteCacheManager();
-				
+
 				LogManager
 				.logInfo(LogConstants.CTX_CONNECTOR,
 						"=== Using RemoteCacheManager (no serverlist defined) ==="); //$NON-NLS-1$
 
 			} else {
 				container = new RemoteCacheManager(this.getRemoteServerList());
-				
 				LogManager
 				.logInfo(LogConstants.CTX_CONNECTOR,
 						"=== Using RemoteCacheManager (loaded by serverlist) ==="); //$NON-NLS-1$
 
 			}
 		}
+		
 
-		return container;
+		this.manager = container;
+		return this.manager;
 
 	}
 
 	public void cleanUp() {
-		manager.stop();
+		if (this.manager != null) {
+			manager.stop();
+		}
 		manager = null;
 	}
 

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/LuceneSearch.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/LuceneSearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/LuceneSearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -21,7 +21,6 @@
  */
 package org.teiid.translator.object.infinispan.search;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -46,47 +45,34 @@
 import org.teiid.logging.LogManager;
 import org.teiid.metadata.Column;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.ObjectExecutionFactory;
 import org.teiid.translator.object.ObjectPlugin;
-import org.teiid.translator.object.SearchStrategy;
-import org.teiid.translator.object.SelectProjections;
-import org.teiid.translator.object.infinispan.InfinispanExecutionFactory;
+import org.teiid.translator.object.infinispan.InfinispanConnectionImpl;
 
 /**
  * LuceneSearch will parse the WHERE criteria and build the search query(s)
  * that's used to retrieve the results from an Infinispan cache.
  * 
+ * Note:  As of Infinispan 5.x, it doesn't support fulltext searching the RemoteCache
+ * 
  * @author vhalbert
  * 
  */
-public class LuceneSearch implements SearchStrategy {
-	protected List<String> exceptionMessages = new ArrayList<String>(2);
+public final class LuceneSearch   {
 
-	private QueryBuilder queryBuilder;
 
-	public LuceneSearch() {
-	}
-
-	public List<Object> performSearch(Select command,
-			SelectProjections projections,
-			ObjectExecutionFactory objectFactory, Object connection)
+	public static List<Object> performSearch(Select command, InfinispanConnectionImpl connection)
 			throws TranslatorException {
-
-		InfinispanExecutionFactory factory = (InfinispanExecutionFactory) objectFactory;
-
+		
 		SearchManager searchManager = Search
-				.getSearchManager((Cache<?, ?>) factory.getCache(connection));
+				.getSearchManager((Cache) connection.getCache() );
 
-		queryBuilder = searchManager.buildQueryBuilderForClass(
-				factory.getRootClass()).get();
+		QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(
+				connection.getFactory().getRootClass()).get();
 
 		BooleanJunction<BooleanJunction> junction = queryBuilder.bool();
 		boolean createdQueries = buildQueryFromWhereClause(command.getWhere(),
-				junction);
+				junction, queryBuilder);
 
-		// check for errors
-		this.throwExceptionIfFound();
-
 		Query query = null;
 		if (createdQueries) {
 			query = junction.createQuery();
@@ -95,7 +81,7 @@
 		}
 
 		CacheQuery cacheQuery = searchManager.getQuery(query,
-				factory.getRootClass()); // rootNodeType
+				connection.getFactory().getRootClass()); // rootNodeType
 
 		List<Object> results = cacheQuery.list();
 		if (results == null || results.isEmpty()) {
@@ -105,8 +91,8 @@
 		return results;
 	}
 
-	private boolean buildQueryFromWhereClause(Condition criteria,
-			BooleanJunction<BooleanJunction> junction)
+	private static boolean buildQueryFromWhereClause(Condition criteria,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder)
 			throws TranslatorException {
 		boolean createdQueries = false;
 		BooleanJunction<BooleanJunction> inUse = junction;
@@ -120,15 +106,15 @@
 			switch (op) {
 			case AND:
 
-				BooleanJunction<BooleanJunction> leftAnd = this.queryBuilder
+				BooleanJunction<BooleanJunction> leftAnd = queryBuilder
 						.bool();
 				boolean andLeftHasQueries = buildQueryFromWhereClause(
-						crit.getLeftCondition(), leftAnd);
+						crit.getLeftCondition(), leftAnd, queryBuilder);
 
-				BooleanJunction<BooleanJunction> rightAnd = this.queryBuilder
+				BooleanJunction<BooleanJunction> rightAnd = queryBuilder
 						.bool();
 				boolean andRightHasQueries = buildQueryFromWhereClause(
-						crit.getRightCondition(), rightAnd);
+						crit.getRightCondition(), rightAnd, queryBuilder);
 
 				if (andLeftHasQueries && andRightHasQueries) {
 					leftAnd.must(rightAnd.createQuery());
@@ -148,9 +134,9 @@
 			case OR:
 
 				boolean orLeftHasQueries = buildQueryFromWhereClause(
-						crit.getLeftCondition(), inUse);
+						crit.getLeftCondition(), inUse, queryBuilder);
 				boolean orRightHasQueries = buildQueryFromWhereClause(
-						crit.getRightCondition(), inUse);
+						crit.getRightCondition(), inUse, queryBuilder);
 
 				createdQueries = (orLeftHasQueries ? orLeftHasQueries
 						: orRightHasQueries);
@@ -164,7 +150,7 @@
 			}
 
 		} else if (criteria instanceof Comparison) {
-			createdQueries = visit((Comparison) criteria, inUse);
+			createdQueries = visit((Comparison) criteria, inUse, queryBuilder);
 
 		} else if (criteria instanceof Exists) {
 			LogManager.logTrace(LogConstants.CTX_CONNECTOR,
@@ -172,10 +158,10 @@
 			// TODO Exists should be supported in a future release.
 
 		} else if (criteria instanceof Like) {
-			createdQueries = visit((Like) criteria, inUse);
+			createdQueries = visit((Like) criteria, inUse, queryBuilder);
 
 		} else if (criteria instanceof In) {
-			createdQueries = visit((In) criteria, inUse);
+			createdQueries = visit((In) criteria, inUse, queryBuilder);
 
 		}
 		// else if (criteria instanceof Not) {
@@ -188,8 +174,8 @@
 		return createdQueries;
 	}
 
-	public boolean visit(Comparison obj,
-			BooleanJunction<BooleanJunction> junction) {
+	public static boolean visit(Comparison obj,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) throws TranslatorException {
 
 		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
 				"Parsing Comparison criteria."); //$NON-NLS-1$
@@ -222,39 +208,37 @@
 		if (value == null) {
 			final String msg = ObjectPlugin.Util
 					.getString("LuceneSearch.unsupportedComparingByNull"); //$NON-NLS-1$
-			addException(msg);
-			return false;
+			throw new TranslatorException(msg);
 		}
 
 		value = escapeReservedChars(value);
 		switch (op) {
 		case NE:
-			createEqualsQuery(mdIDElement, value, false, true, junction);
+			createEqualsQuery(mdIDElement, value, false, true, junction, queryBuilder);
 			break;
 
 		case EQ:
-			createEqualsQuery(mdIDElement, value, true, false, junction);
+			createEqualsQuery(mdIDElement, value, true, false, junction, queryBuilder);
 			break;
 
 		case GT:
-			createRangeAboveQuery(mdIDElement, value, junction);
+			createRangeAboveQuery(mdIDElement, value, junction, queryBuilder);
 			break;
 
 		case LT:
-			createRangeBelowQuery(mdIDElement, value, junction);
+			createRangeBelowQuery(mdIDElement, value, junction, queryBuilder);
 			break;
 
 		default:
 			final String msg = ObjectPlugin.Util
-					.getString("LuceneSearch.unsupportedComparisonOperator"); //$NON-NLS-1$
-			addException(msg);
-			return false;
+					.getString("LuceneSearch.invalidOperator", new Object[] { op, "NE, EQ, GT, LT" }); //$NON-NLS-1$
+			throw new TranslatorException(msg);
 		}
 		return true;
 
 	}
 
-	public boolean visit(In obj, BooleanJunction<BooleanJunction> junction) {
+	public static boolean visit(In obj, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) throws TranslatorException {
 		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
 
 		Expression lhs = ((In) obj).getLeftExpression();
@@ -271,19 +255,19 @@
 				// add these as OR queries
 				createEqualsQuery(mdIDElement,
 						escapeReservedChars(literal.getValue()), false, false,
-						junction);
+						junction, queryBuilder);
 				createdQuery = true;
 			} else {
 				String msg = ObjectPlugin.Util.getString(
 						"LuceneSearch.Unsupported_expression",
 						new Object[] { expr, "IN" });
-				this.addException(msg);
+				throw new TranslatorException(msg);
 			}
 		}
 		return createdQuery;
 	}
 
-	public boolean visit(Like obj, BooleanJunction<BooleanJunction> junction) {
+	public static boolean visit(Like obj, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) throws TranslatorException {
 		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
 				"Parsing LIKE criteria."); //$NON-NLS-1$
 
@@ -305,17 +289,15 @@
 
 			value = (String) escapeReservedChars(((Literal) literalExp)
 					.getValue());
-			createLikeQuery(c, value.replaceAll("%", ""), junction); // "*"
-			return true;
+			createLikeQuery(c, value.replaceAll("%", ""), junction, queryBuilder); // "*"
 		} else {
 			final String msg = ObjectPlugin.Util.getString(
 					"LuceneSearch.Unsupported_expression",
 					new Object[] { literalExp.toString(), "LIKE" });
-			this.addException(msg);
-			return false;
-
+			throw new TranslatorException(msg);
 		}
 
+		return true;
 	}
 
 	protected static Object escapeReservedChars(final Object value) {
@@ -352,8 +334,8 @@
 		return sb.toString();
 	}
 
-	private Query createEqualsQuery(Column column, Object value, boolean and,
-			boolean not, BooleanJunction<BooleanJunction> junction) {
+	private static Query createEqualsQuery(Column column, Object value, boolean and,
+			boolean not, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
 		Query queryKey = queryBuilder.keyword()
 				.onField(getNameInSourceFromColumn(column))
 				// .matching(value.toString() + "*")
@@ -369,8 +351,8 @@
 		return queryKey;
 	}
 
-	private Query createRangeAboveQuery(Column column, Object value,
-			BooleanJunction<BooleanJunction> junction) {
+	private static Query createRangeAboveQuery(Column column, Object value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
 
 		Query queryKey = queryBuilder.range()
 				.onField(getNameInSourceFromColumn(column))
@@ -379,8 +361,8 @@
 		return queryKey;
 	}
 
-	private Query createRangeBelowQuery(Column column, Object value,
-			BooleanJunction<BooleanJunction> junction) {
+	private static Query createRangeBelowQuery(Column column, Object value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
 
 		Query queryKey = queryBuilder.range()
 				.onField(getNameInSourceFromColumn(column))
@@ -389,8 +371,8 @@
 		return queryKey;
 	}
 
-	private Query createLikeQuery(Column column, String value,
-			BooleanJunction<BooleanJunction> junction) {
+	private static Query createLikeQuery(Column column, String value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
 		Query queryKey = queryBuilder.phrase()
 				.onField(getNameInSourceFromColumn(column)).sentence(value)
 				.createQuery();
@@ -398,7 +380,7 @@
 		return queryKey;
 	}
 
-	private String getNameInSourceFromColumn(Column c) {
+	private static String getNameInSourceFromColumn(Column c) {
 		String name = c.getNameInSource();
 		if (name == null || name.trim().equals("")) { //$NON-NLS-1$
 			return c.getName();
@@ -406,16 +388,4 @@
 		return name;
 	}
 
-	private void addException(String message) {
-
-		exceptionMessages.add(message);
-
-	}
-
-	protected void throwExceptionIfFound() throws TranslatorException {
-		if (!exceptionMessages.isEmpty())
-			throw new TranslatorException("LuceneSearch Exception(s): "
-					+ exceptionMessages.toString());
-	}
-
 }

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/SearchByKey.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/SearchByKey.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/SearchByKey.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -25,69 +25,72 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.infinispan.api.BasicCache;
+import org.infinispan.client.hotrod.RemoteCache;
 import org.teiid.language.Select;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.ObjectExecutionFactory;
-import org.teiid.translator.object.SearchStrategy;
-import org.teiid.translator.object.SelectProjections;
-import org.teiid.translator.object.infinispan.InfinispanExecutionFactory;
+import org.teiid.translator.object.infinispan.InfinispanConnectionImpl;
 import org.teiid.translator.object.search.BasicKeySearchCriteria;
 import org.teiid.translator.object.search.SearchCriterion;
 
 /**
- * SearchByKey is a simple SearchStrategy that enables querying the cache by
+ * SearchByKey is a simple ObjectConnection that enables querying the cache by
  * the key, using EQUI and IN clauses on the SELECT statement.
  */
-public class SearchByKey implements SearchStrategy {
+public final class SearchByKey  {
 
-	public List<Object> performSearch(Select command,
-			SelectProjections projections,
-			ObjectExecutionFactory objectFactory, Object connection)
+	public static List<Object> performSearch(Select command, InfinispanConnectionImpl connection)
 			throws TranslatorException {
 
-		InfinispanExecutionFactory factory = (InfinispanExecutionFactory) objectFactory;
-		BasicCache<String, Object> cache = factory.getCache(connection);
+		BasicCache<String, Object> cache = connection.getCache();
 		BasicKeySearchCriteria bksc = BasicKeySearchCriteria.getInstance(
-				factory, projections, command);
+				connection.getFactory(), command);
 
-		return get(bksc.getCriterion(), cache, factory);
+		return get(bksc.getCriterion(), cache, connection.getFactory().getRootClass());
 
 	}
 
-	private List<Object> get(SearchCriterion criterion,
-			BasicCache<String, Object> cache, InfinispanExecutionFactory factory)
+	private static List<Object> get(SearchCriterion criterion,
+			BasicCache<String, Object> cache, Class rootClass)
 			throws TranslatorException {
 		List<Object> results = null;
 
-		if (!criterion.isRootTableInSelect()) {
-			return Collections.EMPTY_LIST;
-		}
+		if (criterion.getOperator() == SearchCriterion.Operator.ALL) {
 
-		if (criterion.getOperator() == SearchCriterion.Operator.ALL) {
-			Set keys = cache.keySet();
-			results = new ArrayList<Object>();
-			for (Iterator it = keys.iterator(); it.hasNext();) {
-				Object v = cache.get(it.next());
-				addValue(v, results, factory.getRootClass());
+			if (cache instanceof RemoteCache) {
+				RemoteCache<?, ?> rc = (RemoteCache<?, ?>) cache;
+		  		Map<?, ?> c = rc.getBulk();
+	    		results = new ArrayList<Object>();
+	    		for (Iterator it = c.keySet().iterator(); it.hasNext();) {
+	    			Object v = cache.get(it.next());
+	    			addValue(v, results, rootClass);	
+	    		}	
+	 
+			} else {
+				Set keys = cache.keySet();
+				results = new ArrayList<Object>();
+				for (Iterator it = keys.iterator(); it.hasNext();) {
+					Object v = cache.get(it.next());
+					addValue(v, results, rootClass);
+				}
 			}
 
 			return results;
 		}
 
 		if (criterion.getCriterion() != null) {
-			results = get(criterion.getCriterion(), cache, factory);
+			results = get(criterion.getCriterion(), cache, rootClass);
 		}
 
 		if (results == null) {
 			results = new ArrayList<Object>();
 		}
+	
 
 		if (criterion.getOperator().equals(SearchCriterion.Operator.EQUALS)) {
 
@@ -96,7 +99,7 @@
 			Object v = cache.get(value instanceof String ? value : value
 					.toString());
 			if (v != null) {
-				addValue(v, results, factory.getRootClass());
+				addValue(v, results, rootClass);
 			}
 		} else if (criterion.getOperator().equals(SearchCriterion.Operator.IN)) {
 
@@ -107,7 +110,7 @@
 				Object v = cache.get(arg instanceof String ? arg : arg
 						.toString());
 				if (v != null) {
-					addValue(v, results, factory.getRootClass());
+					addValue(v, results, rootClass);
 				}
 			}
 
@@ -117,7 +120,7 @@
 
 	}
 
-	private void addValue(Object value, List<Object> results, Class rootNodeType) {
+	private static void addValue(Object value, List<Object> results, Class rootNodeType) {
 		if (value != null && value.getClass().equals(rootNodeType)) {
 
 			if (value.getClass().isArray()) {

Added: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheConnection.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheConnection.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheConnection.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,167 @@
+/*
+ * 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.translator.object.mapcache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.resource.ResourceException;
+
+import org.teiid.language.Select;
+import org.teiid.resource.spi.BasicConnection;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectConnection;
+import org.teiid.translator.object.ObjectPlugin;
+import org.teiid.translator.object.search.BasicKeySearchCriteria;
+import org.teiid.translator.object.search.SearchCriterion;
+
+/**
+ * The MapCacheConnection provides simple key searches of the cache.
+ * 
+ * @author vhalbert
+ * 
+ */
+public class MapCacheConnection extends BasicConnection  implements ObjectConnection {
+
+	private MapCacheExecutionFactory factory = null;
+	private BasicKeySearchCriteria visitor = null;
+	
+	public MapCacheConnection(MapCacheExecutionFactory factory) {
+		super();
+		this.factory = factory;
+	}
+	
+	@Override
+	public boolean isAlive() {
+		return true;
+	}
+
+
+	@Override
+	public void cleanUp() {
+		factory = null;
+		visitor = null;
+	}
+	
+
+	@Override
+	public void close() throws ResourceException {
+		cleanUp();
+		
+	}
+
+	public List<Object> performSearch(Select command) throws TranslatorException {
+
+		visitor = BasicKeySearchCriteria.getInstance(factory,command);
+
+		return get(visitor.getCriterion(), factory.getCache(), factory.getRootClass());
+	}
+
+	private List<Object> get(SearchCriterion criterion, Map<?, ?> cache,
+			Class<?> rootClass) throws TranslatorException {
+		List<Object> results = null;
+		if (criterion.getOperator() == SearchCriterion.Operator.ALL) {
+			results = new ArrayList<Object>();
+			for (Iterator<?> it = cache.keySet().iterator(); it.hasNext();) {
+				Object v = cache.get(it.next());
+				addValue(v, results, rootClass);
+
+			}
+
+			return results;
+		}
+
+		if (criterion.getCriterion() != null) {
+			results = get(criterion.getCriterion(), cache, rootClass);
+		}
+
+		if (results == null) {
+			results = new ArrayList<Object>();
+		}
+
+		if (criterion.getOperator().equals(SearchCriterion.Operator.EQUALS)) {
+
+			Object v = cache.get(criterion.getValue());
+			if (v != null) {
+				addValue(v, results, rootClass);
+			}
+		} else if (criterion.getOperator().equals(SearchCriterion.Operator.IN)) {
+
+			List<?> parms = (List<?>) criterion.getValue();
+			for (Iterator<?> it = parms.iterator(); it.hasNext();) {
+				Object arg = it.next();
+				Object v = cache.get(arg);
+				if (v != null) {
+					addValue(v, results, rootClass);
+				}
+			}
+
+		}
+
+		return results;
+
+	}
+
+	private void addValue(Object value, List<Object> results, Class<?> rootClass)
+			throws TranslatorException {
+		// can only add objects of the same root class in the cache
+		if (value != null) {
+			if (value.getClass().equals(rootClass)) {
+
+				if (value.getClass().isArray()) {
+					List<Object> listRows = Arrays.asList((Object[]) value);
+					results.addAll(listRows);
+					return;
+				}
+
+				if (value instanceof Collection) {
+					results.addAll((Collection<?>) value);
+					return;
+				}
+
+				if (value instanceof Map) {
+					Map<?, ?> mapRows = (Map<?, ?>) value;
+					results.addAll(mapRows.values());
+					return;
+				}
+
+				results.add(value);
+			} else {
+				// the object obtained from the cache has to be of the same root
+				// class type, otherwise, the modeling
+				// structure won't correspond correctly
+				String msg = ObjectPlugin.Util.getString(
+						"MapCacheConnection.unexpectedObjectTypeInCache",
+						new Object[] { value.getClass().getName(),
+								rootClass.getName() });
+
+				throw new TranslatorException(msg);
+			}
+		}
+
+	}
+
+}

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheExecutionFactory.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -21,20 +21,87 @@
  */
 package org.teiid.translator.object.mapcache;
 
+import java.util.Map;
+
+import javax.resource.cci.ConnectionFactory;
+
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectConnection;
 import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectPlugin;
 
+/**
+ * The MapCacheExecutionFactory provides a translator that supports a cache of type Map.
+ * The cache will be looked up using a @link {@link #setCacheJndiName(String) JNDI name};
+ * 
+ * @author vhalbert
+ *
+ */
 @Translator(name = "map-cache", description = "The Map Cache Factory")
 public class MapCacheExecutionFactory extends ObjectExecutionFactory {
+	
+	private volatile Map<?,?> cache = null;
 
 	public MapCacheExecutionFactory() {
-		this.setSearchStrategyClassName(MapCacheSearchByKey.class.getName());
 		this.setSourceRequired(false);
 	}
+	
+	@Override
+	public void start() throws TranslatorException {
+		super.start();
+		
+	      String jndiName = getCacheJndiName();
+          if (jndiName == null || jndiName.trim().length() == 0) {
+	    			String msg = ObjectPlugin.Util
+	    			.getString(
+	    					"MapCacheExecutionFactory.undefinedJndiName", new Object[] { });
+	        		throw new TranslatorException(msg); //$NON-NLS-1$
 
+          }				
+
+	}
+
 	@Override
 	public boolean supportsOnlyLiteralComparison() {
 		return true;
 	}
+	
+    
+    protected synchronized Map<?,?> getCache() throws TranslatorException {
+    	if (this.cache != null) return this.cache;
+    	
+    	Object object = findCacheUsingJNDIName();
+    	Map<?,?> cache = null;
+    	
+		if (object instanceof Map) {
+		    
+			cache = (Map<?,?>)object;
+			
+            LogManager.logInfo(LogConstants.CTX_CONNECTOR, "=== Using CacheManager (obtained from JNDI ==="); //$NON-NLS-1$
 
+		} else {
+			String msg = ObjectPlugin.Util.getString(
+					"MapCacheExecutionFactory.unexpectedCacheType",
+					new Object[] { (object == null ? "nullObject" : object.getClass().getName()), "Map" });
+			throw new TranslatorException(msg); //$NON-NLS-1$
+		}
+    	
+    	this.cache = cache;
+    	return this.cache;
+    	
+    }
+	
+ 
+    
+	@Override
+	public ObjectConnection getConnection(ConnectionFactory factory,
+			ExecutionContext executionContext) throws TranslatorException {
+
+		return new MapCacheConnection(this);
+
+	}
 }

Deleted: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheSearchByKey.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheSearchByKey.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/MapCacheSearchByKey.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -1,155 +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.translator.object.mapcache;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.teiid.language.Select;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.ObjectExecutionFactory;
-import org.teiid.translator.object.ObjectPlugin;
-import org.teiid.translator.object.SearchStrategy;
-import org.teiid.translator.object.SelectProjections;
-import org.teiid.translator.object.search.BasicKeySearchCriteria;
-import org.teiid.translator.object.search.SearchCriterion;
-
-/**
- * The MapCacheSearchByKey provides simple key searches of the cache.
- * 
- * @author vhalbert
- * 
- */
-public class MapCacheSearchByKey implements SearchStrategy {
-
-	private BasicKeySearchCriteria visitor = null;
-
-	public List<Object> performSearch(Select command,
-			SelectProjections projections, ObjectExecutionFactory factory,
-			Object connection) throws TranslatorException {
-
-		Map<?, ?> cache = null;
-		if (connection instanceof Map) {
-			cache = (Map<?, ?>) connection;
-		} else {
-			String msg = ObjectPlugin.Util.getString(
-					"MapCacheSearchByKey.unexpectedCacheType",
-					new Object[] { connection.getClass().getName(), "Map" });
-			throw new TranslatorException(msg); //$NON-NLS-1$
-
-		}
-
-		visitor = BasicKeySearchCriteria.getInstance(factory, projections,
-				command);
-
-		return get(visitor.getCriterion(), cache, factory.getRootClass());
-	}
-
-	private List<Object> get(SearchCriterion criterion, Map<?, ?> cache,
-			Class<?> rootClass) throws TranslatorException {
-		List<Object> results = null;
-		if (criterion.getOperator() == SearchCriterion.Operator.ALL) {
-			results = new ArrayList<Object>();
-			for (Iterator<?> it = cache.keySet().iterator(); it.hasNext();) {
-				Object v = cache.get(it.next());
-				addValue(v, results, rootClass);
-
-			}
-
-			return results;
-		}
-
-		if (criterion.getCriterion() != null) {
-			results = get(criterion.getCriterion(), cache, rootClass);
-		}
-
-		if (results == null) {
-			results = new ArrayList<Object>();
-		}
-
-		if (criterion.getOperator().equals(SearchCriterion.Operator.EQUALS)) {
-
-			Object v = cache.get(criterion.getValue());
-			if (v != null) {
-				addValue(v, results, rootClass);
-			}
-		} else if (criterion.getOperator().equals(SearchCriterion.Operator.IN)) {
-
-			List<?> parms = (List<?>) criterion.getValue();
-			for (Iterator<?> it = parms.iterator(); it.hasNext();) {
-				Object arg = it.next();
-				Object v = cache.get(arg);
-				if (v != null) {
-					addValue(v, results, rootClass);
-				}
-			}
-
-		}
-
-		return results;
-
-	}
-
-	private void addValue(Object value, List<Object> results, Class<?> rootClass)
-			throws TranslatorException {
-		// can only add objects of the same root class in the cache
-		if (value != null) {
-			if (value.getClass().equals(rootClass)) {
-
-				if (value.getClass().isArray()) {
-					List<Object> listRows = Arrays.asList((Object[]) value);
-					results.addAll(listRows);
-					return;
-				}
-
-				if (value instanceof Collection) {
-					results.addAll((Collection<?>) value);
-					return;
-				}
-
-				if (value instanceof Map) {
-					Map<?, ?> mapRows = (Map<?, ?>) value;
-					results.addAll(mapRows.values());
-					return;
-				}
-
-				results.add(value);
-			} else {
-				// the object obtained from the cache has to be of the same root
-				// class type, otherwise, the modeling
-				// structure won't correspond correctly
-				String msg = ObjectPlugin.Util.getString(
-						"MapCacheSearchByKey.unexpectedObjectTypeInCache",
-						new Object[] { value.getClass().getName(),
-								rootClass.getName() });
-
-				throw new TranslatorException(msg);
-			}
-		}
-
-	}
-
-}

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/BasicKeySearchCriteria.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/BasicKeySearchCriteria.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/BasicKeySearchCriteria.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.teiid.core.util.Assertion;
 import org.teiid.language.AggregateFunction;
 import org.teiid.language.ColumnReference;
 import org.teiid.language.Command;
@@ -44,7 +43,6 @@
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.ObjectExecutionFactory;
 import org.teiid.translator.object.ObjectPlugin;
-import org.teiid.translator.object.SelectProjections;
 
 /**
  * The BasicKeySearchCriteria parses the {@link Command select} and creates
@@ -59,33 +57,21 @@
 
 	// search criteria based on the WHERE clause
 	private SearchCriterion criterion;
-	private SelectProjections projections;
 
 	private List<String> exceptionMessages = new ArrayList<String>(2);
 
-	private BasicKeySearchCriteria(ObjectExecutionFactory factory,
-			SelectProjections projections) {
-		this.projections = projections;
+	private BasicKeySearchCriteria(ObjectExecutionFactory factory) {
 	}
 
 	public static BasicKeySearchCriteria getInstance(
-			ObjectExecutionFactory factory, SelectProjections projections,
+			ObjectExecutionFactory factory,
 			Select command) throws TranslatorException {
-		BasicKeySearchCriteria visitor = new BasicKeySearchCriteria(factory,
-				projections);
+		BasicKeySearchCriteria visitor = new BasicKeySearchCriteria(factory);
 		visitor.visitNode(command);
 		visitor.throwExceptionIfFound();
 		return visitor;
 	}
 
-	private String getRootNodePrimaryKeyColumnName() {
-		return this.projections.getRootNodePrimaryKeyColumnName();
-	}
-
-	private boolean isRootTableInFrom() {
-		return this.projections.isRootTableInFrom();
-	}
-
 	/**
 	 * Call to get the {@link SearchCriterion Criterion}. If the command
 	 * specified no criteria, then a {@link SearchCriterion Criterion} that
@@ -100,7 +86,6 @@
 			this.criterion = new SearchCriterion();
 
 		}
-		this.criterion.setRootTableInSelect(isRootTableInFrom());
 
 		return this.criterion;
 	}
@@ -139,8 +124,11 @@
 		}
 
 		if (mdIDElement == null || value == null) {
-			Assertion.assertTrue(false,
-					"BasicKeySearchCriteria.missingComparisonExpression");
+			String msg = ObjectPlugin.Util
+			.getString(
+					"BasicKeySearchCriteria.missingComparisonExpression", new Object[] { });
+			addException(msg);
+			return;
 		}
 
 		addCompareCriteria(mdIDElement,
@@ -170,10 +158,11 @@
 				type = literal.getType();
 
 			} else {
-				Assertion
-						.assertTrue(false,
-								"BasicKeySearchCriteria.Unsupported_expression "
-										+ expr);
+				String msg = ObjectPlugin.Util
+				.getString(
+						"BasicKeySearchCriteria.Unsupported_expression", new Object[] {expr });
+				addException(msg);
+				return;
 			}
 
 		}
@@ -227,19 +216,9 @@
 		assert (searchCriteria.getTableName() != null);
 
 		assert (searchCriteria.getField() != null);
-		assert (getRootNodePrimaryKeyColumnName() != null);
 
-		// must be a key column in order to perform search
-		if (searchCriteria.getTableName().equalsIgnoreCase(
-				this.projections.getRootTableName())
-				&& searchCriteria.getField().equalsIgnoreCase(
-						getRootNodePrimaryKeyColumnName())) {
-
-			if (this.criterion != null) {
-				searchCriteria.addOrCriterion(this.criterion);
-			}
-
-			this.criterion = searchCriteria;
+		if (this.criterion != null) {
+			searchCriteria.addOrCriterion(this.criterion);
 		}
 
 		this.criterion = searchCriteria;

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/SearchCriterion.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/SearchCriterion.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/SearchCriterion.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -41,7 +41,6 @@
 	private Column column;
 	private Object value;
 	private String runtimeType;
-	private boolean isRootTableInSelect = false;
 
 	public SearchCriterion() {
 		this.operator = Operator.ALL;
@@ -141,14 +140,6 @@
 		return this.isAnd;
 	}
 
-	public boolean isRootTableInSelect() {
-		return isRootTableInSelect;
-	}
-
-	public void setRootTableInSelect(boolean isRootTableInSelect) {
-		this.isRootTableInSelect = isRootTableInSelect;
-	}
-
 	private String getNameInSourceFromColumn(Column c) {
 		String name = c.getNameInSource();
 		if (name == null || name.equals("")) { //$NON-NLS-1$

Modified: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectUtil.java
===================================================================
--- trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectUtil.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectUtil.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -32,11 +32,22 @@
 			Collection<?> ctors, ClassLoader loader) throws TranslatorException {
 		try {
 	
-			return ReflectionHelper.create(objectClassName, ctors.toArray(), null, loader);
+			return ReflectionHelper.create(objectClassName, ctors, loader);
 		} catch (Exception e1) {
-			throw new TranslatorException(e1.getCause());
+			throw new TranslatorException(e1);
 		}
 	}
+	
+	public static Object createObject(String objectClassName,
+			Object[] ctorObjs, Class<?>[] argTypes, ClassLoader loader) throws TranslatorException {
+		try {
+	
+			return ReflectionHelper.create(objectClassName, ctorObjs, argTypes, loader);
+		} catch (Exception e1) {
+			e1.printStackTrace();
+			throw new TranslatorException(e1);
+		}
+	}
 
 
 }

Modified: trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
===================================================================
--- trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties	2012-09-21 13:01:05 UTC (rev 4459)
@@ -19,21 +19,30 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA.
 #
-xTEIID12001=Received IAggregate, but it is not supported. Check capabilities.
-xTEIID12005=Received IFunction, but it is not supported. Check capabilities.
-xTEIID12006=Received IScalarSubquery, but it is not supported. Check capabilities.
-xTEIID12007=Received ISearchedCaseExpression, but it is not supported. Check capabilities.
+TEIID12001=Received IAggregate, but it is not supported. Check capabilities.
+TEIID12005=Received IFunction, but it is not supported. Check capabilities.
+TEIID12006=Received IScalarSubquery, but it is not supported. Check capabilities.
+TEIID12007=Received ISearchedCaseExpression, but it is not supported. Check capabilities.
 
+
 ObjectExecutionFactory.rootClassNameNotDefined=RootClassName is undefined
 ObjectExecutionFactory.rootClassNotFound=RootClass {0} not found to load
+ObjectExecutionFactory.cacheNotFoundinJNDI=Cache was not found using JNDI name {0}
 
+InfinispanBaseExecutionFactory.cacheNameNotDefined=CacheName is not defined
+InfinispanBaseExecutionFactory.cacheNotFound=No cache was found for {0} in Infinispan
+
+InfinispanExecutionFactory.undefinedHowToGetCache=Either CacheJndiName or ConfigurationFileName must be specified how the cache will be obtained
+InfinispanExecutionFactory.unsupportedContainerType=CacheContainer type {0} is not currently supported when connecting to Infinispan, must be {1}
+
 LuceneSearch.invalidOperator=Unsupported operator {0} was encountered, only {1} are supported
 LuceneSearch.unsupportedComparingByNull=Comparing using a NULL is not currently supported.
-LuceneSearch.Unsupported_expression=Unsupported expression of {0} when performing [1}
+LuceneSearch.Unsupported_expression=Unsupported expression of {0} when performing {1}
 
-InfinispanBaseExecutionFactory.cacheNameNotDefined=CacheName is not defined
-InfinispanBaseExecutionFactory.noCache=No cache was found for {0} in Infinispan
-InfinispanExecutionFactory.unsupportedConnectionType=Connection type {0} is not currently supported when connecting to Infinispan, must be {1}
+MapCacheConnection.unexpectedObjectTypeInCache=Unexpected root object type in the cache is {0}, expected {1}
 
-MapCacheSearchByKey.unexpectedObjectTypeInCache=Unexpected root object type in the cache is {0}, expected {1}
-MapCacheSearchByKey.unexpectedCacheType=Unable to process object in cache of type {0}, expected type {1}
\ No newline at end of file
+MapCacheExecutionFactory.undefinedJndiName=CacheJndiName is undefined
+MapCacheExecutionFactory.unexpectedCacheType=Expected cache type to be of type Map, but its of type {0}
+
+BasicKeySearchCriteria.missingComparisonExpression=Comparison criteria is missing the expression
+BasicKeySearchCriteria.Unsupported_expression=Unsupported expression {0} found in the IN clause
\ No newline at end of file

Added: trunk/connectors/translator-object/src/test/example_vdbs/infinispancache-vdb.xml
===================================================================
--- trunk/connectors/translator-object/src/test/example_vdbs/infinispancache-vdb.xml	                        (rev 0)
+++ trunk/connectors/translator-object/src/test/example_vdbs/infinispancache-vdb.xml	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<vdb name="team" version="1">
+
+    <description>Shows how to call Web Services</description>
+    
+    <property name="UseConnectorMetadata" value="cached" />
+<!-- connection-jndi-name="dummy" -->
+    <model name="Team" visible="false">
+        <source name="objsource" translator-name="infinispan1" />
+        <metadata type="DDL"><![CDATA[
+            CREATE FOREIGN TABLE Team (TeamObject Object);
+         ]]> </metadata>
+    </model>
+    <model name="TeamView" type="VIRTUAL">
+         <metadata type="DDL"><![CDATA[
+             CREATE VIEW Teams (
+                 TeamName varchar(255) PRIMARY KEY
+             )
+             AS
+               SELECT o.TeamName FROM Team as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name') as o;
+             CREATE VIEW Players (
+                  TeamName varchar(255) PRIMARY KEY,
+                  PlayerName varchar(255)
+             )
+             AS
+             SELECT o.TeamName, y.Name FROM (Select TeamObject from Team) as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name', players object 'teiid_row.players') as o, OBJECTTABLE('m' PASSING o.players as m COLUMNS Name string 'teiid_row') as y;          
+        ]]> </metadata>
+    </model>
+
+    <translator name="infinispan1" type="infinispan-cache">
+        <property name="CacheName" value="teams"/>
+        <property name="RootClassName" value="com.jboss.datagrid.hotrod.Team"/>
+        <property name="CacheJndiName" value="java/CacheManager"/>
+        <property name="SupportsLuceneSearching" value="true"/>
+        
+        <!--  optional properties for obtaining the RemoteCacheManager  -->
+        <!--
+         <property name="ConfigurationFileName" value="<dir>/infinispan-config.xml"/>
+         -->
+
+    </translator>
+</vdb>
\ No newline at end of file

Added: trunk/connectors/translator-object/src/test/example_vdbs/infinispanremotecache-vdb.xml
===================================================================
--- trunk/connectors/translator-object/src/test/example_vdbs/infinispanremotecache-vdb.xml	                        (rev 0)
+++ trunk/connectors/translator-object/src/test/example_vdbs/infinispanremotecache-vdb.xml	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<vdb name="team" version="1">
+
+    <description>Shows how to call Web Services</description>
+    
+    <property name="UseConnectorMetadata" value="cached" />
+<!-- connection-jndi-name="dummy" -->
+    <model name="Team" visible="false">
+        <source name="objsource" translator-name="infinispan1" />
+        <metadata type="DDL"><![CDATA[
+            CREATE FOREIGN TABLE Team (TeamObject Object);
+         ]]> </metadata>
+    </model>
+    <model name="TeamView" type="VIRTUAL">
+         <metadata type="DDL"><![CDATA[
+             CREATE VIEW Teams (
+                 TeamName varchar(255) PRIMARY KEY
+             )
+             AS
+               SELECT o.TeamName FROM Team as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name') as o;
+             CREATE VIEW Players (
+                  TeamName varchar(255) PRIMARY KEY,
+                  PlayerName varchar(255)
+             )
+             AS
+             SELECT o.TeamName, y.Name FROM (Select TeamObject from Team) as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name', players object 'teiid_row.players') as o, OBJECTTABLE('m' PASSING o.players as m COLUMNS Name string 'teiid_row') as y;          
+        ]]> </metadata>
+    </model>
+
+    <translator name="infinispan1" type="infinispanremote-cache">
+        <property name="CacheName" value="teams"/>
+        <property name="RootClassName" value="com.jboss.datagrid.hotrod.Team"/>
+        <property name="RemoteServerList" value="localhost:11222"/>
+        
+        <!--  optional properties for obtaining the RemoteCacheManager  -->
+        <!--
+         <property name="CacheJndiName" value="java/CacheManager"/>
+         <property name="ConfigurationFileName" value="<dir>/infinispan-config.xml"/>
+         -->
+    </translator>
+</vdb>
\ No newline at end of file

Added: trunk/connectors/translator-object/src/test/example_vdbs/mapcache-vdb.xml
===================================================================
--- trunk/connectors/translator-object/src/test/example_vdbs/mapcache-vdb.xml	                        (rev 0)
+++ trunk/connectors/translator-object/src/test/example_vdbs/mapcache-vdb.xml	2012-09-21 13:01:05 UTC (rev 4459)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<vdb name="team" version="1">
+
+    <description>Shows how to call Web Services</description>
+    
+    <property name="UseConnectorMetadata" value="cached" />
+<!-- connection-jndi-name="dummy" -->
+    <model name="Team" visible="false">
+        <source name="objsource" translator-name="mapcache1" />
+        <metadata type="DDL"><![CDATA[
+            CREATE FOREIGN TABLE Team (TeamObject Object);
+         ]]> </metadata>
+    </model>
+    <model name="TeamView" type="VIRTUAL">
+         <metadata type="DDL"><![CDATA[
+             CREATE VIEW Teams (
+                 TeamName varchar(255) PRIMARY KEY
+             )
+             AS
+               SELECT o.TeamName FROM Team as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name') as o;
+             CREATE VIEW Players (
+                  TeamName varchar(255) PRIMARY KEY,
+                  PlayerName varchar(255)
+             )
+             AS
+             SELECT o.TeamName, y.Name FROM (Select TeamObject from Team) as T, OBJECTTABLE('x' PASSING T.TeamObject AS x COLUMNS TeamName varchar(255) 'teiid_row.name', players object 'teiid_row.players') as o, OBJECTTABLE('m' PASSING o.players as m COLUMNS Name string 'teiid_row') as y;          
+        ]]> </metadata>
+    </model>
+
+    <translator name="mapcache1" type="map-cache">
+        <property name="RootClassName" value="com.jboss.datagrid.hotrod.Team"/>
+        <property name="CacheJndiName" value="java/CacheManager"/>
+    </translator>
+</vdb>
\ No newline at end of file

Deleted: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/FakeStrategy.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/FakeStrategy.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/FakeStrategy.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -1,39 +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.translator.object;
-
-import java.util.List;
-
-import org.teiid.language.Select;
-import org.teiid.translator.TranslatorException;
-
-public class FakeStrategy implements SearchStrategy {
-	
-	public static List<Object> RESULTS = null;
-	
-	@Override
-	public List<Object> performSearch(Select command, SelectProjections projections,
-			ObjectExecutionFactory factory, Object connection) throws TranslatorException{
-		return RESULTS;
-	}
-	
-}

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -22,6 +22,8 @@
 package org.teiid.translator.object;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
 
 import java.util.List;
 
@@ -43,19 +45,20 @@
 	
 	@Mock
 	private ExecutionContext context;
+	@Mock 
+	private ObjectConnection connection;
 
 	@Before public void beforeEach() throws Exception{	
  
 		MockitoAnnotations.initMocks(this);
+		
+	    when(connection.performSearch(any(Select.class))).thenReturn(source.getAll());
 
+
 		factory = new ObjectExecutionFactory() {		};
-		factory.setSearchStrategyClassName(FakeStrategy.class.getName());
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
 		
 		factory.start();
-		
-		FakeStrategy.RESULTS = source.getAll();
-		
 
     }
 	
@@ -113,7 +116,7 @@
 	private ObjectExecution createExecution(String sql) throws Exception {
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand(sql); //$NON-NLS-1$
 				
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, connection);
 		
 		return exec;
 

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -59,8 +59,6 @@
 		MockitoAnnotations.initMocks(this);
 		
 		factory = new TestFactory();
-		factory.setSearchStrategyClassName(FakeStrategy.class.getName());
-
     }
 
 	@Test public void testFactory() throws Exception {

Deleted: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestSelectProjections.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestSelectProjections.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestSelectProjections.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -1,126 +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.translator.object;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.teiid.language.Select;
-import org.teiid.translator.object.mapcache.MapCacheSearchByKey;
-import org.teiid.translator.object.util.TradesCacheSource;
-import org.teiid.translator.object.util.VDBUtility;
-
-
- at SuppressWarnings("nls")
-public class TestSelectProjections {
-		
-	private  ObjectExecutionFactory factory;
-	
-	@Before public void beforeEach() throws Exception{
-		
-		MockitoAnnotations.initMocks(this);
-		
-		factory = new ObjectExecutionFactory() {};
-		
-		factory.setSearchStrategyClassName(MapCacheSearchByKey.class.getName());
-		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		
-		factory.start();
-
-	}
-	
-	
-	@Test public void testQueryRootObject() throws Exception {
-
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-
-	    validateResults(true, visitor);
-
-	}
-	
-	@Test public void testQueryWithNonSearchableColumn() throws Exception {		
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select  L.Name as LegName, L.TradeId as ID From  Trade_Object.Leg as L"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-	    validateResults( false, visitor);
-	}	
-		
-	
-	@Test public void testQuery1LevelDownWithRootNotInSelect() throws Exception {		
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select  L.Name as LegName From  Trade_Object.Leg as L"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-	    validateResults( false, visitor);
-	}	
-	
-	@Test public void testQuery2LevelDownWithRootNotInSelect() throws Exception {
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select  N.LineItem " +
-				" From Trade_Object.Transaction as N "); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-	    validateResults(false, visitor);
-
-	}
-	
-	@Test public void testQueryIncludeLegs() throws Exception {		
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-	    validateResults(true, visitor);
-	}	
-	
-	@Test public void testQueryGetAllTransactions() throws Exception {
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName, " + 
-				" N.LineItem " +
-				" From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction as N " + 
-				" Where T.TradeId = L.TradeId and L.LegId = N.LegId"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-	    validateResults(true, visitor);
-
-	}	
-	
-
-	@Test public void testIN() throws Exception {
-		
-		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.TradeID IN (1,2,3)"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
-
-		validateResults(true, visitor);
-	
-	}
-	
-	private SelectProjections createSelectProjections(Select command) {
-		SelectProjections visitor = SelectProjections.create(factory);
-		visitor.parse(command);
-		return visitor;
-		
-	}
-		
-	private void validateResults( boolean rootNodeInQuery, SelectProjections visitor) throws Exception {
-			
-	    assertEquals(rootNodeInQuery, visitor.isRootTableInFrom());
-	    assertNotNull(visitor.getRootNodePrimaryKeyColumnName());
-	    assertNotNull(visitor.getRootTableName());
-
-	}
-		
-}

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/RemoteInfinispanTestHelper.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/RemoteInfinispanTestHelper.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/RemoteInfinispanTestHelper.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -24,25 +24,40 @@
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.Properties;
+
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.server.core.Main;
 import org.infinispan.server.hotrod.HotRodServer;
+import org.teiid.translator.object.util.TradesCacheSource;
 
 /**
  */
 public class RemoteInfinispanTestHelper {
     protected static final int PORT = 11311;
     protected static final int TIMEOUT = 0;
-    protected static final String CONFIG_FILE = "src/test/resources/infinispan_remote_config.xml";
     private static HotRodServer server = null;
     private static int count = 0;
+    private static  DefaultCacheManager CACHEMANAGER = null;
 
     public static synchronized HotRodServer createServer() throws IOException {
         count++;
         if (server == null) {
-            DefaultCacheManager cacheManager = new DefaultCacheManager(CONFIG_FILE);
+        	Configuration c = new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).eviction().maxEntries(7).build();
+        	
+        	CACHEMANAGER = new DefaultCacheManager(
+                    new GlobalConfigurationBuilder().transport().defaultTransport().build(),
+                    c);
+        	CACHEMANAGER.start();
             // This doesn't work on IPv6, because the util assumes "127.0.0.1" ...
             // server = HotRodTestingUtil.startHotRodServer(cacheManager, HOST, PORT);
+        	
+        	
+        	CACHEMANAGER.defineConfiguration(TradesCacheSource.TRADES_CACHE_NAME, c);
+        	
             server = new HotRodServer();
             String hostAddress = hostAddress();
             String hostPort = Integer.toString(hostPort());
@@ -54,10 +69,19 @@
             props.setProperty(Main.PROP_KEY_PROXY_HOST(), hostAddress);
             props.setProperty(Main.PROP_KEY_PROXY_PORT(), hostPort);
             // System.out.println("Starting HotRot Server at " + hostAddress + ":" + hostPort);
-            server.start(props, cacheManager);
+            server.start(props, CACHEMANAGER);
+            
+            server.cacheManager().startCaches(TradesCacheSource.TRADES_CACHE_NAME);
+            
+            TradesCacheSource.loadCache(server.getCacheManager().getCache(TradesCacheSource.TRADES_CACHE_NAME));
+ 
         }
         return server;
     }
+    
+    public static DefaultCacheManager getCacheManager() {
+    	return CACHEMANAGER;
+    }
 
     public static int hostPort() {
         return PORT;

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanConfigFileKeySearch.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanConfigFileKeySearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanConfigFileKeySearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -57,7 +57,6 @@
 
 		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.setSearchStrategyClassName(SearchByKey.class.getName());
 		factory.start();
 		
 		TradesCacheSource.loadCache(factory.getCacheContainer().getCache(TradesCacheSource.TRADES_CACHE_NAME));

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiILuceneSearch.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiILuceneSearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiILuceneSearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -34,7 +34,9 @@
 import org.junit.Test;
 import org.teiid.language.Select;
 import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.BasicSearchTest;
+import org.teiid.translator.object.ObjectConnection;
 import org.teiid.translator.object.ObjectExecution;
 import org.teiid.translator.object.infinispan.search.LuceneSearch;
 import org.teiid.translator.object.util.TradesCacheSource;
@@ -58,11 +60,20 @@
 
 	@Before public void beforeEachTest() throws Exception{	
         
-		factory = new InfinispanExecutionFactory();
+		factory = new InfinispanExecutionFactory() {
 
+			@Override
+			protected Object findCacheUsingJNDIName()
+					throws TranslatorException {
+				return container;
+			}
+			
+		};
+
+		factory.setCacheJndiName("JNDINAME");
 		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.setSearchStrategyClassName(LuceneSearch.class.getName());
+		factory.setSupportsLuceneSearching(true);
 		factory.start();
 	    
 
@@ -70,9 +81,9 @@
 
 	@Override
 	protected List<Object> performTest(Select command, int rowcnt) throws Exception {
-
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, container);
 		
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+		
 		exec.execute();
 		
 		List<Object> rows = new ArrayList<Object>();

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiKeySearch.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiKeySearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiKeySearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -22,18 +22,25 @@
 package org.teiid.translator.object.infinispan;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.naming.Context;
+
 import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.mockito.Mock;
 import org.teiid.language.Select;
 import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.BasicSearchTest;
+import org.teiid.translator.object.ObjectConnection;
 import org.teiid.translator.object.ObjectExecution;
 import org.teiid.translator.object.infinispan.search.SearchByKey;
 import org.teiid.translator.object.util.TradesCacheSource;
@@ -53,15 +60,24 @@
 		
 		TradesCacheSource.loadCache(container.getCache(TradesCacheSource.TRADES_CACHE_NAME));
 		context = mock(ExecutionContext.class);
+		 
 	}
 
 	@Before public void beforeEachTest() throws Exception{	
         
-		factory = new InfinispanExecutionFactory();
+		factory = new InfinispanExecutionFactory() {
 
+			@Override
+			protected Object findCacheUsingJNDIName()
+					throws TranslatorException {
+				return container;
+			}
+			
+		};
+
+		factory.setCacheJndiName("JNDINAME");
 		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.setSearchStrategyClassName(SearchByKey.class.getName());
 		factory.start();
 	    
 
@@ -70,7 +86,7 @@
 	@Override
 	protected List<Object> performTest(Select command, int rowcnt) throws Exception {
 
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, container);
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
 		
 		exec.execute();
 		

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanRemoteJndiKeySearch.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanRemoteJndiKeySearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanRemoteJndiKeySearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -22,6 +22,7 @@
 package org.teiid.translator.object.infinispan;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -53,7 +54,7 @@
 	private static ExecutionContext context;
 
     
-    private InfinispanExecutionFactory factory = null;
+    private InfinispanRemoteExecutionFactory factory = null;
 		
 	@Mock
 	private static Context jndi;
@@ -62,11 +63,10 @@
     public static void beforeEachClass() throws Exception { 
 		RemoteInfinispanTestHelper.createServer();
 	       // Create the cache manager ...
-
+		
         // Set up the mock JNDI ...
 		jndi = mock(Context.class);
         when(jndi.lookup(anyString())).thenReturn(null);
-        when(jndi.lookup(JNDI_NAME)).thenReturn(container);
         
 		context = mock(ExecutionContext.class);
 
@@ -75,8 +75,9 @@
 
 	@Before public void beforeEachTest() throws Exception{	
         
-		factory = new InfinispanExecutionFactory();
+		factory = new InfinispanRemoteExecutionFactory();
 
+		factory.setRemoteServerList(RemoteInfinispanTestHelper.hostAddress() + ":" + RemoteInfinispanTestHelper.hostPort());
 		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
 		factory.start();	    
@@ -91,11 +92,13 @@
 	
 	@Override
 	protected List<Object> performTest(Select command, int rowcnt) throws Exception {
-		container = new RemoteCacheManager("infinispan_remote_config.xml");
-		
-		TradesCacheSource.loadCache(container.getCache(TradesCacheSource.TRADES_CACHE_NAME));
+	    when(jndi.lookup(JNDI_NAME)).thenReturn(container);
+	    
+	    Object t =  RemoteInfinispanTestHelper.getCacheManager().getCache(TradesCacheSource.TRADES_CACHE_NAME).get("1");
 
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, container);
+	    assertNotNull(t);
+	    
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
 		
 		exec.execute();
 		

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/mapcache/TestMapCacheKeySearch.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/mapcache/TestMapCacheKeySearch.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/mapcache/TestMapCacheKeySearch.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -22,15 +22,22 @@
 package org.teiid.translator.object.mapcache;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
+import javax.naming.Context;
+
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.mockito.Mock;
 import org.teiid.language.Select;
 import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.BasicSearchTest;
 import org.teiid.translator.object.ObjectExecution;
 import org.teiid.translator.object.util.TradesCacheSource;
@@ -38,27 +45,44 @@
 
 
 @SuppressWarnings("nls")
-public class TestMapCacheKeySearch extends BasicSearchTest {
-    
+public class TestMapCacheKeySearch extends BasicSearchTest {	      
+
+	protected static final String JNDI_NAME = "java/MyCacheManager";
+	   
 	private static TradesCacheSource source  = TradesCacheSource.loadCache();
 	private static ExecutionContext context;
 	
 	private MapCacheExecutionFactory factory = null;
+	
+	@Mock
+	private static Context jndi;
 
-
 	protected static boolean print = false;
 	
 	@BeforeClass
     public static void beforeEachClass() throws Exception {  
 	    
 		context = mock(ExecutionContext.class);
+		
+        // Set up the mock JNDI ...
+		jndi = mock(Context.class);
+        when(jndi.lookup(anyString())).thenReturn(null);
+        when(jndi.lookup(JNDI_NAME)).thenReturn(source);
 
 	}
 	
 	@Before public void beforeEach() throws Exception{	
 		 
-		factory = new MapCacheExecutionFactory();
+		factory = new MapCacheExecutionFactory() {
 
+			@Override
+			protected Map<?, ?> getCache() throws TranslatorException {
+				return source;
+			}
+			
+		};
+
+		factory.setCacheJndiName(JNDI_NAME);
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
 		factory.start();
 
@@ -67,7 +91,7 @@
 	@Override
 	protected List<Object> performTest(Select command, int rowcnt) throws Exception {
 
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, source);
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
 		
 		exec.execute();
 		

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/search/TestBasicKeySearchCriteria.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/search/TestBasicKeySearchCriteria.java	2012-09-21 02:54:01 UTC (rev 4458)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/search/TestBasicKeySearchCriteria.java	2012-09-21 13:01:05 UTC (rev 4459)
@@ -29,7 +29,6 @@
 import org.junit.Test;
 import org.teiid.language.Select;
 import org.teiid.translator.object.ObjectExecutionFactory;
-import org.teiid.translator.object.SelectProjections;
 import org.teiid.translator.object.util.TradesCacheSource;
 import org.teiid.translator.object.util.VDBUtility;
 
@@ -47,25 +46,17 @@
 		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
 
 	}
-	
-	private SelectProjections createSelectProjections(Select command) {
-		SelectProjections visitor = SelectProjections.create(factory);
-		visitor.parse(command);
-		return visitor;
 		
+	private BasicKeySearchCriteria createVisitor(Select command) throws Exception {
+		return BasicKeySearchCriteria.getInstance(factory, command);		
 	}
-		
-	private BasicKeySearchCriteria createVisitor(Select command, SelectProjections projections) throws Exception {
-		return BasicKeySearchCriteria.getInstance(factory, projections, command);		
-	}
 	
 
 	@Test public void testIN() throws Exception {
 		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.TradeID IN ('1','2','3')"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
 		
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 	
 	}
@@ -73,29 +64,25 @@
 	@Test public void test1Equals() throws Exception {
 
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.TradeID = '1'"); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
 
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 		
 	}
 	
-	@Test public void test2Equals() throws Exception {
+	@Test public void test5Equals() throws Exception {
 
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.Name = 'MyName' and (Trade_Object.Trade.TradeId = '2' or  Trade_Object.Trade.Settled = 'true') or (Trade_Object.Trade.Settled = 'false' and Trade_Object.Trade.TradeId = 3) "); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
 
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
-		validateSearchCriteria(criteria.getCriterion(), 2, false, true);
+		BasicKeySearchCriteria criteria = createVisitor(command);
+		validateSearchCriteria(criteria.getCriterion(), 5, false, true);
 	}		
 
 	
 	@Test public void testQueryIncludeLegsNoCriteria() throws Exception {		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
 
-		SelectProjections visitor = createSelectProjections(command);
-		
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 		
 		assertEquals(criteria.getCriterion().getOperator(), SearchCriterion.Operator.ALL);
@@ -104,9 +91,7 @@
 	@Test public void testQueryIncludeLegsWithCriteria() throws Exception {		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId and L.Name='MyLeg'"); //$NON-NLS-1$
 
-		SelectProjections visitor = createSelectProjections(command);
-
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 	}	
 	
@@ -115,9 +100,8 @@
 				" N.LineItem " +
 				" From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction as N " + 
 				" Where T.TradeId = L.TradeId and L.LegId = N.LegId "); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
 
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 				
 		assertEquals(criteria.getCriterion().getOperator(), SearchCriterion.Operator.ALL);
@@ -129,9 +113,8 @@
 				" N.LineItem " +
 				" From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction as N " + 
 				" Where T.TradeId = L.TradeId and L.LegId = N.LegId and T.TradeId in ('1','2','3') "); //$NON-NLS-1$
-		SelectProjections visitor = createSelectProjections(command);
 
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, true);
 	
 	}
@@ -139,9 +122,7 @@
 	@Test public void testQueryLegsWithCriteria() throws Exception {		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select L.Name as LegName From Trade_Object.Leg as L Where L.Name='MyLeg'"); //$NON-NLS-1$
 
-		SelectProjections visitor = createSelectProjections(command);
-
-		BasicKeySearchCriteria criteria = createVisitor(command, visitor);
+		BasicKeySearchCriteria criteria = createVisitor(command);
 		validateSearchCriteria(criteria.getCriterion(), 1, false, false);
 	}	
 	
@@ -153,7 +134,7 @@
 
 		
 		assertNotNull(criteria);
-		assertEquals(cnt, criteria.getCriteriaCount());
+		assertEquals( "Criteria Count", cnt, criteria.getCriteriaCount());
 
 		if (criteria.getOperator() != SearchCriterion.Operator.ALL) {
 		
@@ -165,12 +146,11 @@
 			assertNotNull(criteria.getRuntimeType());
 			assertNotNull(criteria.getValue());
 			
-			assertEquals(isAnd, criteria.isAndCondition());
+			assertEquals("IsAnd", isAnd, criteria.isAndCondition());
 
+		} else {
+			assertEquals("Criteria Cnt must be 1 when using ALL", 1, criteria.getCriteriaCount());
 		}
-		
-		assertEquals(isRootInSelect, criteria.isRootTableInSelect());
-		
 	}
 	
 }



More information about the teiid-commits mailing list