[teiid-commits] teiid SVN: r4512 - in trunk: connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan and 7 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Oct 4 08:26:57 EDT 2012


Author: shawkins
Date: 2012-10-04 08:26:57 -0400 (Thu, 04 Oct 2012)
New Revision: 4512

Added:
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/SearchByKey.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/LuceneSearch.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestMapCacheKeySearch.java
Removed:
   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/infinispan/InfinispanRemoteExecutionFactory.java
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/search/
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/mapcache/
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/search/
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.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/
Modified:
   trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java
   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/resources/META-INF/services/org.teiid.translator.ExecutionFactory
   trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/BasicSearchTest.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/util/TradesCacheSource.java
   trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java
   trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
Log:
TEIID-2210 refinements to the object translator. decoupling the translator logic from the connection logic.  this temporarily breaks the functionality

Modified: 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	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectConnection.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -21,14 +21,12 @@
  */
 package org.teiid.translator.object;
 
-import java.util.List;
+import java.util.Map;
 
-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.
+ * Each ObjectConnection implementation represents a connection to a set of maps or caches
  * 
  * @author vhalbert
  *
@@ -36,11 +34,15 @@
 public interface ObjectConnection  {
 	
 	/**
-	 * Call to perform the search on the cache identified by this connection instance
-	 * @param command
-	 * @return List of Objects
+	 * Return the map containing the desired objects
 	 * @throws TranslatorException
 	 */
-	public List<Object> performSearch(Select command) throws TranslatorException;
+	public Map<?, ?> getMap(String name) throws TranslatorException;
+	
+	/**
+	 * Return the type of the desired objects
+	 * @throws TranslatorException
+	 */
+	public Class<?> getType(String name) 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -26,6 +26,7 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.script.CompiledScript;
 import javax.script.ScriptContext;
@@ -34,9 +35,11 @@
 
 import org.teiid.language.ColumnReference;
 import org.teiid.language.DerivedColumn;
+import org.teiid.language.NamedTable;
 import org.teiid.language.Select;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
+import org.teiid.metadata.AbstractMetadataRecord;
 import org.teiid.metadata.Column;
 import org.teiid.metadata.RuntimeMetadata;
 import org.teiid.query.eval.TeiidScriptEngine;
@@ -50,21 +53,23 @@
 public class ObjectExecution implements ResultSetExecution {
 
 	private static final String OBJECT_NAME = "o"; //$NON-NLS-1$
-	private Select query;
-	private ObjectConnection connection;
+	protected Select query;
+	protected ObjectConnection connection;
 	private ArrayList<CompiledScript> projects;
 	private ScriptContext sc = new SimpleScriptContext();
 	private static TeiidScriptEngine scriptEngine = new TeiidScriptEngine();
 	private Iterator<Object> resultsIt = null;
+	private ObjectExecutionFactory factory;
 
 	public ObjectExecution(Select query, RuntimeMetadata metadata,
 			ObjectExecutionFactory factory, ObjectConnection connection) throws TranslatorException {
+		this.factory = factory;
 		this.query = query;
 		this.connection = connection;
 		projects = new ArrayList<CompiledScript>(query.getDerivedColumns().size());
 		for (DerivedColumn dc : query.getDerivedColumns()) {
 			Column c = ((ColumnReference) dc.getExpression()).getMetadataObject();
-			String name = getNameInSourceFromColumn(c);
+			String name = getNameInSource(c);
 			if (name.equalsIgnoreCase("this")) { //$NON-NLS-1$
 				projects.add(null);
 			} else {
@@ -81,13 +86,16 @@
 	public void execute() throws TranslatorException {
 
 		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
-				"ObjectExecution command: " + query.toString()); //$NON-NLS-1$
+				"ObjectExecution command:", query.toString(), "using connection:", connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
 
-		List<Object> results = executeQuery();
+		String nameInSource = getNameInSource(((NamedTable)query.getFrom().get(0)).getMetadataObject());
+		Map<?, ?> map = this.connection.getMap(nameInSource);
+		Class<?> type = this.connection.getType(nameInSource);
+	    List<Object> results = factory.search(query, map, type); 	
 
 		if (results != null && results.size() > 0) {
 			LogManager.logDetail(LogConstants.CTX_CONNECTOR,
-					"ObjectExecution number of returned objects is : " + results.size()); //$NON-NLS-1$
+					"ObjectExecution number of returned objects is :", results.size()); //$NON-NLS-1$
 
 		} else {
 			LogManager.logDetail(LogConstants.CTX_CONNECTOR,
@@ -99,18 +107,6 @@
 		this.resultsIt = results.iterator();
 	}
 
-	protected List<Object> executeQuery()
-			throws TranslatorException {
-
-		LogManager
-				.logTrace(
-						LogConstants.CTX_CONNECTOR,
-						"ObjectExecution calling search strategy : " + connection.getClass().getName()); //$NON-NLS-1$
-
-		return connection.performSearch(query);
-
-	}
-
 	@Override
 	public List<Object> next() throws TranslatorException,
 			DataNotAvailableException {
@@ -146,7 +142,7 @@
 	public void cancel() throws TranslatorException {
 	}
 	
-	public static String getNameInSourceFromColumn(Column c) {
+	public static String getNameInSource(AbstractMetadataRecord c) {
 		String name = c.getNameInSource();
 		if (name == null || name.trim().isEmpty()) {
 			return c.getName();

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -22,11 +22,9 @@
 
 package org.teiid.translator.object;
 
+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,8 +33,8 @@
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.ExecutionFactory;
 import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.TranslatorProperty;
 
 
 /**
@@ -46,20 +44,13 @@
  * @author vhalbert
  * 
  */
-public abstract class ObjectExecutionFactory extends
+ at Translator(name = "map-cache", description = "Searches a Map for Objects")
+public class ObjectExecutionFactory extends
 		ExecutionFactory<ConnectionFactory, ObjectConnection> {
 
 	public static final int MAX_SET_SIZE = 10000;
 
-	// 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() {
-
 		setSourceRequiredForMetadata(false);
 		setMaxInCriteriaSize(MAX_SET_SIZE);
 		setMaxDependentInPredicates(1);
@@ -69,42 +60,13 @@
 		setSupportsInnerJoins(false);
 		setSupportsFullOuterJoins(false);
 		setSupportsOuterJoins(false);
-
 	}
 
 	@Override
-	public void start() throws TranslatorException {
-		super.start();
-
-		if (this.getRootClassName() == null
-				|| this.getRootClassName().trim().length() == -1) {
-			String msg = ObjectPlugin.Util.getString(
-					"ObjectExecutionFactory.rootClassNameNotDefined", //$NON-NLS-1$
-					new Object[] {});
-			throw new TranslatorException(msg); 
-		}
-
-		try {
-			rootClass = Class.forName(rootClassName.trim(), true, getClass()
-					.getClassLoader());
-
-		} catch (ClassNotFoundException e) {
-			String msg = ObjectPlugin.Util.getString(
-					"ObjectExecutionFactory.rootClassNotFound",  //$NON-NLS-1$
-					new Object[] { this.rootClassName });
-			throw new TranslatorException(msg);
-		}
-
-	}
-
-	@Override
 	public ResultSetExecution createResultSetExecution(QueryExpression command,
 			ExecutionContext executionContext, RuntimeMetadata metadata,
 			ObjectConnection connection) throws TranslatorException {
-
-		
-		return new ObjectExecution((Select) command, metadata, this, (connection == null ? getConnection(null, executionContext) : connection) );
-
+		return new ObjectExecution((Select) command, metadata, this, connection);
 	}
 
 	@Override
@@ -122,11 +84,6 @@
 		return false;
 	}
 
-	@Override
-	public boolean supportsConvert(int fromType, int toType) {
-		return false;
-	}
-
 	public boolean supportsCompareCriteriaEquals() {
 		return true;
 	}
@@ -136,119 +93,12 @@
 	}
 
 	@Override
-	public boolean supportsLikeCriteria() {
-		// at this point, i've been unable to get the Like to work.
-		return false;
-	}
-
-	@Override
-	public boolean supportsNotCriteria() {
-		return false;
-	}
-
-	@Override
-	public boolean supportsSubqueryInOn() {
-		return false;
-	}
-
-	@Override
-	public boolean supportsOrderBy() {
-		return false;
-	}
-	
-	/**
-	 * 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
-	 * 
-	 * @return
-	 */
-	@TranslatorProperty(display = "Root ClassName of Cached Object", advanced = true)
-	public String getRootClassName() {
-		return this.rootClassName;
-	}
-
-	/**
-	 * Call to set the root class name for the cache accessed by this factory
-	 * instance.
-	 * <p>
-	 * If the root class name has already been set, subsequent calls will have
-	 * no effect.
-	 * 
-	 * @param rootClassName
-	 */
-	public void setRootClassName(String rootClassName) {
-		this.rootClassName = rootClassName;
-	}
-	
-	 /**
-     * 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 void setCacheJndiName( String jndiName ) {
-        this.cacheJndiName = jndiName;
-    }
-
-	/**
-	 * Call to get the class specified by calling
-	 * {@link #setRootClassName(String)}
-	 * 
-	 * @return Class
-	 */
-	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;
-	                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", //$NON-NLS-1$
-		    					new Object[] { jndiName });
-		    			throw new TranslatorException(msg); 
-		            	
-		            } 		
-		        } catch (Exception err) {
-		            if (err instanceof RuntimeException) throw (RuntimeException)err;
-		            throw new TranslatorException(err);
-		        }
-		    } 
-		    return cache;
-	    }	
-	
-	@Override
 	public boolean supportsOnlyLiteralComparison() {
 		return true;
 	}
 
+	public List<Object> search(Select query, Map<?, ?> map, Class<?> type) throws TranslatorException {
+		return SearchByKey.get(query.getWhere(), map, type);
+	}
+
 }

Copied: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/SearchByKey.java (from rev 4505, 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/SearchByKey.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/SearchByKey.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -0,0 +1,124 @@
+/*
+ * 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.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.infinispan.client.hotrod.RemoteCache;
+import org.teiid.core.util.Assertion;
+import org.teiid.language.Comparison;
+import org.teiid.language.Condition;
+import org.teiid.language.Expression;
+import org.teiid.language.In;
+import org.teiid.language.Literal;
+import org.teiid.language.Comparison.Operator;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.translator.TranslatorException;
+
+/**
+ * SearchByKey is a simple ObjectConnection that enables querying the cache by
+ * the key, using EQUI and IN clauses on the SELECT statement.
+ */
+public final class SearchByKey  {
+
+	public static List<Object> get(Condition criterion,
+			Map<?, ?> cache, Class<?> rootClass)
+			throws TranslatorException {
+		List<Object> results = null;
+
+		if (criterion == null) {
+			Map<?, ?> map = cache;
+			if (cache instanceof RemoteCache<?, ?>) {
+				RemoteCache<?, ?> rc = (RemoteCache<?, ?>) cache;
+		  		map = (Map<Object, Object>) rc.getBulk();
+			}
+			Set<?> keys = map.keySet();
+			results = new ArrayList<Object>();
+			for (Iterator<?> it = keys.iterator(); it.hasNext();) {
+				Object v = cache.get(it.next());
+				addValue(v, results, rootClass);
+			}
+			return results;
+		}
+
+		results = new ArrayList<Object>();
+	
+		if (criterion instanceof Comparison) {
+			Comparison obj = (Comparison)criterion;
+			LogManager.logTrace(LogConstants.CTX_CONNECTOR,
+			"Parsing Comparison criteria."); //$NON-NLS-1$
+			Comparison.Operator op = obj.getOperator();
+		
+			Assertion.assertTrue(op == Operator.EQ);
+			Expression rhs = obj.getRightExpression();
+		
+			Literal literal = (Literal)rhs;
+
+			Object v = cache.get(literal.getValue());
+			if (v != null) {
+				addValue(v, results, rootClass);
+			}
+		} else {
+			Assertion.assertTrue(criterion instanceof In, "unexpected condition " + criterion); //$NON-NLS-1$
+			In obj = (In)criterion;
+			Assertion.assertTrue(!obj.isNegated());
+			LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
+
+			List<Expression> rhsList = obj.getRightExpressions();
+
+			for (Expression expr : rhsList) {
+				Literal literal = (Literal) expr;
+
+				Object v = cache.get(literal.getValue());
+				if (v != null) {
+					addValue(v, results, rootClass);
+				}
+			}
+		} 
+		return results;
+	}
+
+	private static void addValue(Object value, List<Object> results, Class<?> rootNodeType) throws TranslatorException {
+		if (value == null) {
+			return;
+		}
+		if (!rootNodeType.isAssignableFrom(value.getClass())) {
+			// 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", //$NON-NLS-1$
+					new Object[] { value.getClass().getName(),
+							rootNodeType.getName() });
+
+			throw new TranslatorException(msg);			
+		}
+		results.add(value);
+	}
+
+}

Deleted: 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	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanBaseExecutionFactory.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,196 +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.infinispan;
-
-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.metadata.MetadataFactory;
-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 {
-
-	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"); //$NON-NLS-1$
-			throw new TranslatorException(msg); 
-		}
-
-	}
-	
-	/**
-	 * 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<Object, Object> getCache() throws TranslatorException {
-		BasicCache<Object, 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() //$NON-NLS-1$
-							: "DefaultCache") }); //$NON-NLS-1$
-			throw new TranslatorException(msg); 
-		}
-
-		return cache;
-
-	}
-	
-	   @Override
-		public void getMetadata(MetadataFactory metadataFactory, ObjectConnection conn)
-				throws TranslatorException {
-
-		}
-	
-
-	@Override
-	public ObjectConnection getConnection(ConnectionFactory factory,
-			ExecutionContext executionContext) throws TranslatorException {
-				
-		return new InfinispanConnectionImpl(this);
-	}
-	
-	public void cleanUp() {
-
-	}
-	
-	@Override
-	public boolean supportsOrCriteria() {
-		return isFullTextSearchingSupported();
-	}
-	
-	@Override
-	public boolean supportsCompareCriteriaOrdered() {
-		return isFullTextSearchingSupported();
-	}
-}

Deleted: 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	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanConnectionImpl.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,103 +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.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);
-		}
-	    return SearchByKey.performSearch(command, this);	
-	}
-	
-	public BasicCache<Object, 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanExecutionFactory.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -21,16 +21,14 @@
  */
 package org.teiid.translator.object.infinispan;
 
