teiid SVN: r3854 - in branches/7.7.x: engine/src/main/java/org/teiid/common/buffer and 12 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-02-07 23:26:20 -0500 (Tue, 07 Feb 2012)
New Revision: 3854
Added:
branches/7.7.x/test-integration/perf/
branches/7.7.x/test-integration/perf/pom.xml
branches/7.7.x/test-integration/perf/src/
branches/7.7.x/test-integration/perf/src/test/
branches/7.7.x/test-integration/perf/src/test/java/
branches/7.7.x/test-integration/perf/src/test/java/org/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
branches/7.7.x/test-integration/perf/src/test/resources/
Modified:
branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
branches/7.7.x/test-integration/pom.xml
Log:
TEIID-1926 adding a performance test and changes to speed up the enhanced sort case
Modified: branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -22,6 +22,7 @@
package org.teiid.logging;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,23 +31,34 @@
*/
public class JavaLogger implements org.teiid.logging.Logger {
+ private ConcurrentHashMap<String, Logger> loggers = new ConcurrentHashMap<String, Logger>();
+
@Override
public boolean isEnabled(String context, int msgLevel) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(msgLevel);
return logger.isLoggable(javaLevel);
}
+ private Logger getLogger(String context) {
+ Logger logger = loggers.get(context);
+ if (logger == null) {
+ logger = Logger.getLogger(context);
+ loggers.put(context, logger);
+ }
+ return logger;
+ }
+
public void log(int level, String context, Object msg) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(level);
logger.log(javaLevel, msg.toString());
}
public void log(int level, String context, Throwable t, Object msg) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(level);
logger.log(javaLevel, msg != null ? msg.toString() : null, t);
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -27,9 +27,9 @@
import java.lang.ref.ReferenceQueue;
import java.util.Collections;
import java.util.IdentityHashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.ListIterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
@@ -132,7 +132,7 @@
return id;
}
- static SearchResult search(SPage page, List k, LinkedList<SearchResult> parent) throws TeiidComponentException {
+ static SearchResult search(SPage page, List k, List<SearchResult> parent) throws TeiidComponentException {
List<List<?>> previousValues = null;
for (;;) {
List<List<?>> values = page.getValues();
@@ -152,8 +152,8 @@
SPage childPage = page;
List oldKey = null;
List newKey = page.stree.extractKey(values.get(0));
- for (Iterator<SearchResult> desc = parent.descendingIterator(); desc.hasNext();) {
- SearchResult sr = desc.next();
+ for (ListIterator<SearchResult> desc = parent.listIterator(); desc.hasPrevious();) {
+ SearchResult sr = desc.previous();
int parentIndex = Math.max(0, -sr.index - 2);
if (oldKey == null) {
oldKey = sr.values.set(parentIndex, newKey);
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -235,7 +235,7 @@
* @throws IOException
* @throws TeiidComponentException
*/
- List find(List n, LinkedList<SearchResult> places) throws TeiidComponentException {
+ List find(List n, List<SearchResult> places) throws TeiidComponentException {
SPage x = null;
for (int i = header.length - 1; i >= 0; i--) {
if (x == null) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import org.teiid.common.buffer.SPage.SearchResult;
@@ -53,6 +52,8 @@
private boolean direction;
private boolean inPartial;
+
+ private ArrayList<SearchResult> places = new ArrayList<SearchResult>();
/**
* Construct a value based browser. The {@link TupleSource} should already be in the
@@ -98,9 +99,8 @@
if (!isPartialKey && lowerBound != null && this.tree.comparator.compare(upperBound, lowerBound) < 0) {
valid = false;
}
- LinkedList<SearchResult> places = new LinkedList<SearchResult>();
- this.tree.find(upperBound, places);
- SearchResult upper = places.getLast();
+ this.tree.find(upperBound, getPlaces());
+ SearchResult upper = places.get(places.size() - 1);
bound = upper.page;
boundIndex = upper.index;
if (boundIndex < 0) {
@@ -141,10 +141,9 @@
}
private boolean setPage(List<?> lowerBound) throws TeiidComponentException {
- LinkedList<SearchResult> places = new LinkedList<SearchResult>();
- this.tree.find(lowerBound, places);
+ this.tree.find(lowerBound, getPlaces());
- SearchResult sr = places.getLast();
+ SearchResult sr = places.get(places.size() - 1);
page = sr.page;
index = sr.index;
boolean result = true;
@@ -156,6 +155,11 @@
return result;
}
+ private ArrayList<SearchResult> getPlaces() {
+ places.clear();
+ return places;
+ }
+
@Override
public List<?> nextTuple() throws TeiidComponentException,
TeiidProcessingException {
@@ -234,6 +238,11 @@
}
}
}
+
+ public void reset(TupleSource ts) throws TeiidComponentException {
+ this.valueSet = ts;
+ resetState();
+ }
private void resetState() throws TeiidComponentException {
if (updated) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -38,6 +38,8 @@
*/
public class LrfuEvictionQueue<V extends BaseCacheEntry> {
+ private static final long DEFAULT_HALF_LIFE = 1<<17;
+ private static final long MIN_INTERVAL = 1<<10;
//TODO: until Java 7 ConcurrentSkipListMap has a scaling bug in that
//the level function limits the effective map size to ~ 2^16
//above which it performs comparably under multi-threaded load to a synchronized LinkedHashMap
@@ -49,7 +51,7 @@
public LrfuEvictionQueue(AtomicLong clock) {
this.clock = clock;
- setHalfLife(1<<17);
+ setHalfLife(DEFAULT_HALF_LIFE);
}
public boolean remove(V value) {
@@ -61,6 +63,10 @@
}
public void touch(V value) {
+ long tick = clock.get();
+ if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) {
+ return;
+ }
evictionQueue.remove(value.getKey());
recordAccess(value);
evictionQueue.put(value.getKey(), value);
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -38,7 +38,6 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
-import org.teiid.query.processor.CollectionTupleSource;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
@@ -55,6 +54,25 @@
*/
public class EnhancedSortMergeJoinStrategy extends MergeJoinStrategy {
+ private final class SingleTupleSource implements TupleSource {
+ boolean returned;
+ List keyTuple;
+
+ @Override
+ public List<?> nextTuple() throws TeiidComponentException,
+ TeiidProcessingException {
+ if (!returned) {
+ returned = true;
+ return keyTuple;
+ }
+ return null;
+ }
+
+ @Override
+ public void closeSource() {
+ }
+ }
+
private boolean semiDep;
private TupleSource currentSource;
@@ -62,6 +80,7 @@
private SourceState notSortedSource;
private List<?> currentTuple;
private TupleBrowser tb;
+ private SingleTupleSource keyTs;
private int reserved;
private STree index;
private int[] reverseIndexes;
@@ -99,6 +118,7 @@
this.notSortedSource = null;
this.sortedTuple = null;
this.reverseIndexes = null;
+ this.keyTs = null;
}
/**
@@ -177,6 +197,9 @@
this.index.removeRowIdFromKey();
state.markDistinct(true);
}
+ keyTs = new SingleTupleSource();
+ keyTs.keyTuple = new ArrayList<Object>(notSortedSource.getExpressionIndexes().length);
+ tb = new TupleBrowser(this.index, keyTs, OrderBy.ASC);
}
@Override
@@ -189,8 +212,8 @@
private boolean shouldIndexIfSmall(SourceState source) throws TeiidComponentException, TeiidProcessingException {
Number cardinality = source.getSource().getEstimateNodeCardinality();
- return (source.hasBuffer() || (cardinality != null && cardinality.floatValue() != NewCalculateCostUtil.UNKNOWN_VALUE && cardinality.floatValue() <= this.joinNode.getBatchSize()))
- && (source.getRowCount() <= this.joinNode.getBatchSize());
+ return (source.hasBuffer() || (cardinality != null && cardinality.floatValue() != NewCalculateCostUtil.UNKNOWN_VALUE && cardinality.floatValue() <= source.getSource().getBatchSize() / 4))
+ && (source.getRowCount() <= source.getSource().getBatchSize() / 2);
}
@Override
@@ -318,8 +341,10 @@
this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), tuple));
continue;
}
- List<?> key = RelationalNode.projectTuple(this.notSortedSource.getExpressionIndexes(), this.currentTuple);
- tb = new TupleBrowser(this.index, new CollectionTupleSource(Arrays.asList(key).iterator()), OrderBy.ASC);
+ this.keyTs.keyTuple.clear();
+ RelationalNode.projectTuple(this.notSortedSource.getExpressionIndexes(), this.currentTuple, this.keyTs.keyTuple, false);
+ keyTs.returned = false;
+ tb.reset(keyTs);
}
if (sortedTuple == null) {
sortedTuple = tb.nextTuple();
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -378,11 +378,12 @@
public static <T> List<T> projectTuple(int[] indexes, List<T> tupleValues) {
return projectTuple(indexes, tupleValues, false);
}
-
+
public static <T> List<T> projectTuple(int[] indexes, List<T> tupleValues, boolean omitMissing) {
-
- List<T> projectedTuple = new ArrayList<T>(indexes.length);
-
+ return projectTuple(indexes, tupleValues, new ArrayList<T>(indexes.length), omitMissing);
+ }
+
+ public static <T> List<T> projectTuple(int[] indexes, List<T> tupleValues, List<T> projectedTuple, boolean omitMissing) {
for (int index : indexes) {
if (omitMissing && index == -1) {
projectedTuple.add(null);
Added: branches/7.7.x/test-integration/perf/pom.xml
===================================================================
--- branches/7.7.x/test-integration/perf/pom.xml (rev 0)
+++ branches/7.7.x/test-integration/perf/pom.xml 2012-02-08 04:26:20 UTC (rev 3854)
@@ -0,0 +1,28 @@
+<?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>teiid-test-integration</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.7.0.CR1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-integration-perf</artifactId>
+ <name>Common Integration Tests</name>
+ <description>Performance tests that do not require external dependencies</description>
+
+ <dependencies>
+ <dependency>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Property changes on: branches/7.7.x/test-integration/perf/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
===================================================================
--- branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java (rev 0)
+++ branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java 2012-02-08 04:26:20 UTC (rev 3854)
@@ -0,0 +1,250 @@
+/*
+ * 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.query.processor.relational;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.common.buffer.BlockedException;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.impl.BufferFrontedFileStoreCache;
+import org.teiid.common.buffer.impl.BufferManagerImpl;
+import org.teiid.common.buffer.impl.FileStorageManager;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.processor.relational.MergeJoinStrategy.SortOption;
+import org.teiid.query.processor.relational.SortUtility.Mode;
+import org.teiid.query.sql.lang.JoinType;
+import org.teiid.query.sql.lang.OrderBy;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.util.CommandContext;
+
+@SuppressWarnings("nls")
+public class TestPerformance {
+
+ private static BufferManagerImpl bm;
+ private static ExecutorService es;
+ private static Random r = new Random(0);
+
+ private void runTask(final int iterations, int threadCount,
+ final Callable<Void> task) throws InterruptedException, Exception {
+ List<Callable<Void>> tasks = new ArrayList<Callable<Void>>(threadCount);
+ for (int i = 0; i < threadCount; i++) {
+ tasks.add(new Callable<Void>() {
+
+ @Override
+ public Void call() throws Exception {
+ for (int j = 0; j < iterations; j++) {
+ task.call();
+ }
+ return null;
+ }
+
+ });
+ }
+ es.invokeAll(tasks);
+ for (Callable<Void> callable : tasks) {
+ callable.call();
+ }
+ }
+
+ private void process(RelationalNode node, int expectedRows)
+ throws TeiidComponentException, TeiidProcessingException {
+ node.open();
+
+ int currentRow = 1;
+ while(true) {
+ try {
+ TupleBatch batch = node.nextBatch();
+ currentRow += batch.getRowCount();
+ if(batch.getTerminationFlag()) {
+ break;
+ }
+ } catch (BlockedException e) {
+
+ }
+ }
+ assertEquals(expectedRows, currentRow - 1);
+ node.close();
+ }
+
+ public void helpTestSort(final BufferManager bufferManager, final int rowCount, final int iterations, int threadCount) throws Exception {
+ final List<?>[] data = sampleData(rowCount);
+
+ ElementSymbol elem1 = new ElementSymbol("e1");
+ elem1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ ElementSymbol elem2 = new ElementSymbol("e2");
+ elem2.setType(DataTypeManager.DefaultDataClasses.STRING);
+
+ final List<ElementSymbol> sortElements = Arrays.asList(elem1);
+ final List<ElementSymbol> elems = Arrays.asList(elem1, elem2);
+ final Callable<Void> task = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ helpTestSort(Mode.SORT, rowCount, sortElements, data, elems, bufferManager);
+ return null;
+ }
+ };
+ runTask(iterations, threadCount, task);
+ }
+
+ private List<?>[] sampleData(final int rowCount) {
+ final List<?>[] data = new List<?>[rowCount];
+
+ for (int i = 0; i < rowCount; i++) {
+ data[i] = Arrays.asList(i, String.valueOf(i));
+ }
+ Collections.shuffle(Arrays.asList(data), r);
+ return data;
+ }
+
+ public void helpTestSort(Mode mode, int expectedRowCount, List<? extends SingleElementSymbol> sortElements, List<?>[] data, List<? extends SingleElementSymbol> elems, BufferManager bufferManager) throws TeiidComponentException, TeiidProcessingException {
+ CommandContext context = new CommandContext ("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ FakeRelationalNode dataNode = new FakeRelationalNode(0, data);
+ dataNode.setElements(elems);
+ dataNode.initialize(context, bufferManager, null);
+
+ SortNode sortNode = new SortNode(1);
+ sortNode.setSortElements(new OrderBy(sortElements).getOrderByItems());
+ sortNode.setMode(mode);
+ sortNode.setElements(dataNode.getElements());
+ sortNode.addChild(dataNode);
+ sortNode.initialize(context, dataNode.getBufferManager(), null);
+
+ process(sortNode, expectedRowCount);
+ }
+
+ public void helpTestEquiJoin(int expectedRowCount, List<?>[] leftData, List<?>[] rightData, List<? extends SingleElementSymbol> elems, BufferManager bufferManager, JoinStrategy joinStrategy, JoinType joinType) throws TeiidComponentException, TeiidProcessingException {
+ CommandContext context = new CommandContext ("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ FakeRelationalNode dataNode1 = new FakeRelationalNode(1, leftData);
+ dataNode1.setElements(elems);
+ dataNode1.initialize(context, bufferManager, null);
+
+ FakeRelationalNode dataNode2 = new FakeRelationalNode(2, rightData);
+ dataNode2.setElements(elems);
+ dataNode2.initialize(context, bufferManager, null);
+
+ JoinNode join = new JoinNode(3);
+ join.addChild(dataNode1);
+ join.addChild(dataNode2);
+ join.setJoinStrategy(joinStrategy.clone());
+ join.setElements(elems);
+ join.setJoinType(joinType);
+ join.setJoinExpressions(elems.subList(0, 1), elems.subList(0, 1));
+ join.initialize(context, bufferManager, null);
+
+ process(join, expectedRowCount);
+ }
+
+ public void helpTestEquiJoin(final BufferManager bufferManager, int leftRowCount, int rightRowCount, final int iterations, int threadCount, final JoinStrategy joinStrategy, final JoinType joinType, final int expectedRowCount) throws Exception {
+ final List<?>[] leftData = sampleData(leftRowCount);
+ final List<?>[] rightData = sampleData(rightRowCount);
+
+ ElementSymbol elem1 = new ElementSymbol("e1");
+ elem1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ ElementSymbol elem2 = new ElementSymbol("e2");
+ elem2.setType(DataTypeManager.DefaultDataClasses.STRING);
+
+ final List<ElementSymbol> elems = Arrays.asList(elem1, elem2);
+ final Callable<Void> task = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ helpTestEquiJoin(expectedRowCount, leftData, rightData, elems, bufferManager, joinStrategy, joinType);
+ return null;
+ }
+ };
+ runTask(iterations, threadCount, task);
+ }
+
+ @BeforeClass public static void oneTimeSetup() throws TeiidComponentException {
+ bm = new BufferManagerImpl();
+
+ bm.setMaxProcessingKB(1<<12);
+ bm.setMaxReserveKB((1<<19)-(1<<17));
+ bm.setMaxActivePlans(20);
+
+ BufferFrontedFileStoreCache cache = new BufferFrontedFileStoreCache();
+ cache.setMemoryBufferSpace(1<<27);
+ FileStorageManager fsm = new FileStorageManager();
+ fsm.setStorageDirectory(UnitTestUtil.getTestScratchPath() + "/data");
+ cache.setStorageManager(fsm);
+ cache.initialize();
+ bm.setCache(cache);
+ bm.initialize();
+
+ es = Executors.newCachedThreadPool();
+ }
+
+ @Test public void runSort_1_100() throws Exception {
+ helpTestSort(bm, 100, 20000, 1);
+ }
+
+ @Test public void runSort_4_5000() throws Exception {
+ helpTestSort(bm, 5000, 1000, 4);
+ }
+
+ @Test public void runSort_16_250000() throws Exception {
+ helpTestSort(bm, 250000, 10, 16);
+ }
+
+ @Test public void runInnerEnhancedJoin_1_100_500() throws Exception {
+ helpTestEquiJoin(bm, 100, 500, 10000, 1, new EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER, 100);
+ }
+
+ @Test public void runInnerEnhancedJoin_4_200_15000() throws Exception {
+ helpTestEquiJoin(bm, 200, 15000, 500, 4, new EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER, 200);
+ }
+
+ @Test public void runInnerEnhancedJoin_16_400_500000() throws Exception {
+ helpTestEquiJoin(bm, 400, 500000, 10, 16, new EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER, 400);
+ }
+
+ @Test public void runInnerMergeJoin_1_100_100() throws Exception {
+ helpTestEquiJoin(bm, 100, 100, 10000, 1, new MergeJoinStrategy(SortOption.SORT, SortOption.SORT, false), JoinType.JOIN_INNER, 100);
+ }
+
+ @Test public void runInnerMergeJoin_4_4000_4000() throws Exception {
+ helpTestEquiJoin(bm, 4000, 4000, 500, 4, new MergeJoinStrategy(SortOption.SORT, SortOption.SORT, false), JoinType.JOIN_INNER, 4000);
+ }
+
+ @Test public void runInnerMergeJoin_16_100000_100000() throws Exception {
+ helpTestEquiJoin(bm, 100000, 100000, 10, 16, new MergeJoinStrategy(SortOption.SORT, SortOption.SORT, false), JoinType.JOIN_INNER, 100000);
+ }
+
+}
Property changes on: branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/7.7.x/test-integration/pom.xml
===================================================================
--- branches/7.7.x/test-integration/pom.xml 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/test-integration/pom.xml 2012-02-08 04:26:20 UTC (rev 3854)
@@ -19,6 +19,18 @@
<apache.ant.version>1.7.0</apache.ant.version>
</properties>
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>perf</id>
+ <modules>
+ <module>perf</module>
+ </modules>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>org.jboss.teiid</groupId>
12 years, 11 months
teiid SVN: r3853 - in branches/7.7.x: client/src/test/java/org/teiid/jdbc and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-02-07 21:54:20 -0500 (Tue, 07 Feb 2012)
New Revision: 3853
Modified:
branches/7.7.x/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java
branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestDataTypeTransformer.java
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
Log:
TEIID-1927 fix for SerialClob getSubString
Modified: branches/7.7.x/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java
===================================================================
--- branches/7.7.x/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java 2012-02-07 15:30:30 UTC (rev 3852)
+++ branches/7.7.x/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java 2012-02-08 02:54:20 UTC (rev 3853)
@@ -229,7 +229,12 @@
return ((SQLXML)value).getString();
} else if (value instanceof Clob) {
Clob c = (Clob)value;
- return c.getSubString(1, c.length()>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)c.length());
+ long length = c.length();
+ if (length == 0) {
+ //there is a bug in SerialClob with 0 length
+ return ""; //$NON-NLS-1$
+ }
+ return c.getSubString(1, length>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)length);
}
return transform(value, String.class, "String"); //$NON-NLS-1$
}
Modified: branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestDataTypeTransformer.java
===================================================================
--- branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestDataTypeTransformer.java 2012-02-07 15:30:30 UTC (rev 3852)
+++ branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestDataTypeTransformer.java 2012-02-08 02:54:20 UTC (rev 3853)
@@ -22,24 +22,25 @@
package org.teiid.jdbc;
+import static org.junit.Assert.*;
+
import java.sql.Clob;
import java.sql.SQLException;
import javax.sql.rowset.serial.SerialClob;
-import org.teiid.jdbc.DataTypeTransformer;
+import org.junit.Test;
-import junit.framework.TestCase;
-
-public class TestDataTypeTransformer extends TestCase {
+@SuppressWarnings("nls")
+public class TestDataTypeTransformer {
- public void testClobToStringConversion() throws Exception {
+ @Test public void testClobToStringConversion() throws Exception {
Clob clob = new SerialClob("foo".toCharArray()); //$NON-NLS-1$
String value = DataTypeTransformer.getString(clob);
assertEquals("foo", value); //$NON-NLS-1$
}
- public void testInvalidTransformation() throws Exception {
+ @Test public void testInvalidTransformation() throws Exception {
try {
DataTypeTransformer.getDate(Integer.valueOf(1));
fail("exception expected"); //$NON-NLS-1$
@@ -48,8 +49,17 @@
}
}
- public void testGetByte() throws Exception {
+ @Test public void testGetDefaultShort() throws Exception {
assertEquals(0, DataTypeTransformer.getShort(null));
}
+
+ @Test public void testGetDefaultByte() throws Exception {
+ assertEquals(0, DataTypeTransformer.getByte(null));
+ }
+
+ @Test public void testGetString() throws Exception {
+ assertEquals("", DataTypeTransformer.getString(new SerialClob(new char[0])));
+ }
+
}
Modified: branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
===================================================================
--- branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-02-07 15:30:30 UTC (rev 3852)
+++ branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-02-08 02:54:20 UTC (rev 3853)
@@ -109,6 +109,13 @@
assertEquals("<root></root>", s.getResultSet().getString(1));
}
+ @Test public void testLobStreaming1() throws Exception {
+ Statement s = conn.createStatement();
+ assertTrue(s.execute("select cast('' as clob) from tables"));
+ s.getResultSet().next();
+ assertEquals("", s.getResultSet().getString(1));
+ }
+
@Test public void testXmlTableScrollable() throws Exception {
Statement s = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
assertTrue(s.execute("select * from xmltable('/root/row' passing (select xmlelement(name \"root\", xmlagg(xmlelement(name \"row\", xmlforest(t.name)) order by t.name)) from tables as t, columns as t1) columns \"Name\" string) as x"));
12 years, 11 months
teiid SVN: r3852 - in branches/7.7.x: engine/src/main/java/org/teiid/common/buffer/impl and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-02-07 10:30:30 -0500 (Tue, 07 Feb 2012)
New Revision: 3852
Modified:
branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBufferFrontedFileStoreCache.java
Log:
TEIID-1931 correcting buffer initialization to account for max storage size in max blocks
Modified: branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
===================================================================
--- branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2012-02-07 02:26:11 UTC (rev 3851)
+++ branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2012-02-07 15:30:30 UTC (rev 3852)
@@ -69,7 +69,7 @@
Teiid has a non-negligible amount of overhead per batch/table page on the order of 100-200 bytes. Depending on the data types involved each
full batch/table page will represent a variable number of rows (a power of two multiple above or below the processor batch size). If you are dealing with datasets with billions of rows and you run into OutOfMemory issues, consider increasing the processor
batch size in the &jboss-beans; file to force the allocation of larger batches and table pages. If the processor batch size is increased and/or you are dealing with extremely wide result sets (several hundred columns),
- then the default setting of 8MB for the maxStorageObjectSize in the &jboss-beans; file may be too low. The sizing for maxStorageObjectSize is terms of serialized size, which will be much
+ then the default setting of 8MB for the maxStorageObjectSize in the &jboss-beans; file may be too low. The sizing for maxStorageObjectSize is in terms of serialized size, which will be much
closer to the raw data size then the Java memory footprint estimation used for maxReservedKB.
maxStorageObjectSize should not be set too large relative to memoryBufferSpace since it will reduce the performance of the memory buffer. The memory buffer supports only 1 concurrent writer for each maxStorageObjectSize of the memoryBufferSpace.
</para>
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java 2012-02-07 02:26:11 UTC (rev 3851)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java 2012-02-07 15:30:30 UTC (rev 3852)
@@ -506,6 +506,7 @@
this.inodeByteBuffer = new BlockByteBuffer(30, blocks+1, LOG_INODE_SIZE, direct);
memoryWritePermits = new Semaphore(blocks);
maxMemoryBlocks = Math.min(MAX_DOUBLE_INDIRECT, blocks);
+ maxMemoryBlocks = Math.min(maxMemoryBlocks, maxStorageObjectSize>>LOG_BLOCK_SIZE + ((maxStorageObjectSize&BufferFrontedFileStoreCache.BLOCK_MASK)>0?1:0));
//try to maintain enough freespace so that writers don't block in cleaning
cleaningThreshold = Math.min(maxMemoryBlocks<<4, blocks>>1);
criticalCleaningThreshold = Math.min(maxMemoryBlocks<<2, blocks>>2);
@@ -1076,5 +1077,9 @@
public void setMinDefrag(long minDefrag) {
this.minDefrag = minDefrag;
}
+
+ public int getMaxMemoryBlocks() {
+ return maxMemoryBlocks;
+ }
}
\ No newline at end of file
Modified: branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBufferFrontedFileStoreCache.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBufferFrontedFileStoreCache.java 2012-02-07 02:26:11 UTC (rev 3851)
+++ branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBufferFrontedFileStoreCache.java 2012-02-07 15:30:30 UTC (rev 3852)
@@ -148,6 +148,7 @@
@Test public void testEviction() throws Exception {
BufferFrontedFileStoreCache cache = createLayeredCache(1<<15, 1<<15);
+ assertEquals(3, cache.getMaxMemoryBlocks());
CacheEntry ce = new CacheEntry(2l);
Serializer<Integer> s = new SimpleSerializer();
12 years, 11 months
teiid SVN: r3851 - in branches/7.7.x/engine/src: test/java/org/teiid/query/optimizer and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-02-06 21:26:11 -0500 (Mon, 06 Feb 2012)
New Revision: 3851
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
Log:
TEIID-1929 allowing inline views to always have columns aliased
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-02-07 02:12:28 UTC (rev 3850)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-02-07 02:26:11 UTC (rev 3851)
@@ -49,48 +49,12 @@
import org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements;
import org.teiid.query.optimizer.relational.rules.RuleChooseJoinStrategy;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.processor.relational.AccessNode;
-import org.teiid.query.processor.relational.ArrayTableNode;
-import org.teiid.query.processor.relational.DependentAccessNode;
-import org.teiid.query.processor.relational.DependentProcedureAccessNode;
-import org.teiid.query.processor.relational.DependentProcedureExecutionNode;
-import org.teiid.query.processor.relational.EnhancedSortMergeJoinStrategy;
-import org.teiid.query.processor.relational.GroupingNode;
-import org.teiid.query.processor.relational.InsertPlanExecutionNode;
-import org.teiid.query.processor.relational.JoinNode;
-import org.teiid.query.processor.relational.LimitNode;
-import org.teiid.query.processor.relational.MergeJoinStrategy;
-import org.teiid.query.processor.relational.NestedLoopJoinStrategy;
-import org.teiid.query.processor.relational.NestedTableJoinStrategy;
-import org.teiid.query.processor.relational.NullNode;
-import org.teiid.query.processor.relational.PlanExecutionNode;
-import org.teiid.query.processor.relational.ProjectIntoNode;
-import org.teiid.query.processor.relational.ProjectNode;
-import org.teiid.query.processor.relational.RelationalNode;
-import org.teiid.query.processor.relational.RelationalPlan;
-import org.teiid.query.processor.relational.SelectNode;
-import org.teiid.query.processor.relational.SortNode;
-import org.teiid.query.processor.relational.TextTableNode;
-import org.teiid.query.processor.relational.UnionAllNode;
-import org.teiid.query.processor.relational.WindowFunctionProjectNode;
-import org.teiid.query.processor.relational.XMLTableNode;
+import org.teiid.query.processor.relational.*;
import org.teiid.query.processor.relational.JoinNode.JoinStrategyType;
import org.teiid.query.processor.relational.MergeJoinStrategy.SortOption;
import org.teiid.query.processor.relational.SortUtility.Mode;
import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.ArrayTable;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.TableFunctionReference;
-import org.teiid.query.sql.lang.TextTable;
-import org.teiid.query.sql.lang.XMLTable;
+import org.teiid.query.sql.lang.*;
import org.teiid.query.sql.lang.SetQuery.Operation;
import org.teiid.query.sql.lang.XMLTable.XMLColumn;
import org.teiid.query.sql.symbol.ElementSymbol;
@@ -354,8 +318,10 @@
if (command instanceof QueryCommand) {
try {
command = (Command)command.clone();
- boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
- boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
+ boolean aliasGroups = modelID != null && (CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder)
+ || CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelID, metadata, capFinder));
+ boolean aliasColumns = modelID != null && (CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder)
+ || CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelID, metadata, capFinder));
command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
} catch (QueryMetadataException err) {
throw new TeiidComponentException(err);
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2012-02-07 02:12:28 UTC (rev 3850)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2012-02-07 02:26:11 UTC (rev 3851)
@@ -26,6 +26,8 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.metadata.Column;
import org.teiid.metadata.MetadataStore;
@@ -33,6 +35,7 @@
import org.teiid.metadata.Table;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.TestOptimizer.DependentProjectNode;
import org.teiid.query.optimizer.TestOptimizer.DependentSelectNode;
import org.teiid.query.optimizer.TestOptimizer.DupRemoveNode;
@@ -43,18 +46,7 @@
import org.teiid.query.processor.FakeDataManager;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.TestProcessor;
-import org.teiid.query.processor.relational.AccessNode;
-import org.teiid.query.processor.relational.DependentAccessNode;
-import org.teiid.query.processor.relational.GroupingNode;
-import org.teiid.query.processor.relational.LimitNode;
-import org.teiid.query.processor.relational.MergeJoinStrategy;
-import org.teiid.query.processor.relational.NestedLoopJoinStrategy;
-import org.teiid.query.processor.relational.NullNode;
-import org.teiid.query.processor.relational.PlanExecutionNode;
-import org.teiid.query.processor.relational.ProjectNode;
-import org.teiid.query.processor.relational.SelectNode;
-import org.teiid.query.processor.relational.SortNode;
-import org.teiid.query.processor.relational.UnionAllNode;
+import org.teiid.query.processor.relational.*;
import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
@@ -649,7 +641,7 @@
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
}
- @Test public void testInlineView() {
+ @Test public void testInlineView() throws TeiidComponentException, TeiidProcessingException {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
//caps.setCapabilitySupport(SourceCapabilities.QUERY_ORDERBY, true);
@@ -660,10 +652,10 @@
String sql = "SELECT * FROM (SELECT * FROM pm3.g1) as v1 limit 100";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 LIMIT 100" //$NON-NLS-1$
+ "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1, g_0.e3 AS c_2, g_0.e4 AS c_3 FROM pm3.g1 AS g_0 LIMIT 100" //$NON-NLS-1$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
- null, capFinder, expectedSql, true);
+ null, capFinder, expectedSql, ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
}
@@ -674,10 +666,12 @@
* down (because they change row order or row count) if there is already a limit node in that plan branch,
* which can only be placed above LIMIT with an inline view. This test acts as a gatekeeper for avoiding
* several of those pushdowns.
+ * @throws TeiidProcessingException
+ * @throws TeiidComponentException
*
* @since 4.3
*/
- @Test public void testInlineViewAboveLimitNotMerged() {
+ @Test public void testInlineViewAboveLimitNotMerged() throws TeiidComponentException, TeiidProcessingException {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
@@ -689,10 +683,10 @@
String sql = "SELECT * FROM (SELECT * FROM pm3.g1 limit 100) as v1 order by e1";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT v_0.c_0, v_0.c_1, v_0.c_2, v_0.c_3 FROM (SELECT pm3.g1.e1 AS c_0, pm3.g1.e2 AS c_1, pm3.g1.e3 AS c_2, pm3.g1.e4 AS c_3 FROM pm3.g1 LIMIT 100) AS v_0 ORDER BY c_0" //$NON-NLS-1$
+ "SELECT v_0.c_0, v_0.c_1, v_0.c_2, v_0.c_3 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1, g_0.e3 AS c_2, g_0.e4 AS c_3 FROM pm3.g1 AS g_0 LIMIT 100) AS v_0 ORDER BY c_0" //$NON-NLS-1$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
- null, capFinder, expectedSql, true);
+ null, capFinder, expectedSql, ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -719,7 +713,7 @@
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
}
- @Test public void testInlineViewJoin() {
+ @Test public void testInlineViewJoin() throws TeiidComponentException, TeiidProcessingException {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -728,10 +722,10 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
String sql = "SELECT x FROM ((SELECT e1 as x FROM pm1.g1 LIMIT 700) c INNER JOIN (SELECT e1 FROM pm1.g2) d ON d.e1 = c.x) order by x LIMIT 5";//$NON-NLS-1$
- String[] expectedSql = new String[] {"SELECT e1 FROM pm1.g1 LIMIT 700", "SELECT e1 FROM pm1.g2"};//$NON-NLS-1$ //$NON-NLS-2$
+ String[] expectedSql = new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 LIMIT 700", "SELECT g_0.e1 FROM pm1.g2 AS g_0"};//$NON-NLS-1$ //$NON-NLS-2$
ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
- null, capFinder, expectedSql, true);
+ null, capFinder, expectedSql, ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
12 years, 11 months
teiid SVN: r3850 - branches/7.7.x/engine/src/main/java/org/teiid/query/sql/lang.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-02-06 21:12:28 -0500 (Mon, 06 Feb 2012)
New Revision: 3850
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
Log:
TEIID-1820 cache access should be synchronized
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java 2012-02-06 17:46:12 UTC (rev 3849)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java 2012-02-07 02:12:28 UTC (rev 3850)
@@ -281,11 +281,16 @@
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException {
List<?> key = Arrays.asList(pattern, escape);
- Pattern result = cache.get(key);
+ Pattern result = null;
+ synchronized (cache) {
+ result = cache.get(key);
+ }
if (result == null) {
String newPattern = getPatternString(pattern, escape);
result = getPattern(newPattern, pattern, flags);
- cache.put(key, result);
+ synchronized (cache) {
+ cache.put(key, result);
+ }
}
return result;
}
12 years, 11 months
teiid SVN: r3849 - branches/7.4.x/console/src/main/resources/META-INF.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2012-02-06 12:46:12 -0500 (Mon, 06 Feb 2012)
New Revision: 3849
Modified:
branches/7.4.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1925: Corrected method name to getExecutionId. Also removed getProcessingTime method since that has been removed from the request metadata.
Modified: branches/7.4.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.4.x/console/src/main/resources/META-INF/rhq-plugin.xml 2012-02-06 16:57:50 UTC (rev 3848)
+++ branches/7.4.x/console/src/main/resources/META-INF/rhq-plugin.xml 2012-02-06 17:46:12 UTC (rev 3849)
@@ -470,15 +470,11 @@
required="false">
<c:map-property name="map">
<c:simple-property displayName="Request ID"
- name="getRequestId" type="string" description="The request identifier" />
+ name="getExecutionId" type="string" description="The request identifier" />
<c:simple-property displayName="Session ID"
name="getSessionId" type="string" description="Session identifier" />
- <c:simple-property displayName="Execution ID"
- name="getExecutionId" type="string" description="Unique Identifier for Request" />
<c:simple-property displayName="Start Time"
name="getStartTime" type="string" description="Time when request submitted" />
- <c:simple-property displayName="Processing Time"
- name="getProcessingTime" type="string" description="Processing time for the request" />
<c:simple-property displayName="Last ping time"
name="getCommand" type="string" description="SQL Command" />
<c:simple-property displayName="Connector level request?"
12 years, 11 months
teiid SVN: r3848 - branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-02-06 11:57:50 -0500 (Mon, 06 Feb 2012)
New Revision: 3848
Added:
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources/coherence-ds.xml
Log:
adding datasource example
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources/coherence-ds.xml
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources/coherence-ds.xml (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources/coherence-ds.xml 2012-02-06 16:57:50 UTC (rev 3848)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+ <no-tx-connection-factory>
+ <!-- The jndi name of the DataSource -->
+ <jndi-name>CoherenceDS</jndi-name>
+
+ <!-- The resource archive file that defines JCA connection for Coherence -->
+ <rar-name>connector-coherence-7.7.0.CR1.rar</rar-name>
+ <!-- connection interface; (do not change this) -->
+ <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
+
+ <!-- Coherence Cache Name (required)-->
+ <config-property name="CacheName">Trades</config-property>
+
+ <!-- Coherence Object Translator Class Name (required)-->
+ <config-property name="CacheTranslatorClassName">org.teiid.translator.coherence.TradesCacheSource</config-property>
+
+ <max-pool-size>20</max-pool-size>
+
+ </no-tx-connection-factory>
+
+</connection-factories>
\ No newline at end of file
12 years, 11 months
teiid SVN: r3847 - in branches/7.7.x/connectors/sandbox: connector-coherence and 22 other directories.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-02-06 00:44:36 -0500 (Mon, 06 Feb 2012)
New Revision: 3847
Added:
branches/7.7.x/connectors/sandbox/connector-coherence/
branches/7.7.x/connectors/sandbox/connector-coherence/lib/
branches/7.7.x/connectors/sandbox/connector-coherence/pom.xml
branches/7.7.x/connectors/sandbox/connector-coherence/readme.txt
branches/7.7.x/connectors/sandbox/connector-coherence/src/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnection.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnectionImpl.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceFilterUtil.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceManagedConnectionFactory.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/META-INF/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/META-INF/ra.xml
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/adapter/
branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/adapter/i18n.properties
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/BaseID.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Leg.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestCoherenceConnection.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestObjectTranslator.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Trade.java
branches/7.7.x/connectors/sandbox/connector-coherence/src/test/resources/
Log:
new version of coherence connector and renamed to match other projects
Added: branches/7.7.x/connectors/sandbox/connector-coherence/pom.xml
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/pom.xml (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/pom.xml 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,81 @@
+<?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>connector-coherence</artifactId>
+ <groupId>org.jboss.teiid.connectors.sandbox</groupId>
+ <name>Coherence Connector</name>
+ <version>7.7.0.CR1</version>
+ <packaging>rar</packaging>
+ <description>This connector reads data from a Coherence cache</description>
+ <dependencies>
+ <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>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}/lib/coherence.jar</systemPath>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: branches/7.7.x/connectors/sandbox/connector-coherence/readme.txt
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/readme.txt (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/readme.txt 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,41 @@
+connector readme
+
+The coherence_connector is an example of how an Oracle Coherence cache can be exposed for access by the translator-coherence.
+
+Design Note:
+- The cacheName is defined in the coherence-ds.xml. This ties the cache to the physical model. If a different cache is needed,
+ then a new/different coherence-ds.xml will need to be deployed. And that will also require a new physical model to be created that
+ is assigned to this new datasource in the vdb.
+
+ Why? Coherence, at the time of writing this, doesn't support doing joins across caches. However, Teiid can enable this by this design.
+
+- The CacheTranslatorClassName is defined in the coherence-ds.xml. This is an implementation that extends org.teiid.translator.coherence.SourceCacheAdapter,
+ which is located in the tranlator-coherence project. The parameter setting has been set in the coherence-ds.xml so that it can be changed without
+ having to update the vdb in designer and redeploy the vdb.
+
+-------------------------
+To compile and run tests:
+-------------------------
+
+- add the coherence.jar to the connector_coherence/lib directory
+
+Coherence can be downloaded from: http://www.oracle.com/technetwork/middleware/coherence/downloads/index.html
+
+Build:
+
+run mvn clean install
+
+
+-------------------------
+Deployment:
+-------------------------
+
+deploy the following files to the jboss as server
+
+- copy target/connector-coherence-<version>.rar to server/<profile>/deploy/teiid directory
+- copy src/main/resources/coherence-ds.xml to server/<profile>/deploy directory
+ a. Set the CacheName in the coherence-ds.xml
+ b. Set the CacheTranslatorClassName in the coherence-ds.xml
+- copy the coherence.jar to the <profile>/lib directory
+
+- see the translator_coherence to deploy the translator deployment
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnection.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnection.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnection.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,54 @@
+/*
+ * 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.resource.adapter.coherence;
+
+import java.util.List;
+
+import com.tangosol.util.Filter;
+
+import javax.resource.ResourceException;
+
+/**
+ * CoherenceConnection interface used by the Coherence Translator to obtain cached objects.
+ * @author vhalbert
+ *
+ * TODO: Add the ability to add/update objects in the cache
+ */
+
+public interface CoherenceConnection {
+
+
+ /**
+ * Returns the objects from the Coherence Cache based on the <code>criteria</code> filter sepcified.
+ * @param criteria
+ * @return List of objects found in the cache.
+ * @throws ResourceException
+ */
+ public List<Object> get(Filter criteria) throws ResourceException;
+
+ /**
+ * Returns the name of the cache translator class name to use.
+ * @return String name of the cache translator class
+ */
+ public String getCacheTranslatorClassName();
+
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnectionImpl.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnectionImpl.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceConnectionImpl.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,130 @@
+/*
+ * 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.resource.adapter.coherence;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+import org.teiid.core.BundleUtil;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.resource.spi.BasicConnection;
+
+import com.tangosol.net.CacheFactory;
+import com.tangosol.net.NamedCache;
+import com.tangosol.util.ConverterCollections;
+import com.tangosol.util.Filter;
+
+/**
+ * Represents an implementation for the connection to a Coherence data source.
+ */
+public class CoherenceConnectionImpl extends BasicConnection implements CoherenceConnection {
+
+ public static final BundleUtil UTIL = BundleUtil.getBundleUtil(CoherenceConnection.class);
+
+ private NamedCache sourceCache = null;
+ private String translatorName = null;
+ private String cacheName = null;
+
+
+ public CoherenceConnectionImpl(CoherenceManagedConnectionFactory config) throws ResourceException {
+
+ sourceCache = getCache(config.getCacheName());
+ translatorName = config.getCacheTranslatorClassName();
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Coherence Connection has been newly created"); //$NON-NLS-1$
+ }
+
+ public String getCacheTranslatorClassName() {
+ return this.translatorName;
+
+ }
+
+
+ /**
+ * Close the connection, if a connection requires closing.
+ * (non-Javadoc)
+ */
+ @Override
+ public void close() {
+ CacheFactory.releaseCache( sourceCache);
+ sourceCache = null;
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR,"Coherence NamedCache " + cacheName + " has been released."); //$NON-NLS-1$
+ }
+
+ /**
+ * Currently, this method always returns alive. We assume the connection is alive,
+ * and rely on proper timeout values to automatically clean up connections before
+ * any server-side timeout occurs. Rather than incur overhead by rebinding,
+ * we'll assume the connection is always alive, and throw an error when it is actually used,
+ * if the connection fails. This may be a more efficient way of handling failed connections,
+ * with the one tradeoff that stale connections will not be detected until execution time. In
+ * practice, there is no benefit to detecting stale connections before execution time.
+ *
+ * One possible extension is to implement a UnsolicitedNotificationListener.
+ * (non-Javadoc)
+ */
+ public boolean isAlive() {
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Coherence Connection is alive for namedCache " + cacheName); //$NON-NLS-1$
+ return true;
+ }
+
+ public List<Object> get(Filter criteria) throws ResourceException {
+// System.out.println("CoherenceConnection cacheName: " + cacheName + " filter: " + (criteria != null ? criteria.toString() : "NULL" ));
+ List<Object> objects = new ArrayList<Object>();
+
+ Set<ConverterCollections.ConverterEntrySet> mapResult = (Set<ConverterCollections.ConverterEntrySet>) sourceCache
+ .entrySet(criteria);
+
+
+ for (Iterator it = mapResult.iterator(); it.hasNext();) {
+ Map.Entry o = (Map.Entry) it.next();
+ objects.add(o.getValue());
+// System.out.println("CoherenceConnection: loaded result " + o.getValue().toString() );
+
+ }
+
+// System.out.println("CoherenceConnection: loaded " + objects.size() + " results ");
+
+ return objects;
+
+ }
+
+ private NamedCache getCache(String name) {
+ this.cacheName = name;
+
+ sourceCache = CacheFactory.getCache(name);
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR,"Coherence NamedCache " + cacheName + " has been obtained."); //$NON-NLS-1$
+
+ return sourceCache;
+
+ }
+
+
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceFilterUtil.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceFilterUtil.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceFilterUtil.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,92 @@
+package org.teiid.resource.adapter.coherence;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.core.BundleUtil;
+import org.teiid.language.Comparison;
+import org.teiid.translator.TranslatorException;
+
+import com.tangosol.util.Filter;
+import com.tangosol.util.QueryHelper;
+
+/**
+ *
+ * @author vhalbert
+ *
+ * TODO: add the LimitFilter
+ */
+
+public class CoherenceFilterUtil {
+ public static final BundleUtil UTIL = BundleUtil.getBundleUtil(CoherenceFilterUtil.class);
+
+
+ public static Filter createFilter(String filterString) throws TranslatorException {
+ return QueryHelper.createFilter(filterString);
+ }
+
+ public static Filter createInFilter(String colName, List<Object> parms, Class<?> type) throws TranslatorException {
+ String parm = null;
+ for (Iterator<Object> it = parms.iterator(); it.hasNext();) {
+ Object t = it.next();
+ if (parm != null) {
+ parm += ",";
+ }
+ if(type == String.class) {
+ parm = (String) t;
+ } else if (type == Long.class) {
+ parm = String.valueOf(t + "l");
+
+ } else {
+ parm = t.toString();
+ }
+
+ }
+
+ String filterString = colName + " in (" + parm + ")";
+ return QueryHelper.createFilter(filterString);
+
+ }
+
+ public static Filter createCompareFilter(String colName, Object parm, Comparison.Operator op, Class<?> type) throws TranslatorException {
+ String parmValue = null;
+ if(type == String.class) {
+ parmValue = (String) parm;
+ } else if (type == Long.class) {
+ parmValue = String.valueOf(parm + "l");
+
+ } else {
+ parmValue = parm.toString();
+ }
+
+ String opString = " = ";
+
+ switch(op) {
+ case NE:
+ case EQ:
+ break;
+ case GT:
+ opString = " > ";
+ break;
+ case GE:
+ opString = " >= ";
+ break;
+ case LT:
+ opString = " < ";
+ break;
+ case LE:
+ opString = " <= ";
+ break;
+ default:
+ final String msg = UTIL.getString("CoherenceVisitor.criteriaNotSupportedError");
+ throw new TranslatorException(msg);
+
+ }
+
+ String filterString = colName + opString + parmValue ;
+ return QueryHelper.createFilter(filterString);
+
+ }
+
+
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceManagedConnectionFactory.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceManagedConnectionFactory.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/java/org/teiid/resource/adapter/coherence/CoherenceManagedConnectionFactory.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,78 @@
+/*
+ * 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.resource.adapter.coherence;
+
+import javax.resource.ResourceException;
+
+import org.teiid.core.BundleUtil;
+import org.teiid.resource.spi.BasicConnectionFactory;
+import org.teiid.resource.spi.BasicManagedConnectionFactory;
+
+public class CoherenceManagedConnectionFactory extends BasicManagedConnectionFactory {
+
+ private static final long serialVersionUID = -1832915223199053471L;
+ public static final BundleUtil UTIL = BundleUtil.getBundleUtil(CoherenceManagedConnectionFactory.class);
+
+ private String cacheName;
+ private String cacheTranslatorClassName = null;
+
+
+
+ @Override
+ public BasicConnectionFactory createConnectionFactory() throws ResourceException {
+ if (cacheName == null) {
+ throw new ResourceException(UTIL.getString("CoherenceManagedConnectionFactory.cachename_not_set")); //$NON-NLS-1$
+ }
+
+ if (cacheTranslatorClassName == null) {
+ throw new ResourceException(UTIL.getString("CoherenceVisitor.cacheTranslatorClassName_not_set")); //$NON-NLS-1$
+ }
+
+ return new BasicConnectionFactory() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public CoherenceConnectionImpl getConnection() throws ResourceException {
+ return new CoherenceConnectionImpl(CoherenceManagedConnectionFactory.this);
+ }
+ };
+ }
+
+ public String getCacheName() {
+ return this.cacheName;
+ }
+
+ public void setCacheName(String cacheName) {
+ this.cacheName = cacheName;
+ }
+
+
+ public String getCacheTranslatorClassName() {
+ return cacheTranslatorClassName;
+ }
+
+ public void setCacheTranslatorClassName(String className) {
+ this.cacheTranslatorClassName = className;
+ }
+
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/META-INF/ra.xml
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/META-INF/ra.xml (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/rar/META-INF/ra.xml 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connector version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Teiid Coherence Connector</eis-type>
+ <resourceadapter-version>1.0</resourceadapter-version>
+ <license>
+ <description>
+ JBoss, Home of Professional Open Source.
+ Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags. See the copyright.txt file in the
+ distribution for a full listing of individual contributors.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ </description>
+ <license-required>true</license-required>
+ </license>
+ <resourceadapter>
+ <resourceadapter-class>org.teiid.resource.spi.BasicResourceAdapter</resourceadapter-class>
+
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.teiid.resource.spi.WrappedConnectionFactory</connectionfactory-impl-class>
+ <connection-interface>javax.resource.cci.Connection</connection-interface>
+ <connection-impl-class>org.teiid.resource.spi.WrappedConnection</connection-impl-class>
+
+ <config-property>
+ <description>{$display:"Coherence Cache Name",$description:"Name of the Coherence Cache",$required:"true"}</description>
+ <config-property-name>CacheName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>{$display:"Coherence Object Translator Class Name",$description:"Name of the class to translate objects in Coherence Cache",$required:"true"}</description>
+ <config-property-name>CacheTranslatorClassName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>org.teiid.translator.coherence.SourceCacheAdapter</config-property-value>
+ </config-property>
+
+ </connection-definition>
+
+ <transaction-support>NoTransaction</transaction-support>
+
+ <authentication-mechanism>
+ <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/adapter/i18n.properties
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/adapter/i18n.properties (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/main/resources/org/teiid/resource/adapter/i18n.properties 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+
+CoherenceManagedConnectionFactory.cachename_not_set=Coherence cache name not set in the datasource -ds.xml file
+CoherenceVisitor.cacheTranslatorClassName_not_set=CacheTranslatorClassName not set. This class will perform the object translation.
+
+
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/BaseID.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/BaseID.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/BaseID.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,27 @@
+package org.teiid.resource.adapter.coherence;
+
+
+import java.io.Serializable;
+
+public abstract class BaseID implements Serializable {
+
+ private long id;
+
+ public BaseID() {
+ super();
+ }
+
+ public BaseID(long id) {
+ super();
+ this.id = id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Leg.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Leg.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Leg.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,28 @@
+package org.teiid.resource.adapter.coherence;
+
+import java.io.Serializable;
+
+
+public class Leg extends BaseID implements Serializable {
+
+ private static final long serialVersionUID = 7683272638393477962L;
+
+private double notional;
+
+ public Leg() {
+ super();
+ }
+
+ public Leg(long legId, double notional) {
+ super(legId);
+ this.notional = notional;
+ }
+
+ public void setNotional(double notional) {
+ this.notional = notional;
+ }
+
+ public double getNotional() {
+ return notional;
+ }
+}
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestCoherenceConnection.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestCoherenceConnection.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestCoherenceConnection.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,232 @@
+/*
+ * 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.resource.adapter.coherence;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import org.teiid.language.Comparison;
+import org.teiid.resource.adapter.coherence.CoherenceConnection;
+import org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory;
+
+import com.tangosol.net.CacheFactory;
+import com.tangosol.net.NamedCache;
+import com.tangosol.util.Filter;
+import junit.framework.TestCase;
+
+public class TestCoherenceConnection extends TestCase {
+
+ public static final String CACHE_NAME = "Trades";
+
+ public static final String OBJECT_TRANSLATOR = "org.teiid.resource.adapter.coherence.TestObjectTranslator";
+
+ 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
+ */
+ private static void loadCoherence() throws Exception {
+ NamedCache tradesCache = CacheFactory.getCache(CACHE_NAME);
+
+ // populate the cache
+ Map legsMap = new HashMap();
+ Trade trade = new Trade();
+
+ for (int i = 1; i <= NUMTRADES; i++) {
+
+ for (int j = 1; j <= NUMLEGS; j++) {
+ Leg leg = new Leg();
+ leg.setId(j);
+ leg.setNotional(i + j);
+ legsMap.put(j, leg);
+ }
+ trade.setId(i);
+ trade.setName("NameIs " + i);
+ trade.setLegs(legsMap);
+ tradesCache.put(i, trade);
+ }
+
+ System.out.println("Loaded Coherence");
+
+ }
+
+ /**
+ * This will instantiate the {@link CoherenceManagedConnectionFactory} and
+ * obtain a connection to
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGet1Trade() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+ CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
+
+ List<Object> ids = new ArrayList<Object>();
+ ids.add(new Long(1));
+
+ Filter criteria = CoherenceFilterUtil.createInFilter("id", ids, Long.class);
+
+ List<?> trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 1, trades.size());
+
+ // grab the first trade to confirm trade 1 was found in the cache.
+ Trade t = (Trade) trades.get(0);
+ Map legs = t.getLegs();
+ assertEquals("Did not get expected number of legs", NUMLEGS, legs.size());
+
+ }
+
+ @Test
+ public void testGetAllTrades() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+ CoherenceConnection conn = (CoherenceConnection) f
+ .createConnectionFactory().getConnection();
+
+ List<Object> trades = conn.get(null);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", NUMTRADES, trades.size());
+
+
+ Trade t = (Trade) trades.get(0);
+ Map legs = t.getLegs();
+ assertEquals("Did not get expected number of legs", NUMLEGS, legs.size());
+
+ }
+
+ @Test
+ public void testLike() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+ CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
+
+ Filter criteria = CoherenceFilterUtil.createFilter("Name like 'Name%'");
+
+ List<?> trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 3, trades.size());
+
+
+ }
+
+ @Test
+ public void testIn() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+ CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
+
+ // NOTE: Coherence, because the datatype of ID is long, wants the "l" appended to the value
+ Filter criteria = CoherenceFilterUtil.createFilter("Id In (1l)");
+
+ List<?> trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 1, trades.size());
+
+
+ }
+
+
+ @Test
+ public void testEqualOnTrade() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+ CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
+
+ // NOTE: Coherence, because the datatype of ID is long, wants the "l" appended to the value
+ Filter criteria = CoherenceFilterUtil.createFilter("Id = 1l");
+
+ List<?> trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 1, trades.size());
+
+ long l = 1;
+ criteria = CoherenceFilterUtil.createCompareFilter("Id", l, Comparison.Operator.EQ, Long.class);
+
+ trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 1, trades.size());
+
+
+
+ }
+
+ /**
+ * this test will not work out-of-the-box. Coherence, from what I've found, doen'st support this, but can be developed.
+ * @throws Exception
+ */
+ @Test
+ public void xtestEqualOnContainerObject() throws Exception {
+
+ CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
+ f.setCacheName(CACHE_NAME);
+ f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
+
+ CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
+ long l = 1;
+ // NOTE: Coherence, because the datatype of ID is long, wants the "l" appended to the value
+// Filter criteria = CoherenceFilterUtil.createFilter("Id = 1l");
+ Filter criteria = CoherenceFilterUtil.createCompareFilter("getLegs.getLegId", l, Comparison.Operator.EQ, Long.class);
+
+
+ List<?> trades = conn.get(criteria);
+ assertNotNull(trades);
+ assertEquals("Did not get expected number of trades", 1, trades.size());
+
+
+ }
+}
+
+
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestObjectTranslator.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/TestObjectTranslator.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,5 @@
+package org.teiid.resource.adapter.coherence;
+
+public class TestObjectTranslator {
+
+}
\ No newline at end of file
Added: branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Trade.java
===================================================================
--- branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Trade.java (rev 0)
+++ branches/7.7.x/connectors/sandbox/connector-coherence/src/test/java/org/teiid/resource/adapter/coherence/Trade.java 2012-02-06 05:44:36 UTC (rev 3847)
@@ -0,0 +1,49 @@
+package org.teiid.resource.adapter.coherence;
+
+import java.io.Serializable;
+
+import java.util.Map;
+
+
+
+public class Trade extends BaseID implements Serializable {
+
+ private static final long serialVersionUID = 8611785625511714561L;
+
+private Map legs;
+private String name;
+
+ public Trade() {
+ super();
+ }
+
+ public Trade(long tradeId, Map legs) {
+ super(tradeId);
+ this.legs = legs;
+ }
+
+ 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 " + getId());
+ return sb.toString();
+ }
+
+}
12 years, 11 months
teiid SVN: r3846 - in branches/7.7.x/connectors/sandbox: translator-coherence and 20 other directories.
by teiid-commits@lists.jboss.org
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;
+
+
+@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
12 years, 11 months
teiid SVN: r3845 - branches/7.7.x/connectors/sandbox.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-02-06 00:19:21 -0500 (Mon, 06 Feb 2012)
New Revision: 3845
Removed:
branches/7.7.x/connectors/sandbox/coherence_translator/
Log:
removing old example to be replaced with new version, differently named
12 years, 11 months