[teiid-commits] teiid SVN: r3955 - in branches/7.7.x: api/src/test/java/org/teiid and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Mar 28 11:29:47 EDT 2012


Author: shawkins
Date: 2012-03-28 11:29:46 -0400 (Wed, 28 Mar 2012)
New Revision: 3955

Added:
   branches/7.7.x/api/src/test/java/org/teiid/translator/
   branches/7.7.x/api/src/test/java/org/teiid/translator/TestBaseDelegatingExecutionFactory.java
Modified:
   branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
   branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java
   branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
Log:
TEIID-1983 updating delegation for all properties

Modified: branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java	2012-03-28 15:25:43 UTC (rev 3954)
+++ branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java	2012-03-28 15:29:46 UTC (rev 3955)
@@ -59,6 +59,9 @@
 		return this.delegate;
 	}
 	
+	/**
+	 * Sets the delegate, will be called by Teiid after {@link #start()}
+	 */
 	public void setDelegate(ExecutionFactory<F, C> delegate) {
 		this.delegate = delegate;
 	}
@@ -344,4 +347,86 @@
 	public int hashCode() {
 		return delegate.hashCode();
 	}
+	@Override
+	public boolean isCopyLobs() {
+		return delegate.isCopyLobs();
+	}
+	@Override
+	public boolean supportsArrayAgg() {
+		return delegate.supportsArrayAgg();
+	}
+	@Override
+	public boolean supportsElementaryOlapOperations() {
+		return delegate.supportsElementaryOlapOperations();
+	}
+	@Override
+	public boolean supportsFormatLiteral(String literal,
+			org.teiid.translator.ExecutionFactory.Format format) {
+		return delegate.supportsFormatLiteral(literal, format);
+	}
+	@Override
+	public boolean supportsLikeRegex() {
+		return delegate.supportsLikeRegex();
+	}
+	@Override
+	public boolean supportsOnlyFormatLiterals() {
+		return delegate.supportsOnlyFormatLiterals();
+	}
+	@Override
+	public boolean supportsOnlySingleTableGroupBy() {
+		return delegate.supportsOnlySingleTableGroupBy();
+	}
+	@Override
+	public boolean supportsSimilarTo() {
+		return delegate.supportsSimilarTo();
+	}
+	@Override
+	public boolean supportsWindowDistinctAggregates() {
+		return delegate.supportsWindowDistinctAggregates();
+	}
+	@Override
+	public boolean supportsWindowOrderByWithAggregates() {
+		return delegate.supportsWindowOrderByWithAggregates();
+	}
+	@Override
+	public int getMaxInCriteriaSize() {
+		return delegate.getMaxInCriteriaSize();
+	}
+	@Override
+	public org.teiid.translator.ExecutionFactory.SupportedJoinCriteria getSupportedJoinCriteria() {
+		return delegate.getSupportedJoinCriteria();
+	}
+	@Override
+	public boolean requiresCriteria() {
+		return delegate.requiresCriteria();
+	}
+	@Override
+	public boolean supportsFullOuterJoins() {
+		return delegate.supportsFullOuterJoins();
+	}
+	@Override
+	public boolean supportsInnerJoins() {
+		return delegate.supportsInnerJoins();
+	}
+	@Override
+	public boolean supportsOrderBy() {
+		return delegate.supportsOrderBy();
+	}
+	@Override
+	public boolean supportsOuterJoins() {
+		return delegate.supportsOuterJoins();
+	}
+	@Override
+	public boolean supportsSelectDistinct() {
+		return delegate.supportsSelectDistinct();
+	}
+	
+	@Override
+	public int getMaxDependentInPredicates() {
+		return delegate.getMaxDependentInPredicates();
+	}
+	@Override
+	public boolean supportsAdvancedOlapOperations() {
+		return delegate.supportsAdvancedOlapOperations();
+	}
 }

Modified: branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java	2012-03-28 15:25:43 UTC (rev 3954)
+++ branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java	2012-03-28 15:29:46 UTC (rev 3955)
@@ -276,7 +276,7 @@
      * @since 3.1 SP2 
      */
 	@TranslatorProperty(display="Supports Select Distinct", description="True, if this connector supports SELECT DISTINCT", advanced=true)