-import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
-import org.infinispan.api.BasicCacheContainer;
-import org.infinispan.manager.DefaultCacheManager;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
+import org.teiid.language.Select;
 import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.object.ObjectPlugin;
+import org.teiid.translator.object.ObjectExecutionFactory;
 
 /**
  * InfinispanExecutionFactory is the translator that will access an Infinispan local cache.
@@ -53,46 +51,17 @@
  *
  */
 @Translator(name = "infinispan-cache", description = "The Infinispan Cache Translator")
-public class InfinispanExecutionFactory extends InfinispanBaseExecutionFactory {
+public class InfinispanExecutionFactory extends ObjectExecutionFactory {
 	private boolean supportsLuceneSearching = false;
 
-	protected BasicCacheContainer cacheContainer = null;
-	private boolean useJndi = true;
-	
 	public InfinispanExecutionFactory() {
 		super();
 	}
 	
-	@Override
-	public void start() throws TranslatorException {
-		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"); //$NON-NLS-1$	
-        		throw new TranslatorException(msg); 
-			}
-			useJndi = false;
-			
-		} else {
-			useJndi = true;
-		}			
-
-	}
-	
-	public boolean isAlive() {
-		return (cacheContainer != null ? true : false);
-	}
-	
 	public boolean isFullTextSearchingSupported() {
 		return this.supportsLuceneSearching;
 	}
 
