[teiid-commits] teiid SVN: r2819 - in trunk: build/assembly/jboss-container and 2 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Wed Jan 5 14:25:12 EST 2011
Author: shawkins
Date: 2011-01-05 14:25:12 -0500 (Wed, 05 Jan 2011)
New Revision: 2819
Added:
trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
Removed:
trunk/connectors/translator-delegate/
Modified:
trunk/build/assembly/jboss-container/dist.xml
trunk/connectors/pom.xml
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1330 refining the delegating translator to just base classes.
Copied: trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java (from rev 2800, trunk/connectors/translator-delegate/src/main/java/org/teiid/translator/delegate/BaseDelegatingExecutionFactory.java)
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2011-01-05 19:25:12 UTC (rev 2819)
@@ -0,0 +1,392 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import org.teiid.language.Call;
+import org.teiid.language.Command;
+import org.teiid.language.LanguageFactory;
+import org.teiid.language.QueryExpression;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+
+/**
+ * Delegate translator. User can define a {@link ExecutionFactory} of their own and have this translator
+ * delegate all the calls to that class. Please note that your 'vdb.xml' file will contain
+ * an xml fragment like the following to configure a delegating translator.
+ * <pre>
+ * {@code
+ <translator type="delegate" name="my-translator" description="custom translator">
+ <property value="delegateName" name="name of the delegate instance"/>
+ </translator>
+ }
+ * </pre>
+ *
+ */
+public class BaseDelegatingExecutionFactory<F, C> extends ExecutionFactory<F, C> implements DelegatingExecutionFactory<F, C> {
+
+ private String delegateName;
+ private ExecutionFactory<F, C> delegate;
+
+ /**
+ * For testing only
+ */
+ ExecutionFactory<F, C> getDelegate() {
+ return this.delegate;
+ }
+
+ public void setDelegate(ExecutionFactory<F, C> delegate) {
+ this.delegate = delegate;
+ }
+
+ @TranslatorProperty(display="Delegate name", required = true)
+ public String getDelegateName() {
+ return this.delegateName;
+ }
+
+ public void setDelegateName(String delegateName) {
+ this.delegateName = delegateName;
+ }
+
+ @Override
+ public void start() throws TranslatorException {
+ this.delegate.start();
+ }
+
+ @Override
+ public boolean areLobsUsableAfterClose() {
+ return delegate.areLobsUsableAfterClose();
+ }
+ @Override
+ public void closeConnection(C connection, F factory) {
+ delegate.closeConnection(connection, factory);
+ }
+ @Override
+ public Execution createExecution(Command command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createExecution(command, executionContext, metadata,
+ connection);
+ }
+ @Override
+ public ProcedureExecution createProcedureExecution(Call command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createProcedureExecution(command, executionContext,
+ metadata, connection);
+ }
+ @Override
+ public ResultSetExecution createResultSetExecution(QueryExpression command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createResultSetExecution(command, executionContext,
+ metadata, connection);
+ }
+ @Override
+ public UpdateExecution createUpdateExecution(Command command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createUpdateExecution(command, executionContext,
+ metadata, connection);
+ }
+ @Override
+ public C getConnection(F factory) throws TranslatorException {
+ return delegate.getConnection(factory);
+ }
+ @Override
+ public NullOrder getDefaultNullOrder() {
+ return delegate.getDefaultNullOrder();
+ }
+ @Override
+ public LanguageFactory getLanguageFactory() {
+ return delegate.getLanguageFactory();
+ }
+ @Override
+ public int getMaxFromGroups() {
+ return delegate.getMaxFromGroups();
+ }
+ @Override
+ public int getMaxInCriteriaSize() {
+ return delegate.getMaxInCriteriaSize();
+ }
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory, C conn)
+ throws TranslatorException {
+ delegate.getMetadata(metadataFactory, conn);
+ }
+ @Override
+ public List<FunctionMethod> getPushDownFunctions() {
+ return delegate.getPushDownFunctions();
+ }
+ @Override
+ public List<String> getSupportedFunctions() {
+ return delegate.getSupportedFunctions();
+ }
+ @Override
+ public TypeFacility getTypeFacility() {
+ return delegate.getTypeFacility();
+ }
+ @Override
+ public boolean isImmutable() {
+ return delegate.isImmutable();
+ }
+ @Override
+ public boolean isSourceRequired() {
+ return delegate.isSourceRequired();
+ }
+ @Override
+ public void setImmutable(boolean arg0) {
+ delegate.setImmutable(arg0);
+ }
+ @Override
+ public void setRequiresCriteria(boolean requiresCriteria) {
+ delegate.setRequiresCriteria(requiresCriteria);
+ }
+ @Override
+ public void setSourceRequired(boolean value) {
+ delegate.setSourceRequired(value);
+ }
+ @Override
+ public void setSupportedJoinCriteria(
+ SupportedJoinCriteria supportedJoinCriteria) {
+ delegate.setSupportedJoinCriteria(supportedJoinCriteria);
+ }
+ @Override
+ public void setSupportsFullOuterJoins(boolean supportsFullOuterJoins) {
+ delegate.setSupportsFullOuterJoins(supportsFullOuterJoins);
+ }
+ @Override
+ public void setSupportsInnerJoins(boolean supportsInnerJoins) {
+ delegate.setSupportsInnerJoins(supportsInnerJoins);
+ }
+ @Override
+ public void setSupportsOrderBy(boolean supportsOrderBy) {
+ delegate.setSupportsOrderBy(supportsOrderBy);
+ }
+ @Override
+ public void setSupportsOuterJoins(boolean supportsOuterJoins) {
+ delegate.setSupportsOuterJoins(supportsOuterJoins);
+ }
+ @Override
+ public void setSupportsSelectDistinct(boolean supportsSelectDistinct) {
+ delegate.setSupportsSelectDistinct(supportsSelectDistinct);
+ }
+ @Override
+ public boolean supportsAggregatesAvg() {
+ return delegate.supportsAggregatesAvg();
+ }
+ @Override
+ public boolean supportsAggregatesCount() {
+ return delegate.supportsAggregatesCount();
+ }
+ @Override
+ public boolean supportsAggregatesCountStar() {
+ return delegate.supportsAggregatesCountStar();
+ }
+ @Override
+ public boolean supportsAggregatesDistinct() {
+ return delegate.supportsAggregatesDistinct();
+ }
+ @Override
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return delegate.supportsAggregatesEnhancedNumeric();
+ }
+ @Override
+ public boolean supportsAggregatesMax() {
+ return delegate.supportsAggregatesMax();
+ }
+ @Override
+ public boolean supportsAggregatesMin() {
+ return delegate.supportsAggregatesMin();
+ }
+ @Override
+ public boolean supportsAggregatesSum() {
+ return delegate.supportsAggregatesSum();
+ }
+ @Override
+ public boolean supportsAliasedTable() {
+ return delegate.supportsAliasedTable();
+ }
+ @Override
+ public boolean supportsBatchedUpdates() {
+ return delegate.supportsBatchedUpdates();
+ }
+ @Override
+ public boolean supportsBetweenCriteria() {
+ return delegate.supportsBetweenCriteria();
+ }
+ @Override
+ public boolean supportsBulkUpdate() {
+ return delegate.supportsBulkUpdate();
+ }
+ @Override
+ public boolean supportsCaseExpressions() {
+ return delegate.supportsCaseExpressions();
+ }
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return delegate.supportsCommonTableExpressions();
+ }
+ @Override
+ public boolean supportsCompareCriteriaEquals() {
+ return delegate.supportsCompareCriteriaEquals();
+ }
+ @Override
+ public boolean supportsCompareCriteriaOrdered() {
+ return delegate.supportsCompareCriteriaOrdered();
+ }
+ @Override
+ public boolean supportsCorrelatedSubqueries() {
+ return delegate.supportsCorrelatedSubqueries();
+ }
+ @Override
+ public boolean supportsExcept() {
+ return delegate.supportsExcept();
+ }
+ @Override
+ public boolean supportsExistsCriteria() {
+ return delegate.supportsExistsCriteria();
+ }
+ @Override
+ public boolean supportsFunctionsInGroupBy() {
+ return delegate.supportsFunctionsInGroupBy();
+ }
+ @Override
+ public boolean supportsGroupBy() {
+ return delegate.supportsGroupBy();
+ }
+ @Override
+ public boolean supportsHaving() {
+ return delegate.supportsHaving();
+ }
+ @Override
+ public boolean supportsInCriteria() {
+ return delegate.supportsInCriteria();
+ }
+ @Override
+ public boolean supportsInCriteriaSubquery() {
+ return delegate.supportsInCriteriaSubquery();
+ }
+ @Override
+ public boolean supportsInlineViews() {
+ return delegate.supportsInlineViews();
+ }
+ @Override
+ public boolean supportsInsertWithIterator() {
+ return delegate.supportsInsertWithIterator();
+ }
+ @Override
+ public boolean supportsInsertWithQueryExpression() {
+ return delegate.supportsInsertWithQueryExpression();
+ }
+ @Override
+ public boolean supportsIntersect() {
+ return delegate.supportsIntersect();
+ }
+ @Override
+ public boolean supportsIsNullCriteria() {
+ return delegate.supportsIsNullCriteria();
+ }
+ @Override
+ public boolean supportsLikeCriteria() {
+ return delegate.supportsLikeCriteria();
+ }
+ @Override
+ public boolean supportsLikeCriteriaEscapeCharacter() {
+ return delegate.supportsLikeCriteriaEscapeCharacter();
+ }
+ @Override
+ public boolean supportsNotCriteria() {
+ return delegate.supportsNotCriteria();
+ }
+ @Override
+ public boolean supportsOrCriteria() {
+ return delegate.supportsOrCriteria();
+ }
+ @Override
+ public boolean supportsOrderByNullOrdering() {
+ return delegate.supportsOrderByNullOrdering();
+ }
+ @Override
+ public boolean supportsOrderByUnrelated() {
+ return delegate.supportsOrderByUnrelated();
+ }
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaAll() {
+ return delegate.supportsQuantifiedCompareCriteriaAll();
+ }
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaSome() {
+ return delegate.supportsQuantifiedCompareCriteriaSome();
+ }
+ @Override
+ public boolean supportsRowLimit() {
+ return delegate.supportsRowLimit();
+ }
+ @Override
+ public boolean supportsRowOffset() {
+ return delegate.supportsRowOffset();
+ }
+ @Override
+ public boolean supportsScalarSubqueries() {
+ return delegate.supportsScalarSubqueries();
+ }
+ @Override
+ public boolean supportsSearchedCaseExpressions() {
+ return delegate.supportsSearchedCaseExpressions();
+ }
+ @Override
+ public boolean supportsSelectExpression() {
+ return delegate.supportsSelectExpression();
+ }
+ @Override
+ public boolean supportsSelfJoins() {
+ return delegate.supportsSelfJoins();
+ }
+ @Override
+ public boolean supportsSetQueryOrderBy() {
+ return delegate.supportsSetQueryOrderBy();
+ }
+ @Override
+ public boolean supportsUnions() {
+ return delegate.supportsUnions();
+ }
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+ @Override
+ public boolean useAnsiJoin() {
+ return delegate.useAnsiJoin();
+ }
+ @Override
+ public boolean equals(Object obj) {
+ return delegate.equals(obj);
+ }
+ @Override
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+}
Modified: trunk/build/assembly/jboss-container/dist.xml
===================================================================
--- trunk/build/assembly/jboss-container/dist.xml 2011-01-05 16:34:06 UTC (rev 2818)
+++ trunk/build/assembly/jboss-container/dist.xml 2011-01-05 19:25:12 UTC (rev 2819)
@@ -184,7 +184,6 @@
<include>org.jboss.teiid.connectors:translator-ldap</include>
<include>org.jboss.teiid.connectors:translator-salesforce</include>
<include>org.jboss.teiid.connectors:translator-ws</include>
- <include>org.jboss.teiid.connectors:translator-delegate</include>
</includes>
<binaries>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2011-01-05 16:34:06 UTC (rev 2818)
+++ trunk/connectors/pom.xml 2011-01-05 19:25:12 UTC (rev 2819)
@@ -76,20 +76,15 @@
<modules>
<module>translator-jdbc</module>
<module>translator-ldap</module>
-
<module>translator-loopback</module>
<module>translator-file</module>
<module>translator-salesforce</module>
- <module>translator-delegate</module>
-
<module>connector-file</module>
<module>connector-salesforce</module>
<module>connector-ldap</module>
<module>salesforce-api</module>
<module>connector-ws</module>
-
<module>sandbox</module>
-
<module>translator-ws</module>
</modules>
</project>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-01-05 16:34:06 UTC (rev 2818)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-01-05 19:25:12 UTC (rev 2819)
@@ -1010,12 +1010,11 @@
</section>
</section>
<section>
- <title>Delegate Translator</title>
+ <title>Delegating Translators</title>
<para>
- The Delegate translator, known by the type name <emphasis>delegate</emphasis>,
- provides way to delegate all the translator calls to yet another translator whoose name is supplied. This does not provide
- any functionality on its own, other than delegation. This translator can be used a base class to intercept the calls to the user
- supplied translator and modify them as they see fit.
+ You may create a delegating translator by extending the <code>org.teiid.translator.BaseDelegatingExecutionFactory</code>.
+ Once your classes are then packaged as a custom translator, you will be able to wire another translator instance into your delegating translator at runtime in order to intercept
+ all of the calls to the delegate. This base class does not provide any functionality on its own, other than delegation.
</para>
<table>
@@ -1034,7 +1033,7 @@
<tbody>
<row>
<entry>delegateName</entry>
- <entry>Translator instance to delegate to</entry>
+ <entry>Translator instance name to delegate to</entry>
<entry></entry>
</row>
</tbody>
More information about the teiid-commits
mailing list