[teiid-commits] teiid SVN: r3846 - in branches/7.7.x/connectors/sandbox: translator-coherence and 20 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Feb 6 00:31:15 EST 2012


Author: van.halbert
Date: 2012-02-06 00:31:15 -0500 (Mon, 06 Feb 2012)
New Revision: 3846

Added:
   branches/7.7.x/connectors/sandbox/translator-coherence/
   branches/7.7.x/connectors/sandbox/translator-coherence/pom.xml
   branches/7.7.x/connectors/sandbox/translator-coherence/readme.txt
   branches/7.7.x/connectors/sandbox/translator-coherence/src/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecution.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecutionFactory.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherencePlugin.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceVisitor.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/SourceCacheAdapter.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/jboss-beans.xml
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/coherence/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/coherence/i18n.properties
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Leg.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TestCoherenceTranslator.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Trade.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TradesCacheSource.java
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/resources/
   branches/7.7.x/connectors/sandbox/translator-coherence/src/test/resources/Trade.vdb
   branches/7.7.x/connectors/sandbox/translator-coherence/usage-guidelines.txt
Log:
new version version of coherence and renamed project to match others

Added: branches/7.7.x/connectors/sandbox/translator-coherence/pom.xml
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/pom.xml	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/pom.xml	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <!--  parent>
+        <artifactId>sandbox</artifactId>
+        <groupId>org.jboss.teiid.connectors</groupId>
+        <version>7.7.0.CR1</version>
+    </parent-->
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>translator-coherence</artifactId>
+    <groupId>org.jboss.teiid.connectors.sandbox</groupId>
+    <version>7.7.0.CR1</version>
+    <name>Coherence Translator</name>
+    <description>This is the tranlator for a Coherence connector</description>
+
+    <dependencies>
+    
+         <dependency>
+        	<artifactId>connector-coherence</artifactId>
+    		<groupId>org.jboss.teiid.connectors.sandbox</groupId>
+    		<version>7.7.0.CR1</version>
+    		<scope>compile</scope>
+			<classifier>lib</classifier>
+        </dependency>   
+			<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-common-core</artifactId>
+				<version>${project.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-common-core</artifactId>
+				<type>test-jar</type>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-api</artifactId>
+				<version>7.7.0.CR1</version>
+				<scope>provided</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-api</artifactId>
+				<type>test-jar</type>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+        	<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-engine</artifactId>
+				<type>test-jar</type>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.teiid</groupId>
+				<artifactId>teiid-metadata</artifactId>
+				<type>test-jar</type>
+				<version>7.7.0.CR1</version>
+				<scope>test</scope>
+			</dependency>
+        
+       <!--   
+        <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-api</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-common-core</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>
+        -->
+        <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-engine</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>  
+        <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-metadata</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>    
+         <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-runtime</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>   
+         <dependency>
+            <groupId>org.jboss.teiid</groupId>
+            <artifactId>teiid-client</artifactId>
+            <version>7.7.0.CR1</version>
+            <scope>provided</scope>
+        </dependency>             
+
+        <dependency>
+            <groupId>javax.resource</groupId>
+            <artifactId>connector-api</artifactId>
+             <version>1.5</version>
+             <scope>provided</scope>
+        </dependency>
+        
+    	<dependency>
+	      	<groupId>coherence</groupId>
+    	  	<artifactId>coherence</artifactId>
+    	  	<version>3.6.1</version>
+     	 	<scope>system</scope>
+      		<systemPath>${basedir}/../connector-coherence/lib/coherence.jar</systemPath>
+   	    </dependency> 
+		
+   	    
+   	 	<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.4</version>
+			<scope>test</scope>
+		</dependency> 	
+		
+		<dependency>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-all</artifactId>
+			<version>1.5</version>
+			<scope>test</scope>
+		</dependency>	
+		
+            <dependency>
+                <groupId>org.jboss.man</groupId>
+                <artifactId>jboss-managed</artifactId>
+                <version>2.1.0.SP1</version>
+                <scope>provided</scope>
+            </dependency>  	
+            							
+            <dependency>    
+                <groupId>org.jboss</groupId>
+                <artifactId>jboss-vfs</artifactId>
+                <version>2.1.2.GA</version>
+                <scope>provided</scope>
+            </dependency>       							
+    </dependencies>
+
+    	<build>
+	<!-- This section defines the default plugin settings inherited by child projects. -->
+		<pluginManagement>
+			<plugins>
+		<!-- Fixes how test resources of a project can be used in projects dependent on it  -->
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-jar-plugin</artifactId>
+					<version>2.2</version>
+				</plugin>
+				<plugin>
+				  <artifactId>maven-assembly-plugin</artifactId>
+				  <version>2.2-beta-6-m1-jboss</version>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+		<plugins>
+	  <!-- Specify the compiler options and settings -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>1.6</source>
+					<target>1.6</target>
+					<showDeprecation>false</showDeprecation>
+					<showWarnings>false</showWarnings>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>2.9</version>
+				<configuration>
+					<includes>
+						<include>**/*TestCase.java</include>
+						<include>**/*Test.java</include>
+						<include>**/Test*.java</include>
+					</includes>
+					<excludes>
+						<exclude>**/Abstract*TestCase.java</exclude>
+			<!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+						<include>**/Test*$*.java</include>
+					</excludes>
+					<systemProperties>
+						<property>
+							<name>user.dir</name>
+							<value>${basedir}/target</value>
+						</property>
+						<property>
+							<name>java.io.tmpdir</name>
+							<value>${basedir}/target</value>
+						</property>
+					</systemProperties>
+				</configuration>
+			</plugin>
+      <!-- 
+      Build a test-jar for each project, so that src/test/* resources and classes can be used
+      in other projects.  Also customize how the jar files are assembled.
+      -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>test-jar</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<archive>
+						<manifest>
+							<addDefaultSpecificationEntries> true</addDefaultSpecificationEntries>
+							<addDefaultImplementationEntries> true</addDefaultImplementationEntries>
+						</manifest>
+						<manifestEntries>
+							<Implementation-URL>${project.url}</Implementation-URL>
+						</manifestEntries>
+					</archive>
+				</configuration>
+			</plugin>
+
+		</plugins>
+	</build>
+    
+
+</project>

Added: branches/7.7.x/connectors/sandbox/translator-coherence/readme.txt
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/readme.txt	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/readme.txt	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,41 @@
+translator readme
+
+The coherence_translator is very simple implementation of mapping a Coherence cache to relational sql request.    
+
+
+PREREQUSITE:
+-  build the connector-coherence project.
+-  Need to implement/extend SourceCacheAdapter, primarily to add the source metadata.  See TradesCacheSource in the tests as an example.
+
+
+BUILD:
+---------
+run  mvn clean install
+
+
+
+DEPLOYMENT
+--------------------
+
+setup 
+
+	1.	see coherence_connector for deployment
+	2.	copy the translator-coherence-<version>.jar to server/<profile>/deploy/teiid/connectors directory
+	2.	copy the implementation of SourceCacheAdapter to the server/<profile>/lib directory
+	3. 	start server
+
+
+Exmaple: To use the example vdb (Trade.vdb), do the following (with the server shutdown)
+
+	1.	copy translator-coherence-<version>-tests.jar to the <profile>/lib directory
+	2.	copy the Trade.vdb, located in src/test/resources, to <profile>/deploy directory
+	3.	in coherence-ds.xml, set the CacheName property to "Trades" and CacheTranslatorClassName property to "org.teiid.translator.coherence.TradesCacheSource"
+		TradeCacheSource will load the cache upon initial use
+	4.  start JBoss server
+	5.  Then use a sql tool (i.e., SQuirreL) to access the Trade.vdb and view the Trade information
+
+
+
+Other notes:
+-	the coherence translator has the translator name of "coherence", which must match the translator defined in the vdb that's mapped to the Coherence physical source.
+

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecution.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecution.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecution.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,106 @@
+/*
+ * ${license}
+ */
+package org.teiid.translator.coherence;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.language.Select;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.resource.adapter.coherence.CoherenceConnection;
+import org.teiid.translator.DataNotAvailableException;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+
+
+/**
+ * Execution of a command. Currently, only select is supported.
+ */
+public class CoherenceExecution implements ResultSetExecution {
+
+
+    private Select query;
+    private CoherenceConnection connection;
+    
+    private Iterator resultsIt = null;
+    
+    private CoherenceVisitor visitor = null;
+
+    private SourceCacheAdapter sourceCacheTranslator = null;
+    
+    
+    public CoherenceExecution(Select query, RuntimeMetadata metadata, CoherenceConnection connection, SourceCacheAdapter cacheTranslator) {
+        this.query = query;
+        this.connection = connection;
+        this.visitor = new CoherenceVisitor(metadata);
+        this.sourceCacheTranslator = cacheTranslator;
+    }
+    
+    @Override
+    public void execute() throws TranslatorException {
+        // Log our command
+        LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Coherence executing command: " + query); //$NON-NLS-1$
+
+    	visitor.visitNode(query);
+    	
+        if(visitor.getException() != null) { 
+            throw visitor.getException();
+        }
+        
+        // Execute url to get results
+        List results = executeQuery();
+        this.resultsIt = results.iterator();
+    }     
+    
+	protected List executeQuery()
+				throws TranslatorException {
+
+		try {
+			List objects = this.connection.get(visitor.getFilter());
+					//"Id in (" + parm + ")", this.connection.getCacheName());
+			
+			if (objects == null)
+				return Collections.EMPTY_LIST;
+			
+			return sourceCacheTranslator.translateObjects(objects, this.visitor);
+
+		} catch (TranslatorException te) {
+			throw te;
+		} catch (Throwable re) {
+			re.printStackTrace();
+		}
+
+		return Collections.EMPTY_LIST;
+	}
+    
+    
+    
+    
+    @Override
+    public List<?> next() throws TranslatorException, DataNotAvailableException {
+    	// create and return one row at a time for your resultset.
+    	if (resultsIt.hasNext()) {
+    		return (List) resultsIt.next();
+    	}
+        
+        return null;
+    }
+    
+
+    @Override
+    public void close() {
+        // TODO:cleanup your execution based resources here
+    }
+
+    @Override
+    public void cancel() throws TranslatorException {
+    	//TODO: initiate the "abort" of execution 
+    }
+
+  
+
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecutionFactory.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceExecutionFactory.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,115 @@
+/*
+ * 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.coherence;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.resource.cci.ConnectionFactory;
+
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.resource.adapter.coherence.CoherenceConnection;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+
+
+ at Translator(name="coherence", description="A Coherence translator")
+public class CoherenceExecutionFactory extends ExecutionFactory<ConnectionFactory, CoherenceConnection> {
+
+
+	public static final int MAX_SET_SIZE = 100;
+	
+    
+    private SourceCacheAdapter cacheTranslator =  null;
+	
+	
+	public CoherenceExecutionFactory() {
+		super();
+		setMaxInCriteriaSize(MAX_SET_SIZE);
+	}
+	
+    @Override
+    public void start() throws TranslatorException {
+    	super.start();
+    }
+
+    @Override
+    public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, CoherenceConnection connection)
+    		throws TranslatorException {
+    	createCacheTranslator(connection);
+    	return new CoherenceExecution((Select)command, metadata, connection, cacheTranslator);
+    }    
+
+    
+    public List getSupportedFunctions() {
+        return Collections.EMPTY_LIST;
+    }
+
+    public boolean supportsCompareCriteriaEquals() {
+        return true;
+    }
+
+    public boolean supportsInCriteria() {
+        return true;
+    }
+    
+    @Override
+    public boolean isSourceRequired() {
+    	return false;
+    }
+    
+    @Override
+    public void getMetadata(MetadataFactory metadataFactory,
+    		CoherenceConnection conn) throws TranslatorException {
+    	
+    	cacheTranslator.setMetadataFactory(metadataFactory);
+    }
+    
+    
+	private void createCacheTranslator(CoherenceConnection conn) throws TranslatorException {
+		if (conn.getCacheTranslatorClassName() == null) {
+			throw new TranslatorException(
+					CoherencePlugin.Util
+							.getString("CoherenceVisitor.cacheTranslatorClassName_not_set")); //$NON-NLS-1$
+		}
+
+		try {
+			String classname = conn.getCacheTranslatorClassName();
+			this.cacheTranslator = (SourceCacheAdapter) ReflectionHelper
+					.create(classname,
+							null, null);
+		} catch (Exception e1) {
+			throw new TranslatorException(e1);
+		}
+
+	}
+  
+  
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherencePlugin.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherencePlugin.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherencePlugin.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,41 @@
+/*
+ * 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.coherence;
+
+import java.util.ResourceBundle;
+
+import org.teiid.core.BundleUtil;
+
+
+/**
+ * CoherencePlugin
+ */
+public class CoherencePlugin { 
+
+    public static final String PLUGIN_ID = CoherencePlugin.class.getPackage().getName();
+
+    /**
+     * Provides access to the plugin's log and to it's resources.
+     */
+    public static final BundleUtil Util = new BundleUtil(PLUGIN_ID, PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceVisitor.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceVisitor.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/CoherenceVisitor.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,324 @@
+/*
+ * 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.coherence;
+
+import java.util.ArrayList;
+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.DerivedColumn;
+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.NamedTable;
+import org.teiid.language.ScalarSubquery;
+import org.teiid.language.SearchedCase;
+import org.teiid.language.Select;
+import org.teiid.language.TableReference;
+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.RuntimeMetadata;
+import org.teiid.metadata.Table;
+import org.teiid.resource.adapter.coherence.CoherenceFilterUtil;
+import org.teiid.translator.TranslatorException;
+
+import com.tangosol.util.Filter;
+
+/**
+ */
+public class CoherenceVisitor extends HierarchyVisitor {
+
+	private String tableName = null;
+	protected String[] attributeNames = null;
+	protected Class[] attributeTypes = null;
+	private RuntimeMetadata metadata;
+	private Filter filter = null;
+
+    private TranslatorException exception;
+
+    /**
+     * 
+     */
+    public CoherenceVisitor(RuntimeMetadata metadata) {
+        super();        
+        this.metadata = metadata;
+    }
+    
+    public Filter getFilter() {
+		return filter;
+
+    }
+ 
+    public String getTableName() {
+    	return tableName;
+    }
+    
+    public String[] getAttributeNames() {
+    	return attributeNames;
+    }
+    
+    public Class[] getAttributeTypes() {
+    	return attributeTypes;
+    }    
+    
+    public TranslatorException getException() {
+        return this.exception;
+    }
+
+    
+	public void visit(Select query) {
+		super.visit(query);
+		
+		Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
+		attributeNames = new String[query.getDerivedColumns().size()];
+		attributeTypes = new Class[query.getDerivedColumns().size()];
+		
+		int i=0;
+		while(selectSymbolItr.hasNext()) {
+			Column e = getElementFromSymbol(selectSymbolItr.next());
+			String attributeName = this.getNameFromElement(e);
+			Class attributeClass = e.getJavaType();
+			
+			attributeNames[i] = attributeName;
+			attributeTypes[i] = attributeClass;
+
+			i++;
+		}
+
+		
+		List<TableReference> tables = query.getFrom();
+		TableReference t = tables.get(0);
+		if(t instanceof NamedTable) {
+			Table group = ((NamedTable)t).getMetadataObject();
+			tableName = group.getName();
+		}
+		
+	}
+	
+	
+    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();
+	
+			String lhsString = getExpressionString(lhs);
+			String rhsString = getExpressionString(rhs);
+			if(lhsString == null || rhsString == null) {
+	            final String msg = CoherencePlugin.Util.getString("CoherenceVisitor.missingComparisonExpression"); //$NON-NLS-1$
+				exception = new TranslatorException(msg); 
+			}
+	
+	        if(rhs instanceof Literal) {
+	            Literal literal = (Literal) rhs;
+	            filter = CoherenceFilterUtil.createCompareFilter(lhsString, literal.getValue(), op, literal.getType() );
+	            
+	        } else {
+	            Literal literal = (Literal) lhs;
+	            filter = CoherenceFilterUtil.createCompareFilter(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 lhsString = getExpressionString(lhs);
+			String rhsString = getExpressionString(rhs);
+//			rhsString = rhsString.replace("%", "*"); //$NON-NLS-1$ //$NON-NLS-2$
+			filter = CoherenceFilterUtil.createFilter(lhsString + " LIKE \'" + 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 lhsString = getExpressionString(lhs);
+			
+			List<Expression> rhsList = ((In)obj).getRightExpressions();
+	
+			Class type = null;
+			List parms = new ArrayList(rhsList.size());
+	        Iterator iter = rhsList.iterator();
+	        while(iter.hasNext()) {
+	            Expression expr = (Expression) iter.next();
+	            type = addParmFromExpression(expr, parms);
+	            
+	        }
+	        
+	        filter = CoherenceFilterUtil.createInFilter(lhsString, parms, type);
+		}catch (TranslatorException t) {
+			exception = t;
+		}
+	        
+    }
+    
+    private 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("CoherenceVisitor.Unsupported_expression" + expr); //$NON-NLS-1$
+        }
+        
+        return type;
+         
+    }
+	/** 
+	 * Method to get name from the supplied Element
+	 * @param e the supplied Element
+	 * @return the name
+	 */
+    // 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.
+	public String getNameFromElement(Column e) {
+		String attributeName = e.getNameInSource();
+		if (attributeName == null || attributeName.equals("")) { //$NON-NLS-1$
+			attributeName = e.getName();
+			// If name in source is not set, then fall back to the column name.
+		}
+		return attributeName;
+	}
+		
+    /**
+     * Helper method for getting runtime {@link org.teiid.connector.metadata.runtime.Element} from a
+     * {@link org.teiid.language.DerivedColumn}.
+     * @param symbol Input ISelectSymbol
+     * @return Element returned metadata runtime Element
+     */
+    private Column getElementFromSymbol(DerivedColumn symbol) {
+        ColumnReference expr = (ColumnReference) symbol.getExpression();
+        return expr.getMetadataObject();
+    }
+	    
+	// 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 = 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 = CoherencePlugin.Util.getString("CoherenceVisitory.unsupportedElementError" , e.toString()); //$NON-NLS-1$
+			throw new TranslatorException(msg); 
+		}
+		expressionName = escapeReservedChars(expressionName);
+		return expressionName;
+	}
+	
+	private String escapeReservedChars(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/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/SourceCacheAdapter.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/SourceCacheAdapter.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/java/org/teiid/translator/coherence/SourceCacheAdapter.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,453 @@
+/*
+ * 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.coherence;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.core.util.StringUtil;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+
+
+public abstract class SourceCacheAdapter {
+    
+    protected MetadataFactory metadataFactory = null;
+ 
+    /**
+     * Called so the implementor can defined its table/column metadata
+     * Use the methods @see #addTable and @see #addColumn.
+     */
+  abstract void addMetadata() throws TranslatorException;
+  
+  /**
+   * Called to translate the list of <code>objects</code> returned from the Coherence cache.
+   * The implementor will use the <code>visitor</code> to obtain sql parsed information 
+   * needed to understand the columns requested.  Then use the @see #retrieveValue method
+   * in order to get the object value returned in the correct type to be passed in the
+   * rows returned to the engine.
+   */
+  public List translateObjects(List objects, CoherenceVisitor visitor) throws TranslatorException {
+
+		List row = null;
+		
+		List rows = new ArrayList();
+
+		Map columnObjectMap = null;
+		
+		String[] attributeNames = visitor.getAttributeNames();
+		Class[] attributeTypes = visitor.getAttributeTypes();
+
+		
+		// these pinpoint the column where a collection is found
+		// and the name nodes it takes to traverse to get the collection
+		//**********************************
+		// NOTE: ONLY 1 COLLECTION CAN BE DEFINED IN A QUERY
+		//**********************************
+		String attributeNameForCollection = "COL_TAG";
+		int attributeLocForCollection = -1;
+		String attributeNamePrefixForCollection = null;
+		List<String> attributeTokensForCollection = null;
+		int collectionNodeDepth = -1;
+		Set<String> collectionNames = new HashSet<String>();
+
+		// 1st time thru, call to get the objects, if a collection is found, that is stored for
+		// processing in the next step because it impacts the number rows returned
+		for (Iterator<Object> it = objects.iterator(); it.hasNext();) {
+			// each object represent 1 row, but will be expanded, if a collection is found in its results 
+			Object o = (Object) it.next();
+			columnObjectMap = new HashMap();
+			
+			for (int i=0; i<attributeNames.length; i++) {
+				final String n = attributeNames[i];
+				
+				List<String> tokens = StringUtil.getTokens(n, ".");
+				
+				final ParmHolder holder = ParmHolder.createParmHolder(visitor.getTableName(), tokens, attributeTypes[i]);
+
+				Object value =  retrieveValue(holder, o, 0);
+				  if (holder.isCollection) {
+					  if (attributeLocForCollection == -1) {
+						  // if a collection type has not been found, then identify it
+						  attributeLocForCollection = i;
+						  attributeTokensForCollection = tokens;
+						  collectionNodeDepth = holder.collectionNodeDepth;
+						  for (int x = 0; x <= holder.collectionNodeDepth; x++) {
+							  if (x > 0) {
+								  attributeNamePrefixForCollection+=".";
+							  }
+							  attributeNamePrefixForCollection+=tokens.get(x);
+						  }
+						  columnObjectMap.put(attributeNameForCollection, value);
+						  collectionNames.add(n);
+						  
+					  } else if (collectionNodeDepth == holder.collectionNodeDepth) {
+						  // if a collection was requested in another column, check to see if the
+						  // same node method was called, if not, then this represents a different collection being retrieved
+						 String a = attributeTokensForCollection.get(collectionNodeDepth);
+						 String b = tokens.get(holder.collectionNodeDepth);
+						 if (!b.equals(a)) {
+							 throw new TranslatorException("Query Error: multiple collections found between " + a + " and " + b +", only 1 is supported per query" );
+					  
+						 }
+						 collectionNames.add(n);
+					  }
+					  
+				  } else {
+
+					  columnObjectMap.put(n, value);
+				  } // end of isCollection
+				
+			}
+			
+		
+			if (attributeLocForCollection != -1) {
+				Object colObj = columnObjectMap.get(attributeNameForCollection);
+				Iterator colIt = null;
+				  if (colObj.getClass().isArray()) {
+				      List objRows = Arrays.asList((Object[]) colObj);
+				      colIt = objRows.iterator();
+				  
+				  } else if (colObj instanceof Collection) { 
+				      Collection objRows = (Collection) colObj;
+				      colIt = objRows.iterator();
+				      
+				  } else if (colObj instanceof Map) {
+					  Map objRows = (Map) colObj;
+					  colIt = objRows.values().iterator();
+					  
+				  } else {
+					  throw new TranslatorException("Program Error: A container type of object is unsupported: " + colObj.getClass().getName());
+				  }
+				  				  
+				  
+					for (Iterator<Object> objit = colIt; colIt.hasNext();) {
+						Object colt = (Object) colIt.next();
+
+						row = new ArrayList<Object>(attributeNames.length);
+						
+						for (int i=0; i<attributeNames.length; i++) {
+							String n = attributeNames[i];
+							
+							if (collectionNames.contains(n)) {
+								// when a collection is found, need to find the value for the row
+								// in order to do that, need to pick where retrieve process left off
+								List<String> tokens = StringUtil.getTokens(n, ".");
+								final ParmHolder holder = ParmHolder.createParmHolder(visitor.getTableName(), tokens, attributeTypes[i]);
+								Object colvalue =  retrieveValue(holder, colt, collectionNodeDepth + 1);
+								row.add(colvalue);
+								
+							} else {
+								row.add(columnObjectMap.get(n));
+							}
+							
+						}
+						rows.add(row);
+					}
+			
+			} else {
+				row = new ArrayList<Object>(attributeNames.length);
+				
+				for (int i=0; i<attributeNames.length; i++) {
+					String n = attributeNames[i];
+					
+					Object attributeObject = columnObjectMap.get(n);
+					
+					row.add(attributeObject);
+			
+				}
+				rows.add(row);
+
+			}
+			
+			columnObjectMap.clear();
+			collectionNames.clear();
+			attributeLocForCollection = -1;
+			// don't reset the following because, once set, they should be the same for all
+			//  attributeNamePrefixForCollection
+			//  collectionNodeDepth
+			
+			
+		}
+			
+	return rows;
+
+  }
+  
+  protected void setMetadataFactory(MetadataFactory metadataFactory) throws TranslatorException {
+    	this.metadataFactory = metadataFactory;
+    	addMetadata();
+    }
+
+  protected Table addTable(String t) throws TranslatorException {
+	  return metadataFactory.addTable(t); //$NON-NLS-1$
+  }
+  
+  protected void addColumn(String columnName, String nameInSource, String dataType, Table t) throws TranslatorException {
+	  Column c = metadataFactory.addColumn(columnName, dataType, t); //$NON-NLS-1$
+	  c.setNameInSource(nameInSource);	  
+  }
+ 
+
+		
+private Object retrieveValue(ParmHolder holder, Object cachedObject, int level) throws TranslatorException {
+	// do not retrieve a value for these types
+	 if (cachedObject.getClass().isArray() || cachedObject instanceof Collection || cachedObject instanceof Map) {
+		 return cachedObject;
+	 }
+
+	 final Class objectClass = cachedObject.getClass();
+	 
+	 final String columnName = holder.nameNodes.get(level);
+
+	 boolean atTheBottom = false;
+	 
+	 if (holder.nodeSize == (level + 1)) atTheBottom = true;
+	 
+	 try {
+		 String methodName = 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 
+		 if (atTheBottom && holder.attributeType == Boolean.class) {
+			 methodName = "is" + columnName;
+		 } else {
+			 methodName = "get" + columnName;
+		 }
+
+		 final Method m = findBestMethod(objectClass, methodName, null);
+		 
+		 final Object value = m.invoke(cachedObject, null);
+		 
+		 if (atTheBottom) {
+			 return value;
+		 }
+		 
+		 // if an array or collection, return, this will be processed after all objects are obtained
+		 // in order the number of rows can be created
+		  if (value.getClass().isArray() || value instanceof Collection || value instanceof Map) {
+			  holder.setCollection(level);  
+//			  System.out.println("Found Collection: " + methodName);
+			  return value;
+		  }
+
+		  return retrieveValue(holder, value, ++level);
+
+		  
+//		 	LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Got value " + value); //$NON-NLS-1$
+		 	
+			 
+	 } catch (InvocationTargetException x) {
+		 Throwable cause = x.getCause();
+		 System.err.format("invocation of %s failed: %s%n",
+				 "get" + columnName, cause.getMessage());
+		 LogManager.logError(LogConstants.CTX_CONNECTOR, "Error calling get" + columnName + ":" + cause.getMessage());
+		 return null;
+	 } catch (Exception e) {
+		 e.printStackTrace();
+		 throw new TranslatorException(e.getMessage());
+	 }
+  }
+
+
+  public static Object createObject(String objectClassName) throws TranslatorException {
+		try {
+			
+			Object classObj =  ReflectionHelper
+					.create(objectClassName,
+							null, null);
+			return classObj;
+		} catch (Exception e1) {
+			throw new TranslatorException(e1);
+		}
+	  
+  }
+  
+  public static Object setValue(String tableName, String columnName, Object cachedObject, Object value, Class classtype) throws TranslatorException {
+		LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Adding value to attribute: " + columnName); //$NON-NLS-1$
+	 try {
+		 ArrayList argTypes = new ArrayList(1);
+		 argTypes.add(classtype);
+		 Method m = findBestMethod(cachedObject.getClass(), "set" + columnName, argTypes);
+		 Object newValue = getArg(m, value);
+			 m.invoke(cachedObject, new Object[] {newValue});
+		 	
+		 	LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Set value " + value); //$NON-NLS-1$
+		 return value;
+	 } catch (InvocationTargetException x) {
+		 Throwable cause = x.getCause();
+		 System.err.format("invocation of %s failed: %s%n",
+				 "set" + columnName, cause.getMessage());
+		 LogManager.logError(LogConstants.CTX_CONNECTOR, "Error calling set" + columnName + ":" + cause.getMessage());
+		 return null;
+	 } catch (Exception e) {
+		 throw new TranslatorException(e.getMessage());
+	 }
+
+}  
+  
+  private static Object getArg(Method m, int value) {
+	  return Integer.valueOf(value);
+  }
+  private static Object getArg(Method m, double value) {
+	  return Double.valueOf(value);
+  }
+  private static Object getArg(Method m, long value) {
+	  return Long.valueOf(value);
+  }
+  private static Object getArg(Method m, float value) {
+	  return Float.valueOf(value);
+  }
+  private static Object getArg(Method m, short value) {
+	  return Short.valueOf(value);
+  }
+  private static Object getArg(Method m, boolean value) {
+	  return Boolean.valueOf(value);
+  }
+
+  private static Object getArg(Method m, Object value) throws Exception {
+	  return value;
+  }
+
+	
+  
+//  private static Object retrieveValue(Integer code, Object value) throws Exception {
+//      if(code != null) {
+//          // Calling the specific methods here is more likely to get uniform (and fast) results from different
+//          // data sources as the driver likely knows the best and fastest way to convert from the underlying
+//          // raw form of the data to the expected type.  We use a switch with codes in order without gaps
+//          // as there is a special bytecode instruction that treats this case as a map such that not every value 
+//          // needs to be tested, which means it is very fast.
+//          switch(code.intValue()) {
+//              case INTEGER_CODE:  {
+//                  return Integer.valueOf(value);
+//              }
+//              case LONG_CODE:  {
+//                  return Long.valueOf(value);
+//              }                
+//              case DOUBLE_CODE:  {
+//                  return Double.valueOf(value);
+//              }                
+//              case BIGDECIMAL_CODE:  {
+//                  return value; 
+//              }
+//              case SHORT_CODE:  {                  
+//                  return Short.valueOf(value);
+//              }
+//              case FLOAT_CODE:  {
+//                  return Float.valueOf(value);
+//              }
+//              case TIME_CODE: {
+//          		return value;
+//              }
+//              case DATE_CODE: {
+//          		return value;
+//              }
+//              case TIMESTAMP_CODE: {
+//          		return value;
+//              }
+//  			case BLOB_CODE: {
+//  					return value;
+//  			}
+//  			case CLOB_CODE: {
+//  					return value;
+//  			}  
+//  			case BOOLEAN_CODE: {
+//  				return Boolean.valueOf(value);
+//  			}
+//          }
+//      }
+//
+//      return value;
+//  }
+  
+  
+  private static Method findBestMethod(Class objectClass, String methodName, List argumentsClasses) throws SecurityException, NoSuchMethodException {
+      ReflectionHelper rh = new ReflectionHelper(objectClass);
+      
+      if (argumentsClasses == null) {
+          argumentsClasses = Collections.EMPTY_LIST;
+      }
+      Method m = rh.findBestMethodWithSignature(methodName, argumentsClasses);
+      return m;
+     
+  }
+
+
+}
+
+final class ParmHolder {
+	static ParmHolder holder = new ParmHolder();
+	String tableName;
+	List<String> nameNodes;
+	Class attributeType;
+	int nodeSize;
+	
+	// these parameters are use when the retrieved object is a collection type
+	// the node name path need to be captured
+	// 
+	boolean isCollection = false;
+	String nodeNamePathToGeCollection=null;
+	int collectionNodeDepth = -1;
+	
+	
+	private ParmHolder() {
+		
+	}
+	
+	static ParmHolder createParmHolder(String tablename, List<String> parsedAttributeName,  Class type) {
+			
+		holder.tableName = tablename;
+		holder.nameNodes = parsedAttributeName;
+		holder.attributeType = type;
+		holder.nodeSize = parsedAttributeName.size();
+		holder.isCollection = false;
+		holder.nodeNamePathToGeCollection=null;
+		holder.collectionNodeDepth = -1;
+		
+		return holder;
+	}
+	
+	void setCollection(int depth) {
+		
+		isCollection = true;
+		collectionNodeDepth = depth;
+		
+	}
+	
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/jboss-beans.xml	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/jboss-beans.xml	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+    <!-- Custom COHERENCE translator -->
+    <bean name="translator-customoracle-template" class="org.teiid.templates.TranslatorDeploymentTemplate">
+        <property name="info"><inject bean="translator-coherence" /> </property>
+        <property name="managedObjectFactory"> <inject bean="ManagedObjectFactory" /> </property>
+    </bean>
+
+    <bean name="translator-coherence" 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.coherence.CoherenceExecutionFactory</parameter>
+            <parameter class="java.lang.String">translator-coherence</parameter>
+            <parameter class="java.lang.String">coherence</parameter>
+        </constructor>
+    </bean>
+
+</deployment>
\ No newline at end of file


Property changes on: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/META-INF/jboss-beans.xml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/coherence/i18n.properties
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/coherence/i18n.properties	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/main/resources/org/teiid/translator/coherence/i18n.properties	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+CoherenceVisitor.missingComparisonExpression=Missing either left or right expression in comparison
+
+CoherenceVisitory.unsupportedElementError=Unsupported element {0}
\ No newline at end of file

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Leg.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Leg.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Leg.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,46 @@
+package org.teiid.translator.coherence;
+
+import java.io.Serializable;
+
+
+public class Leg  implements Serializable {
+
+	private static final long serialVersionUID = 7683272638393477962L;
+	
+private double notational;
+private long id;
+private String name;
+
+   public Leg() {
+       super();
+   }
+
+   public Leg(long legId, double notional) {
+       this.notational = notional;
+   }
+   
+   public String getName() {
+	   return this.name;
+   }
+   
+   public void setName(String name) {
+	   this.name = name;
+   }
+   
+   public long getLegId() {
+	   return id;
+   }
+   
+   public void setLegId(long id) {
+	   this.id = id;
+   }
+
+
+   public void setNotational(double notional) {
+       this.notational = notional;
+   }
+
+   public double getNotational() {
+       return notational;
+   }
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TestCoherenceTranslator.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TestCoherenceTranslator.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TestCoherenceTranslator.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,247 @@
+/*
+ * 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.coherence;
+
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+import org.teiid.cdk.api.ConnectorHost;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory;
+
+
+public class TestCoherenceTranslator extends TestCase  {
+	
+	public static final String CACHE_NAME = "Trades";
+	public static final String OBJECT_TRANSLATOR = "org.teiid.translator.coherence.TradesCacheSource";
+
+	
+	public static QueryMetadataInterface metadata = null;
+	
+	public static ConnectorHost host = null;
+	
+	public static final int NUMLEGS = 10;
+	public static final int NUMTRADES = 3;
+
+	static {
+		new TradesCacheSource();		
+		
+	}
+
+	private ConnectorHost setup() throws Exception {
+		CoherenceManagedConnectionFactory connFactory = new CoherenceManagedConnectionFactory();
+		connFactory.setCacheName(CACHE_NAME);
+		connFactory.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+		
+		CoherenceExecutionFactory execFactory = new CoherenceExecutionFactory();
+			
+		ConnectorHost host = new ConnectorHost(execFactory, connFactory.createConnectionFactory().getConnection(), UnitTestUtil.getTestDataPath() + "/Trade.vdb");
+		return host;
+	}
+
+	/**
+	 * This will instantiate the {@link CoherenceManagedConnectionFactory} and
+	 * obtain a connection to
+	 * 
+	 * @throws Exception
+	 */
+	public void testGet1TradeWith10Legs() throws Exception {
+			
+		ConnectorHost host = setup();
+		
+		List<List> actualResults = host.executeCommand("select tradeid, name, LegId, notational From Trade where tradeid = 1");
+		
+		for (Iterator it=actualResults.iterator(); it.hasNext();) {
+			List row = (List) it.next();
+//			System.out.println("ActualResults Columns #: " + row.size());
+			for (Iterator rowit=row.iterator(); rowit.hasNext();) {
+				Object actualValue = rowit.next();
+//				System.out.println("Result value type: " + actualValue.getClass().getName() + "  value: " + actualValue);
+			}
+			
+		}
+		
+        // Compare actual and expected results
+		// should get back the 10 legs associated with the trade
+        assertEquals("Did not get expected number of rows", 10, actualResults.size()); //$NON-NLS-1$
+             
+	}
+
+	public void testGetAllTrades() throws Exception {
+		
+		ConnectorHost host = setup();
+		
+		List actualResults = host.executeCommand("select tradeid, name From Trade");
+		
+        // Compare actual and expected results
+		// should get back the 10 legs for each trade (3) totaling 30
+        assertEquals("Did not get expected number of rows", 3, actualResults.size()); //$NON-NLS-1$
+             
+	}	
+	
+	public void testTradesAndLegsWhereTradeLessThanGreatThan() throws Exception {
+
+		
+		ConnectorHost host = setup();
+		
+		List actualResults = host.executeCommand("select tradeid, legid, notational From Trade where tradeid > 2");
+		
+        assertEquals("Did not get expected number of rows", 10, actualResults.size()); //$NON-NLS-1$
+        
+		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where tradeid < 3");
+		
+        assertEquals("Did not get expected number of rows", 20, actualResults.size()); //$NON-NLS-1$
+
+		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where tradeid <= 3");
+		
+        assertEquals("Did not get expected number of rows", 30, actualResults.size()); //$NON-NLS-1$
+        
+        actualResults = host.executeCommand("select tradeid, legid, notational From Trade where tradeid >= 1");
+		
+        assertEquals("Did not get expected number of rows", 30, actualResults.size()); //$NON-NLS-1$
+        
+		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where tradeid < 1");
+		
+        assertEquals("Did not get expected number of rows", 0, actualResults.size()); //$NON-NLS-1$
+              
+           
+	}	
+	
+	/**
+	 * This is not supported out-of-the-box in Coherence, but can be developed
+	 * @throws Exception
+	 */
+//	public void testTradesAndLegsWhereLegLessThanGreatThan() throws Exception {
+//
+//		CoherenceManagedConnectionFactory connFactory = new CoherenceManagedConnectionFactory();
+//		connFactory.setCacheName(CACHE_NAME);
+//		connFactory.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+//
+//		CoherenceExecutionFactory execFactory = new CoherenceExecutionFactory();
+//			
+//		ConnectorHost host = new ConnectorHost(execFactory, connFactory.createConnectionFactory().getConnection(), getTradeTranslationUtility());
+//		
+//		List actualResults = host.executeCommand("select tradeid, legid, notational From Trade where legid > 2");
+//		
+//        assertEquals("Did not get expected number of rows", 10, actualResults.size()); //$NON-NLS-1$
+//        
+//		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where legid < 3");
+//		
+//        assertEquals("Did not get expected number of rows", 20, actualResults.size()); //$NON-NLS-1$
+//
+//		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where legid <= 3");
+//		
+//        assertEquals("Did not get expected number of rows", 30, actualResults.size()); //$NON-NLS-1$
+//        
+//        actualResults = host.executeCommand("select tradeid, legid, notational From Trade where legid >= 1");
+//		
+//        assertEquals("Did not get expected number of rows", 30, actualResults.size()); //$NON-NLS-1$
+//        
+//		actualResults = host.executeCommand("select tradeid, legid, notational From Trade where legid < 1");
+//		
+//        assertEquals("Did not get expected number of rows", 0, actualResults.size()); //$NON-NLS-1$
+//              
+//           
+//	}	
+	
+
+	public void testLikeTradesWithLegs() throws Exception {
+
+		CoherenceManagedConnectionFactory connFactory = new CoherenceManagedConnectionFactory();
+		connFactory.setCacheName(CACHE_NAME);
+		connFactory.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+		CoherenceExecutionFactory execFactory = new CoherenceExecutionFactory();
+			
+		ConnectorHost host = new ConnectorHost(execFactory, connFactory.createConnectionFactory().getConnection(),getTradeTranslationUtility());
+		
+		List actualResults = host.executeCommand("select tradeid, name, legid, notational From Trade where Name like 'Trade%' ");
+		
+        // Compare actual and expected results
+		// should get back the 10 legs for each trade (3) totaling 30
+        assertEquals("Did not get expected number of rows", 30, actualResults.size()); //$NON-NLS-1$
+        
+        actualResults = host.executeCommand("select tradeid, legid, notational From Trade where Name like '%2%' ");
+		
+        // Compare actual and expected results
+		// should get back the 10 legs for each trade (3) totaling 30
+        assertEquals("Did not get expected number of rows", 10, actualResults.size()); //$NON-NLS-1$
+        
+             
+	}		
+
+   
+    
+	public TranslationUtility getTradeTranslationUtility() {
+		MetadataStore metadataStore = new MetadataStore();
+        // Create models
+        Schema trading = RealMetadataFactory.createPhysicalModel("CoherenceModel", metadataStore); //$NON-NLS-1$
+        
+        // Create physical groups
+        Table quotes = RealMetadataFactory.createPhysicalGroup("TRADE", trading); //$NON-NLS-1$
+                
+        // Create physical elements
+        String[] elemNames = new String[] {
+                "NAME", "TRADEID", "LEGID", "NOTATIONAL", "LEGNAME"  //$NON-NLS-1$ //$NON-NLS-2$
+        };
+        String[] elemTypes = new String[] {  
+        		DataTypeManager.DefaultDataTypes.STRING,
+                DataTypeManager.DefaultDataTypes.LONG, 
+                DataTypeManager.DefaultDataTypes.LONG,
+                DataTypeManager.DefaultDataTypes.DOUBLE,
+        		DataTypeManager.DefaultDataTypes.STRING
+        };
+        
+        List<Column> cols = RealMetadataFactory.createElements(quotes, elemNames, elemTypes);
+        
+        // Set name in source on each column
+        String[] nameInSource = new String[] {
+        		"Name",
+            	"TradeId", 
+                "Legs.LegId",           
+                "Legs.Notational",
+                "Legs.Name"
+        };
+        for(int i=0; i<nameInSource.length; i++) {
+            cols.get(i).setNameInSource(nameInSource[i]);
+        }
+        
+        // Set column-specific properties
+ //       cols.get(0).setSelectable(false);
+ //       cols.get(0).setSearchType(SearchType.Unsearchable);
+        
+		return new TranslationUtility(RealMetadataFactory.createTransformationMetadata(metadataStore, "trading"));
+	}
+    
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Trade.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Trade.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/Trade.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,56 @@
+package org.teiid.translator.coherence;
+
+import java.io.Serializable;
+
+import java.util.Map;
+
+
+
+public class Trade  implements Serializable {
+
+	private static final long serialVersionUID = 8611785625511714561L;
+	
+private Map legs;
+private long id;
+private String name;
+
+   public Trade() {
+   }
+
+   public Trade(long tradeId, Map legs) {
+       this.legs = legs;
+   }
+   
+   public long getTradeId() {
+	   return id;
+   }
+   
+   public void setTradeId(long id) {
+	   this.id = id;
+   }
+
+   public void setName(String name) {
+	   this.name = name;
+   }
+   
+   public String getName() {
+	   return this.name;
+   }
+
+   public void setLegs(Map legs) {
+       this.legs = legs;
+   }
+
+   public Map getLegs() {
+       return legs;
+   }
+   
+   public String toString() {
+	   
+	   StringBuffer sb = new StringBuffer("Trade:");
+	   sb.append(" id " + getTradeId());
+	   sb.append(" numLegs " + getLegs().size());
+	   return sb.toString();
+   }
+   
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TradesCacheSource.java
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TradesCacheSource.java	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/src/test/java/org/teiid/translator/coherence/TradesCacheSource.java	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,86 @@
+package org.teiid.translator.coherence;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+
+import com.tangosol.net.CacheFactory;
+import com.tangosol.net.NamedCache;
+
+/**
+ * Sample implementation of the SouceCacheAdapter that will
+ * translate the Trade related objects to the row/columns that
+ * are returned in the resultset
+ * 
+ * @author vhalbert
+ *
+ */
+public class TradesCacheSource extends SourceCacheAdapter {
+	public static final String CACHE_NAME = "Trades";
+	public static final int NUMLEGS = 10;
+	public static final int NUMTRADES = 3;
+	
+	static {
+		try {
+			loadCoherence();
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * Load the cache with 3 trades and 10 legs for each trade.
+	 * 
+	 * @throws Exception
+	 */
+	public static void loadCoherence() throws Exception {
+		NamedCache tradesCache = CacheFactory.getCache(CACHE_NAME);
+
+		// populate the cache
+		Map legsMap = new HashMap();
+		
+		Object trade = createObject("org.teiid.translator.coherence.Trade");
+		for (int i = 1; i <= NUMTRADES; i++) {
+
+			for (int j = 1; j <= NUMLEGS; j++) {
+				Object leg = createObject("org.teiid.translator.coherence.Leg");
+					//new Leg();
+				if (leg == null) {
+					throw new Exception("Unable to create leg");
+				}
+				setValue("Trade", "LegId", leg, j, long.class);
+				setValue("Trade", "Notational", leg, j, double.class);
+				setValue("Trade", "Name", leg, "LegName " + j, String.class);
+				
+				legsMap.put(j, leg);
+			}
+			
+			setValue("Trade", "TradeId", trade, i, long.class);
+			setValue("Trade", "Name", trade, "TradeName " + i, String.class);
+			setValue("Trade", "Legs", trade, legsMap, Map.class);
+			
+			tradesCache.put(i, trade);
+		}
+
+		System.out.println("Loaded Coherence");
+
+	}	
+	
+	public void addMetadata() throws TranslatorException {
+		
+		Table t = addTable("Trade");
+		addColumn("Name", "Name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
+		addColumn("TradeId", "TradeId", DataTypeManager.DefaultDataTypes.LONG, t); //$NON-NLS-1$
+		addColumn("LegId", "Legs.LegId", DataTypeManager.DefaultDataTypes.LONG, t); //$NON-NLS-1$
+		addColumn("Notational", "Legs.Notational", DataTypeManager.DefaultDataTypes.DOUBLE, t); //$NON-NLS-1$
+		addColumn("LegName", "Legs.Name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
+						
+	}
+	
+}

Added: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/resources/Trade.vdb
===================================================================
(Binary files differ)


Property changes on: branches/7.7.x/connectors/sandbox/translator-coherence/src/test/resources/Trade.vdb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/7.7.x/connectors/sandbox/translator-coherence/usage-guidelines.txt
===================================================================
--- branches/7.7.x/connectors/sandbox/translator-coherence/usage-guidelines.txt	                        (rev 0)
+++ branches/7.7.x/connectors/sandbox/translator-coherence/usage-guidelines.txt	2012-02-06 05:31:15 UTC (rev 3846)
@@ -0,0 +1,60 @@
+Here are the usage guidelines for using the Coherence translator/connector.
+
+--------------
+Features
+-------------
+1.	SQL queries support:  Comprisons (EQ, LT, GT, etc.), Like, In
+
+-------------
+Modeling Guidelines
+-------------
+
+
+1.	JavaBean convention is used.  The column name (or nameinsource if used) are used in finding the get/set method on the cached object.  
+	What does that mean?
+
+    Example:
+    	Object:   Trade
+    	Attribute:   TradeId  (getter/setter:  getTradeId/setTradeId)
+    	
+	   in the Designer, if the column name is not the name of the a attribute, then the nameInSource will have to be set to the Attribute name
+	   			example:  	columnName:		TRADE_ID
+							nameInSource:   TradeId
+								
+	The process of getting the trade id value from the Trade object will take the nameInSource (if not provided, then use column name) and prepend "get".
+	Therefore, the method name:   getTradeId  must exist on the Trade object.
+	
+	
+2.	The Coherence Cache Name will be set on the Coherence Connector, see it for configuration.
+
+
+
+------------
+Limitations
+------------
+
+	-	A Designer modeled table can only be referencing 1 collection in the root object. 
+		If the root object contains multiple collection type objects, then a table will need to be modeled for each collection.    This will allow the 
+		the Teiid engine to perform the join across collections.
+	-	Cannot put criteria on a column that comes from an object that is in a Collection.  This is a coherence limitation out-of-the-box.  This can
+		be implemented to enable this capability.
+		
+		
+---------------------
+TBD:  The following are things to be added:
+---------------------
+
+	a.  Enable the mapping of a column to a property.  Using this syntax structure: property.<propertyName>
+		set the nameInSource to this value.
+			
+	b.	Enable the support for Boolean.   This would use the "is" prefix to the getter method. (note, this has been coded for, but not tested)
+	
+	c.	enable the abiltiy to a criteria for a column from an object in the collection
+	
+	d.	Because all sql criteria has to mapped to Coherence filters, only some have been mapped so far.  There are others that need to be added so that 
+		the following features will be enabled:
+		-	Limit
+		-	Between
+		-	and others 
+		
+		see http://www.exforsys.com/reviews/oracle-coherence.html for information  and examples
\ No newline at end of file



More information about the teiid-commits mailing list