-
 	/**
 	 * Indicates if Hibernate Search and Apache Lucene are used to index and
 	 * search objects
@@ -108,61 +77,28 @@
 		this.supportsLuceneSearching = supportsLuceneSearching;
 	}
 
-
-	/**
-	 * Method for obtaining the CacheContainer. This method will be called to
-	 * create a container based on the <code>configurationFileName</code>
-	 * specified.
-	 * 
-	 * @return BasicCacheContainer
-	 * @throws TranslatorException
-	 *             if there an issue obtaining the cache
-	 * @see #getCache()
-	 */
-	protected synchronized BasicCacheContainer getCacheContainer()
-			throws TranslatorException {
-		if (this.cacheContainer != null) return this.cacheContainer;
-		
-		this.cacheContainer = createCacheContainer();
-		
-		return this.cacheContainer;
-
+	@Override
+	public boolean supportsOrCriteria() {
+		return isFullTextSearchingSupported();
 	}
 	
-	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",  //$NON-NLS-1$
-			new Object[] { object.getClass().getName(),
-					"BasicCacheContainer" });  //$NON-NLS-1$
-			throw new TranslatorException(msg);
-			
-			
-		}
-		try {
-			container = new DefaultCacheManager(
-					this.getConfigurationFileName());
-			LogManager
-					.logInfo(LogConstants.CTX_CONNECTOR,
-							"=== Using DefaultCacheManager (loaded by configuration) ==="); //$NON-NLS-1$
-		} catch (IOException e) {
-			throw new TranslatorException(e);
-		}
-		
-		return container;
+	@Override
+	public boolean supportsCompareCriteriaOrdered() {
+		return isFullTextSearchingSupported();
 	}
-
-	public void cleanUp() {
-		this.cacheContainer = null;
+	
+	@Override
+	public boolean supportsLikeCriteria() {
+		// at this point, i've been unable to get the Like to work.
+		return false;
 	}
+	
+	@Override
+	public List<Object> search(Select query, Map<?, ?> map, Class<?> type)
+			throws TranslatorException {
+		if (this.supportsLuceneSearching) {
+			return LuceneSearch.performSearch(query, map, type);
+		}
+		return super.search(query, map, type);
+	}
 }

