Author: shawkins
Date: 2012-02-19 21:38:50 -0500 (Sun, 19 Feb 2012)
New Revision: 3892
Removed:
trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMethod.java
Modified:
trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java
trunk/engine/src/test/java/org/teiid/query/optimizer/FakeFunctionMetadataSource.java
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java
Log:
TEIID-1560 consolidating FunctionMethod constructors
Modified: trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2012-02-18 03:14:47 UTC
(rev 3891)
+++ trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2012-02-20 02:38:50 UTC
(rev 3892)
@@ -117,7 +117,7 @@
}
public FunctionMethod(String name, String description, String category,
FunctionParameter[] inputParams, FunctionParameter outputParam) {
- this(name, description, category, PushDown.MUST_PUSHDOWN, null, null, inputParams,
outputParam, true, Determinism.DETERMINISTIC);
+ this(name, description, category, PushDown.MUST_PUSHDOWN, null, null,
inputParams!=null?Arrays.asList(inputParams):null, outputParam, true,
Determinism.DETERMINISTIC);
}
public FunctionMethod(String name,
@@ -126,7 +126,7 @@
PushDown pushdown,
String invocationClass,
String invocationMethod,
- FunctionParameter[] inputParams,
+ List<FunctionParameter> inputParams,
FunctionParameter outputParam,
boolean nullOnNull,
Determinism deterministic) {
@@ -137,14 +137,18 @@
setPushdown(pushdown);
setInvocationClass(invocationClass);
setInvocationMethod(invocationMethod);
- if (inputParams != null) {
- setInputParameters(Arrays.asList(inputParams));
- }
+ setInputParameters(inputParams);
setOutputParameter(outputParam);
setNullOnNull(nullOnNull);
setDeterminism(deterministic);
}
+ public FunctionMethod(String name, String description, String category,
+ String invocationClass, String invocationMethod,
+ FunctionParameter[] inputParams, FunctionParameter outputParam) {
+ this(name, description, category, PushDown.CAN_PUSHDOWN, invocationClass,
invocationMethod, inputParams!=null?Arrays.asList(inputParams):null, outputParam, true,
Determinism.DETERMINISTIC);
+ }
+
/**
* Return name of method
* @return Name
@@ -298,7 +302,9 @@
*/
public void setInputParameters(List<FunctionParameter> params) {
this.inParameters.clear();
- this.inParameters.addAll(params);
+ if (params != null) {
+ this.inParameters.addAll(params);
+ }
}
/**
Deleted: trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMethod.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMethod.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMethod.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.function.metadata;
-
-import org.teiid.metadata.FunctionParameter;
-
-
-/**
- * @see FunctionMetadataValidator
- * @see FunctionCategoryConstants
- */
-public class FunctionMethod extends org.teiid.metadata.FunctionMethod {
- private static final long serialVersionUID = -2380536393719646754L;
-
- /**
- * Construct a function method with default pushdown and null dependent attributes.
- * @param name Function name
- * @param description Function description
- * @param category Function category
- * @param invocationClass Invocation class
- * @param invocationMethod Invocation method
- * @param inputParams Input parameters
- * @param outputParam Output parameter (return parameter)
- */
- public FunctionMethod(String name, String description, String category,
- String invocationClass, String invocationMethod,
- FunctionParameter[] inputParams, FunctionParameter outputParam) {
- super(name, description, category, PushDown.CAN_PUSHDOWN, invocationClass,
invocationMethod, inputParams, outputParam, true, Determinism.DETERMINISTIC);
- }
-
- /**
- * Construct a function method with all parameters assuming null dependent and
non-deterministic.
- * @param name Function name
- * @param description Function description
- * @param category Function category
- * @param invocationClass Invocation class
- * @param invocationMethod Invocation method
- * @param inputParams Input parameters
- * @param outputParam Output parameter (return parameter)
- */
- public FunctionMethod(String name, String description, String category,
- PushDown pushdown, String invocationClass, String invocationMethod,
- FunctionParameter[] inputParams, FunctionParameter outputParam) {
- super(name, description, category, pushdown, invocationClass, invocationMethod,
inputParams, outputParam, false,Determinism.NONDETERMINISTIC);
- }
-
- public FunctionMethod(String name,
- String description,
- String category,
- PushDown pushdown,
- String invocationClass,
- String invocationMethod,
- FunctionParameter[] inputParams,
- FunctionParameter outputParam,
- boolean nullDependent,
- Determinism deterministic) {
- super(name, description, category, pushdown, invocationClass, invocationMethod,
inputParams, outputParam, !nullDependent, deterministic);
- }
-}
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -28,6 +28,7 @@
import java.util.List;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.FunctionParameter;
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.metadata.FunctionMethod.PushDown;
@@ -36,7 +37,6 @@
import org.teiid.query.function.FunctionMetadataSource;
import org.teiid.query.function.FunctionMethods;
import org.teiid.query.function.metadata.FunctionCategoryConstants;
-import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.translator.SourceSystemFunctions;
@@ -211,37 +211,37 @@
private void addArrayLength() {
functions.add(new FunctionMethod(SourceSystemFunctions.ARRAY_LENGTH,
QueryPlugin.Util.getString("SystemSource.array_length_desc"), MISCELLANEOUS,
PushDown.CAN_PUSHDOWN, FUNCTION_CLASS, SourceSystemFunctions.ARRAY_LENGTH, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("array",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.array_param1"))}, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.array_length_result")), false,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(
+ new FunctionParameter("array",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.array_param1"))), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.array_length_result")), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addArrayGet() {
functions.add(new FunctionMethod(SourceSystemFunctions.ARRAY_GET,
QueryPlugin.Util.getString("SystemSource.array_get_desc"), MISCELLANEOUS,
PushDown.CAN_PUSHDOWN, FUNCTION_CLASS, SourceSystemFunctions.ARRAY_GET, //$NON-NLS-1$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("array",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.array_param1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("index",
DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.array_get_param2"))}, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.array_get_result")), false,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("index",
DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.array_get_param2"))), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.array_get_result")), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addUnescape() {
functions.add(new FunctionMethod(SourceSystemFunctions.UNESCAPE,
QueryPlugin.Util.getString("SystemSource.unescape_desc"), STRING,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, SourceSystemFunctions.UNESCAPE, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("string",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.unescape_param1"))}, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.unescape_result")), false,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(
+ new FunctionParameter("string",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.unescape_param1"))), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.unescape_result")), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addSecurityFunctions() {
functions.add(new FunctionMethod("hasRole",
QueryPlugin.Util.getString("SystemSource.hasRole_description"), SECURITY,
PushDown.CANNOT_PUSHDOWN, SECURITY_FUNCTION_CLASS, "hasRole", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("roleType",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.hasRole_param1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("roleName",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.hasRole_param2"))}, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.BOOLEAN,
QueryPlugin.Util.getString("SystemSource.hasRole_result")), false,
Determinism.USER_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("roleName",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.hasRole_param2"))), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.BOOLEAN,
QueryPlugin.Util.getString("SystemSource.hasRole_result")), true,
Determinism.USER_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(new FunctionMethod("hasRole",
QueryPlugin.Util.getString("SystemSource.hasRole_description"), SECURITY,
PushDown.CANNOT_PUSHDOWN, SECURITY_FUNCTION_CLASS, "hasRole", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter[] {
- new FunctionParameter("roleName",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.hasRole_param2"))}, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.BOOLEAN,
QueryPlugin.Util.getString("SystemSource.hasRole_result")), false,
Determinism.USER_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(
+ new FunctionParameter("roleName",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.hasRole_param2"))), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.BOOLEAN,
QueryPlugin.Util.getString("SystemSource.hasRole_result")), true,
Determinism.USER_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addFormatNumberFunctions() {
@@ -458,18 +458,16 @@
private void addTimestampAddFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_desc"), DATETIME,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg3"))}, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(SourceSystemFunctions.TIMESTAMPADD,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_desc"), DATETIME, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_arg3"))}, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Timestampadd_d_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_desc"), DATETIME,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg3"))}, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(SourceSystemFunctions.TIMESTAMPADD,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_desc"), DATETIME, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_arg3"))}, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Timestampadd_t_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD,
QueryPlugin.Util.getString("SystemSource.Timestampadd_ts_desc"), DATETIME,
FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$
@@ -523,9 +521,9 @@
private void addClobFunction(String name, String description, String methodName,
String returnType) {
functions.add(
new FunctionMethod(name, description, STRING, PushDown.MUST_PUSHDOWN,
FUNCTION_CLASS, methodName,
- new FunctionParameter[] {
- new FunctionParameter("clob",
DataTypeManager.DefaultDataTypes.CLOB,
QueryPlugin.Util.getString("SystemSource.Clobfunc_arg1")) }, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result", returnType, description),
false, Determinism.DETERMINISTIC ) ); //$NON-NLS-1$
+ Arrays.asList(
+ new FunctionParameter("clob",
DataTypeManager.DefaultDataTypes.CLOB,
QueryPlugin.Util.getString("SystemSource.Clobfunc_arg1")) ), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result", returnType, description), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$
}
private void addConcatFunction() {
@@ -543,10 +541,10 @@
new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concatop_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
FunctionMethod concat2 = new FunctionMethod("concat2",
QueryPlugin.Util.getString("SystemSource.Concat_desc"), STRING,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$ //$NON-NLS-2$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("string1",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concat_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("string2",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concat_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concat_result_desc")), true,
Determinism.DETERMINISTIC ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("string2",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concat_arg2")) ), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Concat_result_desc")), false,
Determinism.DETERMINISTIC ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(concat2);
}
@@ -620,9 +618,8 @@
private void addSpaceFunction() {
functions.add(
- new FunctionMethod(FunctionLibrary.SPACE,
QueryPlugin.Util.getString("SystemSource.Space_desc"), STRING,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Space_arg1"))}, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(FunctionLibrary.SPACE,
QueryPlugin.Util.getString("SystemSource.Space_desc"), STRING, null, null, new
FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.Space_arg1"))}, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Space_result")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
}
@@ -792,18 +789,16 @@
private void addDecodeFunction(String functionName, String resultType) {
functions.add(
- new FunctionMethod(functionName,
QueryPlugin.Util.getString("SystemSource.Decode1_desc"), MISCELLANEOUS,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("input",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode1_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("decodeString",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode1_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(functionName,
QueryPlugin.Util.getString("SystemSource.Decode1_desc"), MISCELLANEOUS, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("input", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode1_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("decodeString",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode1_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", resultType,
QueryPlugin.Util.getString("SystemSource.Decode1_result") ) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(functionName,
QueryPlugin.Util.getString("SystemSource.Decode2_desc"), MISCELLANEOUS,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("input",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("decodeString",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("delimiter",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg3")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(functionName,
QueryPlugin.Util.getString("SystemSource.Decode2_desc"), MISCELLANEOUS, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("input", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("decodeString",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("delimiter",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Decode2_arg3")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", resultType,
QueryPlugin.Util.getString("SystemSource.Decode2_result") ) ) );
//$NON-NLS-1$ //$NON-NLS-2$
}
@@ -812,54 +807,54 @@
for (String keyValueType : DataTypeManager.getAllDataTypeNames()) {
functions.add(
new FunctionMethod("lookup",
QueryPlugin.Util.getString("SystemSource.Lookup_desc"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "lookup", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("codetable",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Lookup_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("returnelement",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Lookup_arg2")), //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("keyelement",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Lookup_arg3")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("keyvalue", keyValueType,
QueryPlugin.Util.getString("SystemSource.Lookup_arg4")), //$NON-NLS-1$
//$NON-NLS-2$
- },
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.Lookup_result")), true,
Determinism.VDB_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("keyvalue", keyValueType,
QueryPlugin.Util.getString("SystemSource.Lookup_arg4")) //$NON-NLS-1$
//$NON-NLS-2$
+ ),
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.OBJECT,
QueryPlugin.Util.getString("SystemSource.Lookup_result")), false,
Determinism.VDB_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
}
private void addUserFunction() {
functions.add(
new FunctionMethod("user",
QueryPlugin.Util.getString("SystemSource.User_desc"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "user", null, //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.User_result")), false,
Determinism.USER_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.User_result")), true,
Determinism.USER_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addCurrentDatabaseFunction() {
functions.add(
new FunctionMethod("current_database",
QueryPlugin.Util.getString("SystemSource.current_database_desc"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "current_database", null,
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("current_database_result")), false,
Determinism.VDB_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("current_database_result")), true,
Determinism.VDB_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addEnvFunction() {
functions.add(
new FunctionMethod("env",
QueryPlugin.Util.getString("SystemSource.Env_desc"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "env", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("variablename",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Env_varname")) //$NON-NLS-1$
//$NON-NLS-2$
- },
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Env_result")), false,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ ),
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Env_result")), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addSessionIdFunction() {
functions.add(
new FunctionMethod(FunctionLibrary.SESSION_ID,
QueryPlugin.Util.getString("SystemSource.session_id_desc"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "session_id", null, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.session_id_result")), false,
Determinism.SESSION_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.session_id_result")), true,
Determinism.SESSION_DETERMINISTIC) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addCommandPayloadFunctions() {
functions.add(
new FunctionMethod("commandpayload",
QueryPlugin.Util.getString("SystemSource.CommandPayload_desc0"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "commandPayload", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter[] {},
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.CommandPayload_result")), false,
Determinism.COMMAND_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ null,
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.CommandPayload_result")), true,
Determinism.COMMAND_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
new FunctionMethod("commandpayload",
QueryPlugin.Util.getString("SystemSource.CommandPayload_desc1"), MISCELLANEOUS,
PushDown.CANNOT_PUSHDOWN, FUNCTION_CLASS, "commandPayload", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("property",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.CommandPayload_property"))
//$NON-NLS-1$ //$NON-NLS-2$
- },
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.CommandPayload_result")), false,
Determinism.COMMAND_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ ),
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.CommandPayload_result")), true,
Determinism.COMMAND_DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addIfNullFunctions() {
@@ -899,16 +894,14 @@
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formattimestamp_arg2")) },
//$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(FunctionLibrary.FORMATDATE,
QueryPlugin.Util.getString("SystemSource.Formatdate_desc"),CONVERSION,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("date", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Formatdate_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formatdate_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(FunctionLibrary.FORMATDATE,
QueryPlugin.Util.getString("SystemSource.Formatdate_desc"),CONVERSION, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("date", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Formatdate_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formatdate_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(FunctionLibrary.FORMATTIME,
QueryPlugin.Util.getString("SystemSource.Formattime_desc"),CONVERSION,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("time", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Formattime_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formattime_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(FunctionLibrary.FORMATTIME,
QueryPlugin.Util.getString("SystemSource.Formattime_desc"),CONVERSION, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("time", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Formattime_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formattime_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Formattime_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
}
@@ -920,16 +913,14 @@
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsetimestamp_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIMESTAMP,
QueryPlugin.Util.getString("SystemSource.Parsetimestamp_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(FunctionLibrary.PARSETIME,
QueryPlugin.Util.getString("SystemSource.Parsetime_desc"),CONVERSION,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("time", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsetime_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsetime_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(FunctionLibrary.PARSETIME,
QueryPlugin.Util.getString("SystemSource.Parsetime_desc"),CONVERSION, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("time", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsetime_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsetime_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIME,
QueryPlugin.Util.getString("SystemSource.Parsetime_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(FunctionLibrary.PARSEDATE,
QueryPlugin.Util.getString("SystemSource.Parsedate_desc"),CONVERSION,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
- new FunctionParameter("date", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsedate_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsedate_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
+ createSyntheticMethod(FunctionLibrary.PARSEDATE,
QueryPlugin.Util.getString("SystemSource.Parsedate_desc"),CONVERSION, null,
null, new FunctionParameter[] { //$NON-NLS-1$
+ new FunctionParameter("date", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsedate_arg1")), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING,
QueryPlugin.Util.getString("SystemSource.Parsedate_arg2")) }, //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DATE,
QueryPlugin.Util.getString("SystemSource.Parsedate_result_desc")) ) );
//$NON-NLS-1$ //$NON-NLS-2$
}
@@ -1038,10 +1029,10 @@
private void addXmlConcat() {
functions.add(new FunctionMethod(SourceSystemFunctions.XMLCONCAT,
QueryPlugin.Util.getString("SystemSource.xmlconcat_description"), XML,
PushDown.CAN_PUSHDOWN, XML_FUNCTION_CLASS, "xmlConcat", //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("param1",
DataTypeManager.DefaultDataTypes.XML,
QueryPlugin.Util.getString("SystemSource.xmlconcat_param1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("param2",
DataTypeManager.DefaultDataTypes.XML,
QueryPlugin.Util.getString("SystemSource.xmlconcat_param2"), true)},
//$NON-NLS-1$ //$NON-NLS-2$
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.XML,
QueryPlugin.Util.getString("SystemSource.xmlconcat_result")), true,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("param2",
DataTypeManager.DefaultDataTypes.XML,
QueryPlugin.Util.getString("SystemSource.xmlconcat_param2"), true)),
//$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.XML,
QueryPlugin.Util.getString("SystemSource.xmlconcat_result")), false,
Determinism.DETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addTimeZoneFunctions() {
@@ -1062,29 +1053,29 @@
private void addUnixTimeFunctions() {
functions.add(new FunctionMethod(FunctionLibrary.FROM_UNIXTIME,
QueryPlugin.Util.getString("SystemSource.from_unixtime_description"), DATETIME,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("unix_timestamp",
DataTypeManager.DefaultDataTypes.INTEGER,
QueryPlugin.Util.getString("SystemSource.from_unixtime_param1")) //$NON-NLS-1$
//$NON-NLS-2$
- },
- new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.TIMESTAMP,
QueryPlugin.Util.getString("SystemSource.from_unixtime_result")), false,
Determinism.DETERMINISTIC )); //$NON-NLS-1$ //$NON-NLS-2$
+ ),
+ new FunctionParameter("result",
DataTypeManager.DefaultDataTypes.TIMESTAMP,
QueryPlugin.Util.getString("SystemSource.from_unixtime_result")), true,
Determinism.DETERMINISTIC )); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addTypedNullIfFunction(String type) {
functions.add(
new FunctionMethod(FunctionLibrary.NULLIF,
QueryPlugin.Util.getString("SystemSource.nullif_description"), MISCELLANEOUS,
PushDown.SYNTHETIC, null, null, //$NON-NLS-1$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("op1", type,
QueryPlugin.Util.getString("SystemSource.nullif_param1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("op2", type,
QueryPlugin.Util.getString("SystemSource.nullif_param1")) }, //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("result", type,
QueryPlugin.Util.getString("SystemSource.nullif_result")), true,
Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("op2", type,
QueryPlugin.Util.getString("SystemSource.nullif_param1")) ), //$NON-NLS-1$
//$NON-NLS-2$
+ new FunctionParameter("result", type,
QueryPlugin.Util.getString("SystemSource.nullif_result")), false,
Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addTypedCoalesceFunction(String type) {
functions.add(
new FunctionMethod(FunctionLibrary.COALESCE,
QueryPlugin.Util.getString("SystemSource.coalesce_description"), MISCELLANEOUS,
PushDown.CAN_PUSHDOWN, FUNCTION_CLASS, "coalesce", //$NON-NLS-1$ //$NON-NLS-2$
- new FunctionParameter[] {
+ Arrays.asList(
new FunctionParameter("op1", type,
QueryPlugin.Util.getString("SystemSource.coalesce_param1")), //$NON-NLS-1$
//$NON-NLS-2$
new FunctionParameter("op2", type,
QueryPlugin.Util.getString("SystemSource.coalesce_param1")), //$NON-NLS-1$
//$NON-NLS-2$
- new FunctionParameter("op3", type,
QueryPlugin.Util.getString("SystemSource.coalesce_param1"), true) },
//$NON-NLS-1$ //$NON-NLS-2$
- new FunctionParameter("result", type,
QueryPlugin.Util.getString("SystemSource.coalesce_result")), true,
Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("op3", type,
QueryPlugin.Util.getString("SystemSource.coalesce_param1"), true) ),
//$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", type,
QueryPlugin.Util.getString("SystemSource.coalesce_result")), false,
Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -1104,4 +1095,10 @@
public Class<?> getInvocationClass(String className, ClassLoader classloader)
throws ClassNotFoundException {
return Class.forName(className, true, classloader);
}
+
+ public static FunctionMethod createSyntheticMethod(String name, String description,
String category,
+ String invocationClass, String invocationMethod, FunctionParameter[]
inputParams,
+ FunctionParameter outputParam) {
+ return new FunctionMethod(name, description, category, PushDown.SYNTHETIC,
invocationClass, invocationMethod, inputParams!=null?Arrays.asList(inputParams):null,
outputParam, false,Determinism.NONDETERMINISTIC);
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java 2012-02-18
03:14:47 UTC (rev 3891)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -24,6 +24,7 @@
import static org.junit.Assert.*;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -77,7 +78,7 @@
@Test public void testLoadErrors() {
FunctionMethod method = new FunctionMethod(
"dummy", null, null, PushDown.CAN_PUSHDOWN,
"nonexistentClass", "noMethod", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- new FunctionParameter[0],
+ new ArrayList<FunctionParameter>(0),
new FunctionParameter("output",
DataTypeManager.DefaultDataTypes.STRING), false, Determinism.DETERMINISTIC);
//$NON-NLS-1$
//allowed, since we're not validating the class
@@ -140,7 +141,7 @@
@Test public void testNullCategory() {
FunctionMethod method = new FunctionMethod(
"dummy", null, null, PushDown.MUST_PUSHDOWN,
"nonexistentClass", "noMethod", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- new FunctionParameter[0],
+ new ArrayList<FunctionParameter>(0),
new FunctionParameter("output",
DataTypeManager.DefaultDataTypes.STRING), //$NON-NLS-1$
false, Determinism.DETERMINISTIC);
@@ -154,9 +155,9 @@
@Test public void testVarbinary() throws Exception {
FunctionMethod method = new FunctionMethod(
"dummy", null, null, PushDown.CANNOT_PUSHDOWN,
TestFunctionTree.class.getName(), "toString", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- new FunctionParameter[] {new FunctionParameter("in",
DataTypeManager.DefaultDataTypes.VARBINARY)}, //$NON-NLS-1$
+ Arrays.asList(new FunctionParameter("in",
DataTypeManager.DefaultDataTypes.VARBINARY)), //$NON-NLS-1$
new FunctionParameter("output",
DataTypeManager.DefaultDataTypes.STRING), //$NON-NLS-1$
- false, Determinism.DETERMINISTIC);
+ true, Determinism.DETERMINISTIC);
FunctionTree sys = RealMetadataFactory.SFM.getSystemFunctions();
FunctionLibrary fl = new FunctionLibrary(sys, new FunctionTree("foo", new
UDFSource(Arrays.asList(method)), true));
FunctionDescriptor fd = fl.findFunction("dummy", new Class<?>[]
{DataTypeManager.DefaultDataClasses.VARBINARY});
Modified:
trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -22,19 +22,15 @@
package org.teiid.query.function.metadata;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.FunctionParameter;
-public class TestFunctionMethod extends TestCase {
+public class TestFunctionMethod {
- public TestFunctionMethod(String name) {
- super(name);
- }
-
- public void testEquivalence1() {
+ @Test public void testEquivalence1() {
FunctionParameter p1 = new FunctionParameter("in", "string");
//$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter pout = new FunctionParameter("out",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -45,7 +41,7 @@
UnitTestUtil.helpTestEquivalence(0, m1, m1);
}
- public void testEquivalence11() {
+ @Test public void testEquivalence11() {
FunctionParameter pout = new FunctionParameter("out",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
FunctionMethod m1 = new FunctionMethod("length", "",
FunctionCategoryConstants.STRING, //$NON-NLS-1$ //$NON-NLS-2$
@@ -55,7 +51,7 @@
UnitTestUtil.helpTestEquivalence(0, m1, m1);
}
- public void testEquivalence2() {
+ @Test public void testEquivalence2() {
FunctionParameter p1 = new FunctionParameter("in", "string");
//$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter pout = new FunctionParameter("out",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -73,7 +69,7 @@
UnitTestUtil.helpTestEquivalence(1, m1, m2);
}
- public void testEquivalence3() {
+ @Test public void testEquivalence3() {
FunctionParameter p1 = new FunctionParameter("in", "string");
//$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter pout = new FunctionParameter("out",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
Modified:
trunk/engine/src/test/java/org/teiid/query/optimizer/FakeFunctionMetadataSource.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/query/optimizer/FakeFunctionMetadataSource.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/engine/src/test/java/org/teiid/query/optimizer/FakeFunctionMetadataSource.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -27,20 +27,21 @@
import java.util.List;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.metadata.FunctionMethod.PushDown;
import org.teiid.query.function.FunctionMetadataSource;
-import org.teiid.query.function.metadata.FunctionMethod;
-
+@SuppressWarnings("nls")
public class FakeFunctionMetadataSource implements FunctionMetadataSource {
public Collection<org.teiid.metadata.FunctionMethod> getFunctionMethods() {
List<org.teiid.metadata.FunctionMethod> methods = new
ArrayList<org.teiid.metadata.FunctionMethod>();
methods.add(new FunctionMethod("xyz", "", "misc",
PushDown.MUST_PUSHDOWN, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FakeFunctionMetadataSource.class.getName(),
"xyz", //$NON-NLS-1$
- new FunctionParameter[0],
- new FunctionParameter("out",
"integer"))); //$NON-NLS-1$ //$NON-NLS-2$
+ null,
+ new FunctionParameter("out",
"integer"), true, Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter p1 = new FunctionParameter("astring",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter result = new FunctionParameter("trimstring",
"string"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -60,7 +61,7 @@
return methods;
}
- public Class getInvocationClass(String className, ClassLoader cl) throws
ClassNotFoundException {
+ public Class<?> getInvocationClass(String className, ClassLoader cl) throws
ClassNotFoundException {
return Class.forName(className, true, cl);
}
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
===================================================================
---
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -533,7 +533,7 @@
}
if (valid && outputParam != null) {
model.addFunction(new FunctionMethod(procedureRecord.getName(),
procedureRecord.getAnnotation(), model.getName(), PushDown.MUST_PUSHDOWN,
- null, null, args.toArray(new FunctionParameter[args.size()]), outputParam,
false, deterministic?Determinism.DETERMINISTIC:Determinism.NONDETERMINISTIC));
+ null, null, args, outputParam, false,
deterministic?Determinism.DETERMINISTIC:Determinism.NONDETERMINISTIC));
continue;
}
}
Modified:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -160,7 +160,7 @@
};
}
});
- FunctionMethod function = new FunctionMethod("foo", null,
FunctionCategoryConstants.MISCELLANEOUS, PushDown.CANNOT_PUSHDOWN,
TestLocalConnections.class.getName(), "blocking", new FunctionParameter[0], new
FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER), true,
FunctionMethod.Determinism.NONDETERMINISTIC);
+ FunctionMethod function = new FunctionMethod("foo", null,
FunctionCategoryConstants.MISCELLANEOUS, PushDown.CANNOT_PUSHDOWN,
TestLocalConnections.class.getName(), "blocking", null, new
FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER), false,
FunctionMethod.Determinism.NONDETERMINISTIC);
HashMap<String, Collection<FunctionMethod>> udfs = new
HashMap<String, Collection<FunctionMethod>>();
udfs.put("test", Arrays.asList(function));
server.deployVDB("PartsSupplier", UnitTestUtil.getTestDataPath() +
"/PartsSupplier.vdb", udfs);
Modified:
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -68,7 +68,7 @@
@Before public void setUp() throws Exception {
server = new FakeServer();
HashMap<String, Collection<FunctionMethod>> udfs = new
HashMap<String, Collection<FunctionMethod>>();
- udfs.put("funcs", Arrays.asList(new FunctionMethod("pause",
null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause",
null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER),
false, Determinism.NONDETERMINISTIC)));
+ udfs.put("funcs", Arrays.asList(new FunctionMethod("pause",
null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause",
null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER),
true, Determinism.NONDETERMINISTIC)));
server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() +
"/matviews.vdb", udfs);
conn = server.createConnection("jdbc:teiid:matviews");
}
Modified:
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java 2012-02-18
03:14:47 UTC (rev 3891)
+++
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestReplication.java 2012-02-20
02:38:50 UTC (rev 3892)
@@ -138,7 +138,7 @@
server.setReplicator(jor);
server.start(new DQPConfiguration(), true);
HashMap<String, Collection<FunctionMethod>> udfs = new
HashMap<String, Collection<FunctionMethod>>();
- udfs.put("funcs", Arrays.asList(new FunctionMethod("pause",
null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause",
null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER),
false, Determinism.NONDETERMINISTIC)));
+ udfs.put("funcs", Arrays.asList(new FunctionMethod("pause",
null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause",
null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER),
true, Determinism.NONDETERMINISTIC)));
server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() +
"/matviews.vdb", udfs);
return server;
}