[teiid-commits] teiid SVN: r4062 - in branches/7.7.x/connectors/translator-object: src/main/java/org/teiid/translator/object and 10 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon May 7 13:49:59 EDT 2012


Author: van.halbert
Date: 2012-05-07 13:49:58 -0400 (Mon, 07 May 2012)
New Revision: 4062

Added:
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectCacheConnection.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMetadataProcessor.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanObjectVisitor.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanProxy.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java
   branches/7.7.x/connectors/translator-object/src/main/resources/META-INF/
   branches/7.7.x/connectors/translator-object/src/main/resources/META-INF/jboss-beans.xml
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java
Removed:
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java
Modified:
   branches/7.7.x/connectors/translator-object/Notes.txt
   branches/7.7.x/connectors/translator-object/pom.xml
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java
   branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java
   branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java
   branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java
   branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade.vdb
   branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi
Log:
TEIID-1992, 2014, 2015 ExecutionFactory supports importing metadata from non-annotated classes and support calling Infinispan

Modified: branches/7.7.x/connectors/translator-object/Notes.txt
===================================================================
--- branches/7.7.x/connectors/translator-object/Notes.txt	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/Notes.txt	2012-05-07 17:49:58 UTC (rev 4062)
@@ -12,10 +12,11 @@
 1.  There is no current support for 2 or more classes named the same (but different packages) in the same model.  
 	The table name will be the name of the class, not the full classname. 
 	
+2.  Default, columns that are of type object are NOT Selectable or Searchable.  Its assumed that if object types like
+	Map, Collection, or Array, there needs to be a related child table that has a foreign key defined.
 
 
 
-
 Modeling -
 
 -   JavaBean convention is used.  The column name (or nameinsource if used) are used in finding the get/is method.
@@ -44,15 +45,21 @@
 			-	Searchability=UNSEARCHABLE
 			-	Selectable=false
 			-   Updateable=false
-	c.	create the foreign key relationship between parent child, where the NameInSource for the FK being the method
-		to access child objects.
+	c.	create the foreign key relationship between parent child, where the NameInSource for the FK being the method 
+		(minus the "get") to access child objects.  Example:  method - getLegs   NIS - Legs
 	d.  the attribute on an object that is the container object, should not be modeled as an attribute in the table. 
 		This is because its not directly queryable.  It should have a related child table, which has a foreign key
 		(see b and c above).
+	
+
+-  Reverse Engineering the Class Metadata by performing JDBC Import
+	-  create a dynamic.vdb so that, in designer, you can do JDBC import using a Teiid connection, in order to reverse engineer
+		the class metadata.
+	-  NOTE:  The Native Type (i.e., the return type for the "Get" method) does not come thru in the metadata.  The Datdatype and 
+		the Native are set the same.
 		
 		
 		
-		
 TODO:
 
 -  when importing metadata, make the Object types (of return types, collections, etc) non-selectable, because they need

Modified: branches/7.7.x/connectors/translator-object/pom.xml
===================================================================
--- branches/7.7.x/connectors/translator-object/pom.xml	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/pom.xml	2012-05-07 17:49:58 UTC (rev 4062)
@@ -13,7 +13,7 @@
      <properties>
        <version.infinispan>5.1.2.FINAL</version.infinispan>
        <version.hibernate.search>4.1.0.CR1</version.hibernate.search>
-  </properties>
+  	</properties>
     <dependencies>
      
         <dependency>
@@ -43,20 +43,39 @@
 			<type>test-jar</type>
 			<scope>provided</scope>
 		</dependency>
-           
+		
+		<!-- dependency>
+			<groupId>org.jboss.teiid.connectors</groupId>
+			<artifactId>connector-infinispan</artifactId>
+			<classifier>lib</classifier>
+			<version>${project.version}</version>
+			<scope>compile</scope>
+		</dependency-->
+		
+		<dependency>
+	        <groupId>org.infinispan</groupId>
+    	    <artifactId>infinispan-core</artifactId>
+       		<version>${version.infinispan}</version>
+       	</dependency>	
+		
+		<!-- dependency>
+	        <groupId>org.infinispan</groupId>
+    	    <artifactId>infinispan-core</artifactId>
+       		<version>${version.infinispan}</version>
+       	</dependency>	
+        <dependency>
+	      <groupId>org.infinispan</groupId>
+	      <artifactId>infinispan-client-hotrod</artifactId>
+	      <version>${version.infinispan}</version>
+	    </dependency-->       		
+          
 <!-- 
 			<dependency>
 	          <groupId>org.infinispan</groupId>
-    	      <artifactId>infinispan-core</artifactId>
-       		   <version>${version.infinispan}</version>
-       		</dependency>
-       		
-			<dependency>
-	          <groupId>org.infinispan</groupId>
     	      <artifactId>infinispan-query</artifactId>
        		   <version>${version.infinispan}</version>
        		</dependency>  
-     -->       
+     -->      
    
 		<dependency>
 		   <groupId>org.hibernate</groupId>

Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectCacheConnection.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectCacheConnection.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectCacheConnection.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,14 @@
+package org.teiid.translator.object;
+
+import java.util.List;
+
+/**
+ * This is the interface the connection is exposed as.  
+ * @author vhalbert
+ *
+ */
+public interface ObjectCacheConnection {
+	
+	List<Object> get(List<Object> args, String cacheName, Class<?> rootNodeType) throws Exception ;
+
+}

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -44,13 +44,17 @@
     private Select query;
     private ObjectSourceProxy proxy;
     private ObjectMethodManager methodManager;
+    private ObjectExecutionFactory config;
+    private ObjectProjections op;
     
 	private Iterator<List<Object>> resultsIt = null;  
     