Deleted: 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,147 +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.infinispan;
-
-import org.infinispan.api.BasicCacheContainer;
-import org.infinispan.client.hotrod.RemoteCacheManager;
-import org.infinispan.manager.CacheContainer;
-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
- * {@link CacheContainer}. The {@link #getRemoteServerList() serverList} must
- * provide 1 or more <code>host:port[;host:port...]</code> combinations that
- * indicate where the remote server(s) are located.
- * 
- * @author vhalbert
- * 
- */
-
- at Translator(name = "infinispanremote-cache", description = "The Execution Factory for Remote Infinispan Cache")
-public class InfinispanRemoteExecutionFactory extends
-		InfinispanBaseExecutionFactory {
-
-	private RemoteCacheManager manager;
-
-	private String remoteServerList;
-
-	public InfinispanRemoteExecutionFactory() {
-		super();
-	}
-	
-	@Override
-	public boolean isSourceRequired() {
-		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
-	 * servers must be Infinispan HotRod servers. The list must be in the
-	 * appropriate format of <code>host:port[;host:port...]</code> that would be
-	 * used when defining an Infinispan {@link RemoteCacheManager} instance. If
-	 * the value is missing, <code>localhost:11311</code> is assumed.
-	 * 
-	 * @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;
-	}
-
-	/**
-	 * Set the list of remote servers that make up the Infinispan cluster. The
-	 * servers must be Infinispan HotRod servers. The list must be in the
-	 * appropriate format of <code>host:port[;host:port...]</code> that would be
-	 * used when defining an Infinispan {@link RemoteCacheManager} instance. If
-	 * the value is missing, <code>localhost:11311</code> is assumed.
-	 * 
-	 * @param remoteInfinispanServerList
-	 *            the server list in appropriate
-	 *            <code>server:port;server2:port2</code> format.
-	 * 
-	 * @see #getRemoteServerList()
-	 */
-	public void setRemoteServerList(
-			String remoteInfinispanServerList) {
-		if (this.remoteServerList == remoteInfinispanServerList
-				|| this.remoteServerList != null
-				&& this.remoteServerList.equals(remoteInfinispanServerList))
-			return; // unchanged
-		this.remoteServerList = remoteInfinispanServerList;
-	}
-
-	@Override
-	protected synchronized BasicCacheContainer getCacheContainer() {
-		if (this.manager != null) return this.manager;
-		
-		RemoteCacheManager container = null;
-		if (this.getConfigurationFileName() != null) {
-			container = new RemoteCacheManager(this.getConfigurationFileName());
-			
-			LogManager
-			.logInfo(LogConstants.CTX_CONNECTOR,
-					"=== Using RemoteCacheManager (loaded by configuration) ==="); //$NON-NLS-1$
-
-		} else {
-			if (this.getRemoteServerList() == null
-					|| this.getRemoteServerList().isEmpty()
-					|| this.getRemoteServerList().equals("")) { //$NON-NLS-1$
-				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$
-
-			}
-		}
-		
-
-		this.manager = container;
-		return this.manager;
-
-	}
-
-	public void cleanUp() {
-		if (this.manager != null) {
-			manager.stop();
-		}
-		manager = null;
-	}
-
-}

Copied: trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/LuceneSearch.java (from rev 4505, 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/LuceneSearch.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/LuceneSearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -0,0 +1,373 @@
+/*
+ * 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.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.lucene.search.Query;
+import org.hibernate.search.query.dsl.BooleanJunction;
+import org.hibernate.search.query.dsl.QueryBuilder;
+import org.infinispan.Cache;
+import org.infinispan.query.CacheQuery;
+import org.infinispan.query.Search;
+import org.infinispan.query.SearchManager;
+import org.teiid.language.*;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectExecution;
+import org.teiid.translator.object.ObjectPlugin;
+
+/**
+ * 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 final class LuceneSearch   {
+
+
+	public static List<Object> performSearch(Select command, Map<?, ?> cache, Class<?> type)
+			throws TranslatorException {
+		
+		SearchManager searchManager = Search
+				.getSearchManager((Cache<?, ?>) cache );
+
+		QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(type).get();
+
+		BooleanJunction<BooleanJunction> junction = queryBuilder.bool();
+		boolean createdQueries = buildQueryFromWhereClause(command.getWhere(),
+				junction, queryBuilder);
+
+		Query query = null;
+		if (createdQueries) {
+			query = junction.createQuery();
+		} else {
+			query = queryBuilder.all().createQuery();
+		}
+
+		CacheQuery cacheQuery = searchManager.getQuery(query, type); // rootNodeType
+
+		List<Object> results = cacheQuery.list();
+		if (results == null || results.isEmpty()) {
+			return Collections.emptyList();
+		}
+
+		return results;
+	}
+
+	private static boolean buildQueryFromWhereClause(Condition criteria,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder)
+			throws TranslatorException {
+		boolean createdQueries = false;
+		BooleanJunction<BooleanJunction> inUse = junction;
+
+		if (criteria instanceof AndOr) {
+			LogManager.logTrace(LogConstants.CTX_CONNECTOR,
+					"Parsing compound criteria."); //$NON-NLS-1$
+			AndOr crit = (AndOr) criteria;
+			AndOr.Operator op = crit.getOperator();
+
+			switch (op) {
+			case AND:
+
+				BooleanJunction<BooleanJunction> leftAnd = queryBuilder
+						.bool();
+				boolean andLeftHasQueries = buildQueryFromWhereClause(
+						crit.getLeftCondition(), leftAnd, queryBuilder);
+
+				BooleanJunction<BooleanJunction> rightAnd = queryBuilder
+						.bool();
+				boolean andRightHasQueries = buildQueryFromWhereClause(
+						crit.getRightCondition(), rightAnd, queryBuilder);
+
+				if (andLeftHasQueries && andRightHasQueries) {
+					leftAnd.must(rightAnd.createQuery());
+					inUse.should(leftAnd.createQuery());
+				} else if (andLeftHasQueries) {
+
+					inUse.should(leftAnd.createQuery());
+				} else if (andRightHasQueries) {
+					inUse.should(rightAnd.createQuery());
+				}
+
+				createdQueries = (andLeftHasQueries ? andLeftHasQueries
+						: andRightHasQueries);
+
+				break;
+
+			case OR:
+
+				boolean orLeftHasQueries = buildQueryFromWhereClause(
+						crit.getLeftCondition(), inUse, queryBuilder);
+				boolean orRightHasQueries = buildQueryFromWhereClause(
+						crit.getRightCondition(), inUse, queryBuilder);
+
+				createdQueries = (orLeftHasQueries ? orLeftHasQueries
+						: orRightHasQueries);
+
+				break;
+
+			default:
+				final String msg = ObjectPlugin.Util
+						.getString("LuceneSearch.invalidOperator", new Object[] { op, "And, Or" }); //$NON-NLS-1$ //$NON-NLS-2$
+				throw new TranslatorException(msg);
+			}
+
+		} else if (criteria instanceof Comparison) {
+			createdQueries = visit((Comparison) criteria, inUse, queryBuilder);
+
+		} else if (criteria instanceof Exists) {
+			LogManager.logTrace(LogConstants.CTX_CONNECTOR,
+					"Parsing EXISTS criteria: NOT IMPLEMENTED YET"); //$NON-NLS-1$
+			// TODO Exists should be supported in a future release.
+
+		} else if (criteria instanceof Like) {
+			createdQueries = visit((Like) criteria, inUse, queryBuilder);
+
+		} else if (criteria instanceof In) {
+			createdQueries = visit((In) criteria, inUse, queryBuilder);
+
+		}
+		// else if (criteria instanceof Not) {
+		//			LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing NOT criteria."); //$NON-NLS-1$
+		// isNegated = true;
+		// filterList.addAll(getSearchFilterFromWhereClause(((Not)criteria).getCriteria(),
+		// new LinkedList<String>()));
+		// }
+
+		return createdQueries;
+	}
+
+	public static boolean visit(Comparison obj,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) throws TranslatorException {
+
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
+				"Parsing Comparison criteria."); //$NON-NLS-1$
+		Comparison.Operator op = obj.getOperator();
+
+		Expression lhs = obj.getLeftExpression();
+		Expression rhs = obj.getRightExpression();
+
+		// joins between the objects in the same cache is not usable
+		if ((lhs instanceof ColumnReference && rhs instanceof ColumnReference)
+				|| (lhs instanceof Literal && rhs instanceof Literal)) {
+			return false;
+		}
+
+		Object value = null;
+		Column mdIDElement = null;
+		Literal literal = null;
+		if (lhs instanceof ColumnReference) {
+
+			mdIDElement = ((ColumnReference) lhs).getMetadataObject();
+			literal = (Literal) rhs;
+			value = literal.getValue();
+
+		} else if (rhs instanceof ColumnReference ){
+			mdIDElement = ((ColumnReference) rhs).getMetadataObject();
+			literal = (Literal) lhs;
+			value = literal.getValue();
+		}
+
+		if (value == null) {
+			final String msg = ObjectPlugin.Util
+					.getString("LuceneSearch.unsupportedComparingByNull"); //$NON-NLS-1$
+			throw new TranslatorException(msg);
+		}
+
+		value = escapeReservedChars(value);
+		switch (op) {
+		case NE:
+			createEqualsQuery(mdIDElement, value, false, true, junction, queryBuilder);
+			break;
+
+		case EQ:
+			createEqualsQuery(mdIDElement, value, true, false, junction, queryBuilder);
+			break;
+
+		case GT:
+			createRangeAboveQuery(mdIDElement, value, junction, queryBuilder);
+			break;
+
+		case LT:
+			createRangeBelowQuery(mdIDElement, value, junction, queryBuilder);
+			break;
+
+		default:
+			final String msg = ObjectPlugin.Util
+					.getString("LuceneSearch.invalidOperator", new Object[] { op, "NE, EQ, GT, LT" }); //$NON-NLS-1$ //$NON-NLS-2$
+			throw new TranslatorException(msg);
+		}
+		return true;
+
+	}
+
+	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 = obj.getLeftExpression();
+
+		Column mdIDElement = ((ColumnReference) lhs).getMetadataObject();
+
+		List<Expression> rhsList = obj.getRightExpressions();
+		boolean createdQuery = false;
+		for (Expression expr : rhsList) {
+
+			if (expr instanceof Literal) {
+				Literal literal = (Literal) expr;
+
+				// add these as OR queries
+				createEqualsQuery(mdIDElement,
+						escapeReservedChars(literal.getValue()), false, false,
+						junction, queryBuilder);
+				createdQuery = true;
+			} else {
+				String msg = ObjectPlugin.Util.getString(
+						"LuceneSearch.Unsupported_expression", //$NON-NLS-1$
+						new Object[] { expr, "IN" }); //$NON-NLS-1$
+				throw new TranslatorException(msg);
+			}
+		}
+		return createdQuery;
+	}
+
+	public static boolean visit(Like obj, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) throws TranslatorException {
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR,
+				"Parsing LIKE criteria."); //$NON-NLS-1$
+
+		Expression lhs = obj.getLeftExpression();
+		Expression rhs = obj.getRightExpression();
+
+		Column c = null;
+		Expression literalExp = null;
+		if (lhs instanceof ColumnReference) {
+			c = ((ColumnReference) lhs).getMetadataObject();
+			literalExp = rhs;
+		} else {
+			c = ((ColumnReference) rhs).getMetadataObject();
+			literalExp = lhs;
+		}
+
+		String value = null;
+		if (literalExp instanceof Literal) {
+
+			value = (String) escapeReservedChars(((Literal) literalExp)
+					.getValue());
+			createLikeQuery(c, value.replaceAll("%", ""), junction, queryBuilder); // "*" //$NON-NLS-1$ //$NON-NLS-2$
+		} else {
+			final String msg = ObjectPlugin.Util.getString(
+					"LuceneSearch.Unsupported_expression", //$NON-NLS-1$
+					new Object[] { literalExp.toString(), "LIKE" }); //$NON-NLS-1$
+			throw new TranslatorException(msg);
+		}
+
+		return true;
+	}
+
+	protected static Object escapeReservedChars(final Object value) {
+		if (value instanceof String) {
+		} else {
+			return value;
+		}
+
+		String expr = (String) value;
+
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0; i < expr.length(); i++) {
+			char curChar = expr.charAt(i);
+			switch (curChar) {
+			case '\\':
+				sb.append("\\5c"); //$NON-NLS-1$
+				break;
+			case '*':
+				sb.append("\\2a"); //$NON-NLS-1$
+				break;
+			case '(':
+				sb.append("\\28"); //$NON-NLS-1$
+				break;
+			case ')':
+				sb.append("\\29"); //$NON-NLS-1$
+				break;
+			case '\u0000':
+				sb.append("\\00"); //$NON-NLS-1$
+				break;
+			default:
+				sb.append(curChar);
+			}
+		}
+		return sb.toString();
+	}
+
+	private static Query createEqualsQuery(Column column, Object value, boolean and,
+			boolean not, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
+		Query queryKey = queryBuilder.keyword()
+				.onField(ObjectExecution.getNameInSource(column))
+				// .matching(value.toString() + "*")
+				.matching(value.toString()).createQuery();
+
+		if (not) {
+			junction.must(queryKey).not();
+		} else if (and) {
+			junction.must(queryKey);
+		} else {
+			junction.should(queryKey);
+		}
+		return queryKey;
+	}
+
+	private static Query createRangeAboveQuery(Column column, Object value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
+
+		Query queryKey = queryBuilder.range()
+				.onField(ObjectExecution.getNameInSource(column))
+				.above(value.toString()).excludeLimit().createQuery();
+		junction.must(queryKey);
+		return queryKey;
+	}
+
+	private static Query createRangeBelowQuery(Column column, Object value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
+
+		Query queryKey = queryBuilder.range()
+				.onField(ObjectExecution.getNameInSource(column))
+				.below(value.toString()).excludeLimit().createQuery();
+		junction.must(queryKey);
+		return queryKey;
+	}
+
+	private static Query createLikeQuery(Column column, String value,
+			BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) {
+		Query queryKey = queryBuilder.phrase()
+				.onField(ObjectExecution.getNameInSource(column)).sentence(value)
+				.createQuery();
+		junction.should(queryKey);
+		return queryKey;
+	}
+
+}

Modified: trunk/connectors/translator-object/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
--- trunk/connectors/translator-object/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,4 +1,3 @@
 org.teiid.translator.object.infinispan.InfinispanExecutionFactory
-org.teiid.translator.object.infinispan.InfinispanRemoteExecutionFactory
-org.teiid.translator.object.mapcache.MapCacheExecutionFactory
+org.teiid.translator.object.ObjectExecutionFactory
 

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties	2012-10-04 12:26:57 UTC (rev 4512)
@@ -19,8 +19,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA.
 #
-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

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/BasicSearchTest.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/BasicSearchTest.java	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/BasicSearchTest.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -28,6 +28,7 @@
 
 import org.junit.Test;
 import org.teiid.language.Select;
+import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.util.TradesCacheSource;
 import org.teiid.translator.object.util.VDBUtility;
 
@@ -41,35 +42,40 @@
 	@Test public void testQueryGetAllTrades() throws Exception {		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade as T"); //$NON-NLS-1$		
 		
-		performTest(command, TradesCacheSource.NUMTRADES);
+		performTest(command, TradesCacheSource.NUMTRADES, 4);
 		
 	}		
 	
 	@Test public void testTradeProjection() throws Exception {		
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId From Trade_Object.Trade as T"); //$NON-NLS-1$		
 		
-		performTest(command, TradesCacheSource.NUMTRADES);
+		performTest(command, TradesCacheSource.NUMTRADES, 1);
 		
 	}		
 	
 	@Test public void testQueryGetOneTrade() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId = '1'"); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 2);
 		
 	}	
 	
 	@Test public void testQueryInCriteria() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId in ('1', '3')"); //$NON-NLS-1$
 					
-		performTest(command, 2);
+		performTest(command, 2, 2);
 		
 	}	
 	
-	protected List<Object> performTest(Select command, int rowcnt) throws Exception {
+	protected List<Object> performTest(Select command, int rowcnt, int colCount) throws Exception {
 
 		ObjectExecution exec = createExecution(command);
 		
+		return performTest(rowcnt, colCount, exec);
+	}
+
+	static List<Object> performTest(int rowcnt, int colCount, ObjectExecution exec)
+			throws TranslatorException {
 		exec.execute();
 		
 		List<Object> rows = new ArrayList<Object>();
@@ -79,6 +85,7 @@
 	
 		while (row != null) {
 			rows.add(row);
+			assertEquals(colCount, row.size());
 			++cnt;
 			row = exec.next();
 		}

Copied: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestMapCacheKeySearch.java (from rev 4505, 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/TestMapCacheKeySearch.java	                        (rev 0)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestMapCacheKeySearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -0,0 +1,105 @@
+/*
+ * 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.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.Context;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.teiid.language.Select;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
+import org.teiid.query.metadata.SystemMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.util.TradesCacheSource;
+import org.teiid.translator.object.util.VDBUtility;
+
+
+ at SuppressWarnings("nls")
+public class TestMapCacheKeySearch extends BasicSearchTest {	      
+
+	protected static final String JNDI_NAME = "java/MyCacheManager";
+	   
+	private static TradesCacheSource source  = TradesCacheSource.loadCache();
+	private static ExecutionContext context;
+	
+	private ObjectExecutionFactory 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 ObjectExecutionFactory();
+
+		factory.start();
+
+    }
+	
+	@Override
+	protected ObjectExecution createExecution(Select command) throws TranslatorException {
+		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, source);
+	}
+
+	@Ignore
+	@Test public void testGetMetadata() throws Exception {
+		
+		Map<String, Datatype> dts = SystemMetadata.getInstance().getSystemStore().getDatatypes();
+
+		MetadataFactory mfactory = new MetadataFactory("TestVDB", 1, "Trade",  dts, new Properties(), null);
+		
+		factory.getMetadata(mfactory, null);
+		
+		Map<String, Table> tables = mfactory.getSchema().getTables();
+		for (Iterator<Table> it=tables.values().iterator(); it.hasNext();) {
+			Table t = it.next();
+		}
+
+	}
+
+}

Deleted: 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,132 +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.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.teiid.language.Select;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.object.util.TradesCacheSource;
-import org.teiid.translator.object.util.VDBUtility;
-
- at SuppressWarnings("nls")
-public class TestObjectExecution {
-	
-	
-	private static TradesCacheSource source  = TradesCacheSource.loadCache();
-	private static ObjectExecutionFactory factory;
-	
-	@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.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		
-		factory.start();
-
-    }
-	
-
-	@Test public void testQueryRootObject() throws Exception {
-		execute( createExecution("select * From Trade_Object.Trade"), 3, 4);
-	}
-	
-	@Test	public void testAtomicSelects() throws Exception {
-
-		Thread[] threads = new Thread[20];
-		for (int i = 0; i < threads.length; i++) {
-		    threads[i] = new Thread() {
-				public void run() {
-					for (int i=0; i<1000; i++) {
-						test();
-					}
-				}
-				public void test() {
-					ObjectExecution exec = null;
-					try {
-						exec =  createExecution("select * From Trade_Object.Trade");
-						execute(exec, 3, 1);
-					} catch (Exception e) {
-						e.printStackTrace();
-					} finally {
-						if (exec != null) exec.close();
-					}
-				}
-		    };
-  	
-		    threads[i].start();
-		}
-		for (int i = 0; i < threads.length; i++) {
-		    try {
-		       threads[i].join();
-		    } catch (InterruptedException ignore) {}
-		}
-	}
-	
-	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, connection);
-		
-		return exec;
-
-	}
-	
-	private void execute(ObjectExecution exec, int expected, int columns) throws Exception {
-		
-		exec.execute();
-		
-		int cnt = 0;
-		List<?> row = exec.next();
-		
-		// check the number of columns
-		assertEquals("Number of columns is incorrect", columns, row.size());
-
-		
-		while (row != null) {
-			++cnt;
-			row = exec.next();
-		}
-		assertEquals("Did not get expected number of rows", expected, cnt); //$NON-NLS-1$
-		
-		     
-		exec.close();
-	}
-	
-}

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -21,7 +21,7 @@
  */
 package org.teiid.translator.object;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 import java.util.Properties;
 
@@ -33,7 +33,6 @@
 import org.teiid.metadata.MetadataFactory;
 import org.teiid.query.metadata.SystemMetadata;
 import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.object.testdata.Trade;
 import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
@@ -62,8 +61,6 @@
     }
 
 	@Test public void testFactory() throws Exception {
-		factory.setRootClassName(Trade.class.getName());
-	
 		factory.start();
 			
 		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
@@ -72,10 +69,6 @@
 	}
 	
 	@Test public void testFactoryLoadingJarClassNames() throws Exception {
-	
-		
-		factory.setRootClassName(Trade.class.getName());
-		
 		factory.start();
 			
 		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
@@ -87,8 +80,6 @@
 	@Test public void testGetMetadata() throws Exception {
 		
 		MetadataFactory mfactory = new MetadataFactory("TestVDB", 1, "Trade",  SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
-								
-		factory.setRootClassName(Trade.class.getName());
 		
 		factory.start();
 		

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/RemoteInfinispanTestHelper.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -43,7 +43,7 @@
     private static int count = 0;
     private static  DefaultCacheManager CACHEMANAGER = null;
 
-    public static synchronized HotRodServer createServer() throws IOException {
+    public static synchronized HotRodServer createServer() {
         count++;
         if (server == null) {
         	Configuration c = new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).eviction().maxEntries(7).build();

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanConfigFileKeySearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -23,22 +23,49 @@
 
 import static org.mockito.Mockito.*;
 
+import java.util.Map;
+
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.manager.DefaultCacheManager;
 import org.junit.BeforeClass;
 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.testdata.Trade;
 import org.teiid.translator.object.util.TradesCacheSource;
 import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
 public class TestInfinispanConfigFileKeySearch extends BasicSearchTest {
     
+	static final class InfinispanConnection implements ObjectConnection {
+		private final CacheContainer container;
+
+		InfinispanConnection(CacheContainer container) {
+			this.container = container;
+		}
+
+		@Override
+		public Class<?> getType(String name) throws TranslatorException {
+			return Trade.class;
+		}
+
+		@Override
+		public Map<?, ?> getMap(String name) throws TranslatorException {
+			//the real connection should use the name in source to get the cache
+			return container.getCache(TradesCacheSource.TRADES_CACHE_NAME);
+		}
+	}
+
 	private static ExecutionContext context;
 
     
     private static InfinispanExecutionFactory factory = null;
+    
+    private static ObjectConnection conn;
 		
 
 	@BeforeClass
@@ -49,20 +76,18 @@
 		
 		factory = new InfinispanExecutionFactory();
 
-		factory.setConfigurationFileName("./src/test/resources/infinispan_persistent_config.xml");
+		final DefaultCacheManager container = new DefaultCacheManager("./src/test/resources/infinispan_persistent_config.xml");
 
-		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
-		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
 		factory.start();
 		
-		TradesCacheSource.loadCache(factory.getCacheContainer().getCache(TradesCacheSource.TRADES_CACHE_NAME));
+		TradesCacheSource.loadCache(container.getCache(TradesCacheSource.TRADES_CACHE_NAME));
 
-
+		conn = new InfinispanConnection(container);
 	}
 	
 	@Override
 	protected ObjectExecution createExecution(Select command) throws TranslatorException {
-		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, conn);
 	}
 	
 }

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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiILuceneSearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -32,6 +32,7 @@
 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.util.TradesCacheSource;
 import org.teiid.translator.object.util.VDBUtility;
@@ -40,7 +41,7 @@
 public class TestInfinispanJndiILuceneSearch extends BasicSearchTest {
     private static CacheContainer container = null;
 	private static ExecutionContext context;
-    
+    private static ObjectConnection conn;
     private InfinispanExecutionFactory factory = null;
 		
 	@BeforeClass
@@ -49,80 +50,68 @@
 		container = new DefaultCacheManager("infinispan_persistent_indexing_config.xml"); 
 		
 		TradesCacheSource.loadCache(container.getCache(TradesCacheSource.TRADES_CACHE_NAME));
+		
+		conn = new TestInfinispanConfigFileKeySearch.InfinispanConnection(container);
+		
 		context = mock(ExecutionContext.class);
 	}
 
 	@Before public void beforeEachTest() throws Exception{	
-        
-		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 = new InfinispanExecutionFactory();
 		factory.setSupportsLuceneSearching(true);
 		factory.start();
-	    
-
     }
 
 	@Override
 	protected ObjectExecution createExecution(Select command) throws TranslatorException {
-		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, conn);
 	}
 	
 	@Test public void testQueryLikeCriteria1() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name From Trade_Object.Trade as T WHERE T.Name like 'TradeName%'"); //$NON-NLS-1$
 					
-		performTest(command, 3);
+		performTest(command, 3, 2);
 	}	
 	
 	@Test public void testQueryLikeCriteria2() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name From Trade_Object.Trade as T WHERE T.Name like 'TradeName 2%'"); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 2);
 	}	
 	
 	@Test public void testQueryCompareEQBoolean() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name, T.Settled From Trade_Object.Trade as T WHERE T.Settled = 'false'"); //$NON-NLS-1$
 					
-		performTest(command, 2);
+		performTest(command, 2, 3);
 	}	
 	
 	@Test public void testQueryCompareNEBoolean() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name, T.Settled From Trade_Object.Trade as T WHERE T.Settled <> 'false'"); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 3);
 	}		
 	
 	@Test public void testQueryRangeBetween() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId > '1' and T.TradeId < '3'"); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 2);
 	}
 
 	@Test public void testQueryRangeAbove() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId > '1'"); //$NON-NLS-1$
 					
