[teiid-commits] teiid SVN: r3162 - in branches/7.4.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue May 10 15:53:42 EDT 2011


Author: shawkins
Date: 2011-05-10 15:53:41 -0400 (Tue, 10 May 2011)
New Revision: 3162

Modified:
   branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
   branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionTree.java
   branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
Log:
update to accomodate designer function model integration

Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java	2011-05-10 18:14:22 UTC (rev 3161)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java	2011-05-10 19:53:41 UTC (rev 3162)
@@ -53,6 +53,7 @@
     private boolean requiresContext;
     private FunctionMethod method;
     private String schema; //TODO: remove me - we need to create a proper schema for udf and system functions
+    private Object metadataID;
     
     // This is transient as it would be useless to invoke this method in 
     // a different VM.  This function descriptor can be used to look up 
@@ -104,6 +105,7 @@
         return this.requiresContext;
     }
     
+	@Override
 	public String toString() {
 		StringBuffer str = new StringBuffer(this.method.getName());
 		str.append("("); //$NON-NLS-1$
@@ -134,7 +136,8 @@
         return this.method.getDeterminism();
     }
 
-    public Object clone() {
+    @Override
+	public Object clone() {
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
@@ -149,7 +152,15 @@
     void setReturnType(Class<?> returnType) {
         this.returnType = returnType;
     }
-    
+
+	public Object getMetadataID() {
+		return this.metadataID;
+	}
+
+	public void setMetadataID(Object metadataID) {
+		this.metadataID = metadataID;
+	}
+
 	/**
 	 * Invoke the function described in the function descriptor, using the
 	 * values provided.  Return the result of the function.

Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionTree.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionTree.java	2011-05-10 18:14:22 UTC (rev 3161)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/function/FunctionTree.java	2011-05-10 19:53:41 UTC (rev 3162)
@@ -189,7 +189,7 @@
      * @param source The function metadata source, which knows how to obtain the invocation class
      * @param method The function metadata for a particular method signature
      */
-    private void addFunction(String schema, FunctionMetadataSource source, FunctionMethod method) {
+    public FunctionDescriptor addFunction(String schema, FunctionMetadataSource source, FunctionMethod method) {
     	String categoryKey = method.getCategory();
     	if (categoryKey == null) {
     		method.setCategory(FunctionCategoryConstants.MISCELLANEOUS);
@@ -270,6 +270,7 @@
         }
         
         allFunctions.add(method);
+        return descriptor;
     }
 
 	private FunctionDescriptor createFunctionDescriptor(
@@ -285,7 +286,7 @@
         Method invocationMethod = null;
         boolean requiresContext = false;
         // Defect 20007 - Ignore the invocation method if pushdown is not required.
-        if (method.getPushdown() == PushDown.CAN_PUSHDOWN || method.getPushdown() == PushDown.CANNOT_PUSHDOWN) {
+        if (validateClass && (method.getPushdown() == PushDown.CAN_PUSHDOWN || method.getPushdown() == PushDown.CANNOT_PUSHDOWN)) {
             try {
                 Class<?> methodClass = source.getInvocationClass(method.getInvocationClass());
                 ReflectionHelper helper = new ReflectionHelper(methodClass);
@@ -297,9 +298,7 @@
                 	requiresContext = true;
                 }
             } catch (ClassNotFoundException e) {
-            	if (validateClass) {
-            		throw new TeiidRuntimeException(e, "ERR.015.001.0047", QueryPlugin.Util.getString("FunctionTree.no_class", method.getName(), method.getInvocationClass())); //$NON-NLS-1$ //$NON-NLS-2$
-            	}
+            	throw new TeiidRuntimeException(e, "ERR.015.001.0047", QueryPlugin.Util.getString("FunctionTree.no_class", method.getName(), method.getInvocationClass())); //$NON-NLS-1$ //$NON-NLS-2$
             } catch (NoSuchMethodException e) {
             	throw new TeiidRuntimeException(e, "ERR.015.001.0047", QueryPlugin.Util.getString("FunctionTree.no_method", method, method.getInvocationClass(), method.getInvocationMethod())); //$NON-NLS-1$ //$NON-NLS-2$
             } catch (Exception e) {                

Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-05-10 18:14:22 UTC (rev 3161)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-05-10 19:53:41 UTC (rev 3162)
@@ -5265,7 +5265,7 @@
         caps.setFunctionSupport("myrtrim", true); //$NON-NLS-1$
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
+        FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
         FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
         
         processPreparedStatement(sql, expected, dataManager, capFinder,
@@ -5313,7 +5313,7 @@
         caps.setFunctionSupport("concat", true); //$NON-NLS-1$
         capFinder.addCapabilities("pm4", caps); //$NON-NLS-1$
 
-        FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
+        FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
         FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
         
         processPreparedStatement(sql, expected, dataManager, capFinder,



More information about the teiid-commits mailing list