teiid SVN: r4037 - in branches/8.0.x: admin/src/test/java/org/teiid/adminapi/impl and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-26 15:09:46 -0400 (Thu, 26 Apr 2012)
New Revision: 4037
Modified:
branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java
branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-2017 fixing invalid model type handling and removing an unnecessary catch.
Modified: branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-04-26 19:09:46 UTC (rev 4037)
@@ -28,7 +28,12 @@
import java.util.LinkedList;
import java.util.List;
-import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
@@ -108,7 +113,7 @@
@Override
public Type getModelType() {
try {
- return Type.valueOf(modelType.toUpperCase());
+ return Type.valueOf(modelType);
} catch(IllegalArgumentException e) {
return Type.OTHER;
}
@@ -143,7 +148,11 @@
}
public void setModelType(String modelType) {
- this.modelType = modelType;
+ if (modelType != null) {
+ this.modelType = modelType.toUpperCase();
+ } else {
+ this.modelType = null;
+ }
}
public String toString() {
Modified: branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-04-26 19:09:46 UTC (rev 4037)
@@ -39,7 +39,6 @@
import org.teiid.adminapi.AdminPlugin;
import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
@@ -219,7 +218,7 @@
private static void parseModel(XMLStreamReader reader, ModelMetaData model) throws XMLStreamException {
Properties props = getAttributes(reader);
model.setName(props.getProperty(Element.NAME.getLocalName()));
- model.setModelType(Model.Type.valueOf(props.getProperty(Element.TYPE.getLocalName(), "PHYSICAL")));
+ model.setModelType(props.getProperty(Element.TYPE.getLocalName(), "PHYSICAL"));
model.setVisible(Boolean.parseBoolean(props.getProperty(Element.VISIBLE.getLocalName(), "true")));
model.setPath(props.getProperty(Element.PATH.getLocalName()));
Modified: branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
===================================================================
--- branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java 2012-04-26 19:09:46 UTC (rev 4037)
@@ -34,7 +34,7 @@
public void testModelType() {
ModelMetaData model = new ModelMetaData();
- model.modelType = "physical";
+ model.setModelType("physical");
assertTrue(model.getModelType() == Model.Type.PHYSICAL);
assertTrue(model.isSource());
Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-04-26 19:09:46 UTC (rev 4037)
@@ -30,9 +30,7 @@
import java.util.concurrent.Executor;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryParserException;
-import org.teiid.api.exception.query.QueryPlannerException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.client.RequestMessage;
@@ -413,36 +411,32 @@
}
}
+ // If using multi-source models, insert a proxy to simplify the supported capabilities. This is
+ // done OUTSIDE the cache (wrapped around the cache) intentionally to avoid caching the simplified
+ // capabilities which may be different for the same model in a different VDB used by this same DQP.
+ CapabilitiesFinder finder = this.capabilitiesFinder;
+ if(this.multiSourceModels != null) {
+ finder = new MultiSourceCapabilitiesFinder(finder, this.multiSourceModels);
+ }
+
+ boolean debug = analysisRecord.recordDebug();
+ if(debug) {
+ analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
+ analysisRecord.println("USER COMMAND:\n" + command); //$NON-NLS-1$
+ }
+ // Run the optimizer
try {
- // If using multi-source models, insert a proxy to simplify the supported capabilities. This is
- // done OUTSIDE the cache (wrapped around the cache) intentionally to avoid caching the simplified
- // capabilities which may be different for the same model in a different VDB used by this same DQP.
- CapabilitiesFinder finder = this.capabilitiesFinder;
- if(this.multiSourceModels != null) {
- finder = new MultiSourceCapabilitiesFinder(finder, this.multiSourceModels);
+ processPlan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, finder, analysisRecord, context);
+ } finally {
+ String debugLog = analysisRecord.getDebugLog();
+ if(debugLog != null && debugLog.length() > 0) {
+ LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);
}
-
- boolean debug = analysisRecord.recordDebug();
- if(debug) {
- analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
- analysisRecord.println("USER COMMAND:\n" + command); //$NON-NLS-1$
+ if (analysisRecord.recordAnnotations() && analysisRecord.getAnnotations() != null && !analysisRecord.getAnnotations().isEmpty()) {
+ LogManager.logDetail(LogConstants.CTX_QUERY_PLANNER, analysisRecord.getAnnotations());
}
- // Run the optimizer
- try {
- processPlan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, finder, analysisRecord, context);
- } finally {
- String debugLog = analysisRecord.getDebugLog();
- if(debugLog != null && debugLog.length() > 0) {
- LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);
- }
- if (analysisRecord.recordAnnotations() && analysisRecord.getAnnotations() != null && !analysisRecord.getAnnotations().isEmpty()) {
- LogManager.logDetail(LogConstants.CTX_QUERY_PLANNER, analysisRecord.getAnnotations());
- }
- }
- LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { QueryPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
- } catch (QueryMetadataException e) {
- throw new QueryPlannerException(QueryPlugin.Event.TEIID30494, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30494, requestId));
}
+ LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { QueryPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
}
public void processRequest()
Modified: branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-04-26 19:09:46 UTC (rev 4037)
@@ -535,7 +535,6 @@
TEIID30491,
TEIID30492,
TEIID30493,
- TEIID30494,
TEIID30495,
TEIID30496,
TEIID30497,
Modified: branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties 2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties 2012-04-26 19:09:46 UTC (rev 4037)
@@ -860,7 +860,6 @@
TEIID30548=Property value length exceeds max of {0}.
TEIID30549=Could not find a metadata record with uuid {0}.
TEIID30489=Unable to load metadata for VDB name
-TEIID30494=Unknown query metadata exception while registering query: {0}.
DQPCore.Clearing_prepared_plan_cache=Clearing prepared plan cache
DQPCore.Clearing_prepared_plan_cache_for_vdb=Clearing prepared plan cache for vdb {0}.{1}
DQPCore.clearing_resultset_cache=Clearing the resultset cache for vdb {0}.{1}
12 years, 8 months
teiid SVN: r4036 - in branches/7.7.x/connectors/translator-object: src/main/java/org/teiid/translator/object and 2 other directories.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-04-25 19:47:29 -0400 (Wed, 25 Apr 2012)
New Revision: 4036
Modified:
branches/7.7.x/connectors/translator-object/Notes.txt
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
Log:
TEIID-1992 add logic to executionfactoy to load classes based on a comma separated list of packages, cleanup and added some new test
Modified: branches/7.7.x/connectors/translator-object/Notes.txt
===================================================================
--- branches/7.7.x/connectors/translator-object/Notes.txt 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/Notes.txt 2012-04-25 23:47:29 UTC (rev 4036)
@@ -1,3 +1,10 @@
+To add a new data source implementation, implement the following:
+
+- Either extend ObjectExecutionFactory or create your own.
+- Implement ObjectSourceProxy, adding vendor specific logic for executing a query and returning a List of Objects
+
+
+
Notes:
Limitations -
@@ -8,6 +15,7 @@
+
Modeling -
- JavaBean convention is used. The column name (or nameinsource if used) are used in finding the get/is method.
Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -43,15 +43,14 @@
private Select query;
private ObjectSourceProxy proxy;
- private ObjectExecutionFactory factory;
+ private ObjectMethodManager methodManager;
- @SuppressWarnings("rawtypes")
- private Iterator resultsIt = null;
+ private Iterator<List<Object>> resultsIt = null;
- public ObjectExecution(Command query, RuntimeMetadata metadata, ObjectSourceProxy connproxy, ObjectExecutionFactory factory) {
+ public ObjectExecution(Command query, RuntimeMetadata metadata, ObjectSourceProxy connproxy, ObjectMethodManager methodManager) {
this.query = (Select) query;
this.proxy = connproxy;
- this.factory = factory;
+ this.methodManager = methodManager;
}
@Override
@@ -61,13 +60,13 @@
List<Object> objects = executeQuery();
- List<List<?>> results = null;
+ List<List<Object>> results = null;
if (objects != null && objects.size() > 0) {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of objects from proxy is : " + objects.size()); //$NON-NLS-1$
ObjectProjections op = new ObjectProjections(query);
- results = ObjectTranslator.translateObjects(objects, op, factory.getObjectMethodManager());
+ results = ObjectTranslator.translateObjects(objects, op, methodManager);
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of rows from translation : " + results.size()); //$NON-NLS-1$
@@ -102,8 +101,10 @@
@Override
public void close() {
- this.proxy.close();
+ if (this.proxy != null) this.proxy.close();
this.proxy = null;
+ this.methodManager = null;
+ this.query = null;
}
Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -22,11 +22,17 @@
package org.teiid.translator.object;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.teiid.language.QueryExpression;
import org.teiid.language.Select;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
import org.teiid.translator.ExecutionContext;
@@ -56,7 +62,7 @@
private ObjectMethodManager objectMethods=null;
private boolean columnNameFirstLetterUpperCase = true;
-
+ private String packageNamesOfCachedObjects = null;
public ObjectExecutionFactory() {
super();
@@ -76,13 +82,13 @@
@Override
public void start() throws TranslatorException {
- objectMethods = ObjectMethodManager.initialize(isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
+ createObjectMethodManager();
}
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Object connection)
throws TranslatorException {
- return new ObjectExecution((Select)command, metadata, createProxy(connection), this);
+ return new ObjectExecution((Select)command, metadata, createProxy(connection), objectMethods);
}
public List getSupportedFunctions() {
@@ -96,6 +102,28 @@
/**
* <p>
+ * Returns a comma separated list of package names for the cached objects.
+ * </p>
+ * @return String comma separated package names
+ */
+ @TranslatorProperty(display="PackageNamesOfCachedObjects (CSV)", advanced=true)
+ public String getPackageNamesOfCachedObjects() {
+ return this.packageNamesOfCachedObjects;
+ }
+
+ /**
+ * <p>
+ * Call to set package names for the cached objects
+ * </p>
+ * @param String commo separated list of package names
+ */
+ public void setPackageNamesOfCachedObjects(String packageNamesOfCachedObjects) {
+ this.packageNamesOfCachedObjects = packageNamesOfCachedObjects;
+ }
+
+
+ /**
+ * <p>
* The {@link #getColumnNameFirstLetterUpperCase() option, when <code>false</code>, indicates that the column name (or nameInSource when specified)
* will start with a lower case. This is an option because some users prefer (or standardize) on names being lower case or have a
* different case naming structure.
@@ -138,9 +166,7 @@
@Override
public void getMetadata(MetadataFactory metadataFactory, Object conn)
throws TranslatorException {
- if (objectMethods != null) {
- objectMethods = ObjectMethodManager.initialize(isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
- }
+
}
@@ -157,6 +183,57 @@
* @throws TranslatorException
*/
protected abstract ObjectSourceProxy createProxy(Object connection) throws TranslatorException ;
+
+ protected void createObjectMethodManager() throws TranslatorException {
+ if (objectMethods == null) {
+ objectMethods = ObjectMethodManager.initialize(getClassesForPackage(this.packageNamesOfCachedObjects),
+ isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
+ }
+ }
+ protected List<String> getClassesForPackage(String pkgname) throws TranslatorException {
+ if (pkgname == null) return Collections.EMPTY_LIST;
+ ArrayList<String> classes = new ArrayList<String>();
+ // Get a File object for the package
+ File directory = null;
+ String fullPath;
+ String relPath = pkgname.replace('.', '/');
+ URL resource = ClassLoader.getSystemClassLoader().getResource(relPath);
+ if (resource == null) {
+ throw new TranslatorException(ObjectPlugin.Util
+ .getString(
+ "ObjectExecutionFactory.noResourceFound", new Object[] { relPath })); //$NON-NLS-1$
+ }
+ fullPath = resource.getFile();
+
+ try {
+ directory = new File(resource.toURI());
+ } catch (URISyntaxException e) {
+ throw new TranslatorException(ObjectPlugin.Util
+ .getString(
+ "ObjectExecutionFactory.invalidResource", new Object[] { pkgname, resource })); //$NON-NLS-1$
+
+ } catch (IllegalArgumentException e) {
+ directory = null;
+ }
+
+ if (directory != null && directory.exists()) {
+ // Get the list of the files contained in the package
+ String[] files = directory.list();
+ for (int i = 0; i < files.length; i++) {
+ // we are only interested in .class files
+ if (files[i].endsWith(".class") && !files[i].contains("$") ) {
+ // removes the .class extension
+ String className = pkgname + '.' + files[i].substring(0, files[i].length() - 6);
+ classes.add(className);
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ClassDiscovery", className); //$NON-NLS-1$
+
+ }
+ }
+ }
+ return classes;
+ }
+
}
Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -93,13 +94,12 @@
Method getIsMethod(String name) {
return this.is.get(name);
- }
-
+ }
}
@SuppressWarnings("unchecked")
public static ObjectMethodManager initialize(boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
- return loadClassMethods(Collections.EMPTY_LIST, firstLetterUpperCaseInColumName, classloader);
+ return initialize(Collections.EMPTY_LIST, firstLetterUpperCaseInColumName, classloader);
}
@SuppressWarnings("unchecked")
@@ -110,18 +110,22 @@
} else {
classNames = Collections.EMPTY_LIST;
}
- return loadClassMethods(classNames, firstLetterUpperCaseInColumName, classloader);
+ return initialize(classNames, firstLetterUpperCaseInColumName, classloader);
}
- public static ObjectMethodManager loadClassMethods(List<String> classNames, boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
+ public static ObjectMethodManager initialize(List<String> classNames, boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
+ if (classNames == null) classNames = Collections.EMPTY_LIST;
ObjectMethodManager osmm = new ObjectMethodManager(firstLetterUpperCaseInColumName);
+ osmm.loadClassNames(classNames, classloader);
+ return osmm;
+ }
+
+ public void loadClassNames(List<String> classNames, ClassLoader classloader) throws TranslatorException {
for (String clzName: classNames) {
- osmm.loadClassByName(clzName, classloader);
+ loadClassByName(clzName, classloader);
}
-
- return osmm;
}
public Class<?> loadClassByName(String className, ClassLoader classLoader) throws TranslatorException {
@@ -143,25 +147,6 @@
this.firstLetterUpperCaseInColumName = firstLetterUpperCaseInColumName;
}
- private ClassMethods loadClassMethods(Class<?> clzz) {
- Method[] methods = clzz.getDeclaredMethods();
- ClassMethods clzMethods = new ClassMethods(clzz);
-
- for (int i=0; i<methods.length; i++) {
- Method m = methods[i];
- if (m.getName().startsWith(GET)) {
- clzMethods.addGetter(m.getName(), m);
- // commenting out the caching of the setter methods
-// } else if (m.getName().startsWith(SET)) {
-// clzMethods.addSetter(m.getName(), m);
- } else if (m.getName().startsWith(IS)) {
- clzMethods.addIsMethod(m.getName(), m);
- }
- }
- this.put(clzz.getName(), clzMethods);
- return clzMethods;
- }
-
public Object getIsValue(String methodName, Object object)
throws TranslatorException {
@@ -237,7 +222,7 @@
return this.firstLetterUpperCaseInColumName;
}
- public static final Class<?> loadClass(final String className,
+ public static synchronized final Class<?> loadClass(final String className,
final ClassLoader classLoader) throws TranslatorException {
try {
Class<?> cls = null;
@@ -270,6 +255,27 @@
return clzMethods;
}
+
+
+ private synchronized ClassMethods loadClassMethods(Class<?> clzz) {
+ Method[] methods = clzz.getDeclaredMethods();
+ ClassMethods clzMethods = new ClassMethods(clzz);
+
+ for (int i=0; i<methods.length; i++) {
+ Method m = methods[i];
+ if (m.getName().startsWith(GET)) {
+ clzMethods.addGetter(m.getName(), m);
+ // commenting out the caching of the setter methods
+// } else if (m.getName().startsWith(SET)) {
+// clzMethods.addSetter(m.getName(), m);
+ } else if (m.getName().startsWith(IS)) {
+ clzMethods.addIsMethod(m.getName(), m);
+ }
+ }
+ this.put(clzz.getName(), clzMethods);
+ return clzMethods;
+ }
+
private boolean firstLetterUpperCaseInColumName = true;
}
Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -99,10 +99,12 @@
private void addException(String columnNameToUse1,
String columnNameToUse2, String table) {
+
exceptionMessages.add(
- "Query Error: multiple collections found between columns "
- + columnNameToUse1 + " and " + columnNameToUse2
- + " (table: " + table + " ) ");
+ ObjectPlugin.Util
+ .getString(
+ "ObjectProjections.unsupportedMultipleContainers", new Object[] { columnNameToUse1, columnNameToUse2, table }));
+
}
protected void throwExceptionIfFound() throws TranslatorException {
Modified: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -86,11 +86,11 @@
* obtaining the data from an object
* @return List<List<?>> that represent the rows and columns in the result set
*/
- public static List<List<?>> translateObjects(List<Object> objects, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
+ public static List<List<Object>> translateObjects(List<Object> objects, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
projections.throwExceptionIfFound();
- List<List<?>> rows = new ArrayList<List<?>>(objects.size());
+ List<List<Object>> rows = new ArrayList<List<Object>>(objects.size());
// if no container objects required in the results, then
// perform simple logic for building a row
@@ -144,8 +144,9 @@
int level, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
List<List<Object>> containerRows = new ArrayList<List<Object>>();
- // if there another container depth, then process it first
- // this will be recursive
+ // if there is another container depth, then process it first
+ // this will be recursive to get to the bottom child and return
+ // back up the chain, expanding the rows for each child
if (level < projections.childrenDepth) {
String containerMethodName = projections.childrenNodes.get(level);
@@ -230,6 +231,7 @@
if (projections.nodeDepth[col] == level) {
+ // this should not happen, but just in case
if (colObject != null) throw new TranslatorException("Program Error: column object was not null for column " + projections.columnNamesToUse[col] + " at level " + level);
final Object value = getValue(parentObject, col, level, projections, objectManager);
Modified: branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties 2012-04-25 23:47:29 UTC (rev 4036)
@@ -20,15 +20,14 @@
# 02110-1301 USA.
#
+ObjectExecutionFactory.noResourceFound=Unable to discover class, no resource found for {0}
+ObjectExecutionFactory.invalidResource={0} ( {1} ) does not appear to be a valid URL / URI.
-ObjectDriver.urlFormat=The required url format is jdbc:object:classNames=name1[,name2,...n]
+ObjectMethodManager.noMethodFound=Method {0} was not found for class {1}
+ObjectMethodManager.objectClassNotFound=Class {0} not found to load
+ObjectProjections.unsupportedMultipleContainers=Query Error: multiple collections found between columns {0} and {1} (table: {2})
-ObjectExecutionFactory.rootClassNameUndefined=ObjectExecutionFatory is invalid, RootClassName is not defined
-
ObjectVisitor.missingComparisonExpression=Missing either left or right expression in comparison
ObjectVisitor.Unsupported_expressionr=Unsupported element {0}
-ObjectMethodManager.noMethodFound=Method {0} was not found for class {1}
-
-ObjectMethodManager.objectClassNotFound=Class {0} not found to load
Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -28,12 +28,10 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.teiid.language.Command;
import org.teiid.language.Select;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.object.ObjectExecution;
-import org.teiid.translator.object.ObjectExecutionFactory;
-import org.teiid.translator.object.ObjectSourceProxy;
import org.teiid.translator.object.testdata.TradesCacheSource;
import org.teiid.translator.object.testdata.VDBUtility;
@@ -49,54 +47,110 @@
@Test public void testQueryRootObject() throws Exception {
- Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
- this.runCommand(command, 3);
-
+ execute( createExecution("select * From Trade_Object.Trade"), 3, 4);
}
@Test public void testQueryIncludeLegs() throws Exception {
- Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
- runCommand(command, 30);
+ execute( createExecution("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"),
+ 30, 3);
}
- private void runCommand(Select command, int expected) throws Exception {
+ @Test public void testQueryGetAllTransactions() throws Exception {
+ execute( createExecution("select T.TradeId, T.Name as TradeName, L.Name as LegName, " +
+ " N.LineItem " +
+ " From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction N " +
+ " Where T.TradeId = L.TradeId and L.LegId = N.LegId"),150, 4);
+ }
+
- ExecutionContext context = Mockito.mock(ExecutionContext.class);
+ @Test public void testAtomicSelects() throws Exception {
- ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
-
- Mockito.stub(proxy.get(command)).toReturn(source.getAll());
+ Thread[] threads = new Thread[20];
+ for (int i = 0; i < threads.length; i++) {
+ threads[i] = new Thread() {
+ public void run() {
+ for (int i=0; i<1000; i++) {
+ test();
+ }
+ }
+ public void test() {
+ ObjectExecution exec = null;
+ try {
+ exec = createExecution("select * From Trade_Object.Trade");
+ execute(exec, 3, 4);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (exec != null) exec.close();
+ }
+ }
+ };
+
+ threads[i].start();
+ }
+ for (int i = 0; i < threads.length; i++) {
+ try {
+ threads[i].join();
+ } catch (InterruptedException ignore) {}
+ }
+ }
+
+ private ObjectExecution createExecution(String sql) throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand(sql); //$NON-NLS-1$
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
- ObjectExecutionFactory factory = new ObjectExecutionFactory() {
+ final ObjectExecutionFactory factory = new ObjectExecutionFactory() {
@Override
protected ObjectSourceProxy createProxy(Object connection)
throws TranslatorException {
- return (ObjectSourceProxy) connection;
+ return new ObjectSourceProxy() {
+
+ @Override
+ public List<Object> get(Command command) throws TranslatorException {
+ return source.getAll();
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ };
}
};
factory.start();
- ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, proxy);
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+ return exec;
+
+ }
+
+ private void execute(ObjectExecution exec, int expected, int columns) throws Exception {
+
exec.execute();
int cnt = 0;
List<?> row = exec.next();
+ // check the number of columns
+ assertEquals("Number of columns is incorrect", columns, row.size());
+
+
while (row != null) {
++cnt;
row = exec.next();
}
assertEquals("Did not get expected number of rows", expected, cnt); //$NON-NLS-1$
+
exec.close();
-
}
}
Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -24,8 +24,11 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
+import java.io.File;
+
import org.junit.Test;
import org.mockito.Mockito;
+import org.teiid.core.util.UnitTestUtil;
import org.teiid.language.Select;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.TranslatorException;
@@ -43,7 +46,7 @@
ExecutionContext context = Mockito.mock(ExecutionContext.class);
- ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
+ final ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
ObjectExecutionFactory factory = new ObjectExecutionFactory() {
@@ -51,7 +54,7 @@
protected ObjectSourceProxy createProxy(Object connection)
throws TranslatorException {
- return (ObjectSourceProxy) connection;
+ return proxy;
}
};
@@ -60,7 +63,7 @@
factory.start();
- ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, proxy);
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
assertNotNull(exec);
assertNotNull(factory.getObjectMethodManager());
@@ -68,6 +71,45 @@
}
+ @Test public void testFactoryLoadingJarClassNames() throws Exception {
+
+ // File testjar = new File(UnitTestUtil.getTestScratchPath() + "/../" + "translator-object-7.7.1-tests.jar");
+// File testjar = new File("target/" + "translator-object-7.7.1-tests.jar");
+
+// assertEquals("Testjar doesn't exist " + testjar.getAbsolutePath(), true, testjar.exists());
+
+ Select command = Mockito.mock(Select.class);
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ final ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
+
+ ObjectExecutionFactory factory = new ObjectExecutionFactory() {
+
+ @Override
+ protected ObjectSourceProxy createProxy(Object connection)
+ throws TranslatorException {
+
+ return proxy;
+ }
+
+ };
+
+ factory.setColumnNameFirstLetterUpperCase(false);
+
+ factory.setPackageNamesOfCachedObjects("org.teiid.translator.object.testdata");
+
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, null);
+
+ assertNotNull(exec);
+ assertNotNull(factory.getObjectMethodManager());
+ assertEquals(factory.isColumnNameFirstLetterUpperCase(), false);
+
+ }
+
+
}
Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -68,7 +68,6 @@
// confirm the arrays match
for (int i = 0; i < op.getColumns().length; i++) {
assertEquals(op.getColumnNamesToUse()[i], op.getColumnNameToUse(op.getColumns()[i]));
- System.out.println("ColumnToUse: " + op.getColumnNamesToUse()[i]);
}
}
Modified: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java 2012-04-25 20:54:00 UTC (rev 4035)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java 2012-04-25 23:47:29 UTC (rev 4036)
@@ -69,7 +69,7 @@
ObjectMethodManager omm = ObjectMethodManager.initialize(true, this.getClass().getClassLoader());
- List<List<?>> results = ObjectTranslator.translateObjects(source.getAll(), op, omm);
+ List<List<Object>> results = ObjectTranslator.translateObjects(source.getAll(), op, omm);
assertEquals(rows, results.size());
12 years, 8 months
teiid SVN: r4035 - in trunk: engine/src/main/java/org/teiid/query/optimizer/relational/rules and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-25 16:54:00 -0400 (Wed, 25 Apr 2012)
New Revision: 4035
Modified:
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
Log:
TEIID-1993 optimizing handling dealing with unions/aggregation
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -743,7 +743,7 @@
}
/**
- * <p>Support indicates that the connector supports functions in GROUP BY, such as:
+ * <p>Support indicates that the connector supports non-column expressions in GROUP BY, such as:
* <code>SELECT dayofmonth(theDate), COUNT(*) FROM table GROUP BY dayofmonth(theDate)</code></p>
* @since 5.0
*/
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -243,19 +243,8 @@
List<Expression> requiredInput = collectRequiredInputSymbols(root);
//targeted optimization for unnecessary aggregation
if (root.getType() == NodeConstants.Types.GROUP && root.hasBooleanProperty(Info.IS_OPTIONAL) && NodeEditor.findParent(root, NodeConstants.Types.ACCESS) == null) {
- PlanNode old = root;
- PlanNode next = root.getFirstChild();
- NodeEditor.removeChildNode(root.getParent(), root);
-
- SymbolMap symbolMap = (SymbolMap) old.getProperty(NodeConstants.Info.SYMBOL_MAP);
- if (!symbolMap.asMap().isEmpty()) {
- FrameUtil.convertFrame(next.getParent(), symbolMap.asMap().keySet().iterator().next().getGroupSymbol(), null, symbolMap.asMap(), metadata);
- }
- PlanNode parent = next.getParent();
- while (parent.getParent() != null && parent.getParent().getType() != NodeConstants.Types.SOURCE) {
- parent = parent.getParent();
- }
- if (!old.hasCollectionProperty(Info.GROUP_COLS)) {
+ PlanNode parent = removeGroupBy(root, metadata);
+ if (!root.hasCollectionProperty(Info.GROUP_COLS)) {
//just lob off everything under the projection
PlanNode project = NodeEditor.findNodePreOrder(parent, NodeConstants.Types.PROJECT);
project.removeAllChildren();
@@ -288,6 +277,23 @@
}
}
+ static PlanNode removeGroupBy(PlanNode root,
+ QueryMetadataInterface metadata)
+ throws QueryPlannerException {
+ PlanNode next = root.getFirstChild();
+ NodeEditor.removeChildNode(root.getParent(), root);
+
+ SymbolMap symbolMap = (SymbolMap) root.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ if (!symbolMap.asMap().isEmpty()) {
+ FrameUtil.convertFrame(next.getParent(), symbolMap.asMap().keySet().iterator().next().getGroupSymbol(), null, symbolMap.asMap(), metadata);
+ }
+ PlanNode parent = next.getParent();
+ while (parent.getParent() != null && parent.getParent().getType() != NodeConstants.Types.SOURCE && parent.getParent().getType() != NodeConstants.Types.SET_OP) {
+ parent = parent.getParent();
+ }
+ return parent;
+ }
+
public static Set<WindowFunction> getWindowFunctions(
List<Expression> projectCols) {
LinkedHashSet<WindowFunction> windowFunctions = new LinkedHashSet<WindowFunction>();
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -184,6 +184,17 @@
if (aggregates.isEmpty()) {
if (!groupingExpressions.isEmpty()) {
setOp.setProperty(NodeConstants.Info.USE_ALL, Boolean.FALSE);
+ boolean allCols = true;
+ for (Expression ex : groupingExpressions) {
+ if (!(ex instanceof ElementSymbol)) {
+ allCols = false;
+ break;
+ }
+ }
+ if (allCols) {
+ //since there are no expressions in the grouping cols, we know the grouping node is now not needed.
+ RuleAssignOutputElements.removeGroupBy(groupNode, metadata);
+ }
}
return;
}
@@ -246,6 +257,7 @@
FrameUtil.convertNode(node, null, null, mapping, metadata, false);
node = node.getParent();
}
+ removeUnnecessaryViews(unionSourceParent, metadata, capFinder);
}
private void updateParentAggs(PlanNode groupNode, CommandContext context,
@@ -349,8 +361,44 @@
updatedMapping.put(orig, entry.getKey());
}
FrameUtil.convertFrame(sourceNode, oldGroup, Collections.singleton(modifiedGroup), updatedMapping, metadata);
+ removeUnnecessaryViews(sourceNode, metadata, capFinder);
}
+ /**
+ * TODO: remove me - the logic in {@link #addUnionGroupBy} should be redone
+ * to not use a view, but the logic there is more straight-forward there
+ * and then we correct here.
+ * @param sourceNode
+ * @param metadata
+ * @param capFinder
+ * @throws QueryPlannerException
+ * @throws QueryMetadataException
+ * @throws TeiidComponentException
+ */
+ private void removeUnnecessaryViews(PlanNode sourceNode,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
+ throws QueryPlannerException, QueryMetadataException,
+ TeiidComponentException {
+ for (PlanNode source : NodeEditor.findAllNodes(sourceNode.getFirstChild(), NodeConstants.Types.SOURCE, NodeConstants.Types.ACCESS)) {
+ PlanNode planNode = source.getFirstChild();
+ if (planNode == null || planNode.getType() != NodeConstants.Types.ACCESS) {
+ continue;
+ }
+ //temporarily remove the access node
+ NodeEditor.removeChildNode(source, planNode);
+ PlanNode parent = RuleMergeVirtual.doMerge(source, source.getParent(), false, metadata);
+ //add it back
+ if (parent.getFirstChild() == source) {
+ source.getFirstChild().addAsParent(planNode);
+ } else {
+ parent.getFirstChild().addAsParent(planNode);
+ }
+ while (RuleRaiseAccess.raiseAccessNode(planNode, planNode, metadata, capFinder, true, null) != null) {
+ //continue to raise
+ }
+ }
+ }
+
private void addUnionGroupBy(
List<Expression> groupingExpressions,
LinkedHashSet<AggregateSymbol> aggregates, SymbolMap parentMap,
@@ -428,13 +476,6 @@
if (!viewOnly) {
addGroupBy(cc, view, groupingColumns, aggregates, metadata, projectPlanNode.getParent());
}
-
- if (planNode.getType() == NodeConstants.Types.ACCESS) {
- //TODO: temporarily remove the access node so that the inline view could be removed if possible
- while (RuleRaiseAccess.raiseAccessNode(planNode, planNode, metadata, capFinder, true, null) != null) {
- //continue to raise
- }
- }
}
private void updateSymbolName(List<Expression> projectCols, int i,
@@ -455,10 +496,17 @@
return false;
}
Object modelId = RuleRaiseAccess.getModelIDFromAccess(planNode, metadata);
- if (!CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelId, metadata, capFinder)
- || !CapabilitiesUtil.supports(Capability.QUERY_GROUP_BY, modelId, metadata, capFinder)) {
+ if (!CapabilitiesUtil.supports(Capability.QUERY_GROUP_BY, modelId, metadata, capFinder)) {
return false;
}
+ if (!CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelId, metadata, capFinder)
+ && !CapabilitiesUtil.supports(Capability.QUERY_FUNCTIONS_IN_GROUP_BY, modelId, metadata, capFinder)) {
+ for (Expression e : groupingExpressions) {
+ if (!(e instanceof ElementSymbol)) {
+ return false;
+ }
+ }
+ }
for (AggregateSymbol aggregate : aggregates) {
if(! CriteriaCapabilityValidatorVisitor.canPushLanguageObject(aggregate, modelId, metadata, capFinder, record)) {
return false;
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -236,7 +236,7 @@
}
public String toString() {
- return "RuleRemoveOptionalJoins"; //$NON-NLS-1$
+ return "RemoveOptionalJoins"; //$NON-NLS-1$
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -885,8 +885,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1, max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) y group by e1", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$
- "SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT g_0.e1, MAX(g_0.e2) FROM pm1.g1 AS g_0 GROUP BY g_0.e1", "SELECT g_0.e1, MAX(g_0.e2) FROM pm1.g2 AS g_0 GROUP BY g_0.e1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -940,8 +939,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1, count(*) filter (where e3) from (select e1, e2, e3 from pm1.g1 union all select e1, e2, e3 from pm1.g2) y group by e1", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT v_0.c_0, COUNT(*) FILTER(WHERE v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e3 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0",
- "SELECT v_0.c_0, COUNT(*) FILTER(WHERE v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e3 AS c_1 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT g_0.e1, COUNT(*) FILTER(WHERE g_0.e3) FROM pm1.g1 AS g_0 GROUP BY g_0.e1", "SELECT g_0.e1, COUNT(*) FILTER(WHERE g_0.e3) FROM pm1.g2 AS g_0 GROUP BY g_0.e1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -995,8 +993,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT MAX(v_0.c_0) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g2 AS g_0) AS v_0 HAVING COUNT(*) > 0", //$NON-NLS-1$
- "SELECT MAX(v_0.c_0) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0) AS v_0 HAVING COUNT(*) > 0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT MAX(g_0.e2) FROM pm1.g2 AS g_0 HAVING COUNT(*) > 0", "SELECT MAX(g_0.e2) FROM pm1.g1 AS g_0 HAVING COUNT(*) > 0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -1051,8 +1048,7 @@
capFinder.addCapabilities("pm2", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), count(*) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT MAX(v_0.c_0), COUNT(*) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0) AS v_0 HAVING COUNT(*) > 0", //$NON-NLS-1$
- "SELECT g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT MAX(g_0.e2), COUNT(*) FROM pm1.g1 AS g_0 HAVING COUNT(*) > 0", "SELECT g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -1064,13 +1060,41 @@
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
- 2, // Project
+ 1, // Project
0, // Select
0, // Sort
1 // UnionAll
});
}
+ @Test public void testPushDownOverUnionMixed1() throws Exception {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getAggregateCapabilities();
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ BasicSourceCapabilities caps1 = getAggregateCapabilities();
+ caps1.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, false);
+ capFinder.addCapabilities("pm2", caps1); //$NON-NLS-1$
+
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), count(*) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ new String[]{"SELECT MAX(g_0.e2), COUNT(*) FROM pm2.g2 AS g_0 HAVING COUNT(*) > 0", "SELECT MAX(g_0.e2), COUNT(*) FROM pm1.g1 AS g_0 HAVING COUNT(*) > 0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
/**
* pushdown won't happen since searched case is not supported
*/
@@ -1082,8 +1106,7 @@
capFinder.addCapabilities("pm2", getAggregateCapabilities()); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z group by case when e1 is null then 0 else 1 end", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT v_1.c_0, MAX(v_1.c_1) FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0", //$NON-NLS-1$
- "SELECT g_0.e1, g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT g_0.e1, g_0.e2 FROM pm2.g2 AS g_0", "SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT CASE WHEN g_0.e1 IS NULL THEN 0 ELSE 1 END AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -1109,8 +1132,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2, 1 as part from pm1.g1 union all select e1, e2, 2 as part from pm1.g2) z group by case when e1 is null then 0 else 1 end, part", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
- new String[]{"SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 2 AS c_1, g_0.e2 AS c_2 FROM pm1.g2 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1",
- "SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 1 AS c_1, g_0.e2 AS c_2 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[]{"SELECT MAX(v_0.c_2), v_0.c_1 FROM (SELECT 1 AS c_0, CASE WHEN g_0.e1 IS NULL THEN 0 ELSE 1 END AS c_1, g_0.e2 AS c_2 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_1, v_0.c_0", "SELECT MAX(v_0.c_2), v_0.c_0 FROM (SELECT CASE WHEN g_0.e1 IS NULL THEN 0 ELSE 1 END AS c_0, 2 AS c_1, g_0.e2 AS c_2 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0, v_0.c_1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -211,8 +211,7 @@
@Test public void testUnionWithPartitionedAggregate() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select max(intnum) from (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (3, 4)) A group by intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
- new String[] { "SELECT MAX(v_0.c_1) FROM (SELECT g_0.IntKey AS c_0, g_0.intnum AS c_1 FROM BQT1.SmallA AS g_0 WHERE g_0.intkey IN (1, 2)) AS v_0 GROUP BY v_0.c_0",
- "SELECT MAX(v_0.c_1) FROM (SELECT g_0.intkey AS c_0, g_0.intnum AS c_1 FROM BQT2.SmallA AS g_0 WHERE g_0.intkey IN (3, 4)) AS v_0 GROUP BY v_0.c_0" }, ComparisonMode.EXACT_COMMAND_STRING);
+ new String[] { "SELECT MAX(g_0.intnum) FROM BQT2.SmallA AS g_0 WHERE g_0.intkey IN (3, 4) GROUP BY g_0.intkey", "SELECT MAX(g_0.intnum) FROM BQT1.SmallA AS g_0 WHERE g_0.intkey IN (1, 2) GROUP BY g_0.IntKey" }, ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -232,6 +231,53 @@
});
}
+ @Test public void testUnionWithUnnecessaryGroupBy() throws Exception {
+ ProcessorPlan plan = TestOptimizer.helpPlan("select intkey from (SELECT IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT intkey, intnum FROM BQT2.SmallA) A group by intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
+ new String[] { "SELECT g_0.intkey FROM BQT2.SmallA AS g_0", "SELECT g_0.IntKey FROM BQT1.SmallA AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING);
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 1, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
+ @Test public void testUnionWithUnnecessaryGroupByPartitionedConstant() throws Exception {
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.ROW_LIMIT, true);
+ DefaultCapabilitiesFinder capFinder = new DefaultCapabilitiesFinder(bsc);
+ ProcessorPlan plan = TestOptimizer.helpPlan("select intkey from (SELECT 1 as IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT 2 as intkey, intnum FROM BQT2.SmallA) A group by intkey", RealMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
+ new String[] { "SELECT 1 AS c_0 FROM BQT2.SmallA AS g_0 LIMIT 1", "SELECT 1 AS c_0 FROM BQT1.SmallA AS g_0 LIMIT 1" }, ComparisonMode.EXACT_COMMAND_STRING);
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 3, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
@Test public void testUnionPartitionedWithMerge() throws Exception {
//"select max(intnum) from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (3, 4)) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in 6) B group by intkey"
ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT intkey, intnum FROM BQT2.SmallA) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in (6)) B inner join (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (5, 6)) C on b.intkey = c.intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-04-25 14:47:09 UTC (rev 4034)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-04-25 20:54:00 UTC (rev 4035)
@@ -239,11 +239,11 @@
capFinder.addCapabilities("pm2", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
HardcodedDataManager dataManager = new HardcodedDataManager();
- dataManager.addData("SELECT v_0.c_0, COUNT(v_0.c_1), MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$
+ dataManager.addData("SELECT g_0.e1, COUNT(g_0.e2), MAX(g_0.e2) FROM pm1.g1 AS g_0 GROUP BY g_0.e1", //$NON-NLS-1$
new List[] {
Arrays.asList("a", Integer.valueOf(2), Integer.valueOf(1)), //$NON-NLS-1$
});
- dataManager.addData("SELECT v_0.c_0, COUNT(v_0.c_1), MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$
+ dataManager.addData("SELECT g_0.e1, COUNT(g_0.e2), MAX(g_0.e2) FROM pm1.g2 AS g_0 GROUP BY g_0.e1", //$NON-NLS-1$
new List[] {
Arrays.asList("a", Integer.valueOf(3), Integer.valueOf(2)), //$NON-NLS-1$
});
@@ -275,7 +275,7 @@
capFinder.addCapabilities("pm2", bac); //$NON-NLS-1$
HardcodedDataManager dataManager = new HardcodedDataManager();
- dataManager.addData("SELECT v_0.c_0, v_0.c_1, COUNT(*), MAX(v_0.c_2) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1, g_0.e3 AS c_2 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0, v_0.c_1", //$NON-NLS-1$
+ dataManager.addData("SELECT g_0.e1, g_0.e2, COUNT(*), MAX(g_0.e3) FROM pm1.g1 AS g_0 GROUP BY g_0.e1, g_0.e2", //$NON-NLS-1$
new List[] {
Arrays.asList("2", Integer.valueOf(2), Integer.valueOf(2), Boolean.FALSE), //$NON-NLS-1$
Arrays.asList("1", Integer.valueOf(1), Integer.valueOf(3), Boolean.TRUE), //$NON-NLS-1$
@@ -307,7 +307,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("SELECT g_0.e2 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(1), Arrays.asList(2)});
- dataManager.addData("SELECT MAX(v_0.c_0), COUNT(*), COUNT(v_0.c_0), SUM(power(v_0.c_0, 2)), SUM(v_0.c_0) FROM (SELECT g_0.e2 AS c_0 FROM pm2.g2 AS g_0) AS v_0 HAVING COUNT(*) > 0", new List[] {Arrays.asList(5, 6, 4, BigInteger.valueOf(50l), 10l)});
+ dataManager.addData("SELECT MAX(g_0.e2), COUNT(*), COUNT(g_0.e2), SUM(power(g_0.e2, 2)), SUM(g_0.e2) FROM pm2.g2 AS g_0 HAVING COUNT(*) > 0", new List[] {Arrays.asList(5, 6, 4, BigInteger.valueOf(50l), 10l)});
List[] expected = new List[] {
Arrays.asList(5, 8, 2.1147629234082532, 5.366666666666666),
12 years, 8 months
teiid SVN: r4034 - in trunk: engine/src/main/java/org/teiid/query/processor and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-25 10:47:09 -0400 (Wed, 25 Apr 2012)
New Revision: 4034
Modified:
trunk/api/src/main/java/org/teiid/CommandContext.java
trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
Log:
TEIID-1989 adding a counter to the command context
Modified: trunk/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java 2012-04-24 20:22:55 UTC (rev 4033)
+++ trunk/api/src/main/java/org/teiid/CommandContext.java 2012-04-25 14:47:09 UTC (rev 4034)
@@ -143,5 +143,12 @@
* @param listener
*/
void removeListener(CommandListener listener);
+
+ /**
+ * Get the number of times this command has been reused. Useful
+ * in continuous executions.
+ * @return
+ */
+ long getReuseCount();
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2012-04-24 20:22:55 UTC (rev 4033)
+++ trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2012-04-25 14:47:09 UTC (rev 4034)
@@ -34,7 +34,6 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.Assertion;
-import org.teiid.jdbc.SQLStates;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
@@ -148,6 +147,7 @@
result.setTerminationFlag(false);
this.processPlan.close();
this.processPlan.reset();
+ this.context.incrementReuseCount();
this.open = false;
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-04-24 20:22:55 UTC (rev 4033)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-04-25 14:47:09 UTC (rev 4034)
@@ -36,6 +36,7 @@
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.Subject;
@@ -148,6 +149,7 @@
Set<CommandListener> commandListeners = null;
private LRUCache<String, DecimalFormat> decimalFormatCache;
private LRUCache<String, SimpleDateFormat> dateFormatCache;
+ private AtomicLong reuseCount = new AtomicLong();
}
private GlobalState globalState = new GlobalState();
@@ -746,4 +748,13 @@
return result;
}
+ public void incrementReuseCount() {
+ globalState.reuseCount.getAndIncrement();
+ }
+
+ @Override
+ public long getReuseCount() {
+ return globalState.reuseCount.get();
+ }
+
}
12 years, 8 months
teiid SVN: r4033 - in branches/8.0.x: admin and 30 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-24 16:22:55 -0400 (Tue, 24 Apr 2012)
New Revision: 4033
Modified:
branches/8.0.x/admin/pom.xml
branches/8.0.x/adminshell/pom.xml
branches/8.0.x/api/pom.xml
branches/8.0.x/build/pom.xml
branches/8.0.x/client-jdk15/pom.xml
branches/8.0.x/client/pom.xml
branches/8.0.x/common-core/pom.xml
branches/8.0.x/connectors/connector-file/pom.xml
branches/8.0.x/connectors/connector-ldap/pom.xml
branches/8.0.x/connectors/connector-salesforce/pom.xml
branches/8.0.x/connectors/connector-ws/pom.xml
branches/8.0.x/connectors/pom.xml
branches/8.0.x/connectors/salesforce-api/pom.xml
branches/8.0.x/connectors/sandbox/pom.xml
branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml
branches/8.0.x/connectors/translator-file/pom.xml
branches/8.0.x/connectors/translator-hive/pom.xml
branches/8.0.x/connectors/translator-jdbc/pom.xml
branches/8.0.x/connectors/translator-ldap/pom.xml
branches/8.0.x/connectors/translator-loopback/pom.xml
branches/8.0.x/connectors/translator-olap/pom.xml
branches/8.0.x/connectors/translator-salesforce/pom.xml
branches/8.0.x/connectors/translator-ws/pom.xml
branches/8.0.x/engine/pom.xml
branches/8.0.x/hibernate-dialect/pom.xml
branches/8.0.x/jboss-integration/pom.xml
branches/8.0.x/metadata/pom.xml
branches/8.0.x/pom.xml
branches/8.0.x/runtime/pom.xml
branches/8.0.x/test-integration/common/pom.xml
branches/8.0.x/test-integration/db/pom.xml
branches/8.0.x/test-integration/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: branches/8.0.x/admin/pom.xml
===================================================================
--- branches/8.0.x/admin/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/admin/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-admin</artifactId>
Modified: branches/8.0.x/adminshell/pom.xml
===================================================================
--- branches/8.0.x/adminshell/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/adminshell/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: branches/8.0.x/api/pom.xml
===================================================================
--- branches/8.0.x/api/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/api/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: branches/8.0.x/build/pom.xml
===================================================================
--- branches/8.0.x/build/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/build/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: branches/8.0.x/client/pom.xml
===================================================================
--- branches/8.0.x/client/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/client/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: branches/8.0.x/client-jdk15/pom.xml
===================================================================
--- branches/8.0.x/client-jdk15/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/client-jdk15/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: branches/8.0.x/common-core/pom.xml
===================================================================
--- branches/8.0.x/common-core/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/common-core/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: branches/8.0.x/connectors/connector-file/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-file/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/connector-file/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: branches/8.0.x/connectors/connector-ldap/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-ldap/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/connector-ldap/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: branches/8.0.x/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-salesforce/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/connector-salesforce/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: branches/8.0.x/connectors/connector-ws/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-ws/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/connector-ws/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: branches/8.0.x/connectors/pom.xml
===================================================================
--- branches/8.0.x/connectors/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/connectors/salesforce-api/pom.xml
===================================================================
--- branches/8.0.x/connectors/salesforce-api/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/salesforce-api/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: branches/8.0.x/connectors/sandbox/pom.xml
===================================================================
--- branches/8.0.x/connectors/sandbox/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/sandbox/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: branches/8.0.x/connectors/translator-file/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-file/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-file/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: branches/8.0.x/connectors/translator-hive/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-hive/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-hive/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-hive</artifactId>
Modified: branches/8.0.x/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-jdbc/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-jdbc/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: branches/8.0.x/connectors/translator-ldap/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-ldap/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-ldap/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: branches/8.0.x/connectors/translator-loopback/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-loopback/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-loopback/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: branches/8.0.x/connectors/translator-olap/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-olap/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-olap/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: branches/8.0.x/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-salesforce/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-salesforce/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: branches/8.0.x/connectors/translator-ws/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-ws/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/connectors/translator-ws/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: branches/8.0.x/engine/pom.xml
===================================================================
--- branches/8.0.x/engine/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/engine/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: branches/8.0.x/hibernate-dialect/pom.xml
===================================================================
--- branches/8.0.x/hibernate-dialect/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/hibernate-dialect/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: branches/8.0.x/jboss-integration/pom.xml
===================================================================
--- branches/8.0.x/jboss-integration/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/jboss-integration/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/metadata/pom.xml
===================================================================
--- branches/8.0.x/metadata/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/metadata/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: branches/8.0.x/pom.xml
===================================================================
--- branches/8.0.x/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -10,7 +10,7 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
@@ -37,9 +37,9 @@
<version.junit>4.10</version.junit>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</developerConnection>
- <url>http://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</url>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/branches/8.0.x</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/branches/8.0.x</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/teiid/branches/8.0.x</url>
</scm>
<licenses>
<license>
Modified: branches/8.0.x/runtime/pom.xml
===================================================================
--- branches/8.0.x/runtime/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/runtime/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/test-integration/common/pom.xml
===================================================================
--- branches/8.0.x/test-integration/common/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/test-integration/common/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: branches/8.0.x/test-integration/db/pom.xml
===================================================================
--- branches/8.0.x/test-integration/db/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/test-integration/db/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/8.0.x/test-integration/pom.xml
===================================================================
--- branches/8.0.x/test-integration/pom.xml 2012-04-24 20:22:35 UTC (rev 4032)
+++ branches/8.0.x/test-integration/pom.xml 2012-04-24 20:22:55 UTC (rev 4033)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2</version>
+ <version>8.0.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
12 years, 8 months
teiid SVN: r4032 - tags.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-24 16:22:35 -0400 (Tue, 24 Apr 2012)
New Revision: 4032
Added:
tags/teiid-parent-8.0.0.CR2/
Log:
[maven-release-plugin] copy for tag teiid-parent-8.0.0.CR2
12 years, 8 months
teiid SVN: r4031 - in branches/8.0.x: admin and 30 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-24 16:22:26 -0400 (Tue, 24 Apr 2012)
New Revision: 4031
Modified:
branches/8.0.x/admin/pom.xml
branches/8.0.x/adminshell/pom.xml
branches/8.0.x/api/pom.xml
branches/8.0.x/build/pom.xml
branches/8.0.x/client-jdk15/pom.xml
branches/8.0.x/client/pom.xml
branches/8.0.x/common-core/pom.xml
branches/8.0.x/connectors/connector-file/pom.xml
branches/8.0.x/connectors/connector-ldap/pom.xml
branches/8.0.x/connectors/connector-salesforce/pom.xml
branches/8.0.x/connectors/connector-ws/pom.xml
branches/8.0.x/connectors/pom.xml
branches/8.0.x/connectors/salesforce-api/pom.xml
branches/8.0.x/connectors/sandbox/pom.xml
branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml
branches/8.0.x/connectors/translator-file/pom.xml
branches/8.0.x/connectors/translator-hive/pom.xml
branches/8.0.x/connectors/translator-jdbc/pom.xml
branches/8.0.x/connectors/translator-ldap/pom.xml
branches/8.0.x/connectors/translator-loopback/pom.xml
branches/8.0.x/connectors/translator-olap/pom.xml
branches/8.0.x/connectors/translator-salesforce/pom.xml
branches/8.0.x/connectors/translator-ws/pom.xml
branches/8.0.x/engine/pom.xml
branches/8.0.x/hibernate-dialect/pom.xml
branches/8.0.x/jboss-integration/pom.xml
branches/8.0.x/metadata/pom.xml
branches/8.0.x/pom.xml
branches/8.0.x/runtime/pom.xml
branches/8.0.x/test-integration/common/pom.xml
branches/8.0.x/test-integration/db/pom.xml
branches/8.0.x/test-integration/pom.xml
Log:
[maven-release-plugin] prepare release teiid-parent-8.0.0.CR2
Modified: branches/8.0.x/admin/pom.xml
===================================================================
--- branches/8.0.x/admin/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/admin/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-admin</artifactId>
Modified: branches/8.0.x/adminshell/pom.xml
===================================================================
--- branches/8.0.x/adminshell/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/adminshell/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: branches/8.0.x/api/pom.xml
===================================================================
--- branches/8.0.x/api/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/api/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: branches/8.0.x/build/pom.xml
===================================================================
--- branches/8.0.x/build/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/build/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: branches/8.0.x/client/pom.xml
===================================================================
--- branches/8.0.x/client/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/client/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: branches/8.0.x/client-jdk15/pom.xml
===================================================================
--- branches/8.0.x/client-jdk15/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/client-jdk15/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: branches/8.0.x/common-core/pom.xml
===================================================================
--- branches/8.0.x/common-core/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/common-core/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: branches/8.0.x/connectors/connector-file/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-file/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/connector-file/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: branches/8.0.x/connectors/connector-ldap/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-ldap/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/connector-ldap/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: branches/8.0.x/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-salesforce/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/connector-salesforce/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: branches/8.0.x/connectors/connector-ws/pom.xml
===================================================================
--- branches/8.0.x/connectors/connector-ws/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/connector-ws/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: branches/8.0.x/connectors/pom.xml
===================================================================
--- branches/8.0.x/connectors/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/connectors/salesforce-api/pom.xml
===================================================================
--- branches/8.0.x/connectors/salesforce-api/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/salesforce-api/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: branches/8.0.x/connectors/sandbox/pom.xml
===================================================================
--- branches/8.0.x/connectors/sandbox/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/sandbox/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/sandbox/translator-yahoo/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: branches/8.0.x/connectors/translator-file/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-file/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-file/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: branches/8.0.x/connectors/translator-hive/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-hive/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-hive/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-hive</artifactId>
Modified: branches/8.0.x/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-jdbc/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-jdbc/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: branches/8.0.x/connectors/translator-ldap/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-ldap/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-ldap/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: branches/8.0.x/connectors/translator-loopback/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-loopback/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-loopback/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: branches/8.0.x/connectors/translator-olap/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-olap/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-olap/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: branches/8.0.x/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-salesforce/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-salesforce/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: branches/8.0.x/connectors/translator-ws/pom.xml
===================================================================
--- branches/8.0.x/connectors/translator-ws/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/connectors/translator-ws/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: branches/8.0.x/engine/pom.xml
===================================================================
--- branches/8.0.x/engine/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/engine/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: branches/8.0.x/hibernate-dialect/pom.xml
===================================================================
--- branches/8.0.x/hibernate-dialect/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/hibernate-dialect/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: branches/8.0.x/jboss-integration/pom.xml
===================================================================
--- branches/8.0.x/jboss-integration/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/jboss-integration/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/metadata/pom.xml
===================================================================
--- branches/8.0.x/metadata/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/metadata/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: branches/8.0.x/pom.xml
===================================================================
--- branches/8.0.x/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -10,7 +10,7 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
@@ -37,9 +37,9 @@
<version.junit>4.10</version.junit>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/branches/8.0.x</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/branches/8.0.x</developerConnection>
- <url>http://anonsvn.jboss.org/repos/teiid/branches/8.0.x</url>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.CR2</url>
</scm>
<licenses>
<license>
Modified: branches/8.0.x/runtime/pom.xml
===================================================================
--- branches/8.0.x/runtime/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/runtime/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/8.0.x/test-integration/common/pom.xml
===================================================================
--- branches/8.0.x/test-integration/common/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/test-integration/common/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: branches/8.0.x/test-integration/db/pom.xml
===================================================================
--- branches/8.0.x/test-integration/db/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/test-integration/db/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/8.0.x/test-integration/pom.xml
===================================================================
--- branches/8.0.x/test-integration/pom.xml 2012-04-24 16:25:13 UTC (rev 4030)
+++ branches/8.0.x/test-integration/pom.xml 2012-04-24 20:22:26 UTC (rev 4031)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.CR2-SNAPSHOT</version>
+ <version>8.0.0.CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
12 years, 8 months
teiid SVN: r4030 - in branches/8.0.x: engine/src/main/java/org/teiid/query/tempdata and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-24 12:25:13 -0400 (Tue, 24 Apr 2012)
New Revision: 4030
Modified:
branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java
branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
Log:
TEIID-1986 spawning a request/session for asynch refreshes
Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -49,6 +49,7 @@
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
+import org.teiid.client.RequestMessage.StatementType;
import org.teiid.client.lob.LobChunk;
import org.teiid.client.metadata.MetadataResult;
import org.teiid.client.plan.PlanNode;
@@ -485,21 +486,6 @@
return resultsFuture;
}
-// /**
-// * Cancels a node in the request. (This request is called by the
-// * client directly using the admin API), so if this does not support
-// * partial results then remove the original request.
-// * @throws MetaMatrixComponentException
-// */
-// public void cancelAtomicRequest(AtomicRequestID requestID) throws MetaMatrixComponentException {
-// RequestWorkItem workItem = safeGetWorkItem(requestID.getRequestID());
-// if (workItem == null) {
-// LogManager.logDetail(LogConstants.CTX_DQP, "Could not cancel", requestID, "parent request does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
-// return;
-// }
-// workItem.requestAtomicRequestCancel(requestID);
-// }
-
RequestWorkItem getRequestWorkItem(RequestID reqID) throws TeiidProcessingException {
RequestWorkItem result = this.requests.get(reqID);
if (result == null) {
@@ -695,7 +681,27 @@
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents());
processorDataManager.setEventDistributor(eventDistributor);
- dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.processWorkerPool, this.rsCache);
+ dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.rsCache);
+ dataTierMgr.setExecutor(new TempTableDataManager.RequestExecutor() {
+
+ @Override
+ public void execute(String command, List<?> parameters) {
+ final String sessionId = DQPWorkContext.getWorkContext().getSessionId();
+ RequestMessage request = new RequestMessage(command);
+ request.setParameterValues(parameters);
+ request.setStatementType(StatementType.PREPARED);
+ ResultsFuture<ResultsMessage> result = executeRequest(0, request);
+ result.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
+
+ @Override
+ public void onCompletion(
+ ResultsFuture<ResultsMessage> future) {
+ terminateSession(sessionId);
+ }
+
+ });
+ }
+ });
dataTierMgr.setEventDistributor(eventDistributor);
LogManager.logDetail(LogConstants.CTX_DQP, "DQPCore started maxThreads", this.config.getMaxThreads(), "maxActivePlans", this.maxActivePlans, "source concurrency", this.userRequestSourceConcurrency); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -117,6 +117,7 @@
private HashMap<String, DataPolicy> policies;
private boolean useCallingThread;
private Version clientVersion = Version.SEVEN_4;
+ private boolean admin;
public DQPWorkContext() {
}
@@ -141,6 +142,10 @@
public void setSecurityHelper(SecurityHelper securityHelper) {
this.securityHelper = securityHelper;
}
+
+ public SecurityHelper getSecurityHelper() {
+ return securityHelper;
+ }
/**
* @return
@@ -150,10 +155,7 @@
}
public Subject getSubject() {
- if (session.getSubject() != null) {
- return session.getSubject();
- }
- return null;
+ return session.getSubject();
}
/**
@@ -311,4 +313,13 @@
public void setClientVersion(Version clientVersion) {
this.clientVersion = clientVersion;
}
+
+ public void setAdmin(boolean admin) {
+ this.admin = admin;
+ }
+
+ public boolean isAdmin() {
+ return admin;
+ }
+
}
Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -61,19 +61,7 @@
import org.teiid.events.EventDistributor;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.ColumnStats;
-import org.teiid.metadata.Datatype;
-import org.teiid.metadata.ForeignKey;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.KeyRecord;
-import org.teiid.metadata.MetadataRepository;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.ProcedureParameter;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
-import org.teiid.metadata.TableStats;
+import org.teiid.metadata.*;
import org.teiid.query.QueryPlugin;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.TempMetadataID;
@@ -182,7 +170,7 @@
return processSystemQuery(context, command, workItem.getDqpWorkContext());
}
- AtomicRequestMessage aqr = createRequest(context.getProcessorID(), command, modelName, connectorBindingId, nodeID);
+ AtomicRequestMessage aqr = createRequest(workItem, command, modelName, connectorBindingId, nodeID);
aqr.setCommandContext(context);
SourceHint sh = context.getSourceHint();
if (sh != null) {
@@ -572,11 +560,9 @@
return result;
}
- private AtomicRequestMessage createRequest(Object processorId,
+ private AtomicRequestMessage createRequest(RequestWorkItem workItem,
Command command, String modelName, String connectorBindingId, int nodeID)
- throws TeiidProcessingException, TeiidComponentException {
- RequestWorkItem workItem = requestMgr.getRequestWorkItem((RequestID)processorId);
-
+ throws TeiidComponentException {
RequestMessage request = workItem.requestMsg;
// build the atomic request based on original request + context info
AtomicRequestMessage aqr = new AtomicRequestMessage(request, workItem.getDqpWorkContext(), nodeID);
Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -470,7 +470,7 @@
if (context == null) {
createCommandContext(command);
}
- if (this.authorizationValidator != null) {
+ if (!this.workContext.isAdmin() && this.authorizationValidator != null) {
return this.authorizationValidator.validate(commandStr, command, metadata, context, type);
}
return false;
Modified: branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -79,6 +79,7 @@
private Serializable loadingAddress;
private long ttl = -1;
private boolean valid;
+ private boolean asynch; //sub state of loading
protected MatTableInfo() {}
@@ -96,7 +97,9 @@
}
return true;
case LOADING:
- if (!firstPass && localAddress instanceof Comparable<?> && ((Comparable)localAddress).compareTo(possibleLoadingAddress) < 0) {
+ if ((!firstPass && localAddress instanceof Comparable<?> && ((Comparable)localAddress).compareTo(possibleLoadingAddress) < 0)
+ || (refresh && asynch)) {
+ this.asynch = false;
this.loadingAddress = possibleLoadingAddress; //ties go to the lowest address
return true;
}
@@ -130,6 +133,11 @@
notifyAll();
}
+ public synchronized void setAsynchLoad() {
+ assert state == MatState.LOADING;
+ asynch = true;
+ }
+
public synchronized void setTtl(long ttl) {
this.ttl = ttl;
}
Modified: branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -27,15 +27,15 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.FutureTask;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.client.security.SessionToken;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBuffer;
@@ -47,13 +47,14 @@
import org.teiid.core.util.Assertion;
import org.teiid.core.util.StringUtil;
import org.teiid.dqp.internal.process.CachedResults;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
import org.teiid.events.EventDistributor;
+import org.teiid.language.SQLConstants;
import org.teiid.language.SQLConstants.Reserved;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.query.QueryPlugin;
import org.teiid.query.eval.Evaluator;
@@ -85,25 +86,33 @@
*/
public class TempTableDataManager implements ProcessorDataManager {
- private static final String REFRESHMATVIEWROW = ".refreshmatviewrow"; //$NON-NLS-1$
+ public interface RequestExecutor {
+ void execute(String command, List<?> parameters);
+ }
+
+ private static final String REFRESHMATVIEWROW = ".refreshmatviewrow"; //$NON-NLS-1$
private static final String REFRESHMATVIEW = ".refreshmatview"; //$NON-NLS-1$
public static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
-
+ private static String REFRESH_SQL = SQLConstants.Reserved.CALL + ' ' + CoreConstants.SYSTEM_ADMIN_MODEL + REFRESHMATVIEW + "(?, ?)"; //$NON-NLS-1$
+
private ProcessorDataManager processorDataManager;
private BufferManager bufferManager;
private SessionAwareCache<CachedResults> cache;
- private Executor executor;
+ private RequestExecutor executor;
private EventDistributor eventDistributor;
-
+
public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager,
- Executor executor, SessionAwareCache<CachedResults> cache){
+ SessionAwareCache<CachedResults> cache){
this.processorDataManager = processorDataManager;
this.bufferManager = bufferManager;
- this.executor = executor;
this.cache = cache;
}
+ public void setExecutor(RequestExecutor executor) {
+ this.executor = executor;
+ }
+
public void setEventDistributor(EventDistributor eventDistributor) {
this.eventDistributor = eventDistributor;
}
@@ -396,11 +405,12 @@
}
}
if (load) {
- if (!info.isValid()) {
+ if (!info.isValid() || executor == null) {
//blocking load
loadGlobalTable(context, group, tableName, globalStore);
} else {
- loadAsynch(context, group, tableName, globalStore);
+ info.setAsynchLoad();
+ loadAsynch(context, tableName);
}
}
table = globalStore.getTempTableStore().getOrCreateTempTable(tableName, query, bufferManager, false, false, context);
@@ -417,16 +427,25 @@
return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
}
- private void loadAsynch(final CommandContext context,
- final GroupSymbol group, final String tableName, final GlobalTableStore globalStore) {
- Callable<Integer> toCall = new Callable<Integer>() {
+ private void loadAsynch(final CommandContext context, final String tableName) {
+ SessionMetadata session = createTemporarySession(context.getUserName(), "asynch-mat-view-load", context.getDQPWorkContext().getVDB()); //$NON-NLS-1$
+ session.setSubject(context.getSubject());
+ session.setSecurityDomain(context.getSession().getSecurityDomain());
+ DQPWorkContext workContext = new DQPWorkContext();
+ workContext.setAdmin(true);
+ DQPWorkContext current = context.getDQPWorkContext();
+ workContext.setSession(session);
+ workContext.setPolicies(current.getAllowedDataPolicies());
+ workContext.setSecurityHelper(current.getSecurityHelper());
+ final String viewName = tableName.substring(RelationalPlanner.MAT_PREFIX.length());
+ workContext.runInContext(new Runnable() {
+
@Override
- public Integer call() throws Exception {
- return loadGlobalTable(context, group, tableName, globalStore);
+ public void run() {
+ executor.execute(REFRESH_SQL, Arrays.asList(viewName, Boolean.FALSE.toString()));
}
- };
- FutureTask<Integer> task = new FutureTask<Integer>(toCall);
- executor.execute(task);
+
+ });
}
private int loadGlobalTable(CommandContext context,
@@ -515,4 +534,26 @@
public EventDistributor getEventDistributor() {
return this.eventDistributor;
}
+
+ /**
+ * Create an unauthenticated session
+ * @param userName
+ * @param app
+ * @param vdb
+ * @return
+ */
+ public static SessionMetadata createTemporarySession(String userName, String app, VDBMetaData vdb) {
+ long creationTime = System.currentTimeMillis();
+ SessionMetadata newSession = new SessionMetadata();
+ newSession.setSessionToken(new SessionToken(userName));
+ newSession.setSessionId(newSession.getSessionToken().getSessionID());
+ newSession.setUserName(userName);
+ newSession.setCreatedTime(creationTime);
+ newSession.setApplicationName(app);
+ newSession.setVDBName(vdb.getName());
+ newSession.setVDBVersion(vdb.getVersion());
+ newSession.setVdb(vdb);
+ newSession.setEmbedded(true);
+ return newSession;
+ }
}
Modified: branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -35,7 +35,6 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.util.ExecutorUtils;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
import org.teiid.dqp.internal.process.SessionAwareCache;
@@ -75,7 +74,7 @@
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
cache.setTupleBufferCache(bm);
- dataManager = new TempTableDataManager(hdm, bm, ExecutorUtils.getDirectExecutor(), cache);
+ dataManager = new TempTableDataManager(hdm, bm, cache);
}
private void execute(String sql, List<?>... expectedResults) throws Exception {
Modified: branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -46,7 +46,6 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.XMLType;
-import org.teiid.core.util.ExecutorUtils;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
@@ -247,7 +246,7 @@
if (!(dataManager instanceof TempTableDataManager)) {
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
cache.setTupleBufferCache(bufferMgr);
- dataManager = new TempTableDataManager(dataManager, bufferMgr, ExecutorUtils.getDirectExecutor(), cache);
+ dataManager = new TempTableDataManager(dataManager, bufferMgr, cache);
}
if (context.getQueryProcessorFactory() == null) {
context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(bufferMgr, dataManager, new DefaultCapabilitiesFinder(), null, context.getMetadata()));
Modified: branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -43,7 +43,6 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.util.ExecutorUtils;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.service.TransactionContext;
@@ -94,7 +93,7 @@
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
cache.setTupleBufferCache(bm);
- dataManager = new TempTableDataManager(fdm, bm, ExecutorUtils.getDirectExecutor(), cache);
+ dataManager = new TempTableDataManager(fdm, bm, cache);
}
@Test public void testRollbackNoExisting() throws Exception {
Modified: branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
--- branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-04-24 16:22:56 UTC (rev 4029)
+++ branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-04-24 16:25:13 UTC (rev 4030)
@@ -63,7 +63,6 @@
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
import org.teiid.client.plan.PlanNode;
-import org.teiid.client.security.SessionToken;
import org.teiid.client.util.ResultsFuture;
import org.teiid.core.TeiidComponentException;
import org.teiid.deployers.ExtendedPropertyMetadata;
@@ -75,6 +74,7 @@
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.query.tempdata.TempTableDataManager;
abstract class TeiidOperationHandler extends BaseOperationHandler<DQPCore> {
List<TransportService> transports = new ArrayList<TransportService>();
@@ -721,11 +721,16 @@
String user = "CLI ADMIN"; //$NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("admin_executing", user, command)); //$NON-NLS-1$
- SessionMetadata session = createTemporarySession(vdbName, version, user);
+ VDBMetaData vdb = this.vdbRepo.getVDB(vdbName, version);
+ if (vdb == null) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("wrong_vdb")));//$NON-NLS-1$
+ }
+ final SessionMetadata session = TempTableDataManager.createTemporarySession(user, "admin-console", vdb); //$NON-NLS-1$
final long requestID = 0L;
DQPWorkContext context = new DQPWorkContext();
+ context.setUseCallingThread(true);
context.setSession(session);
try {
@@ -735,7 +740,7 @@
long start = System.currentTimeMillis();
RequestMessage request = new RequestMessage(command);
- request.setExecutionId(0L);
+ request.setExecutionId(requestID);
request.setRowLimit(engine.getMaxRowsFetchSize()); // this would limit the number of rows that are returned.
Future<ResultsMessage> message = engine.executeRequest(requestID, request);
ResultsMessage rm = null;
@@ -770,7 +775,19 @@
});
} catch (Throwable t) {
throw new OperationFailedException(new ModelNode().set(t.getMessage()));
- }
+ } finally {
+ try {
+ context.runInContext(new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ engine.terminateSession(session.getSessionId());
+ return null;
+ }
+ });
+ } catch (Throwable e) {
+ throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+ }
+ }
}
private void writeResults(ModelNode resultsNode, List<String> columns, List<? extends List<?>> results) throws SQLException {
@@ -826,27 +843,6 @@
}
}
- private SessionMetadata createTemporarySession(final String vdbName, final int version, final String userName) throws OperationFailedException{
-
- long creationTime = System.currentTimeMillis();
-
- // Return a new session info object
- SessionMetadata newSession = new SessionMetadata();
- newSession.setSessionToken(new SessionToken(userName));
- newSession.setSessionId(newSession.getSessionToken().getSessionID());
- newSession.setUserName(userName);
- newSession.setCreatedTime(creationTime);
- newSession.setApplicationName("admin-console"); //$NON-NLS-1$
- newSession.setVDBName(vdbName);
- newSession.setVDBVersion(version);
-
- VDBMetaData vdb = this.vdbRepo.getVDB(vdbName, version);
- if (vdb == null) {
- throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("wrong_vdb")));//$NON-NLS-1$
- }
- newSession.setVdb(vdb);
- return newSession;
- }
}
class GetVDB extends BaseOperationHandler<VDBRepository>{
12 years, 8 months
teiid SVN: r4029 - in branches/7.7.x/connectors: translator-object and 26 other directories.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-04-24 12:22:56 -0400 (Tue, 24 Apr 2012)
New Revision: 4029
Added:
branches/7.7.x/connectors/translator-object/
branches/7.7.x/connectors/translator-object/Notes.txt
branches/7.7.x/connectors/translator-object/pom.xml
branches/7.7.x/connectors/translator-object/src/
branches/7.7.x/connectors/translator-object/src/main/
branches/7.7.x/connectors/translator-object/src/main/java/
branches/7.7.x/connectors/translator-object/src/main/java/org/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectPlugin.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheObjectVisitor.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/util/
branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectMethodUtil.java
branches/7.7.x/connectors/translator-object/src/main/resources/
branches/7.7.x/connectors/translator-object/src/main/resources/org/
branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/
branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/
branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/
branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
branches/7.7.x/connectors/translator-object/src/test/
branches/7.7.x/connectors/translator-object/src/test/java/
branches/7.7.x/connectors/translator-object/src/test/java/org/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/BaseObjectTest.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Leg.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Trade.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Transaction.java
branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java
branches/7.7.x/connectors/translator-object/src/test/resources/
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetColumns.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTableTypes.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_for3ClassNames.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_ofSpecificTableType.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor1Class.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor2Classes.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor3Classes.expected
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade.vdb
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_View.xmi
branches/7.7.x/connectors/translator-object/src/test/resources/testQueryIncludeLegs.expected
Log:
TEIID-1992 initial commit that provides the core infrastructure for translating objects into results
Added: branches/7.7.x/connectors/translator-object/Notes.txt
===================================================================
--- branches/7.7.x/connectors/translator-object/Notes.txt (rev 0)
+++ branches/7.7.x/connectors/translator-object/Notes.txt 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,51 @@
+Notes:
+
+Limitations -
+
+1. There is no current support for 2 or more classes named the same (but different packages) in the same model.
+ The table name will be the name of the class, not the full classname.
+
+
+
+
+Modeling -
+
+- JavaBean convention is used. The column name (or nameinsource if used) are used in finding the get/is method.
+
+ 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.
+
+
+- A model should have the hierarchical structure of a class normalized. Meaning, any container based objects
+ (i.e., Collections, Arrays, etc.) must have a separate table defined and have a foreign key relationship to
+ its parent table/object.
+- The table defined for the root object must have a primary key defined, which is the key to it being found in the cache
+- If an object has children, then the following must occur:
+ a. parent and child tables need a primary key
+ b. if the child object does not contain a reference to the parent object, then the child table will need to have
+ a column added that can be used in the creation of the foreign key (see "c" below) and used in joins
+ NOTE: set these properties on the new column:
+ - Searchability=UNSEARCHABLE
+ - Selectable=false
+ - Updateable=false
+ c. create the foreign key relationship between parent child, where the NameInSource for the FK being the method
+ to access child objects.
+ d. the attribute on an object that is the container object, should not be modeled as an attribute in the table.
+ This is because its not directly queryable. It should have a related child table, which has a foreign key
+ (see b and c above).
+
+
+
+
+TODO:
+
+- when importing metadata, make the Object types (of return types, collections, etc) non-selectable, because they need
+ to have their own table created and then a foreign key back to the parent table.
\ No newline at end of file
Added: branches/7.7.x/connectors/translator-object/pom.xml
===================================================================
--- branches/7.7.x/connectors/translator-object/pom.xml (rev 0)
+++ branches/7.7.x/connectors/translator-object/pom.xml 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,98 @@
+<?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>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.7.1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-object</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Object Translator</name>
+ <description>This is the translator for Object(s)</description>
+ <properties>
+ <version.infinispan>5.1.2.FINAL</version.infinispan>
+ <version.hibernate.search>4.1.0.CR1</version.hibernate.search>
+ </properties>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ <scope>provided</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>${version.infinispan}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-query</artifactId>
+ <version>${version.infinispan}</version>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <version>${version.hibernate.search}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecution.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.object;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.language.Command;
+import org.teiid.language.Select;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.DataNotAvailableException;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+
+
+/**
+ * Execution of the SELECT Command
+ */
+public class ObjectExecution implements ResultSetExecution {
+
+ private Select query;
+ private ObjectSourceProxy proxy;
+ private ObjectExecutionFactory factory;
+
+ @SuppressWarnings("rawtypes")
+ private Iterator resultsIt = null;
+
+ public ObjectExecution(Command query, RuntimeMetadata metadata, ObjectSourceProxy connproxy, ObjectExecutionFactory factory) {
+ this.query = (Select) query;
+ this.proxy = connproxy;
+ this.factory = factory;
+ }
+
+ @Override
+ public void execute() throws TranslatorException {
+
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Object executing command: " + query.toString()); //$NON-NLS-1$
+
+ List<Object> objects = executeQuery();
+
+ List<List<?>> results = null;
+ if (objects != null && objects.size() > 0) {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of objects from proxy is : " + objects.size()); //$NON-NLS-1$
+
+ ObjectProjections op = new ObjectProjections(query);
+
+ results = ObjectTranslator.translateObjects(objects, op, factory.getObjectMethodManager());
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of rows from translation : " + results.size()); //$NON-NLS-1$
+
+ } else {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution number of objects from proxy is : 0"); //$NON-NLS-1$
+
+ results = Collections.emptyList();
+ }
+
+
+ this.resultsIt = results.iterator();
+ }
+
+ protected List<Object> executeQuery()
+ throws TranslatorException {
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "ObjectExecution calling proxy : " + this.proxy.getClass().getName()); //$NON-NLS-1$
+
+ return this.proxy.get(query);
+
+ }
+
+ @Override
+ public List<Object> next() throws TranslatorException, DataNotAvailableException {
+ // create and return one row at a time for your resultset.
+ if (resultsIt.hasNext()) {
+ return (List<Object>) resultsIt.next();
+ }
+ return null;
+ }
+
+
+ @Override
+ public void close() {
+ this.proxy.close();
+ this.proxy = null;
+
+ }
+
+ @Override
+ public void cancel() throws TranslatorException {
+ //TODO: initiate the "abort" of execution
+ }
+
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectExecutionFactory.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.object;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TranslatorProperty;
+
+/**
+ * The ObjectExecutionFactory is a base implementation of the ExecutionFactory.
+ * For each implementor, the {@link #createProxy(Object)} method will need to be
+ * implemented in order to provide the data source specific implementation for
+ * query execution.
+ *
+ *
+ * @author vhalbert
+ *
+ */
+
+public abstract class ObjectExecutionFactory extends ExecutionFactory<Object, Object> {
+ public static final int MAX_SET_SIZE = 100;
+
+ /*
+ * ObjectMethodManager is the cache of methods used on the objects.
+ * Each ExecutionFactory instance will maintain its own method cache.
+ */
+ private ObjectMethodManager objectMethods=null;
+
+ private boolean columnNameFirstLetterUpperCase = true;
+
+
+ public ObjectExecutionFactory() {
+ super();
+ init();
+ }
+
+ protected void init() {
+ this.setMaxInCriteriaSize(MAX_SET_SIZE);
+ this.setMaxDependentInPredicates(1);
+ this.setSourceRequired(false);
+ this.setSupportsOrderBy(false);
+ this.setSupportsSelectDistinct(false);
+ this.setSupportsInnerJoins(true);
+ this.setSupportsFullOuterJoins(false);
+ this.setSupportsOuterJoins(true);
+ }
+
+ @Override
+ public void start() throws TranslatorException {
+ objectMethods = ObjectMethodManager.initialize(isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
+ }
+
+ @Override
+ public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Object connection)
+ throws TranslatorException {
+ return new ObjectExecution((Select)command, metadata, createProxy(connection), this);
+ }
+
+ public List getSupportedFunctions() {
+ return Collections.EMPTY_LIST;
+ }
+
+ public boolean supportsCompareCriteriaEquals() {
+ return true;
+ }
+
+
+ /**
+ * <p>
+ * The {@link #getColumnNameFirstLetterUpperCase() option, when <code>false</code>, indicates that the column name (or nameInSource when specified)
+ * will start with a lower case. This is an option because some users prefer (or standardize) on names being lower case or have a
+ * different case naming structure.
+ * <p/>
+ * <p>
+ * The case matters for the following reasons:
+ * <li>Deriving the "getter/setter" method on the object to read the value. Because JavaBean naming convention
+ * is used.</li>
+ * <li>Building criteria logic for searching the datasource. This one is functionality specific (i.e., Hibernate Search)
+ * as to how it maps the column name to an indexed field. </li>
+ * </p>
+ * @return boolean indicating if the case of the first letter of the column name (or nameInSource when specified), default <code>true</code>
+ */
+ @TranslatorProperty(display="ColumnNameFirstLetterUpperCase", advanced=true)
+ public boolean isColumnNameFirstLetterUpperCase() {
+ return this.columnNameFirstLetterUpperCase;
+ }
+
+ /**
+ * <p>
+ * The {@link #columnNameFirstLetterUpperCase} option, when <code>false</code>, indicates that the column name (or nameInSource when specified)
+ * will start with a lower case. This is an option because some users prefer (or standardize) on names being lower case or have a
+ * different case naming structure.
+ * <p/>
+ * <p>
+ * The case matters for the following reasons:
+ * <li>Deriving the "getter/setter" method on the object to read the value. Because JavaBean naming convention
+ * is used.</li>
+ * <li>Building criteria logic for searching the datasource. This one is functionality specific (i.e., Hibernate Search)
+ * as to how it maps the column name to an indexed field. </li>
+ * </p>
+ * @param firstLetterUpperCase indicates the case of the first letter in the column name (or nameInSource when specified), default <code>true</code>
+ * @return
+ */
+ public void setColumnNameFirstLetterUpperCase(boolean firstLetterUpperCase) {
+ this.columnNameFirstLetterUpperCase = firstLetterUpperCase;
+ }
+
+
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory, Object conn)
+ throws TranslatorException {
+ if (objectMethods != null) {
+ objectMethods = ObjectMethodManager.initialize(isColumnNameFirstLetterUpperCase(), this.getClass().getClassLoader());
+ }
+ }
+
+
+
+ public ObjectMethodManager getObjectMethodManager() {
+ return this.objectMethods;
+ }
+
+ /**
+ * Implement to return an instance of {@link ObjectSourceProxy proxy} that is used
+ * by {@link ObjectExecution execution} to issue requests.
+ * @param connection
+ * @return IObjectConnectionProxy
+ * @throws TranslatorException
+ */
+ protected abstract ObjectSourceProxy createProxy(Object connection) throws TranslatorException ;
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectMethodManager.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,275 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.object;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.teiid.core.util.StringUtil;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.util.ObjectMethodUtil;
+
+/**
+ * ObjectMethodManager caches the methods for the classes that
+ * are being utilized, and provides utility methods for finding a method
+ * and executing.
+ */
+public class ObjectMethodManager extends ConcurrentHashMap<String, Object> { // className, ClassMethods
+ public static final String GET = "get";
+ public static final String SET = "set";
+ public static final String IS = "is";
+
+ public final class ClassMethods {
+
+ private Class<?> clz = null;
+ private Map<String, Method> getters = new HashMap<String, Method>(10);
+ private Map<String, Method> setters = new HashMap<String, Method>(10);
+ private Map<String, Method> is = new HashMap<String, Method>(5);
+
+ ClassMethods(final Class<?> clzz) {
+ this.clz = clzz;
+ }
+
+ String getClassName() {
+ return this.clz.getName();
+ }
+
+ public Map<String, Method> getGetters() {
+ return getters;
+ }
+
+ void addGetter(String methodName, Method g) {
+ this.getters.put(methodName, g);
+ }
+
+ Method getGetMethod(String name) {
+ return this.getters.get(name);
+ }
+
+ public Map<String, Method> getSetters() {
+ return setters;
+ }
+
+ void addSetter(String methodName, Method s) {
+ this.setters.put(methodName, s);
+ }
+
+ Method getSetMethod(String name) {
+ return this.setters.get(name);
+ }
+
+ public Map<String, Method> getIses() {
+ return this.is;
+ }
+
+ void addIsMethod(String methodName, Method i) {
+ this.is.put(methodName, i);
+ }
+
+ Method getIsMethod(String name) {
+ return this.is.get(name);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static ObjectMethodManager initialize(boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
+ return loadClassMethods(Collections.EMPTY_LIST, firstLetterUpperCaseInColumName, classloader);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static ObjectMethodManager initialize(String commaSeparatedNames, boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
+ List<String> classNames = null;
+ if (commaSeparatedNames != null) {
+ classNames = StringUtil.getTokens(commaSeparatedNames, ",");
+ } else {
+ classNames = Collections.EMPTY_LIST;
+ }
+ return loadClassMethods(classNames, firstLetterUpperCaseInColumName, classloader);
+ }
+
+ public static ObjectMethodManager loadClassMethods(List<String> classNames, boolean firstLetterUpperCaseInColumName, ClassLoader classloader) throws TranslatorException {
+
+ ObjectMethodManager osmm = new ObjectMethodManager(firstLetterUpperCaseInColumName);
+
+ for (String clzName: classNames) {
+ osmm.loadClassByName(clzName, classloader);
+ }
+
+ return osmm;
+ }
+
+ public Class<?> loadClassByName(String className, ClassLoader classLoader) throws TranslatorException {
+ ClassMethods clzzMethods = getClassMethods(className);
+ if (clzzMethods == null) {
+ Class<?> clz = loadClass(className, classLoader);
+ clzzMethods = loadClassMethods(clz);
+ return clz;
+ }
+ return clzzMethods.getClass();
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8576602118928356693L;
+
+ private ObjectMethodManager(boolean firstLetterUpperCaseInColumName) {
+ this.firstLetterUpperCaseInColumName = firstLetterUpperCaseInColumName;
+ }
+
+ private ClassMethods loadClassMethods(Class<?> clzz) {
+ Method[] methods = clzz.getDeclaredMethods();
+ ClassMethods clzMethods = new ClassMethods(clzz);
+
+ for (int i=0; i<methods.length; i++) {
+ Method m = methods[i];
+ if (m.getName().startsWith(GET)) {
+ clzMethods.addGetter(m.getName(), m);
+ // commenting out the caching of the setter methods
+// } else if (m.getName().startsWith(SET)) {
+// clzMethods.addSetter(m.getName(), m);
+ } else if (m.getName().startsWith(IS)) {
+ clzMethods.addIsMethod(m.getName(), m);
+ }
+ }
+ this.put(clzz.getName(), clzMethods);
+ return clzMethods;
+ }
+
+ public Object getIsValue(String methodName, Object object)
+ throws TranslatorException {
+
+ final Method m = findIsMethod(object.getClass(), methodName);
+ if (m == null) {
+ throw new TranslatorException(
+ ObjectPlugin.Util
+ .getString(
+ "ObjectMethodManager.noMethodFound", new Object[] { methodName, object.getClass().getName() })); //$NON-NLS-1$
+ }
+ return ObjectMethodUtil.executeMethod(m, object, (Object[]) null);
+ }
+
+ public Object getGetValue(String methodName, Object object)
+ throws TranslatorException {
+
+ final Method m = findGetterMethod(object.getClass(), methodName);
+ if (m == null) {
+ throw new TranslatorException(
+ ObjectPlugin.Util
+ .getString(
+ "ObjectMethodManager.noMethodFound", new Object[] {methodName, object.getClass().getName()})); //$NON-NLS-1$
+ }
+ return ObjectMethodUtil.executeMethod(m, object, (Object[]) null);
+ }
+
+ public Object setValue(String methodName, Object object)
+ throws TranslatorException {
+
+ final Method m = findSetterMethod(object.getClass(), methodName);
+ if (m == null) {
+ throw new TranslatorException(
+ ObjectPlugin.Util
+ .getString(
+ "ObjectMethodManager.noMethodFound", new Object[] { methodName, object.getClass().getName() })); //$NON-NLS-1$
+ }
+ List<Object> parms = new ArrayList<Object>(1);
+ parms.add(object);
+ return ObjectMethodUtil.executeMethod(m, object, parms);
+ }
+
+ public Method findGetterMethod(Class<?> api, String methodName) throws TranslatorException {
+ return getClassMethods(api).getGetMethod(methodName);
+ }
+
+ public Method findSetterMethod(Class<?> api, String methodName) throws TranslatorException {
+ return getClassMethods(api).getSetMethod(methodName);
+ }
+
+ public Method findIsMethod(Class<?> api, String methodName) throws TranslatorException {
+ return getClassMethods(api).getIsMethod(methodName);
+ }
+
+
+ /**
+ * Call to format the method name based on how the columnName (NameInSource) is being modeled.
+ * If its not UpperCase, then the first character will be UpperCased. This is done so that the
+ * method name follows the JavaBeans naming convention (i.e., getMethod or setMethod)
+ * @param prefix it the value is the fist part of the method name (i.e, get,set,is)
+ * @param columnName is the attribute to calling get,set or is on the object
+ * @param columNameStartsWithUpperCase is a boolean, indicating if the first character is UpperCased.
+ * @return
+ * @see ObjectExecutionFactory#firstLetterUpperCaseInColumName()
+ */
+ public String formatMethodName(String prefix, String columnName) {
+ if (this.firstLetterUpperCaseInColumName) return prefix + columnName;
+
+ return prefix + columnName.substring(0, 1).toUpperCase() + columnName.substring(1);
+ }
+
+
+ public boolean isFirstLetterUpperCaseInColumName() {
+ return this.firstLetterUpperCaseInColumName;
+ }
+
+ public static final Class<?> loadClass(final String className,
+ final ClassLoader classLoader) throws TranslatorException {
+ try {
+ Class<?> cls = null;
+ if (classLoader == null) {
+ cls = Class.forName(className.trim());
+ } else {
+ cls = Class.forName(className.trim(), true, classLoader);
+ }
+ return cls;
+
+ } catch (ClassNotFoundException e) {
+ throw new TranslatorException(
+ ObjectPlugin.Util
+ .getString(
+ "ObjectMethodManager.objectClassNotFound", new Object[] {className})); //$NON-NLS-1$
+ }
+
+ }
+
+ public ClassMethods getClassMethods(String className) {
+ return (ClassMethods) this.get(className);
+ }
+
+ private ClassMethods getClassMethods(Class<?> api) throws TranslatorException {
+ ClassMethods clzMethods = getClassMethods(api.getName());
+ if (clzMethods == null) {
+ loadClassMethods(api);
+ clzMethods = this.getClassMethods(api);
+ }
+ return clzMethods;
+
+ }
+ private boolean firstLetterUpperCaseInColumName = true;
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectPlugin.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectPlugin.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectPlugin.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -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.object;
+
+import java.util.ResourceBundle;
+
+import org.teiid.core.BundleUtil;
+
+
+/**
+ * CoherencePlugin
+ */
+public class ObjectPlugin {
+
+ public static final String PLUGIN_ID = "org.teiid.translator.object" ; //$NON-NLS-1$
+
+ /**
+ * 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/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectProjections.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,194 @@
+package org.teiid.translator.object;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.core.util.StringUtil;
+import org.teiid.language.ColumnReference;
+import org.teiid.language.DerivedColumn;
+import org.teiid.language.Select;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ForeignKey;
+import org.teiid.metadata.KeyRecord;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+
+public class ObjectProjections {
+ // Columns that are in the select clause
+ protected Column[] columns = null; // columnNameToUse, Column in select
+ // The columnNameToUse could be either
+ // - name in source
+ // - if its a child column, then it will be {FK name in source}.{name in source}
+ protected String[] columnNamesToUse = null;
+
+ protected List<String>[] nameNodes = null;
+ protected int[] nodeDepth = null; // values are zero based, anything greater than zero indicates there children involved
+
+ // this is the number of children deep this query is requesting information
+ protected int childrenDepth = -1; //
+ protected List<String> childrenNodes = null;
+
+ protected List<String> exceptionMessages = new ArrayList<String>(2);
+
+
+ public ObjectProjections(Select query) {
+ parse(query);
+ }
+
+ public Column[] getColumns() {
+ return this.columns;
+ }
+
+ public String[] getColumnNamesToUse() {
+ return this.columnNamesToUse;
+ }
+
+ public boolean hasChildren() {
+ return (childrenDepth > -1);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void parse(Select query) {
+
+ Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
+
+ int s = query.getDerivedColumns().size();
+ columns = new Column[s];
+ columnNamesToUse = new String[s];
+ nameNodes = new ArrayList[s];
+ nodeDepth = new int[s];
+
+ String maxDepthColumnNameToUse = null;
+
+ int i=0;
+ while(selectSymbolItr.hasNext()) {
+ columns[i] = getColumnFromSymbol(selectSymbolItr.next());
+ columnNamesToUse[i] = getColumnNameToUse(columns[i]);
+
+ nameNodes[i] = StringUtil.getTokens(columnNamesToUse[i], ".");
+ nodeDepth[i] = nameNodes[i].size() - 1; // if one node name, then depth is zero, and incremented from there
+
+ // only when there are multiple node names will a container be involved
+ if (nodeDepth[i] > 0) {
+ if (childrenDepth == -1) {
+ childrenDepth = nodeDepth[i];
+ // strip off the the child node names (excluding the last node, which is the value call)
+ maxDepthColumnNameToUse = columnNamesToUse[i].substring(0, columnNamesToUse[i].lastIndexOf("."));
+ childrenNodes = nameNodes[i];
+ } else {
+ // if the columns are not on the same path, then this is an error,
+ // can only support one child path per query
+ if (!columnNamesToUse[i].startsWith(maxDepthColumnNameToUse)) {
+ addException(maxDepthColumnNameToUse, columnNamesToUse[i], columns[i].getParent().getName());
+ }
+
+ if ( nodeDepth[i] > childrenDepth) {
+ childrenDepth = nodeDepth[i];
+ childrenNodes = nameNodes[i];
+ }
+
+ }
+ }
+
+ i++;
+ }
+
+ }
+
+
+ private void addException(String columnNameToUse1,
+ String columnNameToUse2, String table) {
+ exceptionMessages.add(
+ "Query Error: multiple collections found between columns "
+ + columnNameToUse1 + " and " + columnNameToUse2
+ + " (table: " + table + " ) ");
+ }
+
+ protected void throwExceptionIfFound() throws TranslatorException {
+ if (!exceptionMessages.isEmpty())
+ throw new TranslatorException("ObjectProjections Exception: " + exceptionMessages.toString());
+ }
+
+ public String getColumnNameToUse(Column column) {
+ String nis = getNameInSourceForObjectHierarchy(column);
+ if (nis == null) return column.getName();
+ return nis;
+ }
+
+ /**
+ * Method to build the nameInSource nodes to be used to lookup a value, starting with the root object.
+ * If the column is associated with a table that has a foreign key (i.e, is contained within), use the nameInSource
+ * of the foreign key as a prefix node in the nameInSource. The process will climb the foreign key hierarchy tree to
+ * combine to make the NameInSource for the column.
+ * Example: Object hierarchy: "A" = getLegs => "B" = getTransactions => "C"
+ * The column object would start with "C" and find a foreign key to "B", having nameInSource of "Transactions"
+ * current nodes in the name are: Transactions."C"
+ *
+ * The process then takes object "B" and determines it has a foreign key to "A", its nameInSource is "Legs", which is prefixed on the nodes names.
+ * current nodes in the name are: Legs.Transactions."C"
+ *
+ * The node name structure will allow the object reflection process to traverse the root object to get to "C" by taking the first node, Legs,
+ * and calling "A".getLegs(), and then processing each object in the collection by calling "B".getTransations().
+ *
+ * @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.
+ protected String getNameInSourceForObjectHierarchy(Column e) {
+ String nis = getNameInSourceFromColumn(e);
+
+ Object p = e.getParent();
+ // if the column comes from a table that has a foreign key, then
+ // preprend the nameInSource with the foreign key nameInSource
+ //NOTE: the foreign key NIS should be the name of the container method to find the column
+ String parentNodeName = null;
+ if (p instanceof Table) {
+ parentNodeName = getForeignKeyNodeName((Table) p);
+ }
+
+ return (parentNodeName != null ? parentNodeName + "." : "") + nis;
+ }
+
+
+ protected String getNameInSourceFromColumn(Column c) {
+ String name = c.getNameInSource();
+ if(name == null || name.equals("")) { //$NON-NLS-1$
+ return c.getName();
+ }
+ return name;
+ }
+
+
+ protected String getForeignKeyNodeName(Table t) {
+ if (t == null) return null;
+
+ if (t.getForeignKeys() != null && !t.getForeignKeys().isEmpty()) {
+ ForeignKey fk = (ForeignKey) t.getForeignKeys().get(0);
+ String fk_nis = fk.getNameInSource();
+
+ KeyRecord kr = fk.getPrimaryKey();
+ if (kr.getParent() != null) {
+ String parentNIS = getForeignKeyNodeName(kr.getParent());
+
+ return (parentNIS != null ? parentNIS + "." : "") + fk_nis;
+ }
+ return fk_nis;
+ }
+
+ return null;
+ }
+
+ /**
+ * Helper method for getting {@link org.teiid.metadata.Column} from a
+ * {@link org.teiid.language.DerivedColumn}.
+ * @param symbol Input ISelectSymbol
+ * @return Element returned metadata runtime Element
+ */
+ protected Column getColumnFromSymbol(DerivedColumn symbol) {
+ ColumnReference expr = (ColumnReference) symbol.getExpression();
+ return expr.getMetadataObject();
+ }
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectSourceProxy.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import java.util.List;
+
+import org.teiid.language.Command;
+import org.teiid.translator.TranslatorException;
+
+/**
+ * <p>
+ * ObjectSourceProxy interface is how the translator will ask for objects from the cache based on
+ * the {@link Command}. The visitor will provide a parsed query such that the
+ * the proxy implementor can use the criteria to perform vendor specific logic to obtain
+ * objects from the cache.
+ * </p>
+ * <p>
+ * The specific proxy implementation will be instantiated by {@link ObjectExecutionFactory}.
+ * Passing in the connection object and ObjectExecutionFactory.
+ * </P
+ *
+ * @author vhalbert
+ *
+ */
+
+public interface ObjectSourceProxy {
+
+ /**
+ * Called by {@link ObjectExecution}, passing in the sql <code>command</code>, to obtain the objects from
+ * the cache based. The implementor will need to parse the command and interpret the criteria according
+ * to data source query syntax.
+ * @param command is the SELECT command to query the data source
+ * @return List of objects found in the cache.
+ * @throws TranslatorException is thrown if there are issues querying the data source
+ */
+ List<Object> get(Command command) throws TranslatorException;
+
+
+ /**
+ * Called when this instance has completed its logical task. This may include closing the connection, if that makes sence.
+ */
+ void close();
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/ObjectTranslator.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.object;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.teiid.translator.TranslatorException;
+
+/**
+ * The ObjectTranslator is the responsible for introspection of an object and turning it into rows.
+ *
+ * This will use reflections, based on model metadata, to invoke methods on the objects
+ *
+ * @author vhalbert
+ *
+ */
+public class ObjectTranslator {
+
+ public enum CONTAINER_TYPE {
+ COLLECTION,
+ ARRAY,
+ MAP
+ }
+
+ /**
+ * <p>
+ * Called to translate the list of <code>objects</code> returned from the
+ * cache. The <code>projections</code> will be used to drive what information on
+ * the objects that will be obtained.
+ * </p>
+ * <p>
+ * The assumptions in converting objects to relational are as follows:
+ * <li>its assumed the objects have been normalized when modeled, not de-normalized. The object is de-normalized
+ * if table or view is defined to have multiple container objects (ie., Maps, List, etc.) returned
+ * in the same source query.
+ * <p> Example:
+ * Object X
+ * Attributes: Name
+ * Addresses (List)
+ * Phones (List)
+ * Object X is mapped to Table A
+ * Name
+ * Street
+ * City
+ * State
+ * Phone_Number
+ *
+ * To model this correctly, you would create 2 Tables (A and B):
+ * Table A
+ * Name, Street, City, State
+ * Table B
+ * Name, Phone_Number
+ *
+ * If the user wants a cross-product result, then allow the Teiid engine to perform that logic, but the Translator
+ * will only traverse one container path per result set. I say container path, because it will be possible for
+ * an object in a container to define another container object, and so on. Theoretically, there is no depth limit.
+ * <li></li>
+ * @param objects is the List of objects from the cache
+ * @param projections are the columns to be returned in the result set
+ * @param objectManager is responsible for providing the object methods used for traversing an object and/or
+ * obtaining the data from an object
+ * @return List<List<?>> that represent the rows and columns in the result set
+ */
+ public static List<List<?>> translateObjects(List<Object> objects, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
+
+ projections.throwExceptionIfFound();
+
+ List<List<?>> rows = new ArrayList<List<?>>(objects.size());
+
+ // if no container objects required in the results, then
+ // perform simple logic for building a row
+ int numCols = projections.columnNamesToUse.length;
+
+ if (!projections.hasChildren()) {
+ for (Iterator<Object> it = objects.iterator(); it.hasNext();) {
+ // each object represent 1 row
+ Object o = (Object) it.next();
+
+ List<Object> row = new ArrayList<Object>(numCols);
+ for (int i = 0; i < numCols; i++) {
+ Object value = getValue(o, i, 0, projections, objectManager);
+
+ row.add(value);
+ }
+
+ rows.add(row);
+ }
+
+ return rows;
+ }
+
+ 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();
+
+ List<List<Object>> containerRows = processContainer(o, 0, projections, objectManager);
+
+ rows.addAll(containerRows);
+ }
+
+ return rows;
+ }
+
+ /**
+ * This is a recursively called method to traverse the container calls. The logic
+ * will traverse to the last node in the node names and as it returns up the chain
+ * of names, it will build the rows.
+ *
+ * @param holder
+ * @param cachedObject
+ * @param level
+ * @param objectManager
+ * @return
+ * @throws TranslatorException
+ */
+ @SuppressWarnings("unchecked")
+ private static List<List<Object>> processContainer(Object parentObject,
+ int level, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
+
+ List<List<Object>> containerRows = new ArrayList<List<Object>>();
+ // if there another container depth, then process it first
+ // this will be recursive
+ if (level < projections.childrenDepth) {
+ String containerMethodName = projections.childrenNodes.get(level);
+
+ final String methodName = objectManager.formatMethodName(
+ ObjectMethodManager.GET, containerMethodName);
+
+ Object containerValue = objectManager.getGetValue(
+ methodName, parentObject);
+
+ if (containerValue != null) {
+
+ CONTAINER_TYPE type = getContainerType(containerValue);
+
+
+ Iterator<Object> colIt = null;
+ switch (type) {
+ case ARRAY:
+ List<Object> listRows = Arrays.asList((Object[]) containerValue);
+ colIt = listRows.iterator();
+ break;
+ case COLLECTION:
+ @SuppressWarnings("rawtypes")
+ Collection<Object> colRows = (Collection) containerValue;
+ colIt = colRows.iterator();
+ break;
+ case MAP:
+ @SuppressWarnings("rawtypes")
+ Map<?,Object> mapRows = (Map) containerValue;
+ colIt = mapRows.values().iterator();
+ break;
+ default:
+
+ }
+
+ if (colIt != null) {
+ while (colIt.hasNext()) {
+ Object colt = (Object) colIt.next();
+
+ final List<List<Object>> rows = processContainer(colt, level+1, projections, objectManager);
+ containerRows.addAll(rows);
+ }
+ } else {
+ final List<List<Object>> rows = processContainer(containerValue, level+1, projections, objectManager);
+
+ containerRows.addAll(rows);
+ }
+ }
+
+ }
+
+ if (containerRows.isEmpty()) {
+ containerRows = new ArrayList<List<Object>>(1);
+ List<Object> row = new ArrayList<Object>(projections.columnNamesToUse.length);
+ for (int i = 0; i < projections.columnNamesToUse.length; i++) {
+ // the column must have as many nodes as the level being processed
+ // in order to obtain the value at the current level
+ if (projections.nameNodes[i].size() >= (level + 1)) { // level is zero based
+ Object value = getValue(parentObject, i, level, projections, objectManager);
+
+ row.add(value);
+ } else {
+ row.add(null);
+ }
+ }
+
+ containerRows.add(row);
+ return containerRows;
+
+ }
+
+
+ List<List<Object>> expandedRows = new ArrayList<List<Object>>();
+ for (List<Object> row: containerRows) {
+
+ List<Object> newrow = new ArrayList<Object>(projections.columnNamesToUse.length);
+
+ for (int col=0; col<projections.columnNamesToUse.length; ++col) {
+ // only make method calls for columns that are being processed at the same level,
+ // columns at other node depths will be loaded when its level is processed
+
+ final Object colObject = row.get(col);
+
+ if (projections.nodeDepth[col] == level) {
+
+ if (colObject != null) throw new TranslatorException("Program Error: column object was not null for column " + projections.columnNamesToUse[col] + " at level " + level);
+
+ final Object value = getValue(parentObject, col, level, projections, objectManager);
+
+ newrow.add(value);
+
+ } else {
+ newrow.add(colObject);
+ }
+
+ }
+
+ expandedRows.add(newrow);
+ }
+ return expandedRows;
+ }
+
+ private static Object getValue(Object cachedObject, int columnIdx, int methodIdx, ObjectProjections projections, ObjectMethodManager objectManager) throws TranslatorException {
+
+
+ // only the last parsed name can be where the boolean call can be made
+ // example: x.y.z z will be where "is" is called
+ // or x x could be where "is" is called
+ Class<?> clzType = projections.columns[columnIdx].getJavaType();
+
+
+ Object value = null;
+
+ if (clzType != null && clzType == Boolean.class) {
+ final String methodName = objectManager.formatMethodName(
+ ObjectMethodManager.IS, projections.nameNodes[columnIdx].get(methodIdx) );
+
+ value = objectManager.getIsValue(
+ methodName, cachedObject);
+ } else {
+ final String methodName = objectManager.formatMethodName(
+ ObjectMethodManager.GET, projections.nameNodes[columnIdx].get(methodIdx) );
+
+ value = objectManager.getGetValue(
+ methodName, cachedObject);
+
+ }
+
+ return value;
+ }
+
+
+ private static CONTAINER_TYPE getContainerType(Object o) {
+ if (o.getClass().isArray()) {
+ return ObjectTranslator.CONTAINER_TYPE.ARRAY;
+ }
+
+ if (o instanceof Collection) {
+ return ObjectTranslator.CONTAINER_TYPE.COLLECTION;
+ }
+
+ if (o instanceof Map) {
+ return ObjectTranslator.CONTAINER_TYPE.MAP;
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheExecutionFactory.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.example;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TranslatorProperty;
+import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectMethodManager;
+import org.teiid.translator.object.ObjectSourceProxy;
+import org.teiid.translator.object.util.ObjectMethodUtil;
+
+@Translator(name="mapCacheExample", description="The Example Map Cache Factory")
+public class MapCacheExecutionFactory extends ObjectExecutionFactory {
+ private static final String LOADCACHE_METHOD_NAME = "loadCache";
+ private String cacheLoaderClassName = null;
+
+ private Map<Object, Object> cache = null;
+
+ @Override
+ public void start() throws TranslatorException {
+ if (cacheLoaderClassName == null) {
+ throw new TranslatorException("CacheLoaderClassName has not been set");
+ }
+
+ super.start();
+
+ Class<?> clzz = ObjectMethodManager.loadClass(cacheLoaderClassName,
+ this.getClass().getClassLoader());
+ Method m = null;
+ try {
+ // because the method is static, pass in null for the object api
+ Class<?>[] parms = null;
+ m = clzz.getMethod(LOADCACHE_METHOD_NAME, parms);
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ throw new TranslatorException("Method " + LOADCACHE_METHOD_NAME
+ + " was not defined on class " + cacheLoaderClassName);
+ }
+
+ try {
+ cache = (Map) ObjectMethodUtil.executeMethod(m, null, Collections.EMPTY_LIST);
+ } catch (Throwable e) {
+ throw new TranslatorException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>
+ * Returns the name of the class used to load the map cache.
+ * </P
+ * @return String name of class to use to load the map cache
+ */
+ @TranslatorProperty(display="CacheLoaderClassName", advanced=true)
+ public String getCacheLoaderClassName() {
+ return this.cacheLoaderClassName;
+ }
+
+ /**
+ * <p>
+ * Set the name of the class used to load the cache map. The only requirement of the class
+ * is it must define a <b>static method</b> called <code>{@literal #LOADCACHE_METHOD_NAME}</code>
+ * and return <code>Map</code> of the cache.
+ * </p>
+ * @param String name of class to use to load the map cache
+ */
+ public void setCacheLoaderClassName(String cacheLoaderClassName) {
+ this.cacheLoaderClassName = cacheLoaderClassName;
+ }
+
+ protected Map<Object, Object> getCache() {
+ return this.cache;
+ }
+
+ @Override
+ protected ObjectSourceProxy createProxy(Object connection)
+ throws TranslatorException {
+
+ return new MapCacheProxy(connection, this);
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheObjectVisitor.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheObjectVisitor.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheObjectVisitor.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,331 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.object.example;
+
+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.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.In;
+import org.teiid.language.Like;
+import org.teiid.language.Literal;
+import org.teiid.language.ScalarSubquery;
+import org.teiid.language.SearchedCase;
+import org.teiid.language.visitor.HierarchyVisitor;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectPlugin;
+
+/**
+ * This is an example of extending ObjectVisitor, providing query access to a local Map object cache
+ */
+public class MapCacheObjectVisitor extends HierarchyVisitor {
+
+ protected TranslatorException exception;
+ public String tableName;
+ public String columnName;
+ public Object value;
+ public Class<?> classType;
+ public List<Object> parms;
+ public Operator op;
+
+ public boolean like = false;
+ public boolean compare = false;
+ public boolean in = false;
+
+ /**
+ *
+ */
+ public MapCacheObjectVisitor() {
+ super();
+ }
+
+
+ public void addCompareCriteria(String tableName,
+ String columnName, Object value, Operator op,
+ Class<?> type) throws TranslatorException {
+ this.tableName = tableName;
+ this.columnName = columnName;
+ this.op = op;
+ this.value = value;
+ this.compare = true;
+ this.classType = type;
+ }
+
+ public void addLikeCriteria(String tableName,
+ String columnName, Object value)
+ throws TranslatorException {
+ this.tableName = tableName;
+ this.columnName = columnName;
+ this.value = value;
+ this.like = true;
+ }
+
+ public void addInCriteria(String tableName, String columnName,
+ List<Object> parms, Class<?> type)
+ throws TranslatorException {
+ this.tableName = tableName;
+ this.columnName = columnName;
+ this.parms = parms;
+ this.in = true;
+ this.classType = type;
+ }
+
+ public TranslatorException getException() {
+ return this.exception;
+ }
+
+
+ public void visit(Comparison obj) {
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing Comparison criteria."); //$NON-NLS-1$
+ try {
+
+ Comparison.Operator op = ((Comparison) obj).getOperator();
+
+ Expression lhs = ((Comparison) obj).getLeftExpression();
+ Expression rhs = ((Comparison) obj).getRightExpression();
+
+ // comparison between the ojbects is not usable, because the nameInSource and its parent(s)
+ // will be how the child objects are obtained
+ if (lhs instanceof ColumnReference && rhs instanceof ColumnReference) {
+ return;
+ }
+
+
+ String lhsString = getExpressionString(lhs);
+ String rhsString = getExpressionString(rhs);
+ if(lhsString == null || rhsString == null) {
+ final String msg = ObjectPlugin.Util.getString("ObjectVisitor.missingComparisonExpression"); //$NON-NLS-1$
+ exception = new TranslatorException(msg);
+ }
+
+ if (rhs instanceof Literal || lhs instanceof Literal) {
+ if(rhs instanceof Literal) {
+ Literal literal = (Literal) rhs;
+ String tableName = getTableNameFromColumnObject(lhs);
+ addCompareCriteria(tableName, lhsString, literal.getValue(), op, literal.getType());
+
+ } else {
+ Literal literal = (Literal) lhs;
+ String tableName = getTableNameFromColumnObject(rhs);
+ addCompareCriteria(tableName, rhsString, literal.getValue(), op, literal.getType());
+
+
+ }
+ }
+ }catch (TranslatorException t) {
+ exception = t;
+ }
+ }
+
+
+ public void visit(Like obj) {
+
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing LIKE criteria."); //$NON-NLS-1$
+// isNegated = ((Like) criteria).isNegated();
+ // Convert LIKE to Equals, where any "%" symbol is replaced with "*".
+ try {
+
+ Comparison.Operator op = Operator.EQ;
+ Expression lhs = ((Like) obj).getLeftExpression();
+ Expression rhs = ((Like) obj).getRightExpression();
+
+ String tableName = getTableNameFromColumnObject(lhs);
+ if (tableName == null) {
+ tableName = getTableNameFromColumnObject(rhs);
+ }
+
+ String lhsString = getExpressionString(lhs);
+ String rhsString = getExpressionString(rhs);
+
+ addLikeCriteria(tableName, lhsString, rhsString);
+
+ }catch (TranslatorException t) {
+ exception = t;
+ }
+ }
+
+
+ public void visit(In obj) {
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
+// isNegated = ((In) criteria).isNegated();
+ try {
+
+ Expression lhs = ((In)obj).getLeftExpression();
+
+ String tableName = getTableNameFromColumnObject(lhs);
+ String colName = getExpressionString(lhs);
+
+ List<Expression> rhsList = ((In)obj).getRightExpressions();
+
+ Class type = lhs.getType();
+ List parms = new ArrayList(rhsList.size());
+ Iterator iter = rhsList.iterator();
+ while(iter.hasNext()) {
+
+ Expression expr = (Expression) iter.next();
+ type = addParmFromExpression(expr, parms);
+
+ }
+ addInCriteria(tableName, colName, parms, type);
+
+ }catch (TranslatorException t) {
+ exception = t;
+ }
+
+ }
+
+ protected String getTableNameFromColumnObject(Object e) {
+ Column col = null;
+ if(e instanceof ColumnReference) {
+ col = ((ColumnReference)e).getMetadataObject();
+ } else if (e instanceof Column) {
+ col = (Column) e;
+ }
+
+ Object p = col.getParent();
+ if (p instanceof Table) {
+ Table t = (Table)p;
+ return t.getName();
+ }
+
+ return null;
+
+ }
+
+ protected Class addParmFromExpression(Expression expr, List parms ) {
+ Class type = null;
+ if(expr instanceof Literal) {
+ Long longparm = null;
+ Literal literal = (Literal) expr;
+
+ parms.add(literal);
+
+ type = literal.getType();
+
+ } else {
+ this.exception = new TranslatorException("ObjectVisitor.Unsupported_expression" + expr); //$NON-NLS-1$
+ }
+
+ return type;
+
+ }
+
+
+ // GHH 20080326 - found that code to fall back on Name if NameInSource
+ // was null wasn't working properly, so replaced with tried and true
+ // code from another custom connector.
+ private String getExpressionString(Expression e) throws TranslatorException {
+ String expressionName = null;
+ // GHH 20080326 - changed around the IElement handling here
+ // - the rest of this method is unchanged
+ if(e instanceof ColumnReference) {
+ Column mdIDElement = ((ColumnReference)e).getMetadataObject();
+ expressionName = getNameInSourceFromColumn(mdIDElement);
+// expressionName = mdIDElement.getNameInSource();
+// if(expressionName == null || expressionName.equals("")) { //$NON-NLS-1$
+// expressionName = mdIDElement.getName();
+// }
+ } else if(e instanceof Literal) {
+// try {
+// if(((Literal)e).getType().equals(Class.forName(Timestamp.class.getName()))) {
+// LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Found an expression that uses timestamp; converting to LDAP string format."); //$NON-NLS-1$
+// Timestamp ts = (Timestamp)((Literal)e).getValue();
+// Date dt = new Date(ts.getTime());
+// //TODO: Fetch format if provided.
+// SimpleDateFormat sdf = new SimpleDateFormat(LDAPConnectorConstants.ldapTimestampFormat);
+// expressionName = sdf.format(dt);
+// LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Timestamp to stsring is: " + expressionName); //$NON-NLS-1$
+// }
+// else {
+// expressionName = ((Literal)e).getValue().toString();
+// }
+
+ expressionName = ((Literal)e).getValue().toString();
+// } catch (ClassNotFoundException cce) {
+// final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.timestampClassNotFoundError"); //$NON-NLS-1$
+// throw new TranslatorException(cce, msg);
+// }
+//
+ } else {
+ if(e instanceof AggregateFunction) {
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IAggregate, but it is not supported. Check capabilities."); //$NON-NLS-1$
+ } else if(e instanceof Function) {
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IFunction, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ } else if(e instanceof ScalarSubquery) {
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IScalarSubquery, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ } else if (e instanceof SearchedCase) {
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Received ISearchedCaseExpression, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ }
+ final String msg = ObjectPlugin.Util.getString("ObjectVisitor.unsupportedElementError" , e.toString()); //$NON-NLS-1$
+ throw new TranslatorException(msg);
+ }
+ expressionName = escapeReservedChars(expressionName);
+ return expressionName;
+ }
+
+ protected String getNameInSourceFromColumn(Column c) {
+ String name = c.getNameInSource();
+ if(name == null || name.equals("")) { //$NON-NLS-1$
+ return c.getName();
+ }
+ return name;
+ }
+
+ protected static String escapeReservedChars(final String expr) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < expr.length(); i++) {
+ char curChar = expr.charAt(i);
+ switch (curChar) {
+ case '\\':
+ sb.append("\\5c"); //$NON-NLS-1$
+ break;
+ case '*':
+ sb.append("\\2a"); //$NON-NLS-1$
+ break;
+ case '(':
+ sb.append("\\28"); //$NON-NLS-1$
+ break;
+ case ')':
+ sb.append("\\29"); //$NON-NLS-1$
+ break;
+ case '\u0000':
+ sb.append("\\00"); //$NON-NLS-1$
+ break;
+ default:
+ sb.append(curChar);
+ }
+ }
+ return sb.toString();
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/example/MapCacheProxy.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.example;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.teiid.language.Command;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectSourceProxy;
+
+public class MapCacheProxy implements ObjectSourceProxy {
+ private MapCacheObjectVisitor visitor = new MapCacheObjectVisitor();
+ private Object connection;
+ private MapCacheExecutionFactory factory;
+
+
+ public MapCacheProxy(Object connection, MapCacheExecutionFactory factory) {
+ this.connection = connection;
+ this.factory = factory;
+ }
+
+
+ private Map<Object, Object> getCache() {
+ return factory.getCache();
+ }
+
+
+ @Override
+ public List<Object> get(Command command) throws TranslatorException {
+ visitor.visitNode(command);
+
+ List<Object> results = null;
+ if (visitor.compare) {
+ results = new ArrayList<Object>(1);
+ results.add(getCache().get(visitor.value));
+ return results;
+
+ } else {
+ results = new ArrayList<Object>();
+ results.addAll(getCache().values());
+ return results;
+
+ }
+ }
+
+
+
+ @Override
+ public void close() {
+
+ }
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectMethodUtil.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectMethodUtil.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/java/org/teiid/translator/object/util/ObjectMethodUtil.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -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.object.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.translator.TranslatorException;
+
+/**
+ * ObjectMethodUtil provides utility methods
+ */
+public final class ObjectMethodUtil {
+
+ /**
+ * Call to execute the method
+ *
+ * @param m
+ * is the method to execute
+ * @param api
+ * is the object to execute the method on
+ * @param parms
+ * are the parameters to pass when the method is executed
+ * @return Object return value
+ * @throws Exception
+ */
+ public static Object executeMethod(Method m, Object api, Object[] parms)
+ throws TranslatorException {
+ try {
+ return m.invoke(api, parms);
+ } catch (InvocationTargetException x) {
+ x.printStackTrace();
+ Throwable cause = x.getCause();
+ System.err.format("invocation of %s failed: %s%n",
+ "set" + m.getName(), cause.getMessage());
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Error calling "
+ + m.getName() + ":" + cause.getMessage());
+ throw new TranslatorException(x.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new TranslatorException(e.getMessage());
+ }
+ }
+
+ /**
+ * Call to execute the method
+ *
+ * @param m
+ * is the method to execute
+ * @param api
+ * is the object to execute the method on
+ * @param parms
+ * are the parameters to pass when the method is executed
+ * @return Object return value
+ * @throws Exception
+ */
+ public static Object executeMethod(Method m, Object api, List<Object> parms)
+ throws TranslatorException {
+ try {
+ if (parms != null) {
+ return m.invoke(api, parms.toArray());
+ }
+ return m.invoke(api, (Object[]) null);
+ } catch (InvocationTargetException x) {
+ x.printStackTrace();
+ Throwable cause = x.getCause();
+ System.err.format("invocation of %s failed: %s%n",
+ "set" + m.getName(), cause.getMessage());
+ LogManager.logError(LogConstants.CTX_CONNECTOR, "Error calling "
+ + m.getName() + ":" + cause.getMessage());
+ throw new TranslatorException(x.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new TranslatorException(e.getMessage());
+ }
+ }
+
+
+
+ public static Object createObject(String objectClassName,
+ Collection<?> ctors, ClassLoader loader) throws TranslatorException {
+ try {
+
+ return ReflectionHelper.create(objectClassName, ctors, loader);
+ } catch (Exception e1) {
+ throw new TranslatorException(e1);
+ }
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties
===================================================================
--- branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/main/resources/org/teiid/translator/object/i18n.properties 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+
+ObjectDriver.urlFormat=The required url format is jdbc:object:classNames=name1[,name2,...n]
+
+
+ObjectExecutionFactory.rootClassNameUndefined=ObjectExecutionFatory is invalid, RootClassName is not defined
+
+ObjectVisitor.missingComparisonExpression=Missing either left or right expression in comparison
+ObjectVisitor.Unsupported_expressionr=Unsupported element {0}
+
+ObjectMethodManager.noMethodFound=Method {0} was not found for class {1}
+
+ObjectMethodManager.objectClassNotFound=Class {0} not found to load
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/BaseObjectTest.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/BaseObjectTest.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/BaseObjectTest.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,191 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jdbc.util.ResultSetUtil;
+
+
+public abstract class BaseObjectTest {
+
+ protected static boolean REPLACE_EXPECTED = false;
+ protected static boolean WRITE_ACTUAL_RESULTS_TO_FILE = false;
+ protected static boolean PRINT_RESULTSETS_TO_CONSOLE = false;
+
+ private static final int MAX_COL_WIDTH = 65;
+
+ public static void writeActualResultsToFile(boolean write) {
+ WRITE_ACTUAL_RESULTS_TO_FILE = write;
+ }
+
+
+ public static void compareResultSet(ResultSet... rs) throws IOException, SQLException {
+ StackTraceElement ste = new Exception().getStackTrace()[1];
+ String testName = ste.getMethodName();
+ String className = ste.getClassName();
+ className = className.substring(className.lastIndexOf('.') + 1);
+ testName = className + "/" + testName; //$NON-NLS-1$
+ compareResultSet(testName, rs);
+ }
+
+ public static void compareResultSet(String testName, ResultSet... rs)
+ throws FileNotFoundException, SQLException, IOException {
+ FileOutputStream actualOut = null;
+ BufferedReader expectedIn = null;
+ PrintStream stream = null;
+ try {
+ if (REPLACE_EXPECTED) {
+ File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
+ actualOut = new FileOutputStream(actual);
+ } else {
+ if (WRITE_ACTUAL_RESULTS_TO_FILE) {
+ File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".actual"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!actual.getParentFile().exists()) {
+ actual.getParentFile().mkdir();
+ }
+ actualOut = new FileOutputStream(actual);
+
+
+ } else {
+ File expected = new File(UnitTestUtil.getTestDataPath() + "/"+testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedIn = new BufferedReader(new FileReader(expected));
+ }
+
+
+ }
+ PrintStream defaultStream = null;
+ if (PRINT_RESULTSETS_TO_CONSOLE) {
+ defaultStream = new PrintStream(System.out) {
+ // SYS.out should be protected from being closed.
+ public void close() {}
+ };
+ }
+ stream = ResultSetUtil.getPrintStream(actualOut, expectedIn, defaultStream);
+ for (int i = 0; i < rs.length; i++) {
+ ResultSetUtil.printResultSet(rs[i], MAX_COL_WIDTH, true, stream);
+ }
+ assertEquals("Actual data did not match expected", //$NON-NLS-1$
+ Collections.EMPTY_LIST,
+ ResultSetUtil.getUnequalLines(stream));
+ } finally {
+ if (stream != null) {
+ stream.close();
+ }
+ if (actualOut != null) {
+ actualOut.close();
+ }
+ if (expectedIn != null) {
+ expectedIn.close();
+ }
+ }
+ }
+
+
+ public static void compareResultSet(String testName, List<Object>... rs)
+ throws FileNotFoundException, SQLException, IOException {
+ FileOutputStream actualOut = null;
+ BufferedReader expectedIn = null;
+ PrintStream stream = null;
+ try {
+ if (REPLACE_EXPECTED) {
+ File actual = new File(UnitTestUtil.getTestDataPath()
+ + "/" + testName + ".expected"); //$NON-NLS-1$ //$NON-NLS-2$
+ actualOut = new FileOutputStream(actual);
+ } else {
+ if (WRITE_ACTUAL_RESULTS_TO_FILE) {
+ File actual = new File(UnitTestUtil.getTestDataPath()
+ + "/" + testName + ".actual"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!actual.getParentFile().exists()) {
+ actual.getParentFile().mkdir();
+ }
+ actualOut = new FileOutputStream(actual);
+
+// ObjectOutput oo = null;
+// oo = new ObjectOutputStream(actualOut);
+
+ for (int i = 0; i < rs.length; i++) {
+ List<Object> r = rs[i];
+ actualOut.write( new String("ROW_" + i).getBytes());
+ for (Iterator it=r.iterator(); it.hasNext();) {
+ Object o = it.next();
+ actualOut.write( o.toString().getBytes());
+ actualOut.write( new String("\t").getBytes());
+ }
+ //ExternalizeUtil.writeList(oo, rs[i]);
+ }
+
+ return;
+
+
+ } else {
+ File expected = new File(UnitTestUtil.getTestDataPath()
+ + "/" + testName + ".expected"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedIn = new BufferedReader(new FileReader(expected));
+ }
+
+ }
+ PrintStream defaultStream = null;
+ if (PRINT_RESULTSETS_TO_CONSOLE) {
+ defaultStream = new PrintStream(System.out) {
+ // SYS.out should be protected from being closed.
+ public void close() {
+ }
+ };
+ }
+ stream = ResultSetUtil.getPrintStream(actualOut, expectedIn,
+ defaultStream);
+// for (int i = 0; i < rs.length; i++) {
+// ResultSetUtil.printResultSet(rs[i], MAX_COL_WIDTH, true, stream);
+// }
+ assertEquals(
+ "Actual data did not match expected", //$NON-NLS-1$
+ Collections.EMPTY_LIST,
+ ResultSetUtil.getUnequalLines(stream));
+ } finally {
+ if (stream != null) {
+ stream.close();
+ }
+ if (actualOut != null) {
+ actualOut.close();
+ }
+ if (expectedIn != null) {
+ expectedIn.close();
+ }
+ }
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecution.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.language.Select;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectExecution;
+import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectSourceProxy;
+import org.teiid.translator.object.testdata.TradesCacheSource;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+@SuppressWarnings("nls")
+public class TestObjectExecution {
+
+ private static TradesCacheSource source;
+
+ @BeforeClass
+ public static void beforeEach() throws Exception {
+ source = TradesCacheSource.loadCache();
+ }
+
+
+ @Test public void testQueryRootObject() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
+ this.runCommand(command, 3);
+
+ }
+
+ @Test public void testQueryIncludeLegs() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
+ runCommand(command, 30);
+
+ }
+
+ private void runCommand(Select command, int expected) throws Exception {
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
+
+ Mockito.stub(proxy.get(command)).toReturn(source.getAll());
+
+
+ ObjectExecutionFactory factory = new ObjectExecutionFactory() {
+
+ @Override
+ protected ObjectSourceProxy createProxy(Object connection)
+ throws TranslatorException {
+
+ return (ObjectSourceProxy) connection;
+ }
+
+ };
+
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, proxy);
+
+ exec.execute();
+
+ int cnt = 0;
+ List<?> row = exec.next();
+
+ while (row != null) {
+ ++cnt;
+ row = exec.next();
+ }
+ assertEquals("Did not get expected number of rows", expected, cnt); //$NON-NLS-1$
+
+ exec.close();
+
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectExecutionFactory.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.language.Select;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectExecution;
+import org.teiid.translator.object.ObjectExecutionFactory;
+import org.teiid.translator.object.ObjectSourceProxy;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+@SuppressWarnings("nls")
+public class TestObjectExecutionFactory {
+
+ @Test public void testFactory() throws Exception {
+
+ Select command = Mockito.mock(Select.class);
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ ObjectSourceProxy proxy = Mockito.mock(ObjectSourceProxy.class);
+
+ ObjectExecutionFactory factory = new ObjectExecutionFactory() {
+
+ @Override
+ protected ObjectSourceProxy createProxy(Object connection)
+ throws TranslatorException {
+
+ return (ObjectSourceProxy) connection;
+ }
+
+ };
+
+ factory.setColumnNameFirstLetterUpperCase(false);
+
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, proxy);
+
+ assertNotNull(exec);
+ assertNotNull(factory.getObjectMethodManager());
+ assertEquals(factory.isColumnNameFirstLetterUpperCase(), false);
+
+ }
+
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectMethodManager.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import javax.transaction.Transaction;
+
+import org.junit.Test;
+import org.teiid.translator.object.ObjectMethodManager;
+import org.teiid.translator.object.testdata.Leg;
+import org.teiid.translator.object.testdata.Trade;
+
+@SuppressWarnings("nls")
+public class TestObjectMethodManager {
+
+ @Test public void testInitializationNoClassesLoaded() throws Exception {
+
+ ObjectMethodManager omm = ObjectMethodManager.initialize(true, this.getClass().getClassLoader());
+
+ // should not fail
+ assertEquals(omm.size(), 0);
+ assertNull(omm.get("test"));
+ assertNull(omm.getClassMethods("class.not.in.here"));
+
+ // when trying to find a method,and the class isn't loaded yet, this should trigger
+ // the loading of the class
+ assertNotNull(omm.findGetterMethod(Trade.class, "getName"));
+
+ }
+
+ @Test public void testInitializationLoading1Class() throws Exception {
+
+ ObjectMethodManager omm = ObjectMethodManager.initialize(Trade.class.getName(), true, this.getClass().getClassLoader());
+
+ // should not fail
+ assertEquals(omm.size(), 1);
+ assertNotNull(omm.get(Trade.class.getName()));
+ assertNotNull(omm.getClassMethods(Trade.class.getName()));
+ assertNotNull(omm.findGetterMethod(Trade.class, "getName"));
+
+ }
+
+ @Test public void testInitializationLoadingMulitipleClasses() throws Exception {
+
+ ObjectMethodManager omm = ObjectMethodManager.initialize(Trade.class.getName() + ","
+ + Leg.class.getName()
+ + ","
+ + Transaction.class.getName()
+ , true, this.getClass().getClassLoader());
+
+ // should not fail
+ assertEquals(omm.size(), 3);
+ assertNotNull(omm.getClassMethods(Trade.class.getName()));
+ assertNotNull(omm.getClassMethods(Leg.class.getName()));
+ assertNotNull(omm.getClassMethods(Transaction.class.getName()));
+ assertNotNull(omm.findGetterMethod(Trade.class, "getName"));
+ assertNotNull(omm.findGetterMethod(Leg.class, "getName"));
+// assertNotNull(omm.findGetterMethod(Transaction.class, "getLineItem"));
+
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectProjections.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.teiid.language.Select;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+@SuppressWarnings("nls")
+public class TestObjectProjections {
+
+
+ @Test public void testQueryRootObject() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
+
+ ObjectProjections op = new ObjectProjections(command);
+
+ validateArrays(4, op);
+
+
+ }
+
+ @Test public void testQueryIncludeLegs() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
+
+ ObjectProjections op = new ObjectProjections(command);
+ validateArrays(3, op);
+ }
+
+ @Test public void testQueryGetAllTransactions() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName, " +
+ " N.LineItem " +
+ " From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction as N " +
+ " Where T.TradeId = L.TradeId and L.LegId = N.LegId"); //$NON-NLS-1$
+ ObjectProjections op = new ObjectProjections(command);
+ validateArrays(4, op);
+
+
+ }
+
+ private void validateArrays(int size, ObjectProjections op) throws Exception {
+ op.throwExceptionIfFound();
+
+ assertEquals(size, op.getColumnNamesToUse().length);
+ assertEquals(size, op.getColumns().length);
+
+ // confirm the arrays match
+ for (int i = 0; i < op.getColumns().length; i++) {
+ assertEquals(op.getColumnNamesToUse()[i], op.getColumnNameToUse(op.getColumns()[i]));
+ System.out.println("ColumnToUse: " + op.getColumnNamesToUse()[i]);
+ }
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/TestObjectTranslator.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.language.Select;
+import org.teiid.translator.object.testdata.TradesCacheSource;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+@SuppressWarnings("nls")
+public class TestObjectTranslator {
+
+ private static TradesCacheSource source;
+
+ @BeforeClass
+ public static void beforeEach() throws Exception {
+ source = TradesCacheSource.loadCache();
+ }
+
+ @Test public void testQueryGetAllTrades() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
+
+ runTest(command, 3, 4);
+ }
+
+ @Test public void testQueryGetAllLegs() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
+ runTest(command, 30, 3);
+ }
+
+ @Test public void testQueryGetAllTransactions() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName, " +
+ " N.LineItem " +
+ " From Trade_Object.Trade as T, Trade_Object.Leg as L, Trade_Object.Transaction N " +
+ " Where T.TradeId = L.TradeId and L.LegId = N.LegId"); //$NON-NLS-1$
+ runTest(command, 150, 4);
+
+
+ }
+
+
+ private void runTest(Select command, int rows, int columns) throws Exception {
+ ObjectProjections op = new ObjectProjections(command);
+
+ ObjectMethodManager omm = ObjectMethodManager.initialize(true, this.getClass().getClassLoader());
+
+
+ List<List<?>> results = ObjectTranslator.translateObjects(source.getAll(), op, omm);
+
+ assertEquals(rows, results.size());
+
+ // check the number of columns
+ List<?> row1 = results.get(0);
+ assertEquals(columns, row1.size());
+
+ }
+
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheIntegration.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.example;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.language.Select;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.object.BaseObjectTest;
+import org.teiid.translator.object.ObjectExecution;
+import org.teiid.translator.object.example.MapCacheExecutionFactory;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+@SuppressWarnings("nls")
+public class TestMapCacheIntegration extends BaseObjectTest {
+
+ private static boolean print = false;
+
+ @Test public void testQueryIncludeLegs() throws Exception {
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select T.TradeId, T.Name as TradeName, L.Name as LegName From Trade_Object.Trade as T, Trade_Object.Leg as L Where T.TradeId = L.TradeId"); //$NON-NLS-1$
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ MapCacheExecutionFactory factory = new MapCacheExecutionFactory();
+ factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+
+ exec.execute();
+
+ int cnt = 0;
+ List<Object> row = exec.next();
+
+// BaseObjectTest.compareResultSet("testQueryIncludeLegs", row);
+
+ while (row != null) {
+ ++cnt;
+ row = exec.next();
+ printRow(cnt, row);
+ }
+
+
+ assertEquals("Did not get expected number of rows", 30, cnt); //$NON-NLS-1$
+
+ exec.close();
+
+ }
+
+ @Ignore
+ @Test public void testQueryGetTrades() throws Exception {
+ WRITE_ACTUAL_RESULTS_TO_FILE = true;
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade"); //$NON-NLS-1$
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ MapCacheExecutionFactory factory = new MapCacheExecutionFactory();
+ factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+
+ exec.execute();
+
+ int cnt = 0;
+ List<Object> row = exec.next();
+
+// BaseObjectTest.compareResultSet("testQueryIncludeLegs", row);
+
+ while (row != null) {
+ ++cnt;
+ row = exec.next();
+ printRow(cnt, row);
+ }
+
+
+ assertEquals("Did not get expected number of rows", 30, cnt); //$NON-NLS-1$
+
+ exec.close();
+
+ }
+
+ @Ignore
+ @Test public void testQueryGetTransaction() throws Exception {
+ WRITE_ACTUAL_RESULTS_TO_FILE = true;
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Transaction"); //$NON-NLS-1$
+
+ ExecutionContext context = Mockito.mock(ExecutionContext.class);
+
+ MapCacheExecutionFactory factory = new MapCacheExecutionFactory();
+ factory.setCacheLoaderClassName("org.teiid.translator.object.testdata.TradesCacheSource");
+ factory.start();
+
+ ObjectExecution exec = (ObjectExecution) factory.createExecution(command, context, VDBUtility.RUNTIME_METADATA, new Object());
+
+ exec.execute();
+
+ int cnt = 0;
+ List<Object> row = exec.next();
+
+// BaseObjectTest.compareResultSet("testQueryIncludeLegs", row);
+
+ while (row != null) {
+ ++cnt;
+ row = exec.next();
+ printRow(cnt, row);
+ }
+
+
+ assertEquals("Did not get expected number of rows", 50, cnt); //$NON-NLS-1$
+
+ exec.close();
+
+ }
+
+ private void printRow(int rownum, List<?> row) {
+ if (!print) return;
+ if (row == null) {
+ System.out.println("Row " + rownum + " is null");
+ return;
+ }
+ int i = 0;
+ for(Object o:row) {
+ System.out.println("Row " + rownum + " Col " + i + " - " + o.toString());
+ ++i;
+ }
+
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/example/TestMapCacheVisitor.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.example;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.language.Comparison.Operator;
+import org.teiid.language.Select;
+import org.teiid.metadata.Column;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.object.ObjectProjections;
+import org.teiid.translator.object.testdata.Trade;
+import org.teiid.translator.object.testdata.VDBUtility;
+
+
+@SuppressWarnings("nls")
+public class TestMapCacheVisitor {
+
+ private static int CNT = 0;
+ @Before public void setup() {
+ CNT = 0;
+ }
+
+ @Test public void testIN() throws Exception {
+
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.TradeID IN (1,2,3)"); //$NON-NLS-1$
+ ObjectProjections op = new ObjectProjections(command);
+
+ MapCacheObjectVisitor visitor =new MapCacheObjectVisitor() {
+ @Override
+ public void addInCriteria(String objectName, String attributeName,
+ List<Object> parms, Class<?> type)
+ throws TranslatorException {
+ CNT+=parms.size();
+ }
+
+ };
+
+ visitor.visit(command);
+
+ validateSelectVisitorAllRootTableColumns(op);
+ assertEquals("In Criteria", 3, CNT);
+
+ }
+
+ @Test public void test1Equals() throws Exception {
+
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.TradeID = 1"); //$NON-NLS-1$
+ ObjectProjections op = new ObjectProjections(command);
+
+ MapCacheObjectVisitor visitor =new MapCacheObjectVisitor() {
+
+ @Override
+ public void addCompareCriteria(String objectName,
+ String attributeName, Object value, Operator op,
+ Class<?> type) throws TranslatorException {
+
+ if (value.toString().equals("1")) {
+ ++CNT;
+ }
+ }
+
+ };
+
+ visitor.visit(command);
+
+ validateSelectVisitorAllRootTableColumns(op);
+ assertEquals("Equals Criteria", 1, CNT);
+ }
+
+ @Test public void testLike() throws Exception {
+
+ Select command = (Select)VDBUtility.TRANSLATION_UTILITY.parseCommand("select * From Trade_Object.Trade where Trade_Object.Trade.Name like 'Test%'"); //$NON-NLS-1$
+ ObjectProjections op = new ObjectProjections(command);
+ MapCacheObjectVisitor visitor =new MapCacheObjectVisitor() {
+
+ @Override
+ public void addLikeCriteria(String objectName,
+ String attributeName, Object value)
+ throws TranslatorException {
+
+ if (value.toString().equals("Test%")) {
+ ++CNT;
+ }
+ }
+
+ };
+
+ visitor.visit(command);
+
+ validateSelectVisitorAllRootTableColumns(op);
+ assertEquals("Like Criteria", 1, CNT);
+ }
+
+ private void validateSelectVisitorAllRootTableColumns(ObjectProjections visitor) throws Exception {
+
+ Column[] columns = visitor.getColumns();
+ String[] columnNamesToUse = visitor.getColumnNamesToUse();
+
+// String[] colnames = visitor.getColumnNames();
+
+ assertNotNull("ColumnNames", columns);
+ assertEquals("Column Names", Trade.NUM_ATTRIBUTES, columns.length);
+ assertEquals("Column Names", columnNamesToUse.length, columns.length);
+
+
+ boolean hasName = false;
+ boolean hasTradeId = false;
+ for (int i=0; i<columns.length; i++) {
+ Column col = columns[i];
+ if (col.getName().equalsIgnoreCase("Name")) hasName = true;
+ else if (col.getName().equalsIgnoreCase("TradeId")) hasTradeId = true;
+ // don't validate NIS, because it can be null
+// assertNotNull("Column NIS", visitor.getColumnNameInSource(colnames[i]));
+ assertNotNull("Column Type", col.getDatatype());
+ assertNotNull("Column Java Type", col.getJavaType());
+ assertNotNull("Column Name to Use", columnNamesToUse[i]);
+ assertNotNull("Column Native Type", col.getNativeType());
+
+ assertNotNull("Column Table Name", col.getParent().getName());
+
+
+ }
+
+ assertTrue("Missing NAME column", hasName);
+ assertTrue("Missing TRADEID column", hasTradeId);
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Leg.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Leg.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Leg.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.testdata;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.List;
+
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
+import org.hibernate.search.annotations.ProvidedId;
+
+@Indexed @ProvidedId
+public class Leg implements Serializable {
+
+ // 4 attributes, transactions is not selectable
+ public static int NUM_ATTRIBUTES = 4;
+
+ private static final long serialVersionUID = 7683272638393477962L;
+
+private @Field double notational;
+private @Field long id;
+private @Field String name;
+private @Field Calendar createdDateTime;
+
+private @IndexedEmbedded List<Transaction> transactions = null;
+
+ public Leg() {
+ super();
+ }
+
+ public Leg(long legId, String name, double notional, Calendar date) {
+ this.notational = notional;
+ this.id=legId;
+ this.name=name;
+ this.createdDateTime=date;
+ }
+
+ 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;
+ }
+
+ public void setCreatedDateTime(Calendar ts) {
+ this.createdDateTime = ts;
+ }
+ public Calendar getCreatedDateTime() {
+ return this.createdDateTime;
+ }
+
+ public void setTransations(List<Transaction> transactions) {
+ this.transactions = transactions;
+ }
+
+ public List<Transaction> getTransactions() {
+ return this.transactions;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer("Leg:");
+ sb.append(" id " + getLegId());
+ sb.append(" name " + getName());
+ sb.append(" notational " + getNotational());
+ sb.append(" createdDate " + getCreatedDateTime());
+ sb.append(" numTransactions " + getTransactions());
+
+
+
+ return sb.toString();
+ }
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Trade.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Trade.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Trade.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.testdata;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
+import org.hibernate.search.annotations.ProvidedId;
+
+
+@Indexed @ProvidedId
+public class Trade implements Serializable {
+
+ // 4 attributes, legs is not selectable
+ public static int NUM_ATTRIBUTES = 4;
+
+ private static final long serialVersionUID = 8611785625511714561L;
+
+private @IndexedEmbedded Map<Object, Object> legs;
+private @Field long tradeId;
+private @Field String name;
+private @Field Date tradeDate;
+private @Field boolean settled;
+
+ public Trade() {
+ }
+
+ public Trade(long tradeId, String name, Map<Object, Object> legs, Date tradeDate) {
+ this.legs = legs;
+ this.tradeId = tradeId;
+ this.name = name;
+ this.tradeDate=tradeDate;
+ }
+
+ public long getTradeId() {
+ return tradeId;
+ }
+
+ public void setTradeId(long id) {
+ this.tradeId = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public Date getTradeDate() {
+ return this.tradeDate;
+ }
+
+ public boolean isSettled() {
+ return this.settled;
+ }
+
+ public void setTradeDate(Date date) {
+ this.tradeDate = date;
+ }
+
+ public void setLegs(Map<Object, Object> legs) {
+ this.legs = legs;
+ }
+
+ public void setSettled(boolean isSettled) {
+ this.settled = isSettled;
+ }
+
+ public Map<Object, Object> getLegs() {
+ if (legs == null) {
+ legs = new HashMap();
+ }
+ return legs;
+ }
+
+ public String toString() {
+
+ StringBuffer sb = new StringBuffer("Trade:");
+ sb.append(" id " + getTradeId());
+ sb.append(" name " + getName());
+ sb.append(" settled " + isSettled());
+ sb.append(" tradeDate " + getTradeDate());
+ sb.append(" numLegs " + getLegs().size());
+
+ return sb.toString();
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/TradesCacheSource.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.testdata;
+
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Sample cache of objects
+ *
+ * @author vhalbert
+ *
+ */
+@SuppressWarnings("rawtypes")
+public class TradesCacheSource extends HashMap <Object, Object> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -727553658250070494L;
+
+
+ public static final String TRADE_CLASS_NAME = Trade.class.getName();
+ public static final String LEG_CLASS_NAME = Leg.class.getName();
+ public static final String TRANSACTION_CLASS_NAME = Transaction.class.getName();
+
+
+ public static final int NUMLEGS = 10;
+ public static final int NUMTRADES = 3;
+ public static final int NUMTRANSACTIONS = 5;
+
+
+ public static void loadCache(Map<Object, Object> cache) {
+ for (int i = 1; i <= NUMTRADES; i++) {
+
+ Map legsMap = new HashMap();
+ double d = 0;
+ for (int j = 1; j <= NUMLEGS; j++) {
+
+ Leg leg = new Leg(j, "LegName " + j, d * j * 3.14, Calendar.getInstance());
+
+ List trans = new ArrayList(NUMTRANSACTIONS);
+ for (int x = 1; x <= NUMTRANSACTIONS; x++) {
+ Transaction t = new Transaction();
+ t.setLineItem("Leg " + j + ", transaction line item " + x);
+ trans.add(t);
+ }
+
+ leg.setTransations(trans);
+ leg.setNotational(i * 7 / 3.14);
+
+ legsMap.put(j, leg);
+ }
+
+ Trade trade = new Trade(i, "TradeName " + i, legsMap, new Date());
+
+ // even trades set settled to true
+ if ( i % 2 == 0) {
+ trade.setSettled(true);
+ }
+
+ cache.put(i, trade);
+
+ }
+ }
+
+ public static TradesCacheSource loadCache() {
+ TradesCacheSource tcs = new TradesCacheSource();
+ loadCache(tcs);
+ return tcs;
+ }
+
+ public List<Object> getAll() {
+ return new ArrayList<Object>(this.values());
+ }
+
+ public List<Object> get(int key) {
+ List<Object> objs = new ArrayList<Object>(1);
+ objs.add(this.get(key));
+ return objs;
+ }
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Transaction.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Transaction.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/Transaction.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.object.testdata;
+
+import java.io.Serializable;
+
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.ProvidedId;
+
+@Indexed @ProvidedId
+public class Transaction implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private @Field Object li = null;
+
+ @Indexed @ProvidedId
+ final class LineItem implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ @Field String description = null;
+
+
+ public String toString() {
+ return description;
+ }
+ }
+
+ public void setLineItem(Object description) {
+ LineItem item = new LineItem();
+ item.description = description.toString();
+ li = item;
+ }
+
+ public Object getLineItem() {
+ return li;
+ }
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/java/org/teiid/translator/object/testdata/VDBUtility.java 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */package org.teiid.translator.object.testdata;
+
+import java.io.File;
+
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.metadata.RuntimeMetadata;
+
+
+public class VDBUtility {
+
+ public static TranslationUtility TRANSLATION_UTILITY = null;
+
+ public static RuntimeMetadata RUNTIME_METADATA = null;
+
+ static {
+ File f = new File(UnitTestUtil.getTestDataPath() + "/ObjectProject/Trade.vdb");
+ System.out.println("TestDataPath " + f.getAbsolutePath());
+ try {
+ TRANSLATION_UTILITY = new TranslationUtility(f.toURI().toURL());
+ } catch (Throwable e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+
+ RUNTIME_METADATA = VDBUtility.TRANSLATION_UTILITY.createRuntimeMetadata();
+ }
+
+
+}
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetColumns.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetColumns.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetColumns.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,30 @@
+string string string string long string long long long long long string string long long long long string string string string long
+TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATLOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE
+<null> NULL Trade getTradeDate 2000 java.lang.Object 0 NULL 0 0 2 NULL 0 0 0 1 YES NULL NULL NULL 0
+<null> NULL Trade getName 12 java.lang.String 0 NULL 0 0 2 NULL 0 0 0 2 YES NULL NULL NULL 0
+<null> NULL Trade getTradeId 2000 java.lang.Object 0 NULL 0 0 2 NULL 0 0 0 3 YES NULL NULL NULL 0
+<null> NULL Trade getLegs 2000 java.lang.Object 0 NULL 0 0 2 NULL 0 0 0 4 YES NULL NULL NULL 0
+Row Count : 4
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+COLUMN_NAME 12 <null> java.lang.String COLUMN_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+DATA_TYPE -5 <null> java.lang.Long DATA_TYPE long <null> <null> 20 19 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+COLUMN_SIZE -5 <null> java.lang.Long COLUMN_SIZE long <null> <null> 20 19 0 false false false false 0 true false false false
+BUFFER_LENGTH -5 <null> java.lang.Long BUFFER_LENGTH long <null> <null> 20 19 0 false false false false 1 true false false false
+DECIMAL_DIGITS -5 <null> java.lang.Long DECIMAL_DIGITS long <null> <null> 20 19 0 false false false false 0 true false false false
+NUM_PREC_RADIX -5 <null> java.lang.Long NUM_PREC_RADIX long <null> <null> 20 19 0 false false false false 0 true false false false
+NULLABLE -5 <null> java.lang.Long NULLABLE long <null> <null> 20 19 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 1 true false false false
+COLUMN_DEF 12 <null> java.lang.String COLUMN_DEF string <null> <null> 4000 4000 0 false false false false 1 true false false false
+SQL_DATA_TYPE -5 <null> java.lang.Long SQL_DATA_TYPE long <null> <null> 20 19 0 false false false false 0 true false false false
+SQL_DATETIME_SUB -5 <null> java.lang.Long SQL_DATETIME_SUB long <null> <null> 20 19 0 false false false false 0 true false false false
+CHAR_OCTET_LENGTH -5 <null> java.lang.Long CHAR_OCTET_LENGTH long <null> <null> 20 19 0 false false false false 0 true false false false
+ORDINAL_POSITION -5 <null> java.lang.Long ORDINAL_POSITION long <null> <null> 20 19 0 false false false false 0 true false false false
+IS_NULLABLE 12 <null> java.lang.String IS_NULLABLE string <null> <null> 4000 4000 0 false false false false 1 true false false false
+SCOPE_CATLOG 12 <null> java.lang.String SCOPE_CATLOG string <null> <null> 4000 4000 0 false false false false 1 true false false false
+SCOPE_SCHEMA 12 <null> java.lang.String SCOPE_SCHEMA string <null> <null> 4000 4000 0 false false false false 1 true false false false
+SCOPE_TABLE 12 <null> java.lang.String SCOPE_TABLE string <null> <null> 4000 4000 0 false false false false 1 true false false false
+SOURCE_DATA_TYPE -5 <null> java.lang.Long SOURCE_DATA_TYPE long <null> <null> 20 19 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTableTypes.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTableTypes.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTableTypes.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,6 @@
+string
+TABLE_TYPE
+TABLE
+Row Count : 1
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,17 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Leg TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Transaction TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 3
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_for3ClassNames.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_for3ClassNames.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_for3ClassNames.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,17 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Leg TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Transaction TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 3
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_ofSpecificTableType.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_ofSpecificTableType.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDatabaseMetaDataTest/testGetTables_ofSpecificTableType.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,17 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Leg TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Transaction TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 3
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor1Class.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor1Class.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor1Class.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,15 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 1
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor2Classes.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor2Classes.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor2Classes.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,16 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Leg TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 2
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor3Classes.expected
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor3Classes.expected (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectDriverIntegrationTest/getTablesFor3Classes.expected 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,17 @@
+string string string string string string string string string string
+TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION
+NULL NULL Trade TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Leg TABLE NULL NULL NULL NULL NULL DERIVED
+NULL NULL Transaction TABLE NULL NULL NULL NULL NULL DERIVED
+Row Count : 3
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+TABLE_CAT 12 <null> java.lang.String TABLE_CAT string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_SCHEM 12 <null> java.lang.String TABLE_SCHEM string <null> <null> 4000 4000 0 false false false false 1 true false false false
+TABLE_NAME 12 <null> java.lang.String TABLE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TABLE_TYPE 12 <null> java.lang.String TABLE_TYPE string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REMARKS 12 <null> java.lang.String REMARKS string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_CAT 12 <null> java.lang.String TYPE_CAT string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_SCHEM 12 <null> java.lang.String TYPE_SCHEM string <null> <null> 4000 4000 0 false false false false 0 true false false false
+TYPE_NAME 12 <null> java.lang.String TYPE_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+SELF_REFERENCING_COL_NAME 12 <null> java.lang.String SELF_REFERENCING_COL_NAME string <null> <null> 4000 4000 0 false false false false 0 true false false false
+REF_GENERATION 12 <null> java.lang.String REF_GENERATION string <null> <null> 4000 4000 0 false false false false 0 true false false false
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade.vdb
===================================================================
(Binary files differ)
Property changes on: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade.vdb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_Object.xmi 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ASCII"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:diagram="http://www.metamatrix.com/metamodels/Diagram" xmlns:jdbc="http://www.metamatrix.com/metamodels/JDBC" xmlns:mmcore="http://www.metamatrix.com/metamodels/Core" xmlns:relational="http://www.metamatrix.com/metamodels/Relational">
+ <mmcore:ModelAnnotation xmi:uuid="mmuuid:abbd65a2-2896-4819-9428-fa8ba13a1b71" primaryMetamodelUri="http://www.metamatrix.com/metamodels/Relational" modelType="PHYSICAL" ProducerName="Teiid Designer" ProducerVersion="7.7.0.v20120327-0117-H1030-Beta2">
+ <modelImports xmi:uuid="mmuuid:7c40d324-5eca-472f-a7a8-c20b01f5d848" name="SimpleDatatypes-instance" modelLocation="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance" modelType="TYPE" primaryMetamodelUri="http://www.eclipse.org/xsd/2002/XSD"/>
+ <modelImports xmi:uuid="mmuuid:ec47f017-3602-4c78-b25f-64d1611529f2" name="XMLSchema" modelLocation="http://www.w3.org/2001/XMLSchema" modelType="TYPE" primaryMetamodelUri="http://www.eclipse.org/xsd/2002/XSD"/>
+ </mmcore:ModelAnnotation>
+ <diagram:DiagramContainer xmi:uuid="mmuuid:060329df-f071-436c-91d8-8de84f4a38b3">
+ <diagram xmi:uuid="mmuuid:0d512295-f6e7-418d-8409-f7e689137c68" type="packageDiagramType" target="mmuuid/abbd65a2-2896-4819-9428-fa8ba13a1b71">
+ <diagramEntity xmi:uuid="mmuuid:0556cf27-0b7f-4670-ba1d-f958c70d1619" name="Trade" modelObject="mmuuid/5b23705c-0091-412a-9e79-c61ed02bd618" xPosition="131" yPosition="57"/>
+ <diagramEntity xmi:uuid="mmuuid:ada12275-d21b-4036-bcc9-c869229899ab" name="Leg" modelObject="mmuuid/3c3beef7-0a75-4bbb-9aaa-7ea240da41f3" xPosition="495" yPosition="69"/>
+ <diagramEntity xmi:uuid="mmuuid:38199303-f03d-43ea-b506-a3d7e0be856b" modelObject="mmuuid/6c111154-eb05-4aca-ae33-d5a7d0c67e46"/>
+ </diagram>
+ </diagram:DiagramContainer>
+ <relational:BaseTable xmi:uuid="mmuuid:5b23705c-0091-412a-9e79-c61ed02bd618" name="Trade" nameInSource=""Trade"">
+ <columns xmi:uuid="mmuuid:1a601c6c-979c-4a8a-9128-ac1c9cf853a8" name="TradeDate" nameInSource="TradeDate" nativeType="java.util.Date" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
+ <type href="http://www.w3.org/2001/XMLSchema#date"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:139a5ee2-44dc-4b5f-b3d0-68a269ffd7a1" name="Name" nameInSource="Name" nativeType="java.lang.String" length="4000" nullable="NULLABLE_UNKNOWN" defaultValue="NULL">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:9ac8e953-1818-4ce6-a9d8-14d1a8539370" name="TradeId" nameInSource="TradeId" nativeType="long" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" uniqueKeys="mmuuid/ac210048-f093-4ed3-9af4-90669fc99c3c">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:6aa63e1e-d16b-4d6c-b927-ca19a96cb619" name="Legs" nameInSource="Legs" nativeType="java.util.Map" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" selectable="false" updateable="false" caseSensitive="false" searchability="UNSEARCHABLE">
+ <type href="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance#object"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:7f3823ba-96f9-43d6-9155-e2e707babccc" name="Settled" nameInSource="Settled" nativeType="boolean" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
+ <type href="http://www.w3.org/2001/XMLSchema#boolean"/>
+ </columns>
+ <primaryKey xmi:uuid="mmuuid:ac210048-f093-4ed3-9af4-90669fc99c3c" name="TradeId_PK" columns="mmuuid/9ac8e953-1818-4ce6-a9d8-14d1a8539370" foreignKeys="mmuuid/3a3196cd-3e6c-48bf-aa02-e6c99fb1fafe"/>
+ </relational:BaseTable>
+ <relational:BaseTable xmi:uuid="mmuuid:3c3beef7-0a75-4bbb-9aaa-7ea240da41f3" name="Leg" nameInSource=""Leg"">
+ <columns xmi:uuid="mmuuid:3ad9207c-b90f-4aca-bd66-8cd9b3a0e2a3" name="LegId" nameInSource="LegId" nativeType="long" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" uniqueKeys="mmuuid/ea715b26-57e0-4245-b3a4-d326dcde47aa">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:19abbb02-6270-4e16-8daa-539e4d024808" name="Name" nameInSource="Name" nativeType="java.lang.String" length="4000" nullable="NULLABLE_UNKNOWN" defaultValue="NULL">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:90f53b02-1ff3-4275-ab86-20465b5e0b77" name="Transactions" nameInSource="Transactions" nativeType="java.util.List" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" selectable="false" updateable="false" caseSensitive="false" searchability="UNSEARCHABLE">
+ <type href="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance#object"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:e542a4df-c982-42b7-9f15-ccda9006762c" name="CreatedDateTime" nameInSource="CreatedDateTime" nativeType="java.util.Calendar" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:3ef7317b-0b54-4bbe-b634-aee7910cc5ca" name="Notational" nameInSource="Notational" nativeType="double" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
+ <type href="http://www.w3.org/2001/XMLSchema#double"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:e08030b0-2255-4f9e-a61f-f3d3a419f9f9" name="TradeId" nameInSource="TradeId" nativeType="long" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" selectable="false" updateable="false" caseSensitive="false" searchability="UNSEARCHABLE" foreignKeys="mmuuid/3a3196cd-3e6c-48bf-aa02-e6c99fb1fafe">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <foreignKeys xmi:uuid="mmuuid:3a3196cd-3e6c-48bf-aa02-e6c99fb1fafe" name="LegToTrade_FK" nameInSource="Legs" primaryKeyMultiplicity="ZERO_TO_MANY" columns="mmuuid/e08030b0-2255-4f9e-a61f-f3d3a419f9f9" uniqueKey="mmuuid/ac210048-f093-4ed3-9af4-90669fc99c3c"/>
+ <primaryKey xmi:uuid="mmuuid:ea715b26-57e0-4245-b3a4-d326dcde47aa" name="LegID_PK" columns="mmuuid/3ad9207c-b90f-4aca-bd66-8cd9b3a0e2a3" foreignKeys="mmuuid/63d1f569-9637-421f-b1c1-489cbd759315"/>
+ </relational:BaseTable>
+ <mmcore:AnnotationContainer xmi:uuid="mmuuid:146acc5c-ec00-4c47-b40f-bcde7a260d72">
+ <annotations xmi:uuid="mmuuid:01b2c46c-61f1-416d-8fea-e21204a8b5d0" description="NULL" annotatedObject="mmuuid/3c3beef7-0a75-4bbb-9aaa-7ea240da41f3"/>
+ <annotations xmi:uuid="mmuuid:a6eeddb2-f866-4e9d-8fce-d81ac06fd133" description="NULL" annotatedObject="mmuuid/6c111154-eb05-4aca-ae33-d5a7d0c67e46"/>
+ <annotations xmi:uuid="mmuuid:be09e12b-a29d-491e-9819-e968dc67eb38" description="NULL" annotatedObject="mmuuid/5b23705c-0091-412a-9e79-c61ed02bd618"/>
+ </mmcore:AnnotationContainer>
+ <relational:BaseTable xmi:uuid="mmuuid:6c111154-eb05-4aca-ae33-d5a7d0c67e46" name="Transaction" nameInSource=""Transaction"">
+ <columns xmi:uuid="mmuuid:ed5c696c-a021-4a05-b5d1-61e398931773" name="LineItem" nameInSource="LineItem" nativeType="java.lang.Object" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="UNSEARCHABLE">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:4065954d-91fc-45e2-8893-8221644a7719" name="LegId" nameInSource="TradeId" nativeType="long" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" selectable="false" updateable="false" caseSensitive="false" searchability="UNSEARCHABLE" foreignKeys="mmuuid/63d1f569-9637-421f-b1c1-489cbd759315">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <foreignKeys xmi:uuid="mmuuid:63d1f569-9637-421f-b1c1-489cbd759315" name="TransToLeg_FK" nameInSource="Transactions" primaryKeyMultiplicity="ZERO_TO_MANY" columns="mmuuid/4065954d-91fc-45e2-8893-8221644a7719" uniqueKey="mmuuid/ea715b26-57e0-4245-b3a4-d326dcde47aa"/>
+ </relational:BaseTable>
+ <jdbc:JdbcSource xmi:uuid="mmuuid:700653fe-5c8f-46f2-abb5-343af1927615" name="Object JDBC" driverName="Object JDBC Driver" driverClass="org.teiid.translator.object.jdbcdriver.ObjectDriver" username="user" url="jdbc:object:classNames=org.teiid.translator.object.testdata.Trade,org.teiid.translator.object.testdata.Leg,org.teiid.translator.object.testdata.Transaction">
+ <importSettings xmi:uuid="mmuuid:2d204a81-1586-4bee-aedf-0bb09155a701" createCatalogsInModel="false" createSchemasInModel="false" includeIndexes="false" includeApproximateIndexes="false">
+ <includedTableTypes>TABLE</includedTableTypes>
+ </importSettings>
+ </jdbc:JdbcSource>
+</xmi:XMI>
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_View.xmi
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_View.xmi (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/Trade_View.xmi 2012-04-24 16:22:56 UTC (rev 4029)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ASCII"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:diagram="http://www.metamatrix.com/metamodels/Diagram" xmlns:mmcore="http://www.metamatrix.com/metamodels/Core" xmlns:relational="http://www.metamatrix.com/metamodels/Relational" xmlns:transformation="http://www.metamatrix.com/metamodels/Transformation">
+ <mmcore:ModelAnnotation xmi:uuid="mmuuid:5a3d4831-477f-42b8-bb8e-62a895f62365" primaryMetamodelUri="http://www.metamatrix.com/metamodels/Relational" modelType="VIRTUAL" ProducerName="Teiid Designer" ProducerVersion="7.7.0.v20120327-0117-H1030-Beta2">
+ <modelImports xmi:uuid="mmuuid:d3b3585d-b97d-4f9f-885f-b653f01daddc" name="Trade_Object" modelLocation="Trade_Object.xmi" uuid="mmuuid:abbd65a2-2896-4819-9428-fa8ba13a1b71" modelType="PHYSICAL" primaryMetamodelUri="http://www.metamatrix.com/metamodels/Relational"/>
+ <modelImports xmi:uuid="mmuuid:48862877-960f-45c6-90fe-d97b49508ddd" name="XMLSchema" modelLocation="http://www.w3.org/2001/XMLSchema" modelType="TYPE" primaryMetamodelUri="http://www.eclipse.org/xsd/2002/XSD"/>
+ </mmcore:ModelAnnotation>
+ <mmcore:AnnotationContainer xmi:uuid="mmuuid:376f12cd-a07c-430a-89f6-72c21a43f334"/>
+ <transformation:TransformationContainer xmi:uuid="mmuuid:82fc8a9d-fa7a-4f42-bd2c-435128e99bf2">
+ <transformationMappings xsi:type="transformation:SqlTransformationMappingRoot" xmi:uuid="mmuuid:e1683238-ae62-4ea5-9862-d89aa6a618c1" outputs="mmuuid/d1202de2-c370-42ad-851b-5cfb89fb19de" target="mmuuid/d1202de2-c370-42ad-851b-5cfb89fb19de">
+ <helper xsi:type="transformation:SqlTransformation" xmi:uuid="mmuuid:e347fd3e-3a26-4942-82cc-e219f8f90d5f">
+ <nested xsi:type="transformation:SqlTransformation" xmi:uuid="mmuuid:c1e16e72-4ca7-4c2d-9eea-8554bd7bc304" selectSql="SELECT
		Trade_Object.Trade.TradeId, Trade_Object.Trade.Name, Trade_Object.Leg.LegId, Trade_Object.Leg.Notational, Trade_Object.Leg.Name AS LegName, Trade_Object.Trade.Settled
	FROM
		Trade_Object.Trade, Trade_Object.Leg"/>
+ <aliases xmi:uuid="mmuuid:4e39271e-ea0b-4419-ab90-75aa072e4475" alias="Trade">
+ <aliasedObject href="Trade_Object.xmi#mmuuid/5b23705c-0091-412a-9e79-c61ed02bd618"/>
+ </aliases>
+ <aliases xmi:uuid="mmuuid:60a538ba-5ecd-4ccc-afd7-0a359d2a8180" alias="Leg">
+ <aliasedObject href="Trade_Object.xmi#mmuuid/3c3beef7-0a75-4bbb-9aaa-7ea240da41f3"/>
+ </aliases>
+ </helper>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:21b5cb8c-f40e-4b98-b6f1-1a53c2dfb568" outputs="mmuuid/6a07d2c3-b0ee-4b29-85ee-bfc9e874cb10">
+ <inputs href="Trade_Object.xmi#mmuuid/9ac8e953-1818-4ce6-a9d8-14d1a8539370"/>
+ </nested>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:01039342-1945-4db0-b0f2-bfbe8488dc71" outputs="mmuuid/7a44decb-8083-4a9c-acfa-8ed71d1cc308">
+ <inputs href="Trade_Object.xmi#mmuuid/139a5ee2-44dc-4b5f-b3d0-68a269ffd7a1"/>
+ </nested>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:245d2337-8396-43f0-a75e-ac6037d22baf" outputs="mmuuid/0fb2cad2-eaee-4b73-8411-994eb7eb3fd0">
+ <inputs href="Trade_Object.xmi#mmuuid/3ad9207c-b90f-4aca-bd66-8cd9b3a0e2a3"/>
+ </nested>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:7101182e-04c9-4d12-8141-ca2fdaa90ad1" outputs="mmuuid/77da2470-3fc1-4fdf-94b4-de43b30b5f25">
+ <inputs href="Trade_Object.xmi#mmuuid/3ef7317b-0b54-4bbe-b634-aee7910cc5ca"/>
+ </nested>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:bd02fb13-86c7-4af7-a439-d76739b85bb9" outputs="mmuuid/e62074a4-0366-4332-b6a4-8fbe855a96ca">
+ <inputs href="Trade_Object.xmi#mmuuid/19abbb02-6270-4e16-8daa-539e4d024808"/>
+ </nested>
+ <nested xsi:type="transformation:TransformationMapping" xmi:uuid="mmuuid:411dcb19-5da1-4ecc-9980-fe4e1b6f63fc" outputs="mmuuid/c4fe20fa-2936-4131-9df1-79f0347e19ca">
+ <inputs href="Trade_Object.xmi#mmuuid/7f3823ba-96f9-43d6-9155-e2e707babccc"/>
+ </nested>
+ <inputs href="Trade_Object.xmi#mmuuid/5b23705c-0091-412a-9e79-c61ed02bd618"/>
+ <inputs href="Trade_Object.xmi#mmuuid/3c3beef7-0a75-4bbb-9aaa-7ea240da41f3"/>
+ </transformationMappings>
+ </transformation:TransformationContainer>
+ <diagram:DiagramContainer xmi:uuid="mmuuid:e3ea76b1-8edd-4f68-8fea-346d5ceb2a0c">
+ <diagram xmi:uuid="mmuuid:cd1589b7-71af-4fba-bbac-15c75732b75a" type="packageDiagramType" target="mmuuid/5a3d4831-477f-42b8-bb8e-62a895f62365">
+ <diagramEntity xmi:uuid="mmuuid:3927d9a9-77fd-4662-8029-4127e7b0f87c" modelObject="mmuuid/d1202de2-c370-42ad-851b-5cfb89fb19de"/>
+ </diagram>
+ <diagram xmi:uuid="mmuuid:e009ec34-e8c3-419d-bb0c-c4ab6fc9511a" type="transformationDiagramType" target="mmuuid/d1202de2-c370-42ad-851b-5cfb89fb19de">
+ <diagramEntity xmi:uuid="mmuuid:aaa3adb9-255e-4b77-a560-69eb0d65de26" name="Trades_View" modelObject="mmuuid/d1202de2-c370-42ad-851b-5cfb89fb19de" xPosition="30" yPosition="50"/>
+ <diagramEntity xmi:uuid="mmuuid:a403e12c-a40a-48fc-8677-31f0b0319c60" name="T" modelObject="mmuuid/e1683238-ae62-4ea5-9862-d89aa6a618c1" xPosition="211" yPosition="50"/>
+ <diagramEntity xmi:uuid="mmuuid:8db4da4d-2983-463a-a929-44fd158c1c37" xPosition="261" yPosition="50">
+ <modelObject href="Trade_Object.xmi#mmuuid/5b23705c-0091-412a-9e79-c61ed02bd618"/>
+ </diagramEntity>
+ <diagramEntity xmi:uuid="mmuuid:74af4ac8-e4ae-4853-8d45-638b1b5813bc" xPosition="434" yPosition="50">
+ <modelObject href="Trade_Object.xmi#mmuuid/3c3beef7-0a75-4bbb-9aaa-7ea240da41f3"/>
+ </diagramEntity>
+ </diagram>
+ </diagram:DiagramContainer>
+ <relational:BaseTable xmi:uuid="mmuuid:d1202de2-c370-42ad-851b-5cfb89fb19de" name="Trades_View" supportsUpdate="false">
+ <columns xmi:uuid="mmuuid:6a07d2c3-b0ee-4b29-85ee-bfc9e874cb10" name="TradeID">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:7a44decb-8083-4a9c-acfa-8ed71d1cc308" name="Name" length="4000" caseSensitive="false">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:0fb2cad2-eaee-4b73-8411-994eb7eb3fd0" name="LegID">
+ <type href="http://www.w3.org/2001/XMLSchema#long"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:77da2470-3fc1-4fdf-94b4-de43b30b5f25" name="Notational">
+ <type href="http://www.w3.org/2001/XMLSchema#double"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:e62074a4-0366-4332-b6a4-8fbe855a96ca" name="LegName" length="4000">
+ <type href="http://www.w3.org/2001/XMLSchema#string"/>
+ </columns>
+ <columns xmi:uuid="mmuuid:c4fe20fa-2936-4131-9df1-79f0347e19ca" name="Settled" fixedLength="true" nullable="NULLABLE_UNKNOWN" defaultValue="NULL" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
+ <type href="http://www.w3.org/2001/XMLSchema#boolean"/>
+ </columns>
+ </relational:BaseTable>
+</xmi:XMI>
Added: branches/7.7.x/connectors/translator-object/src/test/resources/testQueryIncludeLegs.expected
===================================================================
(Binary files differ)
Property changes on: branches/7.7.x/connectors/translator-object/src/test/resources/testQueryIncludeLegs.expected
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
12 years, 8 months
teiid SVN: r4028 - branches/8.0.x/build/kits/jboss-as7/docs/teiid.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-04-23 14:32:04 -0400 (Mon, 23 Apr 2012)
New Revision: 4028
Modified:
branches/8.0.x/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
Log:
TEIID-2006 adding support for a set payload statement and optional encryption of requests and refactoring to simplify xaresourceimpl
Modified: branches/8.0.x/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- branches/8.0.x/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-04-23 18:13:47 UTC (rev 4027)
+++ branches/8.0.x/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-04-23 18:32:04 UTC (rev 4028)
@@ -48,6 +48,8 @@
<LI><B>Greenplum Translator</B> - for use with the Greenplum database.
<LI><B>Enhanced parse/format pushdown</B> - added more built-in support and extension points for parse/format function pushdown. Added parse/format timestamp handling for SQLServer, Sybase, Oracle, and PostgreSQL.
<LI><B>User Defined Aggregates</B> - user defined aggregate functions can be defined via extension metadata, DDL, or connector metadata.
+ <LI><B>SET PAYLOAD statement</B> - SET PAYLOAD can be used to set a name value pair on a session scoped payload that will be sent with requests.
+ <LI><B>ENCRYPT REQUESTS</B> - encryptRequests may be used as a connection/datasource property when not using SSL to indicate that request messgaes and any associated payload should be encrypted.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
12 years, 8 months