-		performTest(command, 2);
+		performTest(command, 2, 2);
 	}
 	
 	@Test public void testQueryRangeBelow() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId < '2'"); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 2);
 	}	
 	
 	@Test public void testQueryAnd() throws Exception {	
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName From Trade_Object.Trade as T WHERE T.TradeId > '1' and T.Settled = 'false' "); //$NON-NLS-1$
 					
-		performTest(command, 1);
+		performTest(command, 1, 2);
 	}	
 }

Deleted: 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanJndiKeySearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,78 +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.infinispan;
-
-import static org.mockito.Mockito.*;
-
-import org.infinispan.manager.CacheContainer;
-import org.infinispan.manager.DefaultCacheManager;
-import org.junit.Before;
-import org.junit.BeforeClass;
-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;
-import org.teiid.translator.object.util.VDBUtility;
-
- at SuppressWarnings("nls")
-public class TestInfinispanJndiKeySearch extends BasicSearchTest {
-    private static CacheContainer container = null;
-	private static ExecutionContext context;
-    
-    private InfinispanExecutionFactory factory = null;
-		
-	@BeforeClass
-    public static void beforeEachClass() throws Exception {  
-	       // Create the cache manager ...
-		container = new DefaultCacheManager("infinispan_persistent_config.xml"); 
-		
-		TradesCacheSource.loadCache(container.getCache(TradesCacheSource.TRADES_CACHE_NAME));
-		context = mock(ExecutionContext.class);
-		 
-	}
-
-	@Before public void beforeEachTest() throws Exception{	
-        
-		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.start();
-    }
-	
-	@Override
-	protected ObjectExecution createExecution(Select command) throws TranslatorException {
-		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
-	}
-
-}