-    public final boolean supportsSelectDistinct() {
+    public boolean supportsSelectDistinct() {
     	return supportsSelectDistinct;
     }
 	
@@ -308,7 +308,7 @@
      * @since 6.1.0
      */
 	@TranslatorProperty(display="Supported Join Criteria", description="Returns one of any, theta, equi, or key", advanced=true)
-    public final SupportedJoinCriteria getSupportedJoinCriteria() {
+    public SupportedJoinCriteria getSupportedJoinCriteria() {
     	return supportedJoinCriteria;
     }
 	
@@ -322,7 +322,7 @@
      * @since 6.1.0
      */
 	@TranslatorProperty(display="Supports Inner Joins", description="True, if this connector supports inner joins", advanced=true)
-    public final boolean supportsInnerJoins() {
+    public boolean supportsInnerJoins() {
     	return supportsInnerJoins;
     }
 	
@@ -345,7 +345,7 @@
      * @since 3.1 SP2
      */
 	@TranslatorProperty(display="Supports Outer Joins", description="True, if this connector supports outer joins", advanced=true)
-    public final boolean supportsOuterJoins() {
+    public boolean supportsOuterJoins() {
     	return supportsOuterJoins;
     }
 	
@@ -358,7 +358,7 @@
      * @since 3.1 SP2 
      */
 	@TranslatorProperty(display="Supports Full Outer Joins", description="True, if this connector supports full outer joins", advanced=true)
-    public final boolean supportsFullOuterJoins() {
+    public boolean supportsFullOuterJoins() {
     	return supportsFullOuterJoins;
     }
 	
@@ -490,7 +490,7 @@
      * @since 3.1 SP2
      */
     @TranslatorProperty(display="Supports ORDER BY", description="True, if this connector supports ORDER BY", advanced=true)
-    public final boolean supportsOrderBy() {
+    public boolean supportsOrderBy() {
     	return supportsOrderBy;
     }
     
@@ -718,7 +718,7 @@
      * @since 5.0
      */
 	@TranslatorProperty(display="Max number of IN predicate entries", advanced=true)
-    public final int getMaxInCriteriaSize() {
+    public int getMaxInCriteriaSize() {
         return maxInSize;
     }
 	
@@ -788,7 +788,7 @@
      * @since 6.0
      */
 	@TranslatorProperty(display="Requries Criteria", description="True, if this connector requires criteria on source queries", advanced=true)
-    public final boolean requiresCriteria() {
+    public boolean requiresCriteria() {
     	return requiresCriteria;
     }
 	

Added: branches/7.7.x/api/src/test/java/org/teiid/translator/TestBaseDelegatingExecutionFactory.java
===================================================================
--- branches/7.7.x/api/src/test/java/org/teiid/translator/TestBaseDelegatingExecutionFactory.java	                        (rev 0)
+++ branches/7.7.x/api/src/test/java/org/teiid/translator/TestBaseDelegatingExecutionFactory.java	2012-03-28 15:29:46 UTC (rev 3955)
@@ -0,0 +1,40 @@
+/*
+ * 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 static org.junit.Assert.*;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+
+public class TestBaseDelegatingExecutionFactory {
+
+	@Test public void testMethodOverrides() {
+		Method[] methods = ExecutionFactory.class.getDeclaredMethods();
+		Method[] proxyMethods = BaseDelegatingExecutionFactory.class.getDeclaredMethods();
+		//excluding the setter methods the counts should be equal
+		assertEquals(methods.length - 9, proxyMethods.length);
+	}
+	
+}


Property changes on: branches/7.7.x/api/src/test/java/org/teiid/translator/TestBaseDelegatingExecutionFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml	2012-03-28 15:25:43 UTC (rev 3954)
+++ branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml	2012-03-28 15:29:46 UTC (rev 3955)
@@ -1570,7 +1570,7 @@
 		<title>Delegating Translator</title>
 		<para>In some instances you may wish to extend several differnt kinds of translators with the same functionality.  
 		Rather than create separate subclasses for each extension, you can use the delegating translator framework which provides you with a proxying mechanism to override translator behavior.
-		It implement a delegating translator, your common translator logic should be added to a subclass of BaseDelegatingExecutionFactory where you can override any of the delegation methods to perform whatever logic you want.
+		Your common translator logic can be added to a subclass of <code>BaseDelegatingExecutionFactory</code> where you can override any of the delegation methods to perform whatever logic you want.
         <example>
         	<title>Example BaseDelegatingExecutionFactory Subclass</title>
         	<programlisting language="JAVA"><![CDATA[@Translator(name="custom-delegator")
@@ -1605,7 +1605,8 @@
 </translator>]]></programlisting>
 			<para>From the previous example the translator type is custom-delegator.  Now my-translator can be used as a translator-name on a source and will proxy all calls to whatever delegate instance you assign.</para>
 		</example>
-		<note><para>Note that the delegate instance can be any translator instance, whether configured by it's own translator entry or just the name of a standard translator type.</para></note>
+		<note><para>The delegate instance can be any translator instance whether configured by it's own translator entry or just the name of a standard translator type.  Using a <code>BaseDelegatingExecutionFactory</code> by default means that standard override translator property settings on your instance will have no effect, since the underlying delegate is called instead.</para></note>
+		<para>You may also wish to use a different class hierarchy and instead make your custom translator just implement <code>DelegatingExecutionFactory</code> instead.</para>
 		</para>
 	</section>
     



More information about the teiid-commits mailing list