-    public ObjectExecution(Command query, RuntimeMetadata metadata, ObjectSourceProxy connproxy, ObjectMethodManager methodManager) {
+    public ObjectExecution(Command query, RuntimeMetadata metadata, ObjectSourceProxy proxy, ObjectMethodManager methodManager, ObjectExecutionFactory factory) {
     	this.query = (Select) query;
-        this.proxy = connproxy;
+    	this.op = new ObjectProjections(this.query);
+        this.proxy = proxy;
         this.methodManager = methodManager;
+        this.config = factory;
     }
     
 	@Override
@@ -63,8 +67,6 @@
         List<List<Object>> results = null;
 		if (objects != null && objects.size() > 0) {
 		    LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of objects from proxy is : " + objects.size()); //$NON-NLS-1$
-
-		    ObjectProjections op = new ObjectProjections(query);
 		    
 			results = ObjectTranslator.translateObjects(objects, op, methodManager);
 			 
@@ -85,7 +87,7 @@
 
 		    LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution calling proxy : " + this.proxy.getClass().getName()); //$NON-NLS-1$
 
-			return this.proxy.get(query);
+			return this.proxy.get(query, config.getCacheName(), op.rootNodeClassName);
 
 	}
 	

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -23,16 +23,21 @@
 package org.teiid.translator.object;
 
 import java.io.File;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.List;
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 
+import javax.resource.cci.ConnectionFactory;
+
+import org.teiid.core.util.StringUtil;
 import org.teiid.language.QueryExpression;
 import org.teiid.language.Select;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
 import org.teiid.metadata.MetadataFactory;
 import org.teiid.metadata.RuntimeMetadata;
 import org.teiid.translator.ExecutionContext;
@@ -52,7 +57,7 @@
  *
  */
 
-public abstract class ObjectExecutionFactory extends ExecutionFactory<Object, Object> {
+public abstract class ObjectExecutionFactory extends ExecutionFactory<ConnectionFactory, ObjectCacheConnection > {
 	public static final int MAX_SET_SIZE = 100;
 
 	/*
@@ -63,6 +68,9 @@
 	
 	private boolean columnNameFirstLetterUpperCase = true;
 	private String packageNamesOfCachedObjects = null;
+	private String classNamesOfCachedObjects = null;
+	private String cacheName = null;
+	private String objectRelationShips = null;
 	
 	public ObjectExecutionFactory() {
 		super();
@@ -82,13 +90,16 @@
 		
     @Override
     public void start() throws TranslatorException {
+    	super.start();
     	createObjectMethodManager();
+    	
     }
    
     @Override
-    public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Object connection)
+    public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, ObjectCacheConnection connection)
     		throws TranslatorException {
-    	return new ObjectExecution((Select)command, metadata, createProxy(connection), objectMethods);
+    	return new ObjectExecution((Select)command, metadata, createProxy(connection), objectMethods, this);
+    	  
     }    
   
 	public List getSupportedFunctions() {
@@ -99,8 +110,50 @@
     	return true;
     }
     
-    
+	
 	/**
+	 * 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 object relationships.  
+	 * @return
+	 * @see #setObjectRelationships(String)
+	 */
+	@TranslatorProperty(display="ObjectRelationShips", advanced=true)
+	public String getObjectRelationships() {
+		return this.objectRelationShips;
+	}
+	
+	/**
+	 * Set the object relationships so that the metadata relationships can be built.  Specify the 
+	 * relationships using the format:  <simple classname>.<getMethod>:<simple classname> 
+	 * @param cacheName
+	 * @see #getObjectRelationships()
+	 */
+	
+	public void setObjectRelationships(String objectRelationships) {
+		this.objectRelationShips = objectRelationships;
+	} 
+	
+	/**
 	 * <p>
 	 * Returns a comma separated list of package names for the cached objects.
 	 * </p>
@@ -120,6 +173,25 @@
 	public void setPackageNamesOfCachedObjects(String packageNamesOfCachedObjects) {
 		this.packageNamesOfCachedObjects = packageNamesOfCachedObjects;
 	}
+	
+	/**
+	 * Call to get a comma separated list of class names to use. 
+	 * @return
+	 */
+	@TranslatorProperty(display="ClassNamesOfCachedObjects (CSV)", advanced=true)
+	public String getClassNamesOfCachedObjects() {
+		return this.classNamesOfCachedObjects;
+	}
+	
+	/**
+	 * <p>
+	 * Call to set class names for the cached objects
+	 * </p>
+	 * @param String commo separated list of package names
+	 */
+	public void setClassNamesOfCachedObjects(String classNamesOfCachedObjects) {
+		this.classNamesOfCachedObjects = classNamesOfCachedObjects;
+	}	
 
   
 	/**
@@ -164,9 +236,11 @@
 
     
     @Override
-	public void getMetadata(MetadataFactory metadataFactory, Object conn)
+	public void getMetadata(MetadataFactory metadataFactory, ObjectCacheConnection conn)
 			throws TranslatorException {
-
+    	createObjectMethodManager();
+ 		ObjectMetadataProcessor processor = new ObjectMetadataProcessor(metadataFactory, this);
+		processor.processMetadata();
 	}
 	
 	
@@ -182,58 +256,138 @@
 	 * @return IObjectConnectionProxy
 	 * @throws TranslatorException
 	 */
-	protected abstract ObjectSourceProxy createProxy(Object connection) throws TranslatorException ;
+	protected abstract ObjectSourceProxy createProxy(ObjectCacheConnection connection) throws TranslatorException ;
 
 	protected void createObjectMethodManager() throws TranslatorException {
-    	if (objectMethods == null) {
-    		objectMethods = ObjectMethodManager.initialize(getClassesForPackage(this.packageNamesOfCachedObjects), 
-    				isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
-    	}
+	    	if (objectMethods == null) {
+	
+	    		List<String> classes = new ArrayList<String>();
+	    		if (this.classNamesOfCachedObjects != null) {
+	    			classes = StringUtil.split(this.classNamesOfCachedObjects, ",");
+	    			
+	    		} else if (this.packageNamesOfCachedObjects != null && this.packageNamesOfCachedObjects.trim().length() > 0) {
+		    		List<String> packageNames = StringUtil.split(this.packageNamesOfCachedObjects, ",");
+		    		
+		    		for (String packageName : packageNames) {
+		    			classes.addAll(getClassesInPackage(packageName, null));
+		    		}
+	    		}
+		    		
+		    	objectMethods = ObjectMethodManager.initialize( classes, isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
+	    	}
 	}
-	
-	protected List<String> getClassesForPackage(String pkgname) throws TranslatorException {
-		if (pkgname == null) return Collections.EMPTY_LIST;
-	    ArrayList<String> classes = new ArrayList<String>();
-	    // Get a File object for the package
-	    File directory = null;
-	    String fullPath;
-	    String relPath = pkgname.replace('.', '/');
-	    URL resource = ClassLoader.getSystemClassLoader().getResource(relPath);
-	    if (resource == null) {
-	        throw new TranslatorException(ObjectPlugin.Util
-			.getString(
-					"ObjectExecutionFactory.noResourceFound", new Object[] { relPath })); //$NON-NLS-1$    
 
-	    }
-	    fullPath = resource.getFile();
+	/**
+	 * Scans all classes accessible from the context class loader which belong to the given package and subpackages.
+	 * Adapted from http://snippets.dzone.com/posts/show/4831 and extended to support use of JAR files
+	 *
+	 * @param packageName The base package
+	 * @param regexFilter an optional class name pattern.
+	 * @return The classes
+	 */
+	protected List<String> getClassesInPackage(String packageName, String regexFilter) throws TranslatorException{
+		if (packageName == null) return Collections.EMPTY_LIST;
 
-	    try {
-	        directory = new File(resource.toURI());
-	    } catch (URISyntaxException e) {
-	        throw new TranslatorException(ObjectPlugin.Util
-	    			.getString(
-	    					"ObjectExecutionFactory.invalidResource", new Object[] { pkgname, resource })); //$NON-NLS-1$    
-	    	
-	    } catch (IllegalArgumentException e) {
-	        directory = null;
-	    }
+		Pattern regex = null;
+		if (regexFilter != null)
+			regex = Pattern.compile(regexFilter);
 
-	    if (directory != null && directory.exists()) {
-	        // Get the list of the files contained in the package
-	        String[] files = directory.list();
-	        for (int i = 0; i < files.length; i++) {
-	            // we are only interested in .class files
-	            if (files[i].endsWith(".class") && !files[i].contains("$") ) {
-	                // removes the .class extension
-	                String className = pkgname + '.' + files[i].substring(0, files[i].length() - 6);
-                    classes.add(className);
-                    
-					LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ClassDiscovery", className); //$NON-NLS-1$
+		try {
+			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+			assert classLoader != null;
+			String path = packageName.replace('.', '/');
+			Enumeration<URL> resources = classLoader.getResources(path);
+			List<String> dirs = new ArrayList<String>();
+			while (resources.hasMoreElements()) {
+				URL resource = resources.nextElement();
+				dirs.add(resource.getFile());
+			}
+			if (dirs.isEmpty()) {
+				classLoader = this.getClass().getClassLoader();
+				assert classLoader != null;
+				resources = classLoader.getResources(path);
+				while (resources.hasMoreElements()) {
+					URL resource = resources.nextElement();
+					dirs.add(resource.getFile());
+				}
+				if (dirs.isEmpty()) {				
+			        throw new TranslatorException(ObjectPlugin.Util
+			        		.getString(
+							"ObjectExecutionFactory.noResourceFound", new Object[] { packageName })); //$NON-NLS-1$   
+				}
+	
+		    }
 
-	            }
-	        }
-	    }
-	    return classes;
+			TreeSet<String> classes = new TreeSet<String>();
+			for (String directory : dirs) {
+				classes.addAll(findClasses(directory, packageName, regex));
+			}
+			ArrayList<String> classNames = new ArrayList<String>();
+//			ArrayList<Class> classList = new ArrayList<Class>();
+			for (String clazz : classes) {
+				classNames.add(clazz);
+			}
+//			return classList.toArray(new Class[classes.size()]);
+//			
+				        
+	        return classNames;			
+			
+		} catch (TranslatorException te) {
+			throw te;
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new TranslatorException(e);
+		}
 	}
 
+	/**
+	 * Recursive method used to find all classes in a given path (directory or zip file url).  Directories
+	 * are searched recursively.  (zip files are
+	 * Adapted from http://snippets.dzone.com/posts/show/4831 and extended to support use of JAR files
+	 *
+	 * @param path   The base directory or url from which to search.
+	 * @param packageName The package name for classes found inside the base directory
+	 * @param regex       an optional class name pattern.  e.g. .*Test
+	 * @return The classes
+	 */
+	private static TreeSet<String> findClasses(String path, String packageName, Pattern regex) throws Exception {
+		TreeSet<String> classes = new TreeSet<String>();
+		if (path.startsWith("file:") && path.contains("!")) {
+			
+		} else if (path.indexOf(".jar") > -1) {
+			int idx =  path.indexOf(".jar") + 4;
+        	path = "file:" + path.substring(0, idx) + "!" + path.substring(idx + 1) ;
+        }
+		if (path.startsWith("file:") && path.contains("!")) {
+			String[] split = path.split("!");
+			URL jar = new URL(split[0]);
+			ZipInputStream zip = new ZipInputStream(jar.openStream());
+			ZipEntry entry;
+			while ((entry = zip.getNextEntry()) != null) {
+				if (entry.getName().endsWith(".class")) {
+					String className = entry.getName().replaceAll("[$].*", "").replaceAll("[.]class", "").replace('/', '.');
+					if (className.startsWith(packageName) && (regex == null || regex.matcher(className).matches()))
+						classes.add(className);
+				}
+			}
+		}
+		File dir = new File(path);
+		if (!dir.exists()) {
+			return classes;
+		}
+		File[] files = dir.listFiles();
+		for (File file : files) {
+			if (file.isDirectory()) {
+				assert !file.getName().contains(".");
+				classes.addAll(findClasses(file.getAbsolutePath(), packageName + "." + file.getName(), regex));
+			} else if (file.getName().endsWith(".class")) {
+				String className = packageName + '.' + file.getName().substring(0, file.getName().length() - 6);
+				if (regex == null || regex.matcher(className).matches())
+					classes.add(className);
+			}
+		}
+		return classes;
+	}
+	
+
 }

Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMetadataProcessor.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMetadataProcessor.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMetadataProcessor.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,220 @@
+/*
+ * 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.lang.reflect.Method;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Column.SearchType;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
+
+
+/**
+ * Reads from {@link ObjectMethodManager} and creates metadata through the {@link MetadataFactory}.
+ */
+public class ObjectMetadataProcessor {
+	
+
+	private boolean widenUnsingedTypes = true;
+	private Set<String> unsignedTypes = new HashSet<String>();
+	private MetadataFactory metadataFactory;
+	private ObjectExecutionFactory connectorEnv;
+	
+	private Map<String, Table> tableMap = new HashMap<String, Table>();
+//	private List<Relationship> relationships = new ArrayList<Relationship>();
+
+	
+	public ObjectMetadataProcessor(MetadataFactory metadataFactory, ObjectExecutionFactory env) {
+		this.metadataFactory = metadataFactory;
+		this.connectorEnv = env;
+	}
+	
+	public void processMetadata() throws TranslatorException {
+			
+			ObjectMethodManager mgr = connectorEnv.getObjectMethodManager();
+			
+			Iterator<String> cnIt = mgr.keySet().iterator();
+			while (cnIt.hasNext()) {
+				String className = (String) cnIt.next();
+						
+				ObjectMethodManager.ClassMethods cm = mgr.getClassMethods(className);
+
+				addTable(cm);
+				
+				
+			}
+
+//			addRelationships();
+	}
+
+	
+	private void addTable(ObjectMethodManager.ClassMethods cm) throws TranslatorException {
+
+		if (cm == null || !cm.hasMethods()) {
+			
+	        LogManager.logWarning(LogConstants.CTX_CONNECTOR, ObjectPlugin.Util
+	    			.getString(
+	    					"ObjectExecutionFactory.missingClassMethods", new Object[] { cm.getClassIdentifier().getName() })); //$NON-NLS-1$  
+
+		}
+		
+		String className = cm.getClassName();
+		String tableName = getTableName(className);
+		
+		Table table = metadataFactory.addTable(tableName);
+		table.setNameInSource(className);
+		table.setSupportsUpdate(false);
+		table.setAnnotation("Class: "+ className);
+		
+		tableMap.put(tableName, table);
+//		getRelationships(objectMetadata);
+
+		addColumns(cm, table);
+		
+		
+	}
+	
+	
+	private String getTableName(String className) {
+		String tableName = null;
+		int idx = className.lastIndexOf(".");
+		if (idx > 0) {
+			tableName = className.substring(idx + 1);
+		} else {
+			tableName = className;
+		}
+		return tableName;
+
+	}
+	
+	private void addColumns(ObjectMethodManager.ClassMethods cm, Table table) throws TranslatorException {
+		Map<String, Method> methods = cm.getGetters();
+		
+		Column column = null;
+		Iterator<String> mIts = methods.keySet().iterator();
+		while (mIts.hasNext()) {
+			String methodName = mIts.next();
+			Method m = methods.get(methodName);
+
+			methodName=methodName.substring( methodName.indexOf("get") + 3);
+			
+			String runtimeType = getRuntimeType(m.getReturnType());
+			
+			column = metadataFactory.addColumn(methodName, runtimeType, table);
+			String simpleName = m.getReturnType().getSimpleName();
+			column.setNativeType(simpleName);
+			
+//			String columnName = columns.getString(4);
+//			int type = columns.getInt(5);
+//			String typeName = columns.getString(6);
+//			int columnSize = columns.getInt(7);
+//			String runtimeType = getRuntimeType(type, typeName, columnSize);
+//			//note that the resultset is already ordered by position, so we can rely on just adding columns in order
+//			Column column = metadataFactory.addColumn(columnName, runtimeType, tableInfo.table);
+//			column.setNameInSource(quoteName(columnName));
+//			column.setPrecision(columnSize);
+//			column.setLength(columnSize);
+//			column.setNativeType(typeName);
+//			column.setRadix(columns.getInt(10));
+//			column.setNullType(NullType.values()[columns.getShort(11)]);
+//			column.setUpdatable(true);
+//			String remarks = columns.getString(12);
+//			column.setAnnotation(remarks);
+//			String defaultValue = columns.getString(13);
+//			column.setDefaultValue(defaultValue);			
+			
+			
+			if (runtimeType.equalsIgnoreCase("blob") || runtimeType.equalsIgnoreCase("clob") || runtimeType.equalsIgnoreCase("object")) {
+				column.setSearchType(SearchType.Unsearchable);
+				column.setSelectable(false);
+			}
+			
+			if (runtimeType.equalsIgnoreCase("string")) {
+				column.setLength(4000);
+			}
+
+		}
+		
+		methods = cm.getIses();
+		
+		mIts = methods.keySet().iterator();
+		while (mIts.hasNext()) {
+			String methodName = mIts.next();
+			Method m = methods.get(methodName);
+			
+			methodName=methodName.substring( methodName.indexOf("is") + 2);							
+			
+			String simpleName = m.getReturnType().getSimpleName();
+			String runtimeType = getRuntimeType(m.getReturnType());
+			
+			column = metadataFactory.addColumn(methodName, runtimeType, table);
+			
+			column.setNativeType(simpleName);
+			
+		}	
+	}
+	
+	
+	private String getRuntimeType(Class attributeType) {
+		
+		Class datatypeClass = DataTypeManager.getDataTypeClass(attributeType.getSimpleName());
+		
+		int sqlType = TypeFacility.getSQLTypeFromRuntimeType(datatypeClass);
+			
+		sqlType = checkForUnsigned(sqlType, attributeType.getSimpleName());
+		
+		return TypeFacility.getDataTypeNameFromSQLType(  sqlType );
+	}
+	
+
+
+	private int checkForUnsigned(int sqlType, String typeName) {
+		if (widenUnsingedTypes && unsignedTypes.contains(typeName)) {
+			switch (sqlType) {
+			case Types.TINYINT:
+				sqlType = Types.SMALLINT;
+				break;
+			case Types.SMALLINT:
+				sqlType = Types.INTEGER;
+				break;
+			case Types.INTEGER:
+				sqlType = Types.BIGINT;
+				break;
+			}
+		}
+		return sqlType;
+	}
+	
+}

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -26,7 +26,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -56,10 +55,17 @@
 			this.clz = clzz;
 		}
 		
-		String getClassName() {
+		public Class getClassIdentifier() {
+			return this.clz;
+		}
+		public String getClassName() {
 			return this.clz.getName();
 		}
 		
+		public boolean hasMethods() {
+			return (!getters.isEmpty() || !is.isEmpty() || !setters.isEmpty());
+		}
+		
 		public Map<String, Method> getGetters() {
 			return getters;
 		}

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -27,9 +27,12 @@
 	
 	// this is the number of children deep this query is requesting information
 	protected int childrenDepth = -1;  // 
+	// this is the path of method calls to traverse the children
 	protected List<String> childrenNodes = null;
 	
 	protected List<String> exceptionMessages = new ArrayList<String>(2);
+	
+	protected String rootNodeClassName = null;
 
 	
 	public ObjectProjections(Select query) {
@@ -50,26 +53,20 @@
 	
 	@SuppressWarnings("unchecked")
 	private void parse(Select query) {
+		columns = getSelectableColumns(query);
+		columnNamesToUse = new String[columns.length];
+		nameNodes = new ArrayList[columns.length];
+		nodeDepth = new int[columns.length];  
 		
-		Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
-		
-		int s = query.getDerivedColumns().size();
-		columns = new Column[s];
-		columnNamesToUse = new String[s];
-		nameNodes = new ArrayList[s];
-		nodeDepth = new int[s];  
-		
 		String maxDepthColumnNameToUse = null;
 		
-		int i=0;
-		while(selectSymbolItr.hasNext()) {
-			columns[i] = getColumnFromSymbol(selectSymbolItr.next());
+		for (int i=0; i<columns.length; ++i) {
 			columnNamesToUse[i] = getColumnNameToUse(columns[i]);
 			
 			nameNodes[i] = StringUtil.getTokens(columnNamesToUse[i], ".");
 			nodeDepth[i] = nameNodes[i].size() - 1;  // if one node name, then depth is zero, and incremented from there
 			
-			// only when there are multiple node names will a container be involved
+			// only when there are multiple node names will a container/child be involved
 			if (nodeDepth[i] > 0) {
 				if (childrenDepth == -1) {
 					childrenDepth = nodeDepth[i];
@@ -91,11 +88,35 @@
 				}
 			}
 					
-			i++;
 		}
 		
 	}
 
+	private Column[] getSelectableColumns(Select query) {
+		Column[] interimColumns =  new Column[query.getDerivedColumns().size()];
+		
+		Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
+		int i=0;
+		while(selectSymbolItr.hasNext()) {
+			Column c = getColumnFromSymbol(selectSymbolItr.next());
+			if (!c.isSelectable()) continue;
+			
+			interimColumns[i] = c;
+			++i;
+		}
+		
+		// if all columns are included, then return, no need to rebuild the array
+		if (interimColumns.length == i+1) {
+			return interimColumns;
+		}
+		
+		Column[] columns =  new Column[i];
+		for (int x=0; x<i; ++x) {
+			columns[x] = interimColumns[x];
+		}
+		return columns;
+	
+	}
 
 	private void addException(String columnNameToUse1,
 			String columnNameToUse2, String table) {
@@ -154,6 +175,14 @@
 		return (parentNodeName != null ? parentNodeName + "." : "") + nis;
 	}
 	
+	protected void setRootClassName(Table t) {
+		if (this.rootNodeClassName != null) return;
+		
+		if (t.getNameInSource() != null) {
+			this.rootNodeClassName = t.getNameInSource();
+		}
+	}
+	
 	  
 	protected  String getNameInSourceFromColumn(Column c) {
 		String name = c.getNameInSource();
@@ -167,6 +196,8 @@
 	protected  String getForeignKeyNodeName(Table t) {
 		if (t == null) return null;
 		
+		setRootClassName(t);
+	
 		if (t.getForeignKeys() != null && !t.getForeignKeys().isEmpty()) {
 			ForeignKey fk = (ForeignKey)  t.getForeignKeys().get(0);
 			String fk_nis = fk.getNameInSource();

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -28,15 +28,10 @@
 
 /**
  * <p>
- * ObjectSourceProxy interface is how the translator will ask for objects from the cache based on
- * the {@link Command}. The visitor will provide a parsed query such that the
- * the proxy implementor can use the criteria to perform vendor specific logic to obtain
- * objects from the cache. 
+ * ObjectSourceProxy interface is implemented for a specific Object data source.  That
+ * implementation will be responsible for adding its query logic for translating the
+ * {@link Command} into vendor specific syntax for querying the cache.
  * </p> 
- * <p>
- * The specific proxy implementation will be instantiated by  {@link ObjectExecutionFactory}.
- * Passing in the connection object and ObjectExecutionFactory.
- * </P
  * 
  * @author vhalbert
  *
@@ -45,14 +40,17 @@
 public interface ObjectSourceProxy {
 		
 	/**
-	 * Called by {@link ObjectExecution}, passing in the sql <code>command</code>, to obtain the objects from 
-	 * the cache based.  The implementor will need to parse the command and interpret the criteria according
+	 * Called by {@link ObjectExecution}, passing in the sql {@link Command command}, the cache to be
+	 * queries and the <code>rootClassName</code> to identify the object type to be obtained from
+	 * the cachee.  The implementor will need to parse the command and interpret the criteria according
 	 * to data source query syntax.
 	 * @param command is the SELECT command to query the data source
+	 * @param cacheName is the name of the cache to query
+	 * @param rootClassName is the class type of the object in the cache
 	 * @return List of objects found in the cache.
 	 * @throws TranslatorException is thrown if there are issues querying the data source
 	 */
-	List<Object> get(Command command) throws TranslatorException;
+	List<Object> get(Command command, String cacheName, String rootClassName) throws TranslatorException;
 
 	
 	/**

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -29,6 +29,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.types.DataTypeManager.DefaultDataClasses;
+import org.teiid.core.types.DataTypeManager.DefaultTypeCodes;
+import org.teiid.core.types.TransformationException;
 import org.teiid.translator.TranslatorException;
 
 /**
@@ -250,31 +254,65 @@
 	}
 	
 	private static Object getValue(Object cachedObject, int columnIdx, int methodIdx, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
+		Object value = null;
 
-
 		// only the last parsed name can be where the boolean call can be made
 		// example: x.y.z z will be where "is" is called
 		// or x x could be where "is" is called
 		Class<?> clzType = projections.columns[columnIdx].getJavaType();
+		
+		if (cachedObject.getClass().equals(clzType)) {
+			return cachedObject;
+		}
 
+		Class dataTypeClass = DataTypeManager.getDataTypeClass(cachedObject.getClass().getName());
 
-		Object value = null;
-			
-		if (clzType != null && clzType == Boolean.class) {
-			final String methodName = objectManager.formatMethodName(
-					ObjectMethodManager.IS, projections.nameNodes[columnIdx].get(methodIdx) );
-			
-			value = objectManager.getIsValue(
-					methodName, cachedObject);	
+		// if the class is not a native type, but the POJO object, then
+		// call the method on the class to get the value
+		if (dataTypeClass == DefaultDataClasses.OBJECT) {
+			if (clzType != null && clzType == Boolean.class) {
+				final String methodName = objectManager.formatMethodName(
+						ObjectMethodManager.IS, projections.nameNodes[columnIdx].get(methodIdx) );
+				
+				value = objectManager.getIsValue(
+						methodName, cachedObject);	
+			} else {
+				final String methodName = objectManager.formatMethodName(
+						ObjectMethodManager.GET, projections.nameNodes[columnIdx].get(methodIdx) );
+				
+				value = objectManager.getGetValue(
+						methodName, cachedObject);
+				
+			}			
 		} else {
-			final String methodName = objectManager.formatMethodName(
-					ObjectMethodManager.GET, projections.nameNodes[columnIdx].get(methodIdx) );
-			
-			value = objectManager.getGetValue(
-					methodName, cachedObject);
-			
-		}		
 		
+			int datatype = DataTypeManager.getTypeCode(cachedObject.getClass());		
+	
+			switch (datatype) {
+			case DefaultTypeCodes.OBJECT:
+			case DefaultTypeCodes.CLOB:
+			case DefaultTypeCodes.BLOB:
+				
+				break;
+	
+			default:
+				
+				try {
+					if (DataTypeManager.isTransformable(cachedObject.getClass(), clzType)) {
+						value = DataTypeManager.getTransform(cachedObject.getClass(), clzType).transform(cachedObject);
+					} else {
+						return cachedObject;
+					}
+				} catch (TransformationException e) {
+					// TODO Auto-generated catch block
+					throw new TranslatorException(e);
+				}				
+				
+				break;
+			}
+		}
+		
+	
 		return value;
 	}		
 

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -25,16 +25,20 @@
 import java.util.Collections;
 import java.util.Map;
 
+import javax.resource.cci.ConnectionFactory;
+
+import org.teiid.translator.ExecutionFactory;
 import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.TranslatorProperty;
+import org.teiid.translator.object.ObjectCacheConnection;
 import org.teiid.translator.object.ObjectExecutionFactory;
 import org.teiid.translator.object.ObjectMethodManager;
 import org.teiid.translator.object.ObjectSourceProxy;
 import org.teiid.translator.object.util.ObjectMethodUtil;
 
 @Translator(name="mapCacheExample", description="The Example Map Cache Factory")
-public class MapCacheExecutionFactory extends ObjectExecutionFactory {
+public class MapCacheExecutionFactory extends  ObjectExecutionFactory {
 	private static final String LOADCACHE_METHOD_NAME = "loadCache";
 	private String cacheLoaderClassName = null;
 	
@@ -98,7 +102,7 @@
 	}
 
 	@Override
-	protected ObjectSourceProxy createProxy(Object connection)
+	protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
 			throws TranslatorException {
 
 		return new MapCacheProxy(connection, this);

Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -22,6 +22,7 @@
 package org.teiid.translator.object.example;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -31,12 +32,12 @@
 
 public class MapCacheProxy implements ObjectSourceProxy {
 	private MapCacheObjectVisitor visitor = new MapCacheObjectVisitor();
-	private Object connection;
+//	private Object connection;
 	private MapCacheExecutionFactory factory;
 	
 
 	public MapCacheProxy(Object connection, MapCacheExecutionFactory factory) {
-		this.connection = connection;
+//		this.connection = connection;
 		this.factory = factory;
 	}
 
@@ -47,7 +48,7 @@
 
 
 	@Override
-	public List<Object> get(Command command) throws TranslatorException {
+	public List<Object> get(Command command, String cache, String rootClassName) throws TranslatorException {
 		visitor.visitNode(command);
 
 		List<Object> results = null;
@@ -55,17 +56,21 @@
 			results = new ArrayList<Object>(1);
 			results.add(getCache().get(visitor.value));
 			return results;
-			
+		} else if (visitor.in) {
+			results = new ArrayList(visitor.parms.size());
+			for (Iterator it=visitor.parms.iterator(); it.hasNext();) {
+				results.add(getCache().get(it.next()));
+			}
+			return results;
+		
 		} else {
 			results = new ArrayList<Object>();
 			results.addAll(getCache().values());
-			return results;
-			
+			return results;			
 		}
 	}
 	
 
-
 	@Override
 	public void close() {
 		

Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanObjectVisitor.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanObjectVisitor.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanObjectVisitor.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,348 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.language.AggregateFunction;
+import org.teiid.language.ColumnReference;
+import org.teiid.language.Comparison;
+import org.teiid.language.Comparison.Operator;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.In;
+import org.teiid.language.Like;
+import org.teiid.language.Literal;
+import org.teiid.language.ScalarSubquery;
+import org.teiid.language.SearchedCase;
+import org.teiid.language.visitor.HierarchyVisitor;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectPlugin;
+
+
+/**
+ * This is an example of extending ObjectVisitor, providing query access to a local Map object cache
+ */
+public class InfinispanObjectVisitor extends HierarchyVisitor  {
+	
+    protected TranslatorException exception;
+	public String tableName;
+	public String columnName;
+	public Object value;
+	public Class<?> classType;
+	public List<Object> parms;
+	public Operator op;
+	
+	public boolean like = false;
+	public boolean compare = false;
+	public boolean in = false;
+
+    /**
+     * 
+     */
+    public InfinispanObjectVisitor() {
+        super();         
+    }
+    
+    
+
+	public List<Object> getKeyCriteria() {
+		// TODO Auto-generated method stub
+		if (parms != null) return parms;
+		
+		if (value == null) return Collections.EMPTY_LIST;
+		
+		List result = new ArrayList(1);
+		result.add(value);
+		return result;
+	}
+
+
+
+
+	public void addCompareCriteria(String tableName,
+			String columnName, Object value, Operator op,
+			Class<?> type) throws TranslatorException {
+		this.tableName = tableName;
+		this.columnName = columnName;
+		this.op = op;
+		this.value = value;
+		this.compare = true;
+		this.classType = type;
+	}
+	
+	public void addLikeCriteria(String tableName,
+			String columnName, Object value)
+			throws TranslatorException {
+		this.tableName = tableName;
+		this.columnName = columnName;
+		this.value = value;
+		this.like = true;
+	}	
+	
+	public void addInCriteria(String tableName, String columnName,
+			List<Object> parms, Class<?> type)
+			throws TranslatorException {
+		this.tableName = tableName;
+		this.columnName = columnName;
+		this.parms = parms;
+		this.in = true;
+		this.classType = type;	
+	}	
+  
+    public TranslatorException getException() {
+        return this.exception;
+    }
+    
+	
+    public void visit(Comparison obj) {
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing Comparison criteria."); //$NON-NLS-1$
+		try {	
+			
+			Comparison.Operator op = ((Comparison) obj).getOperator();
+	       
+			Expression lhs = ((Comparison) obj).getLeftExpression();
+			Expression rhs = ((Comparison) obj).getRightExpression();
+			
+			// comparison between the ojbects is not usable, because the nameInSource and its parent(s) 
+			// will be how the child objects are obtained
+			if (lhs instanceof ColumnReference && rhs instanceof ColumnReference) {
+				return;
+			}
+
+	
+			String lhsString = getExpressionString(lhs);
+			String rhsString = getExpressionString(rhs);
+			if(lhsString == null || rhsString == null) {
+	            final String msg = ObjectPlugin.Util.getString("ObjectVisitor.missingComparisonExpression"); //$NON-NLS-1$
+				exception = new TranslatorException(msg); 
+			}
+
+			if (rhs instanceof Literal || lhs instanceof Literal) {
+		        if(rhs instanceof Literal) {
+		            Literal literal = (Literal) rhs;		            
+					String tableName = getTableNameFromColumnObject(lhs);
+					addCompareCriteria(tableName, lhsString, literal.getValue(), op, literal.getType());
+		            
+		        } else {
+		            Literal literal = (Literal) lhs;
+		            String tableName = getTableNameFromColumnObject(rhs);
+		            addCompareCriteria(tableName, rhsString, literal.getValue(), op, literal.getType());
+
+		        	
+		        }
+			}
+		}catch (TranslatorException t) {
+			exception = t;
+		}
+    }
+
+    
+    public void visit(Like obj) {
+    	
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing LIKE criteria."); //$NON-NLS-1$
+//		isNegated = ((Like) criteria).isNegated();
+		// Convert LIKE to Equals, where any "%" symbol is replaced with "*".
+		try {
+			
+			Comparison.Operator op = Operator.EQ;
+			Expression lhs = ((Like) obj).getLeftExpression();
+			Expression rhs = ((Like) obj).getRightExpression();
+			
+			String tableName = getTableNameFromColumnObject(lhs);
+			if (tableName == null) {
+				tableName = getTableNameFromColumnObject(rhs);
+			}
+		
+			String lhsString = getExpressionString(lhs);
+			String rhsString = getExpressionString(rhs);
+			
+            addLikeCriteria(tableName, lhsString, rhsString);
+
+		}catch (TranslatorException t) {
+			exception = t;
+		}
+    }
+
+    
+    public void visit(In obj) {
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
+//		isNegated = ((In) criteria).isNegated();
+		try {
+			
+			Expression lhs = ((In)obj).getLeftExpression();
+			
+			String tableName = getTableNameFromColumnObject(lhs);
+			String colName = getExpressionString(lhs);
+			
+			List<Expression> rhsList = ((In)obj).getRightExpressions();
+	
+			Class type = lhs.getType();
+			List parms = new ArrayList(rhsList.size());
+	        Iterator iter = rhsList.iterator();
+	        while(iter.hasNext()) {
+	  
+	            Expression expr = (Expression) iter.next();
+	            type = addParmFromExpression(expr, parms);
+	            
+	        }
+	        addInCriteria(tableName, colName, parms, type);
+	        
+		}catch (TranslatorException t) {
+			exception = t;
+		}
+	        
+    }
+    
+    protected String getTableNameFromColumnObject(Object e)  {
+    	Column col = null;
+		if(e instanceof ColumnReference) {
+			col = ((ColumnReference)e).getMetadataObject();
+		} else if (e instanceof Column) {
+			col = (Column) e;
+		}
+			
+		Object p = col.getParent();
+		if (p instanceof Table) {
+			Table t = (Table)p;
+			return t.getName();
+		}			
+
+		return null;
+    	
+    }
+    
+    protected  Class addParmFromExpression(Expression expr, List parms ) {
+    	Class type = null;
+        if(expr instanceof Literal) {
+        	Long longparm = null;
+            Literal literal = (Literal) expr;
+            
+            parms.add(literal);
+            
+            type = literal.getType();
+  
+        } else {
+            this.exception = new TranslatorException("ObjectVisitor.Unsupported_expression" + expr); //$NON-NLS-1$
+        }
+        
+        return type;
+         
+    }
+
+	    
+	// GHH 20080326 - found that code to fall back on Name if NameInSource
+	// was null wasn't working properly, so replaced with tried and true
+	// code from another custom connector.
+	private  String getExpressionString(Expression e) throws TranslatorException {
+		String expressionName = null;
+		// GHH 20080326 - changed around the IElement handling here
+		// - the rest of this method is unchanged
+		if(e instanceof ColumnReference) {
+			Column mdIDElement = ((ColumnReference)e).getMetadataObject();
+			expressionName = getNameInSourceFromColumn(mdIDElement);
+//			expressionName = mdIDElement.getNameInSource();
+//			if(expressionName == null || expressionName.equals("")) {  //$NON-NLS-1$
+//				expressionName = mdIDElement.getName();
+//			}
+		} else if(e instanceof Literal) {
+//			try {
+//				if(((Literal)e).getType().equals(Class.forName(Timestamp.class.getName()))) {
+//					LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Found an expression that uses timestamp; converting to LDAP string format."); //$NON-NLS-1$
+//					Timestamp ts = (Timestamp)((Literal)e).getValue();
+//					Date dt = new Date(ts.getTime());
+//					//TODO: Fetch format if provided.
+//					SimpleDateFormat sdf = new SimpleDateFormat(LDAPConnectorConstants.ldapTimestampFormat);
+//					expressionName = sdf.format(dt);
+//					LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Timestamp to stsring is: " + expressionName); //$NON-NLS-1$
+//				}
+//				else {
+//					expressionName = ((Literal)e).getValue().toString();
+//				}
+				
+				expressionName = ((Literal)e).getValue().toString();
+//			} catch (ClassNotFoundException cce) {
+//	            final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.timestampClassNotFoundError"); //$NON-NLS-1$
+//				throw new TranslatorException(cce, msg); 
+//			}
+//				
+		} else {
+			if(e instanceof AggregateFunction) {
+				LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IAggregate, but it is not supported. Check capabilities."); //$NON-NLS-1$
+			} else if(e instanceof Function) {
+				LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IFunction, but it is not supported. Check capabilties."); //$NON-NLS-1$
+			} else if(e instanceof ScalarSubquery) {
+				LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IScalarSubquery, but it is not supported. Check capabilties."); //$NON-NLS-1$
+			} else if (e instanceof SearchedCase) {
+				LogManager.logError(LogConstants.CTX_CONNECTOR, "Received ISearchedCaseExpression, but it is not supported. Check capabilties."); //$NON-NLS-1$
+			}
+            final String msg = ObjectPlugin.Util.getString("ObjectVisitor.unsupportedElementError" , e.toString()); //$NON-NLS-1$
+			throw new TranslatorException(msg); 
+		}
+		expressionName = escapeReservedChars(expressionName);
+		return expressionName;
+	}
+	
+	protected  String getNameInSourceFromColumn(Column c) {
+		String name = c.getNameInSource();
+		if(name == null || name.equals("")) {  //$NON-NLS-1$
+			return c.getName();
+		}
+		return name;
+	}   	
+	
+	protected static String escapeReservedChars(final String expr) {
+		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();
+	}	
+	
+}

Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanProxy.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanProxy.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanProxy.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,86 @@
+/*
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.teiid.core.BundleUtil;
+import org.teiid.language.Command;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectCacheConnection;
+import org.teiid.translator.object.ObjectSourceProxy;
+
+/** 
+ * Represents an implementation for the connection to an Infinispan local cache data source. 
+ */
+public class InfinispanProxy implements ObjectSourceProxy { 
+	
+	public static final BundleUtil UTIL = BundleUtil.getBundleUtil(InfinispanProxy.class);
+	
+	private InfinispanObjectVisitor visitor = new InfinispanObjectVisitor();
+	private InfinispanRemoteExecutionFactory factory;
+	private ObjectCacheConnection connection;
+	
+	public InfinispanProxy(ObjectCacheConnection connection, InfinispanRemoteExecutionFactory factory) {
+		this.factory = factory;
+		this.connection = connection;
+	}
+
+
+	@Override
+	public void close() {
+		this.visitor = null;
+		this.factory = null;
+	}
+
+
+	@Override
+	public List<Object> get(Command command, String cache, String rootClassName) throws TranslatorException {
+		visitor.visitNode(command);
+		
+		Class<?> rootClass = null;
+		if (this.factory.getObjectMethodManager().getClassMethods(rootClassName) == null) {
+			rootClass = this.factory.getObjectMethodManager().loadClassByName(rootClassName, null);
+		} else {
+			rootClass = this.factory.getObjectMethodManager().getClassMethods(rootClassName).getClassIdentifier();
+		}
+		try {
+			return connection.get(visitor.getKeyCriteria(), cache, rootClass);
+		} catch (Exception e) {
+			throw new TranslatorException(e.getMessage());
+		}
+		
+	}
+	
+	public  String formatColumnName(String columnName) {
+		if (factory.isColumnNameFirstLetterUpperCase()) return columnName;
+		
+		return  columnName.substring(0, 1).toLowerCase() + columnName.substring(1);
+	}
+
+}

Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/infinispan/InfinispanRemoteExecutionFactory.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,30 @@
+package org.teiid.translator.object.infinispan;
+
+
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectCacheConnection;
+import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectSourceProxy;
+
+ at Translator(name="infinispanRemote", description="The Execution Factory for Remote Infinispan Cache")
+public class InfinispanRemoteExecutionFactory extends ObjectExecutionFactory {
+	
+	public InfinispanRemoteExecutionFactory() {
+		super();
+	}
+
+	@Override
+	public void start() throws TranslatorException {
+		super.start();
+  	
+	}
+
+
+	protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
+			throws TranslatorException {
+		return new InfinispanProxy(connection, this);
+	}	
+    
+    
+}

Added: branches/7.7.x/connectors/translator-object/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/resources/META-INF/jboss-beans.xml	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/resources/META-INF/jboss-beans.xml	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+    
+   <bean name="translator-infinispanRemote-template" class="org.teiid.templates.TranslatorDeploymentTemplate">
+      <property name="info"><inject bean="translator-infinispanRemote"/></property>
+      <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
+   </bean>
+   
+   <bean name="translator-infinispanRemote" class="org.teiid.templates.TranslatorTemplateInfo">
+      <constructor factoryMethod="createTemplateInfo">
+         <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
+         <parameter class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.translator.object.infinispan.InfinispanRemoteExecutionFactory</parameter>
+         <parameter class="java.lang.String">translator-infinispanRemote</parameter>
+         <parameter class="java.lang.String">infinispanRemote</parameter>         
+      </constructor>
+   </bean> 
+   
+   <bean name="translator-mapCacheExample-template" class="org.teiid.templates.TranslatorDeploymentTemplate">
+      <property name="info"><inject bean="translator-mapCacheExample"/></property>
+      <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
+   </bean>
+   
+   <bean name="translator-mapCacheExample" class="org.teiid.templates.TranslatorTemplateInfo">
+      <constructor factoryMethod="createTemplateInfo">
+         <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
+         <parameter class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.translator.object.example.MapCacheExecutionFactory</parameter>
+         <parameter class="java.lang.String">translator-mapCacheExample</parameter>
+         <parameter class="java.lang.String">mapCacheExample</parameter>         
+      </constructor>
+   </bean>    
+   
+</deployment>
\ No newline at end of file

Modified: branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties	2012-05-07 17:49:58 UTC (rev 4062)
@@ -20,14 +20,14 @@
 # 02110-1301 USA.
 #
 
-ObjectExecutionFactory.noResourceFound=Unable to discover class, no resource found for {0}
+ObjectExecutionFactory.noResourceFound=Unable to discover class, no resource found for package {0}
 ObjectExecutionFactory.invalidResource={0} ( {1} ) does not appear to be a valid URL / URI. 
+ObjectExecutionFactory.missingClassMethods=Missing class methods for className {0}, ensure class has 'getMethod' or 'isMethod' defined
 
 ObjectMethodManager.noMethodFound=Method {0} was not found for class {1}
 ObjectMethodManager.objectClassNotFound=Class {0} not found to load
 
 ObjectProjections.unsupportedMultipleContainers=Query Error: multiple collections found between columns {0} and {1}  (table: {2}) 
 
-ObjectVisitor.missingComparisonExpression=Missing either left or right expression in comparison
-ObjectVisitor.Unsupported_expressionr=Unsupported element {0}
-
+InfinispanRemoteExecutionFactory.cacheNameNotSet=CacheName property has not been set
+InfinispanRemoteExecutionFactory.cacheDoesNotExist=The cache {0} does not exist in the RemoteInfinispanCache 
\ No newline at end of file

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -32,17 +32,49 @@
 import org.teiid.language.Select;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.testdata.TradesCacheSource;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.util.TradesCacheSource;
+import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
 public class TestObjectExecution {
 	
 	private static TradesCacheSource source;
+	private static ObjectExecutionFactory factory;
+	private static ExecutionContext context;
+
 	
 	@BeforeClass
     public static void beforeEach() throws Exception {        
 		source = TradesCacheSource.loadCache();
+		
+		context = Mockito.mock(ExecutionContext.class);
+
+		factory = new ObjectExecutionFactory() {
+
+			@Override
+			protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
+					throws TranslatorException {
+
+				return new ObjectSourceProxy() {
+
+					@Override
+					public List<Object> get(Command command, String cacheName, String className) throws TranslatorException {
+						return source.getAll();
+					}
+
+					@Override
+					public void close() {
+						
+					}
+					
+				};
+			}
+			
+		};
+		
+		factory.start();
+		
+
     }
 	
 
@@ -98,34 +130,7 @@
 	
 	private ObjectExecution createExecution(String sql) throws Exception {
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand(sql); //$NON-NLS-1$
-
-		ExecutionContext context = Mockito.mock(ExecutionContext.class);
-		
-		final ObjectExecutionFactory factory = new ObjectExecutionFactory() {
-
-			@Override
-			protected ObjectSourceProxy createProxy(Object connection)
-					throws TranslatorException {
-
-				return new ObjectSourceProxy() {
-
-					@Override
-					public List<Object> get(Command command) throws TranslatorException {
-						return source.getAll();
-					}
-
-					@Override
-					public void close() {
-						
-					}
-					
-				};
-			}
-			
-		};
 				
-		factory.start();
-			
 		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
 		
 		return exec;

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -21,21 +21,27 @@
  */
 package org.teiid.translator.object;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
 
-import java.io.File;
+import java.util.*;
 
+
+
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.teiid.core.util.UnitTestUtil;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl;
 import org.teiid.language.Select;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.VDBMetadataFactory;
+import org.teiid.query.metadata.CompositeMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.ObjectExecution;
-import org.teiid.translator.object.ObjectExecutionFactory;
-import org.teiid.translator.object.ObjectSourceProxy;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
 public class TestObjectExecutionFactory {
@@ -51,7 +57,7 @@
 		ObjectExecutionFactory factory = new ObjectExecutionFactory() {
 
 			@Override
-			protected ObjectSourceProxy createProxy(Object connection)
+			protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
 					throws TranslatorException {
 
 				return proxy;
@@ -72,12 +78,7 @@
 	}
 	
 	@Test public void testFactoryLoadingJarClassNames() throws Exception {
-		
-	//	File testjar = new File(UnitTestUtil.getTestScratchPath() + "/../" + "translator-object-7.7.1-tests.jar");
-//		File testjar = new File("target/" + "translator-object-7.7.1-tests.jar");
-		
-//		assertEquals("Testjar doesn't exist " + testjar.getAbsolutePath(), true, testjar.exists());
-		
+	
 
 		Select command = Mockito.mock(Select.class);
 
@@ -88,7 +89,7 @@
 		ObjectExecutionFactory factory = new ObjectExecutionFactory() {
 
 			@Override
-			protected ObjectSourceProxy createProxy(Object connection)
+			protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
 					throws TranslatorException {
 
 				return proxy;
@@ -97,7 +98,6 @@
 		};
 		
 		factory.setColumnNameFirstLetterUpperCase(false);
-		
 		factory.setPackageNamesOfCachedObjects("org.teiid.translator.object.testdata");
 		
 		factory.start();
@@ -110,6 +110,38 @@
 		
 	}	
 	
+	@Test public void testGetMetadata() throws Exception {
+		
+		Collection dts = VDBMetadataFactory.getSystem().getDatatypes();
+		Map<String, Datatype> mapTypes = new HashMap<String, Datatype>();
+		for (Iterator it=  dts.iterator(); it.hasNext();) {
+			Datatype dt = (Datatype) it.next();
+			mapTypes.put(dt.getName()   , dt);
+		}
+		
+		MetadataFactory mfactory = new MetadataFactory("testModel", mapTypes, new Properties());
+		
+		final ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
+		
+		ObjectExecutionFactory factory = new ObjectExecutionFactory() {
 
-  
+			@Override
+			protected ObjectSourceProxy createProxy(ObjectCacheConnection connection)
+					throws TranslatorException {
+
+				return proxy;
+			}
+			
+		};
+		
+		factory.setColumnNameFirstLetterUpperCase(false);
+		
+		factory.setPackageNamesOfCachedObjects("org.teiid.translator.object.testdata");
+		
+		factory.start();
+		
+		factory.getMetadata(mfactory, null);
+
+	}
+
 }

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -25,10 +25,12 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.transaction.Transaction;
 
 import org.junit.Test;
-import org.teiid.translator.object.ObjectMethodManager;
 import org.teiid.translator.object.testdata.Leg;
 import org.teiid.translator.object.testdata.Trade;
 
@@ -80,5 +82,28 @@
 //		assertNotNull(omm.findGetterMethod(Transaction.class, "getLineItem"));
 		
 	}
+	
+	@Test public void testInitializationLoadingListOfClasses() throws Exception {
+
+		List<String> classNames = new ArrayList(3);
+		classNames.add(Trade.class.getName());
+		classNames.add(Leg.class.getName());
+		classNames.add(Transaction.class.getName());
+		
+		
+		
+		ObjectMethodManager omm = ObjectMethodManager.initialize(classNames,
+				true, this.getClass().getClassLoader());
+		
+		// should not fail
+		assertEquals(omm.size(), 3);
+		assertNotNull(omm.getClassMethods(Trade.class.getName()));
+		assertNotNull(omm.getClassMethods(Leg.class.getName()));
+		assertNotNull(omm.getClassMethods(Transaction.class.getName()));
+		assertNotNull(omm.findGetterMethod(Trade.class, "getName"));
+		assertNotNull(omm.findGetterMethod(Leg.class, "getName"));
+//		assertNotNull(omm.findGetterMethod(Transaction.class, "getLineItem"));
+		
+	}
   
 }

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -25,7 +25,8 @@
 
 import org.junit.Test;
 import org.teiid.language.Select;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.testdata.Trade;
+import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
 public class TestObjectProjections {
@@ -36,7 +37,7 @@
 
 	    ObjectProjections op = new ObjectProjections(command);
 	    
-	    validateArrays(4, op);
+	    validateResults(4, 0, op);
 	    
 
 	}
@@ -45,7 +46,7 @@
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
 
 	    ObjectProjections op = new ObjectProjections(command);
-	    validateArrays(3, op);
+	    validateResults(3, 1, op);
 	}	
 	
 	@Test public void testQueryGetAllTransactions() throws Exception {
@@ -54,17 +55,27 @@
 				" From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction as N " + 
 				" Where T.TradeId = L.TradeId and L.LegId = N.LegId"); //$NON-NLS-1$
 	    ObjectProjections op = new ObjectProjections(command);
-	    validateArrays(4, op);
+	    validateResults(4, 2, op);
 
 	
 	}	
 	
-	private void validateArrays(int size, ObjectProjections op) throws Exception {
+	private void validateResults(int size, int depth, ObjectProjections op) throws Exception {
 		op.throwExceptionIfFound();
 		
+		assertEquals(Trade.class.getName(), op.rootNodeClassName);
 	    assertEquals(size, op.getColumnNamesToUse().length);
 	    assertEquals(size, op.getColumns().length);
 
+	    int d = (op.childrenDepth > -1 ? op.childrenDepth : 0 );
+
+	    assertEquals(depth, d);
+	    
+	  //if children, then there should always be one more child node than the depth
+	    assertEquals(depth, (op.childrenNodes == null ? 0 : op.childrenNodes.size() - 1) ); 
+	    assertEquals(size, op.nameNodes.length);
+	    assertEquals(size, op.nodeDepth.length);
+
 	    // confirm the arrays match
 	    for (int i = 0; i < op.getColumns().length; i++) {
 	    	assertEquals(op.getColumnNamesToUse()[i], op.getColumnNameToUse(op.getColumns()[i]));

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -28,8 +28,8 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.language.Select;
-import org.teiid.translator.object.testdata.TradesCacheSource;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.util.TradesCacheSource;
+import org.teiid.translator.object.util.VDBUtility;
 
 @SuppressWarnings("nls")
 public class TestObjectTranslator {

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -31,10 +31,12 @@
 import org.teiid.language.Select;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.object.BaseObjectTest;
+import org.teiid.translator.object.ObjectCacheConnection;
 import org.teiid.translator.object.ObjectExecution;
 import org.teiid.translator.object.example.MapCacheExecutionFactory;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.util.VDBUtility;
 
+
 @SuppressWarnings("nls")
 public class TestMapCacheIntegration extends BaseObjectTest {
 	
@@ -44,12 +46,14 @@
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
 
 		ExecutionContext context = Mockito.mock(ExecutionContext.class);
+		
+		ObjectCacheConnection connection = Mockito.mock(ObjectCacheConnection.class);
 
 		MapCacheExecutionFactory factory = new MapCacheExecutionFactory();	
-		factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
+		factory.setCacheLoaderClassName("org.teiid.translator.object.util.TradesCacheSource");
 		factory.start();
 				
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, connection);
 		
 		exec.execute();
 		
@@ -77,12 +81,13 @@
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
 
 		ExecutionContext context = Mockito.mock(ExecutionContext.class);
-
+		ObjectCacheConnection connection = Mockito.mock(ObjectCacheConnection.class);
+		
 		MapCacheExecutionFactory factory = new MapCacheExecutionFactory();	
 		factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
 		factory.start();
 				
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, connection);
 		
 		exec.execute();
 		
@@ -110,12 +115,13 @@
 		Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Transaction"); //$NON-NLS-1$
 
 		ExecutionContext context = Mockito.mock(ExecutionContext.class);
+		ObjectCacheConnection connection = Mockito.mock(ObjectCacheConnection.class);
 
 		MapCacheExecutionFactory factory = new MapCacheExecutionFactory();	
 		factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
 		factory.start();
 				
-		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+		ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, connection);
 		
 		exec.execute();
 		

Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -35,7 +35,7 @@
 import org.teiid.translator.TranslatorException;
 import org.teiid.translator.object.ObjectProjections;
 import org.teiid.translator.object.testdata.Trade;
-import org.teiid.translator.object.testdata.VDBUtility;
+import org.teiid.translator.object.util.VDBUtility;
 
 
 @SuppressWarnings("nls")

Deleted: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -1,107 +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.testdata;
-
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * Sample cache of objects
- * 
- * @author vhalbert
- *
- */
- at SuppressWarnings("rawtypes")
-public class TradesCacheSource extends HashMap <Object, Object> {
-	
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = -727553658250070494L;
-	
-	
-	public static final String TRADE_CLASS_NAME = Trade.class.getName();
-	public static final String LEG_CLASS_NAME = Leg.class.getName();
-	public static final String TRANSACTION_CLASS_NAME = Transaction.class.getName();
-
-	
-	public static final int NUMLEGS = 10;
-	public static final int NUMTRADES = 3;
-	public static final int NUMTRANSACTIONS = 5;
-	
-
-	public static void loadCache(Map<Object, Object> cache) {
-		for (int i = 1; i <= NUMTRADES; i++) {
-			
-			Map legsMap = new HashMap();
-			double d = 0;
-			for (int j = 1; j <= NUMLEGS; j++) {
-				
-				Leg leg = new Leg(j, "LegName " + j, d * j * 3.14, Calendar.getInstance());
-				
-				List trans = new ArrayList(NUMTRANSACTIONS);
-				for (int x = 1; x <= NUMTRANSACTIONS; x++) {
-					Transaction t = new Transaction();
-					t.setLineItem("Leg " + j + ", transaction line item " + x);
-					trans.add(t);
-				}
-				
-				leg.setTransations(trans);
-				leg.setNotational(i * 7 / 3.14);
-				
-				legsMap.put(j, leg);
-			}
-			
-			Trade trade = new Trade(i, "TradeName " + i, legsMap, new Date());
-			
-			// even trades set settled to true
-			if ( i % 2 == 0) {
-				trade.setSettled(true);
-			}
-			
-			cache.put(i, trade);
-
-		}
-	}
-
-	public static TradesCacheSource loadCache() {
-		TradesCacheSource tcs = new TradesCacheSource();
-		loadCache(tcs);
-		return tcs;		
-	}
-	
-	public List<Object> getAll() {
-		return new ArrayList<Object>(this.values());
-	}
-	
-	public List<Object> get(int key) {
-		List<Object> objs = new ArrayList<Object>(1);
-		objs.add(this.get(key));
-		return objs;
-	}
-}

Deleted: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -1,51 +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.testdata;
-
-import java.io.File;
-
-import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.core.util.UnitTestUtil;
-import org.teiid.metadata.RuntimeMetadata;
-
-
-public class VDBUtility {
-
-	public static TranslationUtility TRANSLATION_UTILITY = null;
-
-	public static RuntimeMetadata RUNTIME_METADATA = null;
-	
-	static {
-		File f = new File(UnitTestUtil.getTestDataPath() + "/ObjectProject/Trade.vdb");
-		System.out.println("TestDataPath " + f.getAbsolutePath());
-		try {
-			TRANSLATION_UTILITY = new TranslationUtility(f.toURI().toURL());
-		} catch (Throwable e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			throw new RuntimeException(e);
-		}
-		
-		RUNTIME_METADATA = VDBUtility.TRANSLATION_UTILITY.createRuntimeMetadata();
-	}
-	
-
-}

Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/TradesCacheSource.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,111 @@
+/*
+ * 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.util;
+
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.teiid.translator.object.testdata.Leg;
+import org.teiid.translator.object.testdata.Trade;
+import org.teiid.translator.object.testdata.Transaction;
+
+
+/**
+ * Sample cache of objects
+ * 
+ * @author vhalbert
+ *
+ */
+ at SuppressWarnings("rawtypes")
+public class TradesCacheSource extends HashMap <Object, Object> {
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -727553658250070494L;
+	
+	
+	public static final String TRADE_CLASS_NAME = Trade.class.getName();
+	public static final String LEG_CLASS_NAME = Leg.class.getName();
+	public static final String TRANSACTION_CLASS_NAME = Transaction.class.getName();
+
+	
+	public static final int NUMLEGS = 10;
+	public static final int NUMTRADES = 3;
+	public static final int NUMTRANSACTIONS = 5;
+	
+
+	public static void loadCache(Map<Object, Object> cache) {
+		for (int i = 1; i <= NUMTRADES; i++) {
+			
+			Map legsMap = new HashMap();
+			double d = 0;
+			for (int j = 1; j <= NUMLEGS; j++) {
+				
+				Leg leg = new Leg(j, "LegName " + j, d * j * 3.14, Calendar.getInstance());
+				
+				List trans = new ArrayList(NUMTRANSACTIONS);
+				for (int x = 1; x <= NUMTRANSACTIONS; x++) {
+					Transaction t = new Transaction();
+					t.setLineItem("Leg " + j + ", transaction line item " + x);
+					trans.add(t);
+				}
+				
+				leg.setTransations(trans);
+				leg.setNotational(i * 7 / 3.14);
+				
+				legsMap.put(j, leg);
+			}
+			
+			Trade trade = new Trade(i, "TradeName " + i, legsMap, new Date());
+			
+			// even trades set settled to true
+			if ( i % 2 == 0) {
+				trade.setSettled(true);
+			}
+			
+			cache.put(i, trade);
+
+		}
+	}
+
+	public static TradesCacheSource loadCache() {
+		TradesCacheSource tcs = new TradesCacheSource();
+		loadCache(tcs);
+		return tcs;		
+	}
+	
+	public List<Object> getAll() {
+		return new ArrayList<Object>(this.values());
+	}
+	
+	public List<Object> get(int key) {
+		List<Object> objs = new ArrayList<Object>(1);
+		objs.add(this.get(key));
+		return objs;
+	}
+}

Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java	                        (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/util/VDBUtility.java	2012-05-07 17:49:58 UTC (rev 4062)
@@ -0,0 +1,52 @@
+/*
+ * 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.util;
+ 
+import java.io.File;
+
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.metadata.RuntimeMetadata;
+
+
+public class VDBUtility {
+
+	public static TranslationUtility TRANSLATION_UTILITY = null;
+
+	public static RuntimeMetadata RUNTIME_METADATA = null;
+	
+	static {
+		File f = new File(UnitTestUtil.getTestDataPath() + "/ObjectProject/Trade.vdb");
+		System.out.println("TestDataPath " + f.getAbsolutePath());
+		try {
+			TRANSLATION_UTILITY = new TranslationUtility(f.toURI().toURL());
+		} catch (Throwable e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			throw new RuntimeException(e);
+		}
+		
+		RUNTIME_METADATA = VDBUtility.TRANSLATION_UTILITY.createRuntimeMetadata();
+	}
+	
+
+}

Modified: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade.vdb
===================================================================
(Binary files differ)

Modified: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi	2012-05-07 17:48:51 UTC (rev 4061)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi	2012-05-07 17:49:58 UTC (rev 4062)
@@ -11,7 +11,7 @@
       <diagramEntity xmi:uuid="mmuuid:38199303-f03d-43ea-b506-a3d7e0be856b" modelObject="mmuuid/6c111154-eb05-4aca-ae33-d5a7d0c67e46"/>
     </diagram>
   </diagram:DiagramContainer>
-  <relational:BaseTable xmi:uuid="mmuuid:5b23705c-0091-412a-9e79-c61ed02bd618" name="Trade" nameInSource="&quot;Trade&quot;">
+  <relational:BaseTable xmi:uuid="mmuuid:5b23705c-0091-412a-9e79-c61ed02bd618" name="Trade" nameInSource="org.teiid.translator.object.testdata.Trade">
     <columns xmi:uuid="mmuuid:1a601c6c-979c-4a8a-9128-ac1c9cf853a8" name="TradeDate" nameInSource="TradeDate" nativeType="java.util.Date" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
       <type href="http://www.w3.org/2001/XMLSchema#date"/>
     </columns>



More information about the teiid-commits mailing list