Deleted: 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/infinispan/TestInfinispanRemoteJndiKeySearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,100 +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.infinispan;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import javax.naming.Context;
-
-import org.infinispan.client.hotrod.RemoteCacheManager;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.mockito.Mock;
-import org.teiid.language.Select;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.object.BasicSearchTest;
-import org.teiid.translator.object.ObjectExecution;
-import org.teiid.translator.object.util.TradesCacheSource;
-import org.teiid.translator.object.util.VDBUtility;
-
- at SuppressWarnings("nls")
- at Ignore
-public class TestInfinispanRemoteJndiKeySearch extends BasicSearchTest {
-    protected static final String JNDI_NAME = "java/MyCacheManager";
-    
-    private static RemoteCacheManager container = null;
-	private static ExecutionContext context;
-
-    
-    private InfinispanRemoteExecutionFactory factory = null;
-		
-	@Mock
-	private static Context jndi;
-
-	@BeforeClass
-    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);
-        
-		context = mock(ExecutionContext.class);
-
-
-	}
-
-	@Before public void beforeEachTest() throws Exception{	
-        
-		factory = new InfinispanRemoteExecutionFactory();
-
-		factory.setRemoteServerList(RemoteInfinispanTestHelper.hostAddress() + ":" + RemoteInfinispanTestHelper.hostPort());
-		factory.setCacheName(TradesCacheSource.TRADES_CACHE_NAME);
-		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.start();	    
-
-    }
-	
-    @AfterClass
-    public static void closeConnection() throws Exception {
-        RemoteInfinispanTestHelper.releaseServer();
-    }
-    
-    @Override
-    protected ObjectExecution createExecution(Select command)
-    		throws Exception {
-	    when(jndi.lookup(JNDI_NAME)).thenReturn(container);
-	    
-	    Object t =  RemoteInfinispanTestHelper.getCacheManager().getCache(TradesCacheSource.TRADES_CACHE_NAME).get("1");
-
-	    assertNotNull(t);
-	    
-		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
-    }
-
-	
-}

Deleted: 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-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/mapcache/TestMapCacheKeySearch.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.translator.object.mapcache;
-
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.naming.Context;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.teiid.language.Select;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.Table;
-import org.teiid.query.metadata.SystemMetadata;
-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;
-import org.teiid.translator.object.util.VDBUtility;
-
-
- at SuppressWarnings("nls")
-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() {
-
-			@Override
-			protected Map<?, ?> getCache() throws TranslatorException {
-				return source;
-			}
-			
-		};
-
-		factory.setCacheJndiName(JNDI_NAME);
-		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.start();
-
-    }
-	
-	@Override
-	protected ObjectExecution createExecution(Select command) throws TranslatorException {
-		return (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
-	}
-
-	@Test public void testGetMetadata() throws Exception {
-		
-		Map dts = SystemMetadata.getInstance().getSystemStore().getDatatypes();
-
-		MetadataFactory mfactory = new MetadataFactory("TestVDB", 1, "Trade",  dts, new Properties(), null);
-		
-		MapCacheExecutionFactory factory = new MapCacheExecutionFactory() {
-			
-		};
-		
-		factory.setCacheJndiName(JNDI_NAME);
-		factory.setRootClassName(TradesCacheSource.TRADE_CLASS_NAME);
-		factory.start();
-		
-		factory.getMetadata(mfactory, null);
-		
-		Map<String, Table> tables = mfactory.getSchema().getTables();
-		for (Iterator<Table> it=tables.values().iterator(); it.hasNext();) {
-			Table t = it.next();
-			System.out.println(t.getName() + " - " + (t.getSelectTransformation() != null ? t.getSelectTransformation() : t.getSQLString()));
-		}
-
-	}
-
-	
-  
-}

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -29,6 +29,8 @@
 import java.util.Map;
 
 import org.infinispan.api.BasicCache;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectConnection;
 import org.teiid.translator.object.testdata.Leg;
 import org.teiid.translator.object.testdata.Trade;
 import org.teiid.translator.object.testdata.Transaction;
@@ -40,8 +42,8 @@
  * @author vhalbert
  *
  */
- at SuppressWarnings("rawtypes")
-public class TradesCacheSource extends HashMap <Object, Object> {
+ at SuppressWarnings("nls")
+public class TradesCacheSource extends HashMap <Object, Object> implements ObjectConnection {
 	
 	/**
 	 * 
@@ -146,4 +148,14 @@
 		objs.add(super.get(key));
 		return objs;
 	}
+
+	@Override
+	public Map<?, ?> getMap(String name) throws TranslatorException {
+		return this;
+	}
+
+	@Override
+	public Class<?> getType(String name) throws TranslatorException {
+		return Trade.class;
+	}
 }

Modified: trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java
===================================================================
--- trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -27,7 +27,7 @@
 import org.teiid.core.util.UnitTestUtil;
 import org.teiid.metadata.RuntimeMetadata;
 
-
+ at SuppressWarnings("nls")
 public class VDBUtility {
 
 	public static TranslationUtility TRANSLATION_UTILITY = null;

Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java	2012-10-03 19:05:34 UTC (rev 4511)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java	2012-10-04 12:26:57 UTC (rev 4512)
@@ -59,6 +59,7 @@
 import org.teiid.core.types.InputStreamFactory.BlobInputStreamFactory;
 import org.teiid.core.types.InputStreamFactory.ClobInputStreamFactory;
 import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.StringUtil;
 import org.teiid.core.util.TimestampWithTimezone;
 import org.teiid.language.SQLConstants;
 import org.teiid.language.SQLConstants.NonReserved;
@@ -799,37 +800,7 @@
 	// ================== Function = replace =====================
 
 	public static Object replace(String string, String subString, String replaceString) {
-		// Check some simple cases that require no work
-		if(subString.length() > string.length() || string.length() == 0 || subString.length() == 0) {
-			return string;
-		}
-
-		StringBuffer result = new StringBuffer();
-		int index = 0;
-
-		while(true) {
-			int newIndex = string.indexOf(subString, index);
-			if(newIndex < 0) {
-				// No more replacement sections, grab from old index to end of string
-				result.append( string.substring(index));
-
-				// Break out of loop
-				break;
-
-			}
-			// Matched the substring at newIndex
-
-			// First append section from old index to new
-			result.append( string.substring( index, newIndex));
-
-			// Then append replacement section for sub
-			result.append( replaceString );
-
-			// Then move the index counter forward
-			index = newIndex + subString.length();
-		}
-
-		return result.toString();
+		return StringUtil.replaceAll(string, subString, replaceString);
 	}
 
 	// ================== Function = insert =====================



More information about the teiid-commits mailing list