teiid SVN: r557 - trunk/common-internal.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-13 15:20:48 -0400 (Fri, 13 Mar 2009)
New Revision: 557
Modified:
trunk/common-internal/pom.xml
Log:
TEIID-413: stringtemplate is required for this plugin and we do not need to expose it dependent plugins; so making it optional.
Modified: trunk/common-internal/pom.xml
===================================================================
--- trunk/common-internal/pom.xml 2009-03-13 18:54:39 UTC (rev 556)
+++ trunk/common-internal/pom.xml 2009-03-13 19:20:48 UTC (rev 557)
@@ -53,15 +53,11 @@
<groupId>net.sf.saxon</groupId>
<artifactId>saxon-dom</artifactId>
</dependency>
-
+
<dependency>
<groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- </dependency>
-
- <dependency>
- <groupId>antlr</groupId>
<artifactId>stringtemplate</artifactId>
+ <scope>optional</scope>
</dependency>
<dependency>
16 years, 6 months
teiid SVN: r556 - in trunk: client/src/test/java/com/metamatrix/dqp and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-13 14:54:39 -0400 (Fri, 13 Mar 2009)
New Revision: 556
Added:
trunk/client/src/test/java/com/metamatrix/dqp/message/
trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
Removed:
trunk/engine/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTrackingService.java
trunk/engine/pom.xml
trunk/engine/src/main/java/com/metamatrix/dqp/internal/cache/ResultSetCacheUtil.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/CachedRequestWorkItem.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/PreparedStatementRequest.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/CustomizableTrackingService.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/TrackingService.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestMetaDataProcessor.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestPreparedStatement.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestRequest.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/TestCustomizableTrackingService.java
Log:
TEIID-395 clean up of command logging to ensure the exact user command string is logged.
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -23,6 +23,7 @@
package com.metamatrix.dqp.message;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -40,9 +41,8 @@
public static final int DEFAULT_FETCH_SIZE = 2000;
- private String commandStr;
- private String[] batchedCommands;
- private Serializable command;
+ private String[] commands;
+ private boolean isBatchedUpdate;
private int fetchSize = DEFAULT_FETCH_SIZE;
private int cursorType;
private boolean partialResultsFlag;
@@ -83,37 +83,9 @@
public RequestMessage(String command) {
this();
-
- this.commandStr = command;
+ setCommands(command);
}
-
- /**
- * @return Command
- */
- public Serializable getCommand() {
- if (command != null) {
- return command;
- }
- if (commandStr != null) {
- return commandStr;
- }
- return batchedCommands;
- }
- /**
- * Sets the command.
- * @param command The command to set
- */
- public void setCommand(Serializable command) {
- if (command instanceof String) {
- this.commandStr = (String)command;
- } else if (command instanceof String[]) {
- this.batchedCommands = (String[])command;
- } else {
- this.command = command;
- }
- }
-
public int getFetchSize() {
return fetchSize;
}
@@ -327,8 +299,11 @@
this.useResultSetCache = useResultSetCacse;
}
- public String getCacheCommand() {
- return commandStr;
+ public String getCommandString() {
+ if (commands.length == 1) {
+ return commands[0];
+ }
+ return Arrays.deepToString(commands);
}
public void setDoubleQuotedVariableAllowed(boolean allowed) {
@@ -382,22 +357,14 @@
this.rowLimit = rowLimit;
}
- public String getCommandStr() {
- return commandStr;
+ public String[] getCommands() {
+ return commands;
}
- public void setCommandStr(String commandStr) {
- this.commandStr = commandStr;
+ public void setCommands(String... batchedCommands) {
+ this.commands = batchedCommands;
}
- public String[] getBatchedCommands() {
- return batchedCommands;
- }
-
- public void setBatchedCommands(String[] batchedCommands) {
- this.batchedCommands = batchedCommands;
- }
-
public boolean isPreparedBatchUpdate() {
return isPreparedBatchUpdate;
}
@@ -422,4 +389,12 @@
this.executionId = executionId;
}
+ public void setBatchedUpdate(boolean isBatchedUpdate) {
+ this.isBatchedUpdate = isBatchedUpdate;
+ }
+
+ public boolean isBatchedUpdate() {
+ return isBatchedUpdate;
+ }
+
}
Copied: trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java (from rev 544, trunk/engine/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java)
===================================================================
--- trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java (rev 0)
+++ trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -0,0 +1,110 @@
+/*
+ * 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 com.metamatrix.dqp.message;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.jdbc.api.ExecutionProperties;
+
+public class TestRequestMessage extends TestCase {
+
+ /**
+ * Constructor for TestRequestMessage.
+ * @param name
+ */
+ public TestRequestMessage(String name) {
+ super(name);
+ }
+
+ public static RequestMessage example() {
+ RequestMessage message = new RequestMessage();
+ message.setCallableStatement(true);
+ message.setFetchSize(100);
+ List params = new ArrayList();
+ params.add(new Integer(100));
+ params.add(new Integer(200));
+ params.add(new Integer(300));
+ params.add(new Integer(400));
+ message.setParameterValues(params);
+
+ message.setPartialResults(true);
+ message.setPreparedStatement(false);
+ message.setSubmittedTimestamp(new Date(11111111L));
+ message.setProcessingTimestamp(new Date(12345678L));
+ message.setStyleSheet("myStyleSheet"); //$NON-NLS-1$
+ message.setExecutionPayload("myExecutionPayload"); //$NON-NLS-1$
+ try {
+ message.setTxnAutoWrapMode(ExecutionProperties.AUTO_WRAP_ON);
+ } catch (MetaMatrixProcessingException e) {
+ throw new RuntimeException(e);
+ }
+
+ message.setValidationMode(true);
+ message.setXMLFormat("xMLFormat"); //$NON-NLS-1$
+ message.setShowPlan(true);
+ message.setRowLimit(1313);
+ return message;
+ }
+
+ public void testSerialize() throws Exception {
+ RequestMessage copy = UnitTestUtil.helpSerialize(example());
+
+ assertTrue(copy.isCallableStatement());
+ assertEquals(100, copy.getFetchSize());
+ assertNotNull(copy.getParameterValues());
+ assertEquals(4, copy.getParameterValues().size());
+ assertEquals(new Integer(100), copy.getParameterValues().get(0));
+ assertEquals(new Integer(200), copy.getParameterValues().get(1));
+ assertEquals(new Integer(300), copy.getParameterValues().get(2));
+ assertEquals(new Integer(400), copy.getParameterValues().get(3));
+
+ assertFalse(copy.isPreparedStatement());
+ assertEquals(new Date(11111111L), copy.getSubmittedTimestamp());
+ assertEquals(new Date(12345678L), copy.getProcessingTimestamp());
+ assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$
+ assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$
+ assertEquals(ExecutionProperties.AUTO_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
+ assertTrue(copy.getValidationMode());
+ assertEquals("xMLFormat", copy.getXMLFormat()); //$NON-NLS-1$
+ assertTrue(copy.getShowPlan());
+ assertEquals(1313, copy.getRowLimit());
+
+ }
+
+ public void testInvalidTxnAutoWrap() {
+ RequestMessage rm = new RequestMessage();
+ try {
+ rm.setTxnAutoWrapMode("foo"); //$NON-NLS-1$
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (MetaMatrixProcessingException e) {
+ assertEquals("'FOO' is an invalid transaction autowrap mode.", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+}
Property changes on: trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -975,11 +975,8 @@
this.currentRequestID = this.driverConnection.nextRequestID();
RequestMessage reqMsg = new RequestMessage();
// Create a request message
- if (isBatchedCommand) {
- reqMsg.setBatchedCommands(commands);
- } else {
- reqMsg.setCommandStr(commands[0]);
- }
+ reqMsg.setCommands(commands);
+ reqMsg.setBatchedUpdate(isBatchedCommand);
reqMsg.markSubmissionStart();
reqMsg.setExecutionPayload(this.payload);
reqMsg.setDoubleQuotedVariableAllowed(Boolean.valueOf(
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTrackingService.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTrackingService.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTrackingService.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -30,7 +30,6 @@
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.dqp.service.TrackingService;
-import com.metamatrix.query.sql.lang.Command;
public class EmbeddedTrackingService extends EmbeddedBaseDQPService implements TrackingService {
//public static HashMap traceData = new HashMap();
@@ -48,7 +47,7 @@
short cmdPoint,
String sessionUid,
String principal,
- Command sql,
+ String sql,
int rowCount,
ExecutionContext context) {
@@ -81,7 +80,7 @@
String principal,
String vdbName,
String vdbVersion,
- Command sql,
+ String sql,
int rowCount) {
}
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/pom.xml 2009-03-13 18:54:39 UTC (rev 556)
@@ -56,6 +56,12 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ </dependency>
<dependency>
<groupId>javax.transaction</groupId>
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/cache/ResultSetCacheUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/cache/ResultSetCacheUtil.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/cache/ResultSetCacheUtil.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -37,7 +37,7 @@
}else{
scopeID = workContext.getConnectionID();
}
- return new CacheID(scopeID, request.getCacheCommand(), request.getParameterValues());
+ return new CacheID(scopeID, request.getCommandString(), request.getParameterValues());
}
// public static boolean isQuery(String sql){
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -547,9 +547,10 @@
if(tracker == null || !tracker.willRecordSrcCmd()){
return;
}
- Command sqlCmd = null;
+ String sqlStr = null;
if(cmdStatus == TrackerLogConstants.CMD_STATUS.NEW){
- sqlCmd = qr.getCommand();
+ Command cmd = qr.getCommand();
+ sqlStr = cmd != null ? cmd.toString() : null;
}
String userName = qr.getWorkContext().getUserName();
String transactionID = null;
@@ -563,7 +564,7 @@
tracker.log(qr.getRequestID().toString(), id.getNodeID(), transactionID,
cmdStatus, modelName == null ? "null" : modelName, connectorName, //$NON-NLS-1$
cmdStatus == TrackerLogConstants.CMD_STATUS.NEW ? TrackerLogConstants.CMD_POINT.BEGIN : TrackerLogConstants.CMD_POINT.END,
- qr.getWorkContext().getConnectionID(), userName == null ? "unknown" : userName, sqlCmd, finalRowCnt, context); //$NON-NLS-1$
+ qr.getWorkContext().getConnectionID(), userName == null ? "unknown" : userName, sqlStr, finalRowCnt, context); //$NON-NLS-1$
}
/**
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/CachedRequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/CachedRequestWorkItem.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/CachedRequestWorkItem.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -52,7 +52,6 @@
protected void processNew() throws MetaMatrixComponentException, MetaMatrixProcessingException {
request.initMetadata();
request.validateEntitlement(originalCommand);
- requestMsg.setCommand(originalCommand);
this.request = null;
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DQPCore.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DQPCore.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -191,7 +191,7 @@
RequestWorkItem holder = requests.get(requestID);
if(holder != null && !holder.isCanceled()) {
- RequestInfo req = new RequestInfo(holder.requestID, holder.requestMsg.getCommand().toString(), holder.requestMsg.getSubmittedTimestamp(), holder.requestMsg.getProcessingTimestamp());
+ RequestInfo req = new RequestInfo(holder.requestID, holder.requestMsg.getCommandString(), holder.requestMsg.getSubmittedTimestamp(), holder.requestMsg.getProcessingTimestamp());
if (holder.getTransactionContext() != null && holder.getTransactionContext().isInTransaction()) {
req.setTransactionId(holder.getTransactionContext().getTxnID());
}
@@ -497,10 +497,10 @@
}
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
RequestID rID = new RequestID(workContext.getConnectionID(), msg.getExecutionId());
- Command command = null;
+ String command = null;
String txnID = null;
if(isBegin && !isCancel){
- command = (Command)msg.getCommand();
+ command = msg.getCommandString();
}
String appName = workContext.getAppName();
// Log to request log
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/PreparedStatementRequest.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/PreparedStatementRequest.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -123,7 +123,7 @@
List values = requestMsg.getParameterValues();
if(requestMsg.isPreparedBatchUpdate()){
if(values.size() > 1){
- ((PreparedBatchUpdate)requestMsg.getCommand()).setUpdatingModelCount(2);
+ ((PreparedBatchUpdate)command).setUpdatingModelCount(2);
}
for(int i=0; i<values.size(); i++){
if (params.size() != ((List)values.get(i)).size()) {
@@ -152,7 +152,7 @@
*/
protected void generatePlan() throws QueryPlannerException, QueryParserException, QueryResolverException, QueryValidatorException, MetaMatrixComponentException {
- String sqlQuery = (String)requestMsg.getCommand();
+ String sqlQuery = requestMsg.getCommands()[0];
prepPlan = prepPlanCache.getPreparedPlan(this.workContext.getConnectionID(), sqlQuery, requestMsg.isPreparedBatchUpdate());
if (prepPlan == null) {
//if prepared plan does not exist, create one
@@ -178,7 +178,7 @@
//already in cache. obtain the values from cache
analysisRecord = prepPlan.getAnalysisRecord();
- requestMsg.setCommand(command);
+ this.command = command;
createCommandContext(command);
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -145,6 +145,8 @@
protected TransactionContext transactionContext;
private int chunkSize;
+
+ protected Command command;
void initialize(RequestMessage requestMsg,
ApplicationEnvironment env,
@@ -327,7 +329,7 @@
}
}
- requestMsg.setCommand(preRewrite);
+ this.command = preRewrite;
return command;
}
@@ -371,15 +373,15 @@
}
private Command getCommand() throws QueryParserException {
- String command = requestMsg.getCommandStr();
+ String[] commands = requestMsg.getCommands();
ParseInfo parseInfo = new ParseInfo();
if (requestMsg.isDoubleQuotedVariableAllowed()) {
parseInfo.allowDoubleQuotedVariable = true;
}
- if (command != null) {
- return QueryParser.getQueryParser().parseCommand(command, parseInfo);
- }
- String[] commands = requestMsg.getBatchedCommands();
+ if (!requestMsg.isBatchedUpdate()) {
+ String commandStr = commands[0];
+ return QueryParser.getQueryParser().parseCommand(commandStr, parseInfo);
+ }
List parsedCommands = new ArrayList(commands.length);
for (int i = 0; i < commands.length; i++) {
String updateCommand = commands[i];
@@ -422,7 +424,7 @@
if(ExecutionProperties.AUTO_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){
startAutoWrapTxn = true;
- } else if ( ((Command)requestMsg.getCommand()).updatingModelCount(metadata) > 1) {
+ } else if ( command.updatingModelCount(metadata) > 1) {
if (ExecutionProperties.AUTO_WRAP_OPTIMISTIC.equals(requestMsg.getTxnAutoWrapMode())){
String msg = DQPPlugin.Util.getString("Request.txn_needed_wrong_mode", requestId); //$NON-NLS-1$
throw new MetaMatrixComponentException(msg);
@@ -596,8 +598,6 @@
generatePlan();
- Command command = (Command)requestMsg.getCommand();
-
validateEntitlement(command);
setSchemasForXMLPlan(command, metadata);
@@ -606,25 +606,25 @@
}
public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext) throws MetaMatrixProcessingException, MetaMatrixComponentException {
- boolean isRootXQuery = recursionGroup == null && commandContext.getCallStackDepth() == 0 && this.requestMsg.getCommand() instanceof XQuery;
+ boolean isRootXQuery = recursionGroup == null && commandContext.getCallStackDepth() == 0 && command instanceof XQuery;
ParseInfo parseInfo = new ParseInfo();
if (isRootXQuery && requestMsg.isDoubleQuotedVariableAllowed()) {
parseInfo.allowDoubleQuotedVariable = true;
}
- Command command = QueryParser.getQueryParser().parseCommand(query, parseInfo);
- QueryResolver.resolveCommand(command, metadata);
+ Command newCommand = QueryParser.getQueryParser().parseCommand(query, parseInfo);
+ QueryResolver.resolveCommand(newCommand, metadata);
- List references = ReferenceCollectorVisitor.getReferences(command);
+ List references = ReferenceCollectorVisitor.getReferences(newCommand);
referenceCheck(references);
- validateQuery(command, isRootXQuery);
+ validateQuery(newCommand, isRootXQuery);
- validateQueryValues(command);
+ validateQueryValues(newCommand);
if (isRootXQuery) {
- validateEntitlement(command);
+ validateEntitlement(newCommand);
}
CommandContext copy = (CommandContext) commandContext.clone();
@@ -632,10 +632,10 @@
copy.pushCall(recursionGroup);
}
- QueryRewriter.rewrite(command, null, metadata, copy);
- ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, capabilitiesFinder, analysisRecord, copy);
+ QueryRewriter.rewrite(newCommand, null, metadata, copy);
+ ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, capabilitiesFinder, analysisRecord, copy);
- TupleSourceID resultsId = bufferManager.createTupleSource(command.getProjectedSymbols(), TypeRetrievalUtil.getTypeNames(command.getProjectedSymbols()), copy.getConnectionID(), TupleSourceType.PROCESSOR);
+ TupleSourceID resultsId = bufferManager.createTupleSource(newCommand.getProjectedSymbols(), TypeRetrievalUtil.getTypeNames(newCommand.getProjectedSymbols()), copy.getConnectionID(), TupleSourceType.PROCESSOR);
copy.setTupleSourceID(resultsId);
return new QueryProcessor(plan, copy, bufferManager, processorDataManager);
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -370,7 +370,7 @@
protected void processNew() throws MetaMatrixProcessingException, MetaMatrixComponentException {
request.processRequest();
- originalCommand = (Command)requestMsg.getCommand();
+ originalCommand = request.command;
processor = request.processor;
processor.setBatchHandler(new BatchHandler() {
public void batchProduced(TupleBatch batch)
@@ -468,9 +468,8 @@
response.setWarnings(responseWarnings);
// If it is stored procedure, set parameters
- Command command = (Command)requestMsg.getCommand();
- if (command instanceof StoredProcedure) {
- StoredProcedure proc = (StoredProcedure)command;
+ if (originalCommand instanceof StoredProcedure) {
+ StoredProcedure proc = (StoredProcedure)originalCommand;
if (proc.returnParameters()) {
response.setParameters(getParameterInfo(proc));
}
@@ -691,7 +690,7 @@
dqpWorkContext.getUserName(),
dqpWorkContext.getVdbName(),
dqpWorkContext.getVdbVersion(),
- originalCommand,
+ (originalCommand != null ? originalCommand.toString() : null ),
-1);
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/CustomizableTrackingService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/CustomizableTrackingService.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/CustomizableTrackingService.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -43,7 +43,6 @@
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.spi.CommandLoggerSPI;
import com.metamatrix.dqp.spi.TrackerLogConstants;
-import com.metamatrix.query.sql.lang.Command;
/**
@@ -100,13 +99,13 @@
String principal,
String vdbName,
String vdbVersion,
- Command sql,
+ String sql,
int rowCount) {
if (this.willRecordMMCmd()) {
CustomizableTrackingMessage message = null;
if (cmdPoint == TrackerLogConstants.CMD_POINT.BEGIN) {
- message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, txnUid, sessionUid, applicationName, principal, vdbName, vdbVersion, (sql!=null)?sql.toString():null);
+ message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, txnUid, sessionUid, applicationName, principal, vdbName, vdbVersion, sql);
} else {
boolean isCancelled = false;
boolean errorOccurred = false;
@@ -134,14 +133,14 @@
short cmdPoint,
String sessionUid,
String principal,
- Command sql,
+ String sql,
int rowCount,
ExecutionContext context) {
if (this.willRecordSrcCmd()) {
CustomizableTrackingMessage message = null;
if (cmdPoint == TrackerLogConstants.CMD_POINT.BEGIN) {
- message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, (sql!=null)?sql.toString():null, context);
+ message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, sql, context);
} else {
boolean isCancelled = false;
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/TrackingService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/TrackingService.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/TrackingService.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -27,7 +27,6 @@
import org.teiid.connector.api.ExecutionContext;
import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.query.sql.lang.Command;
/**
* This service is used to log transactions and commands,
@@ -35,12 +34,14 @@
*/
public interface TrackingService extends ApplicationService {
/**
- * Log the command into database if the vaule of the property
+ * Log the command if the value of the property
* "metamatrix.transaction.log.storeMMCMD" is "true".
+ *
* @param requestId Unique command ID.
* @param txnUid Unique transaction ID.
* @param cmdPoint Point in command being logged -
- * TransactionLogConstants.POINT.BEGIN, or TransactionLogConstants.POINT.END.
+ * TransactionLogConstants.POINT.BEGIN,
+ * or TransactionLogConstants.POINT.END.
* @param sessionUid Session ID.
* @param applicationName name of the user application
* @param principal User name.
@@ -50,21 +51,22 @@
* @param rowCount Final row count.
*/
public void log(String requestId, String txnUid, short cmdPoint, short status,
- String sessionUid, String applicationName, String principal, String vdbName, String vdbVersion, Command sql, int rowCount);
+ String sessionUid, String applicationName, String principal, String vdbName, String vdbVersion, String sql, int rowCount);
/**
- * Log the command into database if the vaule of the property
+ * Log the command if the value of the property
* "metamatrix.transaction.log.storeSRCCMD" is "true".
+ *
* @param requestId Unique command ID.
* @param nodeID Subcommand ID
* @param subTxnUid Unique subtransaction ID.
- * @param status Type of request -
- * TransactionLogConstants.SRCCMD_STATUS.NEW, or TransactionLogConstants.SRCCMD_STATUS.CANCEL,
- * TransactionLogConstants.SRCCMD_STATUS.END, or TransactionLogConstants.SRCCMD_STATUS.ERROR.
+ * @param status Type of request - TransactionLogConstants.SRCCMD_STATUS.NEW,
+ * or TransactionLogConstants.SRCCMD_STATUS.CANCEL, or TransactionLogConstants.SRCCMD_STATUS.END,
+ * or TransactionLogConstants.SRCCMD_STATUS.ERROR.
* @param modelName Name of model.
* @param cbName Connector binding name.
- * @param cmdPoint Point in command being logged -
- * TransactionLogConstants.POINT.BEGIN, or TransactionLogConstants.POINT.END.
+ * @param cmdPoint Point in command being logged - TransactionLogConstants.POINT.BEGIN,
+ * or TransactionLogConstants.POINT.END.
* @param sessionUid Session ID.
* @param principal User name.
* @param sql SQL for the command.
@@ -72,7 +74,7 @@
*/
public void log(String requestId, long nodeID, String subTxnUid,
short status, String modelName, String cbName, short cmdPoint,
- String sessionUid, String principal, Command sql, int rowCount,
+ String sessionUid, String principal, String sql, int rowCount,
ExecutionContext context);
/**
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCore.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCore.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -95,8 +95,7 @@
}
public RequestMessage exampleRequestMessage(String sql) {
- RequestMessage msg = new RequestMessage();
- msg.setCommand(sql);
+ RequestMessage msg = new RequestMessage(sql);
msg.setCallableStatement(false);
msg.setCursorType(ResultSet.TYPE_SCROLL_INSENSITIVE);
msg.setFetchSize(10);
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -116,7 +116,6 @@
command = helpGetCommand(sql, metadata);
RequestMessage original = new RequestMessage();
- original.setCommand(command);
original.setExecutionId(1);
DQPWorkContext workContext = new DQPWorkContext();
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestMetaDataProcessor.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestMetaDataProcessor.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -72,8 +72,7 @@
// Initialize components
RequestID requestID = workContext.getRequestID(1);
- RequestMessage requestMsg = new RequestMessage();
- requestMsg.setCommand(sql);
+ RequestMessage requestMsg = new RequestMessage(sql);
TestDQPCoreRequestHandling.addRequest(requestMgr, requestMsg, requestID, command, null, null, AnalysisRecord.createNonRecordingRecord(), null, null); //$NON-NLS-1$
ApplicationEnvironment env = new ApplicationEnvironment();
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestPreparedStatement.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestPreparedStatement.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -183,8 +183,7 @@
QueryPlannerException {
//Create Request
- RequestMessage request = new RequestMessage();
- request.setCommand(preparedSql);
+ RequestMessage request = new RequestMessage(preparedSql);
request.setPreparedStatement(true);
request.setCallableStatement(callableStatement);
request.setParameterValues(values);
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestRequest.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestRequest.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -83,12 +83,11 @@
public void testGetSchemasForValidation() throws Exception {
FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject doc1 = metadata.getStore().findObject("xmltest.doc1", FakeMetadataObject.GROUP);
+ FakeMetadataObject doc1 = metadata.getStore().findObject("xmltest.doc1", FakeMetadataObject.GROUP); //$NON-NLS-1$
List<String> schemas = Arrays.asList("a.xsd", "b.xsd"); //$NON-NLS-1$ //$NON-NLS-2$
doc1.putProperty(FakeMetadataObject.Props.XML_SCHEMAS, schemas);
- RequestMessage message = new RequestMessage();
+ RequestMessage message = new RequestMessage("select * from xmltest.doc1"); //$NON-NLS-1$
message.setValidationMode(true);
- message.setCommandStr("select * from xmltest.doc1"); //$NON-NLS-1$
DQPWorkContext workContext = new DQPWorkContext();
workContext.setVdbName(VDB);
workContext.setVdbVersion(VDB_VERSION);
@@ -116,7 +115,6 @@
QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, true, metadata, AnalysisRecord.createNonRecordingRecord());
RequestMessage message = new RequestMessage();
- message.setCommand(command);
DQPWorkContext workContext = new DQPWorkContext();
workContext.setVdbName(VDB);
workContext.setVdbVersion(VDB_VERSION);
Deleted: trunk/engine/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -1,113 +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 com.metamatrix.dqp.message;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.dqp.internal.datamgr.language.TestQueryImpl;
-import com.metamatrix.jdbc.api.ExecutionProperties;
-
-public class TestRequestMessage extends TestCase {
-
- /**
- * Constructor for TestRequestMessage.
- * @param name
- */
- public TestRequestMessage(String name) {
- super(name);
- }
-
- public static RequestMessage example() {
- RequestMessage message = new RequestMessage();
- message.setCallableStatement(true);
- message.setCommand(TestQueryImpl.helpExample());
- message.setFetchSize(100);
- List params = new ArrayList();
- params.add(new Integer(100));
- params.add(new Integer(200));
- params.add(new Integer(300));
- params.add(new Integer(400));
- message.setParameterValues(params);
-
- message.setPartialResults(true);
- message.setPreparedStatement(false);
- message.setSubmittedTimestamp(new Date(11111111L));
- message.setProcessingTimestamp(new Date(12345678L));
- message.setStyleSheet("myStyleSheet"); //$NON-NLS-1$
- message.setExecutionPayload("myExecutionPayload"); //$NON-NLS-1$
- try {
- message.setTxnAutoWrapMode(ExecutionProperties.AUTO_WRAP_ON);
- } catch (MetaMatrixProcessingException e) {
- throw new RuntimeException(e);
- }
-
- message.setValidationMode(true);
- message.setXMLFormat("xMLFormat"); //$NON-NLS-1$
- message.setShowPlan(true);
- message.setRowLimit(1313);
- return message;
- }
-
- public void testSerialize() throws Exception {
- RequestMessage copy = UnitTestUtil.helpSerialize(example());
-
- assertTrue(copy.isCallableStatement());
- assertEquals(TestQueryImpl.helpExample(), copy.getCommand());
- assertEquals(100, copy.getFetchSize());
- assertNotNull(copy.getParameterValues());
- assertEquals(4, copy.getParameterValues().size());
- assertEquals(new Integer(100), copy.getParameterValues().get(0));
- assertEquals(new Integer(200), copy.getParameterValues().get(1));
- assertEquals(new Integer(300), copy.getParameterValues().get(2));
- assertEquals(new Integer(400), copy.getParameterValues().get(3));
-
- assertFalse(copy.isPreparedStatement());
- assertEquals(new Date(11111111L), copy.getSubmittedTimestamp());
- assertEquals(new Date(12345678L), copy.getProcessingTimestamp());
- assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$
- assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$
- assertEquals(ExecutionProperties.AUTO_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
- assertTrue(copy.getValidationMode());
- assertEquals("xMLFormat", copy.getXMLFormat()); //$NON-NLS-1$
- assertTrue(copy.getShowPlan());
- assertEquals(1313, copy.getRowLimit());
-
- }
-
- public void testInvalidTxnAutoWrap() {
- RequestMessage rm = new RequestMessage();
- try {
- rm.setTxnAutoWrapMode("foo"); //$NON-NLS-1$
- fail("exception expected"); //$NON-NLS-1$
- } catch (MetaMatrixProcessingException e) {
- assertEquals("'FOO' is an invalid transaction autowrap mode.", e.getMessage()); //$NON-NLS-1$
- }
- }
-
-}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/TestCustomizableTrackingService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/TestCustomizableTrackingService.java 2009-03-12 23:09:37 UTC (rev 555)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/TestCustomizableTrackingService.java 2009-03-13 18:54:39 UTC (rev 556)
@@ -22,21 +22,37 @@
package com.metamatrix.dqp.service;
+import java.io.Serializable;
+import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import junit.framework.TestCase;
+
import org.teiid.connector.api.ExecutionContext;
-import junit.framework.TestCase;
-
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+import com.metamatrix.common.vdb.api.ModelInfo;
+import com.metamatrix.dqp.internal.datamgr.impl.FakeTransactionService;
+import com.metamatrix.dqp.internal.process.DQPCore;
+import com.metamatrix.dqp.internal.process.DQPWorkContext;
+import com.metamatrix.dqp.message.RequestMessage;
+import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.spi.CommandLoggerSPI;
import com.metamatrix.dqp.spi.TrackerLogConstants;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.TestQuery;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
/**
* Tests the DQP Tracking service implementation which uses a CommandLogger service
@@ -100,6 +116,33 @@
assertEquals(expectedResults, ((FakeCommandLogger)trackingService.getCommandLogger()).logEntries);
}
+ /**
+ * Test the tracking service as it is invoked by DQP during query processing
+ * using a <code>String</code> as the query object.
+ * <p>
+ * This test creates a sample query statement of type <code>String</code> along
+ * with an instance of <code>TrackingService</code> returned by a call to
+ * <code>getTrackingService()</code> asking for a <code>TrackingService</code> that
+ * will log the user-command. The query and <code>TrackingService</code> instance
+ * are passed to the helper method <code>logUserCommandViaDQP()</code> and the
+ * expected results returned from the helper method are compared to the actual
+ * results logged by <code>FakeCommandLogger</code>.
+ * <p>
+ * This test can only succeed if the log entry sent to <code>FakeCommandLogger</code>
+ * from <code>DQPCore</code> matches the expected results returned by the
+ * helper method.
+ *
+ * @see #getTrackingService(boolean, boolean, boolean)
+ * @see #helpLogUserCommandViaDQP(TrackingService, Serializable)
+ * @since 6
+ * @throws Exception
+ */
+ public void testUserCommandFromDQP_String() throws Exception {
+ String sql = "SELECT SQRT(100)"; //$NON-NLS-1$
+ CustomizableTrackingService trackingService = getTrackingService(false, true, false);
+ helpLogUserCommandViaDQP(trackingService, sql);
+ }
+
// ========================================================================================================
// test utilities
// ========================================================================================================
@@ -118,6 +161,124 @@
return service;
}
+ /**
+ * Helper method that creates an instance of <code>DQPCore</code> and sends
+ * it a <code>RequestMessage</code> along with the value passed in <code>ts</code>
+ * so that <code>DQPCore</code> can use it as the tracking service to log the
+ * user-command <code>command</code> if <code>ts</code> is set to capture
+ * user-commands.
+ * <p>
+ * If <code>ts</code> is set to record the user-command, this method will
+ * return two log entries. The first log entry represents the START state
+ * of the user-command and the second represents the END state of the
+ * user command.
+ * <p>
+ * <code>command</code> must be valid and DQP must be able to parse the query.
+ * Because this helper method does not actually build or establish any metadata
+ * for DQP or define any sources, <code>command</code> should only contain scalar
+ * functions or constant values for its symbols. Because DQP can receive either
+ * a <code>String</code> or a <code>Command</code> object representing the
+ * user-command, <code>command</code> can be of either type. <code>command</code>
+ * will be passed to the <code>RequestMessage</code> that is sent to <code>DQPCore</code>
+ *
+ * @param ts A configured and running instance of a <code>TrackingService</code>.
+ * @param command The query representing the user-command.
+ * @return If <code>ts</code> has been set to record the user-command, two log entries
+ * should be returned. Each entry is made up of one or more <code>Object</code>
+ * types and is contained within a <code>List</code> object. The final two log
+ * entries are also contained in a <code>List</code> object.
+ * @throws InterruptedException
+ * @throws ExecutionException
+ * @throws TimeoutException
+ * @throws MetaMatrixProcessingException
+ * @throws ApplicationLifecycleException
+ */
+ private void helpLogUserCommandViaDQP(CustomizableTrackingService ts, String command) throws InterruptedException, ExecutionException, TimeoutException, MetaMatrixProcessingException, ApplicationLifecycleException {
+ String principal = "stuart"; //$NON-NLS-1$
+ String vdbName = "bqt"; //$NON-NLS-1$
+ String vdbVersion = "1"; //$NON-NLS-1$
+ MetaMatrixSessionID sessionID = new MetaMatrixSessionID(1);
+ int requestID = 100;
+ int finalRowCount = 1;
+ List<Object> expectedStartLogEntry = new ArrayList<Object>();
+ List<Object> expectedEndLogEntry = new ArrayList<Object>();
+ List<List<Object>> expectedLogEntries = new ArrayList<List<Object>>();
+
+ if ( ts.willRecordMMCmd() ) {
+ expectedStartLogEntry.add(sessionID + "." + requestID); // Request ID //$NON-NLS-1$
+ expectedStartLogEntry.add(null); // Transaction ID
+ expectedStartLogEntry.add(sessionID.toString()); // Session ID
+ expectedStartLogEntry.add(null); // Application Name
+ expectedStartLogEntry.add(principal); // Principal Name
+ expectedStartLogEntry.add(vdbName); // VDB Name
+ expectedStartLogEntry.add(vdbVersion); // VDB Version
+ expectedStartLogEntry.add(command.toString()); // SQL
+ expectedLogEntries.add(expectedStartLogEntry);
+
+ expectedEndLogEntry.add(sessionID + "." + requestID); // Request ID //$NON-NLS-1$
+ expectedEndLogEntry.add(null); // Transaction ID
+ expectedEndLogEntry.add(sessionID.toString()); // Session ID
+ expectedEndLogEntry.add(principal); // Principal Name
+ expectedEndLogEntry.add(vdbName); // VDB Name
+ expectedEndLogEntry.add(vdbVersion); // VDB Version
+ expectedEndLogEntry.add(new Integer(finalRowCount)); // Expected Number of Rows
+ expectedEndLogEntry.add(Boolean.FALSE); // isCanceled?
+ expectedEndLogEntry.add(Boolean.FALSE); // wasError?
+ expectedLogEntries.add(expectedEndLogEntry);
+ }
+
+ ApplicationEnvironment env = new ApplicationEnvironment();
+ env.bindService(DQPServiceNames.BUFFER_SERVICE, new FakeBufferService());
+ FakeMetadataService mdSvc = new FakeMetadataService();
+ mdSvc.addVdb(vdbName, vdbVersion, FakeMetadataFactory.exampleBQTCached());
+ env.bindService(DQPServiceNames.METADATA_SERVICE, mdSvc);
+ env.bindService(DQPServiceNames.DATA_SERVICE, new AutoGenDataService());
+ env.bindService(DQPServiceNames.TRANSACTION_SERVICE, new FakeTransactionService());
+ env.bindService(DQPServiceNames.TRACKING_SERVICE, ts);
+ FakeVDBService vdbService = new FakeVDBService();
+ vdbService.addBinding(vdbName, vdbVersion, "BQT1", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ vdbService.addBinding(vdbName, vdbVersion, "BQT2", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ vdbService.addBinding(vdbName, vdbVersion, "BQT3", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ vdbService.addModel(vdbName, vdbVersion, "BQT3", ModelInfo.PRIVATE, false); //$NON-NLS-1$
+ env.bindService(DQPServiceNames.VDB_SERVICE, vdbService);
+
+ DQPCore core = new DQPCore(env);
+ core.start(new Properties());
+
+ DQPWorkContext workContext = new DQPWorkContext();
+ workContext.setVdbName(vdbName);
+ workContext.setVdbVersion(vdbVersion);
+ workContext.setSessionId(sessionID);
+ workContext.setUserName(principal);
+ DQPWorkContext.setWorkContext(workContext);
+
+ RequestMessage reqMsg = new RequestMessage(command);
+ reqMsg.setCallableStatement(false);
+ reqMsg.setCursorType(ResultSet.TYPE_SCROLL_INSENSITIVE);
+ reqMsg.setFetchSize(10);
+ reqMsg.setPartialResults(false);
+ reqMsg.setExecutionId(requestID);
+
+ ResultsMessage results = null;
+ Future<ResultsMessage> message = null;
+
+ // Execute reqMsg
+ message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ results = message.get(50000, TimeUnit.MILLISECONDS);
+ assertNull("executeRequest resulted in " + results.getException(), results.getException()); //$NON-NLS-1$
+ core.closeRequest(requestID);
+ FakeCommandLogger fcl = (FakeCommandLogger)ts.getCommandLogger();
+ //close is fully asynch, calling stop immediately may take effect before the work item is requeued
+ synchronized (fcl) {
+ for (int i = 0; i < 10 && fcl.logEntries.size() != expectedLogEntries.size(); i++) {
+ fcl.wait(50);
+ }
+ }
+ core.stop();
+ ts.stop();
+ assertEquals(expectedLogEntries, fcl.logEntries);
+ }
+
private List logExampleUserCommandStart(TrackingService trackingService) {
String requestID = "req1"; //$NON-NLS-1$
@@ -131,9 +292,10 @@
String vdbVersion = "2"; //$NON-NLS-1$
Command sql = TestQuery.sample1();
int rows = 10000;
+
+ String sqlStr = sql != null ? sql.toString() : null;
+ trackingService.log(requestID, transactionID, cmdPoint, status, sessionID, applicationName, principal, vdbName, vdbVersion, sqlStr, rows);
- trackingService.log(requestID, transactionID, cmdPoint, status, sessionID, applicationName, principal, vdbName, vdbVersion, sql, rows);
-
List expectedLogEntry = new ArrayList();
expectedLogEntry.add(requestID);
expectedLogEntry.add(transactionID);
@@ -163,7 +325,8 @@
boolean isCancelled = false;
boolean errorOccurred = false;
- trackingService.log(requestID, transactionID, cmdPoint, status, sessionID, applicationName, principal, vdbName, vdbVersion, sql, rows);
+ String sqlStr = sql != null ? sql.toString() : null;
+ trackingService.log(requestID, transactionID, cmdPoint, status, sessionID, applicationName, principal, vdbName, vdbVersion, sqlStr, rows);
List expectedLogEntry = new ArrayList();
expectedLogEntry.add(requestID);
@@ -192,8 +355,9 @@
short status = TrackerLogConstants.CMD_STATUS.NEW;
int finalRowCount = 3;
+ String sqlStr = sql != null ? sql.toString() : null;
trackingService.log(requestID, sourceCommandID, subTransactionID, status, modelName, connectorBindingName,
- cmdPoint, sessionID, principal, sql, finalRowCount, null);
+ cmdPoint, sessionID, principal, sqlStr, finalRowCount, null);
List expectedLogEntry = new ArrayList();
expectedLogEntry.add(requestID);
@@ -223,8 +387,9 @@
boolean isCancelled = true;
boolean errorOccurred = false;
+ String sqlStr = sql != null ? sql.toString() : null;
trackingService.log(requestID, sourceCommandID, subTransactionID, status, modelName, connectorBindingName,
- cmdPoint, sessionID, principal, sql, finalRowCount, null);
+ cmdPoint, sessionID, principal, sqlStr, finalRowCount, null);
List expectedLogEntry = new ArrayList();
expectedLogEntry.add(requestID);
@@ -264,7 +429,7 @@
public void close() {
}
- public void dataSourceCommandStart(long timestamp,
+ public synchronized void dataSourceCommandStart(long timestamp,
String requestID,
long sourceCommandID,
String subTransactionID,
@@ -285,9 +450,10 @@
logEntry.add(principal);
logEntry.add(sql);
logEntries.add(logEntry);
+ notifyAll();
}
- public void dataSourceCommandEnd(long timestamp,
+ public synchronized void dataSourceCommandEnd(long timestamp,
String requestID,
long sourceCommandID,
String subTransactionID,
@@ -312,43 +478,10 @@
logEntry.add(Boolean.valueOf(isCancelled));
logEntry.add(Boolean.valueOf(errorOccurred));
logEntries.add(logEntry);
+ notifyAll();
}
- public void transactionStart(long timestamp,
- String transactionID,
- String sessionID,
- String principal,
- String vdbName,
- String vdbVersion) {
-
- List logEntry = new ArrayList(8);
- logEntry.add(transactionID);
- logEntry.add(sessionID);
- logEntry.add(principal);
- logEntry.add(vdbName);
- logEntry.add(vdbVersion);
- logEntries.add(logEntry);
- }
-
- public void transactionEnd(long timestamp,
- String transactionID,
- String sessionID,
- String principal,
- String vdbName,
- String vdbVersion,
- boolean commit) {
-
- List logEntry = new ArrayList(8);
- logEntry.add(transactionID);
- logEntry.add(sessionID);
- logEntry.add(principal);
- logEntry.add(vdbName);
- logEntry.add(vdbVersion);
- logEntry.add(Boolean.valueOf(commit));
- logEntries.add(logEntry);
- }
-
- public void userCommandStart(long timestamp,
+ public synchronized void userCommandStart(long timestamp,
String requestID,
String transactionID,
String sessionID,
@@ -367,10 +500,11 @@
logEntry.add(vdbName);
logEntry.add(vdbVersion);
logEntry.add(sql);
- logEntries.add(logEntry);
+ logEntries.add(logEntry);
+ notifyAll();
}
- public void userCommandEnd(long timestamp,
+ public synchronized void userCommandEnd(long timestamp,
String requestID,
String transactionID,
String sessionID,
@@ -391,7 +525,8 @@
logEntry.add(new Integer(finalRowCount));
logEntry.add(Boolean.valueOf(isCancelled));
logEntry.add(Boolean.valueOf(errorOccurred));
- logEntries.add(logEntry);
+ logEntries.add(logEntry);
+ notifyAll();
}
}
}
16 years, 6 months
teiid SVN: r555 - in trunk/connectors/sandbox: connector-object and 2 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-12 19:09:37 -0400 (Thu, 12 Mar 2009)
New Revision: 555
Modified:
trunk/connectors/sandbox/connector-exec/pom.xml
trunk/connectors/sandbox/connector-object/pom.xml
trunk/connectors/sandbox/connector-oracle-spatial/pom.xml
trunk/connectors/sandbox/connector-yahoo/pom.xml
Log:
TEIID-413: classpath for the connectors will be computed based upon the dependencies defined for the connector, and then it will be inserted into the CDK xml fragment, which will be included with the connector artifact zip.
Modified: trunk/connectors/sandbox/connector-exec/pom.xml
===================================================================
--- trunk/connectors/sandbox/connector-exec/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
+++ trunk/connectors/sandbox/connector-exec/pom.xml 2009-03-12 23:09:37 UTC (rev 555)
@@ -10,6 +10,16 @@
<name>Exec Connector</name>
<description>This connector executes Admin API calls and System.exec calls through the connector using SQL representation</description>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
Modified: trunk/connectors/sandbox/connector-object/pom.xml
===================================================================
--- trunk/connectors/sandbox/connector-object/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
+++ trunk/connectors/sandbox/connector-object/pom.xml 2009-03-12 23:09:37 UTC (rev 555)
@@ -13,6 +13,17 @@
any JAVA API, and turn it into connector</description>
<dependencies>
<dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
Modified: trunk/connectors/sandbox/connector-oracle-spatial/pom.xml
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
+++ trunk/connectors/sandbox/connector-oracle-spatial/pom.xml 2009-03-12 23:09:37 UTC (rev 555)
@@ -11,6 +11,17 @@
<description>Oracle Spatial Connector</description>
<dependencies>
<dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-jdbc</artifactId>
<version>${project.version}</version>
Modified: trunk/connectors/sandbox/connector-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/connector-yahoo/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
+++ trunk/connectors/sandbox/connector-yahoo/pom.xml 2009-03-12 23:09:37 UTC (rev 555)
@@ -9,4 +9,17 @@
<artifactId>connector-yahoo</artifactId>
<name>Yahoo Connector</name>
<description>Test connector used to query ticker symbols from Yahoo website</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
16 years, 6 months
teiid SVN: r554 - in trunk: connectors and 18 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-12 19:03:44 -0400 (Thu, 12 Mar 2009)
New Revision: 554
Modified:
trunk/connector-api/pom.xml
trunk/connectors/connector-jdbc/pom.xml
trunk/connectors/connector-jdbc/src/assembly/bundle.xml
trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-ldap/src/assembly/bundle.xml
trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
trunk/connectors/connector-loopback/pom.xml
trunk/connectors/connector-loopback/src/assembly/bundle.xml
trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-salesforce/src/assembly/bundle.xml
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
trunk/connectors/connector-text/pom.xml
trunk/connectors/connector-text/src/assembly/bundle.xml
trunk/connectors/connector-text/src/main/resources/connector-text.xml
trunk/connectors/connector-xml/pom.xml
trunk/connectors/connector-xml/src/assembly/bundle.xml
trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
trunk/connectors/pom.xml
Log:
TEIID-413: classpath for the connectors will be computed based upon the dependencies defined for the connector, and then it will be inserted into the CDK xml fragment, which will be included with the connector artifact zip.
Modified: trunk/connector-api/pom.xml
===================================================================
--- trunk/connector-api/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connector-api/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -22,17 +22,14 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
<type>test-jar</type>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-internal</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
<type>test-jar</type>
+ <scope>test</scope>
</dependency>
<dependency>
Modified: trunk/connectors/connector-jdbc/pom.xml
===================================================================
--- trunk/connectors/connector-jdbc/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-jdbc/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -12,30 +12,92 @@
<name>JDBC Connector</name>
<description>This project contains connectors for a JDBC source. Currently this is an aggregator for all the JDBC connectors relational databases.</description>
- <!-- bundles all its dependencies in a single zip file -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
+ <build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-jdbc/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-jdbc/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,5 +1,5 @@
<ComponentType Name="JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.952-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.952-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:jdbcconn.jar" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" IsPreferred="true" />
<PropertyDefinition Name="UseBindVariables" DisplayName="Use prepared statements and bind variables" ShortDescription="" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="ExtensionCapabilityClass" DisplayName="Extension Capability Class" ShortDescription="" IsExpert="true" />
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-ldap/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -8,30 +8,93 @@
<artifactId>connector-ldap</artifactId>
<name>LDAP Connector</name>
<description>LDAP Connector</description>
-
- <!-- bundles all its dependencies in a single zip file -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
+ <build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ </build>
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-ldap/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-ldap/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-ldap/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
===================================================================
--- trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,5 +1,5 @@
<ComponentType Name="LDAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.946-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.946-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:ldapconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" />
<PropertyDefinition Name="SearchDefaultBaseDN" DisplayName="Default Search Base DN" ShortDescription="Default Base DN for LDAP Searches" IsExpert="true" />
<PropertyDefinition Name="com.metamatrix.data.pool.cleaning_interval" DisplayName="Pool cleaning Interval (seconds)" ShortDescription="Set the interval to cleaning the pool" DefaultValue="300" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="LdapAdminUserDN" DisplayName="Ldap Admin User DN" ShortDescription="User DN for the LDAP admin account." DefaultValue="cn=<>,ou=<>,dc=<>" Multiplicity="1" IsPreferred="true" />
Modified: trunk/connectors/connector-loopback/pom.xml
===================================================================
--- trunk/connectors/connector-loopback/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-loopback/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,31 +11,93 @@
<artifactId>connector-loopback</artifactId>
<name>Loopback Connector</name>
<description>Loopback Connector</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
- <!-- bundles all its dependencies in a single zip file -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
+ <build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-loopback/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-loopback/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-loopback/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
===================================================================
--- trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,5 +1,5 @@
<ComponentType Name="Loopback Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.945-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.945-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:loopbackconn.jar;extensionjar:jdbcconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" />
<PropertyDefinition Name="CapabilitiesClass" DisplayName="Capabilities Class" ShortDescription="" DefaultValue="com.metamatrix.connector.loopback.LoopbackCapabilities" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="WaitTime" DisplayName="Max Random Wait Time" ShortDescription="" DefaultValue="0" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.loopback.LoopbackConnector" Multiplicity="1" IsExpert="true" />
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-salesforce/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -12,6 +12,16 @@
<name>Salesforce Connector</name>
<description>Integrates the query engine with Salesforce.com.</description>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-xml-common</artifactId>
@@ -25,29 +35,78 @@
</dependency>
</dependencies>
- <!-- bundles all its dependencies in a single zip file -->
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
<build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-salesforce/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-salesforce/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,5 +1,5 @@
<ComponentType Name="Salesforce Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.916-06:00" CreationDate="2008-10-31T10:26:19.916-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="ClassPath" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-codec-1.2.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:axis.jar;extensionjar:salesforce.jar;extensionjar:salesforceconn.jar" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="ClassPath" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="username" DisplayName="User Name" ShortDescription="Name value for Salesforce authentication" DefaultValue="" Multiplicity="1" IsPreferred="true" />
<PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.salesforce.ConnectorState" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
Modified: trunk/connectors/connector-text/pom.xml
===================================================================
--- trunk/connectors/connector-text/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-text/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -9,30 +9,98 @@
<artifactId>connector-text</artifactId>
<name>Text Connector</name>
<description>This connector reads data from text files.</description>
-
- <!-- bundles all its dependencies in a single zip file -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
+ <build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ </build>
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-text/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-text/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-text/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-text/src/main/resources/connector-text.xml
===================================================================
--- trunk/connectors/connector-text/src/main/resources/connector-text.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-text/src/main/resources/connector-text.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,5 +1,5 @@
<ComponentType Name="Text File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.945-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.945-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:textconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" />
<PropertyDefinition Name="PartialStartupAllowed" DisplayName="Partial Startup Allowed" ShortDescription="" DefaultValue="true" Multiplicity="1" PropertyType="Boolean" IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="DescriptorFile" DisplayName="Text File Descriptor" ShortDescription="" Multiplicity="1" IsPreferred="true" />
Modified: trunk/connectors/connector-xml/pom.xml
===================================================================
--- trunk/connectors/connector-xml/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-xml/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -13,6 +13,16 @@
<description>This connector produces the XML documents from Web
service and transforms the document into a relational structure.</description>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-xml-common</artifactId>
@@ -25,32 +35,80 @@
<scope>compile</scope>
</dependency>
</dependencies>
-
-
- <!-- bundles all its dependencies in a single zip file -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bundle.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
+ it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
+ classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
+ <build>
+ <plugins>
+ <!-- build class path -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <fileSeparator>:</fileSeparator>
+ <pathSeparator>;</pathSeparator>
+ <prefix>extension</prefix>
+ <excludeTransitive>false</excludeTransitive>
+ <includeScope>runtime</includeScope>
+ <excludeTypes>pom</excludeTypes>
+ <outputFile>target/classpath.properties</outputFile>
+ <regenerateFile>true</regenerateFile>
+ <outputFilterFile>true</outputFilterFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- bundles all its dependencies in a single zip file -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bundle.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <!-- replaces the classpath tokens in the xml file -->
+ <filters>
+ <filter>target/classpath.properties</filter>
+ </filters>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
</project>
\ No newline at end of file
Modified: trunk/connectors/connector-xml/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-xml/src/assembly/bundle.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-xml/src/assembly/bundle.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,7 +11,7 @@
<fileSets>
<fileSet>
- <directory>src/main/resources</directory>
+ <directory>target/classes</directory>
<includes><include>${project.artifactId}.xml</include></includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
===================================================================
--- trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -1,13 +1,16 @@
- <ComponentType Name="XML File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar" Multiplicity="1" />
+ <ComponentType Name="XML Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}.${project.version}.jar;${classpath}" Multiplicity="1" />
+ </ComponentType>
+
+
+ <ComponentType Name="XML File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
<PropertyDefinition Name="CharacterEncodingScheme" DisplayName="File Encoding Used" ShortDescription="A character-encoding scheme is a mapping between a coded character set and a set of octet (eight-bit byte) sequences. Some samples are UTF-8,ISO-8859-1,UTF-16)" DefaultValue="ISO-8859-1" />
<PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xmlsource.XMLSourceConnector" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="ConnectionType" DisplayName="Type Of XML Connection" ShortDescription="Connection type used to get the XML data" DefaultValue="com.metamatrix.connector.xmlsource.file.FileConnection" Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="DirectoryLocation" DisplayName="XML File(s) Directory Location" ShortDescription="" DefaultValue="" Multiplicity="1" IsPreferred="true" />
</ComponentType>
- <ComponentType Name="XML SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:axis.jar" Multiplicity="1" IsPreferred="true" />
+ <ComponentType Name="XML SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
<PropertyDefinition Name="AuthPassword" DisplayName="Authentication User Password" ShortDescription="Password value for authentication" DefaultValue="" IsExpert="true" IsMasked="true" IsPreferred="true" />
<PropertyDefinition Name="SAMLPropertyFile" DisplayName="SAML Property File (only required when SAML profile used)" ShortDescription="SAML Security property file (saml.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
@@ -23,10 +26,9 @@
<PropertyDefinition Name="EncryptPropertyFile" DisplayName="Encrypt crypto property file (only if Encrypt profile used)" ShortDescription="The file defines properties of cryptography for encryption of the message;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="TrustType" DisplayName="Trust Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the service are known to the service and have pre-registered their certificate chains before using the service. The direct-reference method presumes that the service operator trusts all users with certificates issued by a trusted CA." DefaultValue="DirectReference" IsExpert="true" IsPreferred="true" />
</ComponentType>
- <ComponentType Name="XML-Relational File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.918-06:00" CreationDate="2008-10-31T10:26:19.918-06:00">
+ <ComponentType Name="XML-Relational File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.918-06:00" CreationDate="2008-10-31T10:26:19.918-06:00">
<PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="FilePath" DisplayName="File Path" ShortDescription="" Multiplicity="1" />
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:ConnectorCommons.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar" Multiplicity="1" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
<PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" Multiplicity="1" PropertyType="Integer" />
@@ -41,7 +43,7 @@
<PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsConstrainedToAllowedValues="false" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
</ComponentType>
- <ComponentType Name="XML-Relational HTTP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.920-06:00" CreationDate="2008-10-31T10:26:19.921-06:00">
+ <ComponentType Name="XML-Relational HTTP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.920-06:00" CreationDate="2008-10-31T10:26:19.921-06:00">
<PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
<PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" Multiplicity="1" PropertyType="Integer" />
@@ -59,7 +61,6 @@
<PropertyDefinition Name="ProxyUri" DisplayName="Proxy Server URI" ShortDescription="The URI of the proxy server" DefaultValue="" />
<PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:ConnectorCommons.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar;extensionjar:commons-codec-1.2.jar" Multiplicity="1" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="HttpBasicAuthUserName" DisplayName="HTTP Basic Authentication Name" ShortDescription="Name value for HTTP basic authentication" DefaultValue="" IsExpert="true" />
<PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.base.XMLConnector" Multiplicity="1" IsExpert="true" />
@@ -78,7 +79,7 @@
<PropertyDefinition Name="HostnameVerifier" DisplayName="Hostname Verifier" ShortDescription="Class implementing javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround." IsConstrainedToAllowedValues="false" IsExpert="true" />
<PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsConstrainedToAllowedValues="false" IsExpert="true" />
</ComponentType>
- <ComponentType Name="XML-Relational SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.919-06:00" CreationDate="2008-10-31T10:26:19.919-06:00">
+ <ComponentType Name="XML-Relational SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.919-06:00" CreationDate="2008-10-31T10:26:19.919-06:00">
<PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="AuthPassword" DisplayName="Authentication User Password" ShortDescription="Password value for authentication" DefaultValue="" IsExpert="true" IsMasked="true" IsPreferred="true" />
<PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
@@ -102,7 +103,6 @@
<PropertyDefinition Name="EncryptPropertyFile" DisplayName="Encrypt crypto property file (only if Encrypt profile used)" ShortDescription="The file defines properties of cryptography for encryption of the message;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
- <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar;extensionjar:commons-codec-1.2.jar;extensionjar:axis.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:saaj.jar;extensionjar:jaxrpc.jar" Multiplicity="1" />
<PropertyDefinition Name="SAMLPropertyFile" DisplayName="SAML Property File (only required when SAML profile used)" ShortDescription="SAML Security property file (saml.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="EncodingStyle" DisplayName="Encoding Style (RPC - Encoded, RPC - Literal, Document - Literal, Document - Encoded)" ShortDescription="Encoding Style" DefaultValue="Document - Literal" Multiplicity="1">
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2009-03-12 22:21:46 UTC (rev 553)
+++ trunk/connectors/pom.xml 2009-03-12 23:03:44 UTC (rev 554)
@@ -11,36 +11,19 @@
<artifactId>teiid-connectors</artifactId>
<packaging>pom</packaging>
<name>Connectors</name>
- <description>This project is aggregator for all the supported
- connectors.</description>
+ <description>This project is aggregator for all the supported connectors.</description>
<dependencies>
-
- <!-- Internal dependencies -->
+
+ <!-- Internal Test Dependencies -->
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-connector-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-api</artifactId>
<type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- </exclusion>
- </exclusions>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-sdk</artifactId>
- <scope>test</scope>
+ <artifactId>teiid-connector-sdk</artifactId>
<exclusions>
<exclusion>
<groupId>org.jboss.teiid</groupId>
@@ -54,7 +37,8 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-metadata</artifactId>
</exclusion>
- </exclusions>
+ </exclusions>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
@@ -74,41 +58,47 @@
<artifactId>teiid-metadata</artifactId>
</exclusion>
</exclusions>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
+ <artifactId>teiid-engine</artifactId>
<type>test-jar</type>
+ <scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- <scope>runtime</scope>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <scope>runtime</scope>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <scope>runtime</scope>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-internal</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-metadata</artifactId>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-metadata</artifactId>
<type>test-jar</type>
- <scope>runtime</scope>
- </dependency>
-
+ <scope>test</scope>
+ </dependency>
+
<!-- External dependencies -->
</dependencies>
16 years, 6 months
teiid SVN: r553 - trunk/engine/src/main/java/com/metamatrix/common/buffer/impl.
by teiid-commits@lists.jboss.org
Author: ghelblin
Date: 2009-03-12 18:21:46 -0400 (Thu, 12 Mar 2009)
New Revision: 553
Modified:
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
Log:
TEIID-54 - Fix for NPE while handling LOB returned from a UDF [reviewed by Ramesh]
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2009-03-12 21:48:51 UTC (rev 552)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2009-03-12 22:21:46 UTC (rev 553)
@@ -1032,8 +1032,9 @@
// a streming id or not; if one is not assigned create one and assign it
// to the lob; if one is already assigned just return;
// this will prohibit calling lob on itself into this routine.
- Streamable lob = (Streamable)anObj;
- if (lob.getReferenceStreamId() == null) {
+ Streamable lob = (Streamable)anObj;
+
+ if (lob.getReferenceStreamId() == null || lobIsNotKnownInTupleSourceMap( lob, parentId) ) {
List schema = new ArrayList();
schema.add(parentSchema.get(col));
@@ -1077,7 +1078,32 @@
}
}
}
+
+ private boolean lobIsNotKnownInTupleSourceMap( Streamable lob, TupleSourceID parentId) throws TupleSourceNotFoundException {
+ /*
+ * The need for this defensive feature arises because there are multiple uses of the TupleSourceMap which
+ * are somewhat inconsistent with one another. In the case of LOBs we use the parent/child group feature
+ * of tuplesources to associate a parent tuplesource containing metadata about the LOB with a second
+ * tuplesource that contains the LOB. When such a group is no longer needed (for example, see SubqueryProcessorUtility.close()),
+ * removing the child tupleSources has the unfortunate side effect of leaving the actual LOBs with references to
+ * tuplesources that no longer exist, and are therefore no longer in the tupleSourceMap.
+ *
+ * This test ensures that such orphaned LOBs will be treated correctly (TEIID-54).
+ *
+ */
+ if (!lob.getReferenceStreamId().equals(parentId.getStringID())) {
+ TupleSourceID id = new TupleSourceID(lob.getReferenceStreamId());
+ TupleSourceInfo lobInfo = getTupleSourceInfo(id, false);
+ if ( lobInfo == null ) {
+ return true; // is not known
+ }
+ return false; // is known
+ }
+ return false; // don't care if known
+ }
+
+
/**
* @see com.metamatrix.common.buffer.BufferManager#addStreamablePart(com.metamatrix.common.buffer.TupleSourceID, com.metamatrix.common.lob.LobChunk, int)
*/
16 years, 6 months
teiid SVN: r551 - in trunk: connector-api/src/main/java/org/teiid/connector/internal and 18 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-12 17:48:48 -0400 (Thu, 12 Mar 2009)
New Revision: 551
Added:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/XAJDBCPropertyNames.java
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCConnector.java
trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
Log:
TEIID-352 TEIID-164 moving capabilities loading onto Translator, made use of the isxa property, and the properties to configure default security.
Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -2,18 +2,30 @@
import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ConnectorIdentity;
import org.teiid.connector.api.CredentialMap;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.MappedUserIdentity;
import org.teiid.connector.api.SingleIdentity;
+import org.teiid.connector.internal.ConnectorPropertyNames;
+import com.metamatrix.common.util.PropertiesUtils;
+
public abstract class BasicConnector implements Connector {
private boolean useCredentialMap;
private boolean adminConnectionsAllowed = true;
private String connectorName;
+
+ @Override
+ public void start(ConnectorEnvironment environment)
+ throws ConnectorException {
+ this.connectorName = environment.getConnectorName();
+ this.adminConnectionsAllowed = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.ADMIN_CONNECTIONS_ALLOWED, true);
+ this.useCredentialMap = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.USE_CREDENTIALS_MAP, false);
+ }
/* (non-Javadoc)
* @see com.metamatrix.connector.api.Connector#createIdentity(com.metamatrix.connector.api.ExecutionContext)
Modified: trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -98,7 +98,7 @@
public static final String IS_XA = "IsXA"; //$NON-NLS-1$
- public static final String USE_CREDENTIALS_MAPS = "UseCredentialMaps"; //$NON-NLS-1$
+ public static final String USE_CREDENTIALS_MAP = "UseCredentialMap"; //$NON-NLS-1$
public static final String ADMIN_CONNECTIONS_ALLOWED = "AdminConnectionsAllowed"; //$NON-NLS-1$
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -35,6 +35,7 @@
import org.teiid.connector.api.ConnectorLogger;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.basic.BasicExecution;
+import org.teiid.connector.internal.ConnectorPropertyNames;
import org.teiid.connector.jdbc.translator.TranslatedCommand;
import org.teiid.connector.jdbc.translator.Translator;
import org.teiid.connector.language.ICommand;
@@ -59,6 +60,7 @@
// Derived from properties
protected boolean trimString;
protected int fetchSize;
+ protected int maxResultRows;
// Set during execution
protected Statement statement;
@@ -77,16 +79,16 @@
this.logger = logger;
this.context = context;
- String propStr = props.getProperty(JDBCPropertyNames.TRIM_STRINGS);
- if (propStr != null) {
- trimString = Boolean.valueOf(propStr).booleanValue();
- }
-
+ trimString = PropertiesUtils.getBooleanProperty(props, JDBCPropertyNames.TRIM_STRINGS, false);
fetchSize = PropertiesUtils.getIntProperty(props, JDBCPropertyNames.FETCH_SIZE, context.getBatchSize());
- int max = sqlTranslator.getMaxResultRows();
- if (max > 0) {
- fetchSize = Math.min(fetchSize, max);
+ maxResultRows = PropertiesUtils.getIntProperty(props, ConnectorPropertyNames.MAX_RESULT_ROWS, -1);
+ //if the connector work needs to throw an excpetion, set the size plus 1
+ if (maxResultRows > 0 && PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.EXCEPTION_ON_MAX_ROWS, false)) {
+ maxResultRows++;
}
+ if (maxResultRows > 0) {
+ fetchSize = Math.min(fetchSize, maxResultRows);
+ }
}
// ===========================================================================================================================
@@ -134,8 +136,8 @@
}
protected void setSizeContraints(Statement statement) throws SQLException {
- if (sqlTranslator.getMaxResultRows() > 0) {
- statement.setMaxRows(sqlTranslator.getMaxResultRows());
+ if (maxResultRows > 0) {
+ statement.setMaxRows(maxResultRows);
}
statement.setFetchSize(fetchSize);
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -354,10 +354,6 @@
return false;
}
- public boolean supportsOrderByInInlineViews() {
- return false;
- }
-
/**
* @see org.teiid.connector.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaSome()
*/
@@ -366,13 +362,6 @@
}
/**
- * @see org.teiid.connector.api.ConnectorCapabilities#supportsUnionOrderBy()
- */
- public boolean supportsUnionOrderBy() {
- return true;
- }
-
- /**
* @see org.teiid.connector.basic.BasicConnectorCapabilities#supportsSetQueryOrderBy()
*/
@Override
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -46,8 +46,6 @@
import org.teiid.connector.basic.BasicConnector;
import org.teiid.connector.internal.ConnectorPropertyNames;
import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.jdbc.xa.JDBCSourceXAConnection;
-import org.teiid.connector.jdbc.xa.XAJDBCPropertyNames;
import org.teiid.connector.xa.api.TransactionContext;
import org.teiid.connector.xa.api.XAConnection;
import org.teiid.connector.xa.api.XAConnector;
@@ -95,13 +93,12 @@
@Override
public void start(ConnectorEnvironment environment)
throws ConnectorException {
+ super.start(environment);
logger = environment.getLogger();
this.environment = environment;
logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
- capabilities = createCapabilities(environment.getProperties(), Thread.currentThread().getContextClassLoader());
-
Properties connectionProps = environment.getProperties();
// Get the JDBC properties ...
@@ -127,6 +124,8 @@
}
sqlTranslator.initialize(environment);
+ capabilities = sqlTranslator.getConnectorCapabilities();
+
createDataSources(dataSourceClassName, connectionProps);
if (areAdminConnectionsAllowed()) {
@@ -214,7 +213,7 @@
TransactionContext transactionContext) throws ConnectorException {
XADataSource xaDataSource = getXADataSource();
if (xaDataSource == null) {
- throw new UnsupportedOperationException("Connector is not XA capable");
+ throw new UnsupportedOperationException(JDBCPlugin.Util.getString("JDBCConnector.non_xa_connection_source")); //$NON-NLS-1$
}
javax.sql.XAConnection conn = null;
try {
@@ -223,6 +222,8 @@
} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
conn = xaDataSource.getXAConnection(id.getMappedUser(), id.getPassword());
+ } else {
+ throw new ConnectorException(JDBCPlugin.Util.getString("JDBCConnector.unsupported_identity_type")); //$NON-NLS-1$
}
java.sql.Connection c = conn.getConnection();
setDefaultTransactionIsolationLevel(c);
@@ -242,27 +243,6 @@
public ConnectorCapabilities getCapabilities() {
return capabilities;
}
-
- static ConnectorCapabilities createCapabilities(Properties p, ClassLoader loader)
- throws ConnectorException {
- //create Capabilities
- String className = p.getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, JDBCCapabilities.class.getName());
- try {
- ConnectorCapabilities result = (ConnectorCapabilities)ReflectionHelper.create(className, null, loader);
- if(result instanceof JDBCCapabilities) {
- String setCriteriaBatchSize = p.getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
- if(setCriteriaBatchSize != null) {
- int maxInCriteriaSize = Integer.parseInt(setCriteriaBatchSize);
- if(maxInCriteriaSize > 0) {
- ((JDBCCapabilities)result).setMaxInCriteriaSize(maxInCriteriaSize);
- }
- }
- }
- return result;
- } catch (Exception e) {
- throw new ConnectorException(e);
- }
- }
protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
// create data source
@@ -286,7 +266,7 @@
@Override
public Object invoke(Object proxy, Method method,
Object[] args) throws Throwable {
- if (method.getName().equals("getConnection")) {
+ if (method.getName().equals("getConnection")) { //$NON-NLS-1$
Properties p = new Properties();
String user = null;
String password = null;
@@ -298,14 +278,14 @@
password = connectionProps.getProperty(JDBCPropertyNames.PASSWORD);
}
if (user != null) {
- p.put("user", user);
+ p.put("user", user); //$NON-NLS-1$
}
if (password != null) {
- p.put("password", password);
+ p.put("password", password); //$NON-NLS-1$
}
return driver.connect(url, p);
}
- throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections");
+ throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections"); //$NON-NLS-1$
}
});
} else {
@@ -317,7 +297,7 @@
this.xaDs = (XADataSource)temp;
PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
} else {
- throw new ConnectorException("Specified class is not a XADataSource, DataSource, or Driver " + dataSourceClassName);
+ throw new ConnectorException(JDBCPlugin.Util.getString("JDBCConnector.invalid_source", dataSourceClassName)); //$NON-NLS-1$
}
}
if (this.ds instanceof XADataSource) {
@@ -360,13 +340,13 @@
// Will be: [aHost], [aPort]
final String[] hostPort = protoHost[1].split(":"); //$NON-NLS-1$
- connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, (String)hostPort[0]);
- connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, (String)hostPort[1]);
+ connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, hostPort[0]);
+ connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, hostPort[1]);
// For "databaseName", "SID", and all optional props
// (<propName1>=<propValue1>;<propName2>=<propValue2>;...)
for ( int i = 1; i < urlParts.length; i++ ) {
- final String nameVal = (String) urlParts[i];
+ final String nameVal = urlParts[i];
// Will be: [propName], [propVal]
final String[] aProp = nameVal.split("="); //$NON-NLS-1$
if ( aProp.length > 1) {
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -23,7 +23,7 @@
package org.teiid.connector.jdbc;
public class JDBCPropertyNames {
- public static final String CONNECTION_SOURCE_CLASS = "Driver"; //$NON-NLS-1$
+ public static final String CONNECTION_SOURCE_CLASS = "ConnectionSource"; //$NON-NLS-1$
public static final String URL = "URL"; //$NON-NLS-1$
public static final String USERNAME = "User"; //$NON-NLS-1$
public static final String PASSWORD = "Password"; //$NON-NLS-1$
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -90,7 +90,7 @@
try {
this.physicalConnection.close();
} catch(SQLException e) {
- logger.logDetail("Exception during close: " + e.getMessage());
+ logger.logDetail("Exception during close: " + e.getMessage()); //$NON-NLS-1$
}
}
Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java (from rev 549, trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/JDBCSourceXAConnection.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -0,0 +1,104 @@
+/*
+ * 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.connector.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.ConnectionEvent;
+import javax.sql.ConnectionEventListener;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.jdbc.translator.Translator;
+import org.teiid.connector.xa.api.XAConnection;
+
+
+public class JDBCSourceXAConnection extends JDBCSourceConnection implements XAConnection {
+ private javax.sql.XAConnection xaConn;
+ private XAResource resource;
+ private boolean errorOccurred;
+
+ public JDBCSourceXAConnection(Connection conn, javax.sql.XAConnection xaConn, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException, SQLException {
+ super(conn, environment, sqlTranslator);
+ this.xaConn = xaConn;
+ this.xaConn.addConnectionEventListener(new ConnectionEventListener() {
+ @Override
+ public void connectionClosed(ConnectionEvent event) {
+
+ }
+ @Override
+ public void connectionErrorOccurred(ConnectionEvent event) {
+ errorOccurred = true;
+ }
+ });
+ this.resource = xaConn.getXAResource();
+ }
+
+ /**
+ * @see org.teiid.connector.xa.api.XAConnection#getXAResource()
+ */
+ public XAResource getXAResource() throws ConnectorException {
+ return resource;
+ }
+
+ @Override
+ public void close() {
+ super.close();
+
+ try {
+ this.xaConn.close();
+ } catch (SQLException e) {
+ this.environment.getLogger().logDetail("Exception while closing: " + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * XAConnection Connections should be cycled to ensure proper cleanup after the transaction.
+ */
+ @Override
+ public void closeCalled() {
+ closeSourceConnection();
+ try {
+ this.physicalConnection = this.xaConn.getConnection();
+ } catch (SQLException e) {
+ this.environment.getLogger().logDetail("Exception while cycling connection: " + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public boolean isAlive() {
+ if (errorOccurred) {
+ return false;
+ }
+ return super.isAlive();
+ }
+
+ public javax.sql.XAConnection getXAConnection() {
+ return this.xaConn;
+ }
+
+}
Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/XAJDBCPropertyNames.java (from rev 549, trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/XAJDBCPropertyNames.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/XAJDBCPropertyNames.java (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/XAJDBCPropertyNames.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/*
+ * Date: Jan 23, 2003
+ * Time: 5:38:40 PM
+ */
+package org.teiid.connector.jdbc;
+
+/**
+ * XAJDBCPropertyNames.
+ */
+public class XAJDBCPropertyNames {
+
+ /** An XA Transaction-related property. The <code>XADataSource</code>'s unique
+ * resource name for the underlying <code>ConnectionPoolDataSource</code> object.
+ */
+ public static final String DATASOURCE_NAME = "dataSourceName"; //$NON-NLS-1$
+
+ public static final String PORT_NUMBER = "portNumber";//$NON-NLS-1$
+
+ public static final String SERVER_NAME = "serverName";//$NON-NLS-1$
+
+}
Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/XAJDBCPropertyNames.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -24,6 +24,7 @@
*/
package org.teiid.connector.jdbc.access;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
@@ -42,4 +43,9 @@
return false;
}
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return AccessCapabilities.class;
+ }
+
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -25,6 +25,7 @@
import java.util.Arrays;
import java.util.List;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
@@ -49,11 +50,11 @@
@Override
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new DB2ConvertModifier(getLanguageFactory())); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new DB2ConvertModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
@@ -85,6 +86,11 @@
@Override
public String getDefaultConnectionTestQuery() {
return "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
+ }
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return DB2Capabilities.class;
}
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -22,6 +22,7 @@
package org.teiid.connector.jdbc.derby;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.SourceSystemFunctions;
@@ -39,14 +40,14 @@
@Override
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.CONCAT, new EscapeSyntaxModifier()); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier()); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier()); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new DerbyConvertModifier(getLanguageFactory())); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.COALESCE, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.CONCAT, new EscapeSyntaxModifier());
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier());
+ registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier());
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new DerbyConvertModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.COALESCE, new AliasModifier("coalesce")); //$NON-NLS-1$
}
@Override
@@ -57,6 +58,11 @@
@Override
public String getDefaultConnectionTestQuery() {
return "Select 0 from sys.systables where 1 = 2"; //$NON-NLS-1$
+ }
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return DerbyCapabilities.class;
}
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -24,6 +24,7 @@
*/
package org.teiid.connector.jdbc.informix;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.SourceSystemFunctions;
@@ -38,12 +39,17 @@
@Override
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new DropFunctionModifier()); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new DropFunctionModifier());
}
@Override
public String getDefaultConnectionTestQuery() {
return "select 'x' from informix.sysusers where 1=0"; //$NON-NLS-1$
}
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return InformixCapabilities.class;
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -29,9 +29,11 @@
import java.sql.Time;
import java.sql.Timestamp;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.derby.DerbyCapabilities;
import org.teiid.connector.jdbc.translator.Translator;
@@ -44,7 +46,7 @@
@Override
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new MySQLConvertModifier(getLanguageFactory())); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new MySQLConvertModifier(getLanguageFactory()));
}
@Override
@@ -93,4 +95,9 @@
}
}
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return DerbyCapabilities.class;
+ }
+
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
@@ -62,31 +63,31 @@
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("nvl")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LOG10, new Log10FunctionModifier(getLanguageFactory())); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new OracleConvertModifier(getLanguageFactory(), getEnvironment().getLogger())); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("nvl")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOG10, new Log10FunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new OracleConvertModifier(getLanguageFactory(), getEnvironment().getLogger()));
registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier("HOUR"));//$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier("YEAR"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier("MINUTE"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier("SECOND"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier("MONTH"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractFunctionModifier("DAY"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.WEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "WW"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.QUARTER, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "Q"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "D"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "DDD"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));//$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.CONCAT, new ConcatFunctionModifier(getLanguageFactory())); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier("YEAR"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier("MINUTE"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier("SECOND"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier("MONTH"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractFunctionModifier("DAY"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.WEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "WW"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.QUARTER, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "Q"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "D"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "DDD"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.CONCAT, new ConcatFunctionModifier(getLanguageFactory()));
}
@Override
@@ -159,18 +160,18 @@
queryCommand.setLimit(null);
List<Object> parts = new ArrayList<Object>();
if (limit.getRowOffset() > 0) {
- parts.add("SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (");
+ parts.add("SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM ("); //$NON-NLS-1$
} else {
- parts.add("SELECT * FROM (");
+ parts.add("SELECT * FROM ("); //$NON-NLS-1$
}
parts.add(queryCommand);
if (limit.getRowOffset() > 0) {
- parts.add(") VIEW_FOR_LIMIT WHERE ROWNUM <= ");
+ parts.add(") VIEW_FOR_LIMIT WHERE ROWNUM <= "); //$NON-NLS-1$
parts.add(limit.getRowLimit() + limit.getRowOffset());
- parts.add(") WHERE ROWNUM_ > ");
+ parts.add(") WHERE ROWNUM_ > "); //$NON-NLS-1$
parts.add(limit.getRowOffset());
} else {
- parts.add(") WHERE ROWNUM <= ");
+ parts.add(") WHERE ROWNUM <= "); //$NON-NLS-1$
parts.add(limit.getRowLimit());
}
return parts;
@@ -261,7 +262,7 @@
Statement stmt = null;
try {
stmt = connection.createStatement();
- rs = stmt.executeQuery("select * from v$instance");
+ rs = stmt.executeQuery("select * from v$instance"); //$NON-NLS-1$
int columnCount = rs.getMetaData().getColumnCount();
while (rs.next()) {
@@ -288,4 +289,9 @@
}
}
}
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return OracleCapabilities.class;
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.List;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
@@ -143,5 +144,10 @@
command.acceptVisitor(visitor);
return command;
}
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return PostgreSQLCapabilities.class;
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -24,6 +24,7 @@
*/
package org.teiid.connector.jdbc.sqlserver;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.SourceSystemFunctions;
@@ -38,13 +39,18 @@
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
//TEIID-31 remove mod modifier for SQL Server 2008
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.REPEAT, new AliasModifier("replicate")); //$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.REPEAT, new AliasModifier("replicate")); //$NON-NLS-1$
}
@Override
public String getLengthFunctionName() {
return "len"; //$NON-NLS-1$
}
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return SqlServerCapabilities.class;
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -37,7 +37,7 @@
/**
*/
-public class SybaseConvertModifier extends BasicFunctionModifier implements FunctionModifier {
+public class SybaseConvertModifier extends BasicFunctionModifier {
private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
static {
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
@@ -49,14 +50,14 @@
*/
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory())); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("+")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LENGTH, new AliasModifier(getLengthFunctionName())); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("isnull")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new SubstringFunctionModifier(getLanguageFactory(), "substring", getLengthFunctionName())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new SybaseConvertModifier(getLanguageFactory())); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("+")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LENGTH, new AliasModifier(getLengthFunctionName()));
+ registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("isnull")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new SubstringFunctionModifier(getLanguageFactory(), getLengthFunctionName()));
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new SybaseConvertModifier(getLanguageFactory()));
}
public String getLengthFunctionName() {
@@ -87,16 +88,21 @@
queryCommand.setLimit(null);
queryCommand.setOrderBy(null);
List<Object> parts = new ArrayList<Object>(6);
- parts.add("SELECT TOP ");
+ parts.add("SELECT TOP "); //$NON-NLS-1$
parts.add(limit.getRowLimit());
- parts.add(" * FROM (");
+ parts.add(" * FROM ("); //$NON-NLS-1$
parts.add(queryCommand);
- parts.add(") AS X");
+ parts.add(") AS X"); //$NON-NLS-1$
if (orderBy != null) {
- parts.add(" ");
+ parts.add(" "); //$NON-NLS-1$
parts.add(orderBy);
}
return parts;
}
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return SybaseCapabilities.class;
+ }
+
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -94,7 +94,7 @@
* Subclass should override this method as needed.
* @see org.teiid.connector.jdbc.translator.FunctionModifier#translate(org.teiid.connector.language.IFunction)
*/
- public List translate(IFunction function) {
+ public List<?> translate(IFunction function) {
return null;
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -38,7 +38,7 @@
private ILanguageFactory languageFactory;
private String length_function;
- public SubstringFunctionModifier(ILanguageFactory languageFactory, String substring_function, String length_function) {
+ public SubstringFunctionModifier(ILanguageFactory languageFactory, String length_function) {
this.languageFactory = languageFactory;
this.length_function = length_function;
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -40,11 +40,12 @@
import java.util.Map;
import java.util.TimeZone;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.internal.ConnectorPropertyNames;
+import org.teiid.connector.jdbc.JDBCCapabilities;
import org.teiid.connector.jdbc.JDBCPlugin;
import org.teiid.connector.jdbc.JDBCPropertyNames;
import org.teiid.connector.language.ICommand;
@@ -57,6 +58,7 @@
import org.teiid.connector.language.IParameter.Direction;
import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.util.ReflectionHelper;
/**
* Base class for creating source SQL queries and retrieving results.
@@ -112,7 +114,6 @@
private boolean useComments;
private boolean usePreparedStatements;
- private int maxResultRows = 0;
private TypeFacility typeFacility;
private volatile boolean initialConnection;
@@ -142,23 +143,7 @@
this.useComments = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, false);
this.usePreparedStatements = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_BIND_VARIABLES, false);
this.connectionTestQuery = env.getProperties().getProperty(JDBCPropertyNames.CONNECTION_TEST_QUERY, getDefaultConnectionTestQuery());
- this.isValidTimeout = PropertiesUtils.getIntProperty(env.getProperties(), JDBCPropertyNames.IS_VALID_TIMEOUT, -1);
-
- String maxResultRowsString = env.getProperties().getProperty(ConnectorPropertyNames.MAX_RESULT_ROWS);
- if ( maxResultRowsString != null && maxResultRowsString.trim().length() > 0 ) {
- try {
- maxResultRows = Integer.parseInt(maxResultRowsString);
- String exceptionOnMaxRowsString = env.getProperties().getProperty(
- ConnectorPropertyNames.EXCEPTION_ON_MAX_ROWS);
- maxResultRows = Math.max(0, maxResultRows);
- //if the connector work needs to throw an excpetion, set the size plus 1
- if (maxResultRows > 0 && Boolean.valueOf(exceptionOnMaxRowsString).booleanValue()) {
- maxResultRows++;
- }
- } catch (NumberFormatException e) {
- //this will already be logged by the connector worker
- }
- }
+ this.isValidTimeout = PropertiesUtils.getIntProperty(env.getProperties(), JDBCPropertyNames.IS_VALID_TIMEOUT, -1);
}
/**
@@ -538,6 +523,14 @@
stmt.setObject(i, param, type);
}
+ /**
+ * Execute a bulk insert on the given preparedstatement.
+ * @param conn
+ * @param stmt
+ * @param command
+ * @return
+ * @throws SQLException
+ */
public int executeStatementForBulkInsert(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException {
List rows = command.getPreparedValues();
int updateCount = 0;
@@ -558,17 +551,14 @@
return updateCount;
}
- public List modifyRow(List batch, ExecutionContext context, ICommand command) {
- return batch;
- }
-
- public int getMaxResultRows() {
- return maxResultRows;
- }
-
- /*
- * @see com.metamatrix.connector.jdbc.extension.ValueRetriever#retrieveValue(java.sql.ResultSet, int, java.lang.Class, java.util.Calendar)
- */
+ /**
+ * Retrieve the value on the current resultset row for the given column index.
+ * @param results
+ * @param columnIndex
+ * @param expectedType
+ * @return
+ * @throws SQLException
+ */
public Object retrieveValue(ResultSet results, int columnIndex, Class expectedType) throws SQLException {
Integer code = TYPE_CODE_MAP.get(expectedType);
if(code != null) {
@@ -647,6 +637,14 @@
return results.getObject(columnIndex);
}
+ /**
+ * Retrieve the value for the given parameter index
+ * @param results
+ * @param parameterIndex
+ * @param expectedType
+ * @return
+ * @throws SQLException
+ */
public Object retrieveValue(CallableStatement results, int parameterIndex, Class expectedType) throws SQLException{
Integer code = TYPE_CODE_MAP.get(expectedType);
if(code != null) {
@@ -719,7 +717,11 @@
// translation routines
return results.getObject(parameterIndex);
}
-
+
+ /**
+ * Called exactly once for this source.
+ * @param connection
+ */
protected void afterInitialConnectionCreation(Connection connection) {
// now dig some details about this driver/database for log.
try {
@@ -742,21 +744,82 @@
}
/**
+ * Provides a hook to call source specific logic when
+ * a connection is created.
+ *
* defect request 13979 & 13978
*/
public void afterConnectionCreation(Connection connection) {
if (initialConnection) {
- initialConnection = false;
- afterInitialConnectionCreation(connection);
+ synchronized (this) {
+ if (!initialConnection) {
+ return;
+ }
+ initialConnection = false;
+ afterInitialConnectionCreation(connection);
+ }
}
}
+ /**
+ * Returns a positive number if query testing should use the JDBC 4.0 isValid check.
+ * Can be set via the {@link JDBCPropertyNames#IS_VALID_TIMEOUT} property
+ * @return
+ */
public int getIsValidTimeout() {
return isValidTimeout;
}
+ /**
+ * Create the {@link SQLConversionVisitor} that will perform translation. Typical custom
+ * JDBC connectors will not need to create custom conversion visitors, rather implementors
+ * should override existing {@link Translator} methods.
+ * @return
+ */
public SQLConversionVisitor getSQLConversionVisitor() {
return new SQLConversionVisitor(this);
}
+ /**
+ * Get the default capabilities class. Will be used by {@link #getConnectorCapabilities()} to
+ * return a capabilities instance.
+ * @return
+ */
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return JDBCCapabilities.class;
+ }
+
+ /**
+ * Get the capabilties for the source.
+ * @return
+ * @throws ConnectorException
+ */
+ public ConnectorCapabilities getConnectorCapabilities() throws ConnectorException {
+ // create Capabilities
+ String className = this.environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS);
+ try {
+ ConnectorCapabilities result = null;
+ if (className != null && className.length() > 0) {
+ result = (ConnectorCapabilities) ReflectionHelper.create(
+ className, null, Thread.currentThread().getContextClassLoader());
+ } else {
+ result = getDefaultCapabilities().newInstance();
+ }
+
+ if (result instanceof JDBCCapabilities) {
+ String setCriteriaBatchSize = this.environment.getProperties().getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
+ if (setCriteriaBatchSize != null) {
+ int maxInCriteriaSize = Integer
+ .parseInt(setCriteriaBatchSize);
+ if (maxInCriteriaSize > 0) {
+ ((JDBCCapabilities) result).setMaxInCriteriaSize(maxInCriteriaSize);
+ }
+ }
+ }
+ return result;
+ } catch (Exception e) {
+ throw new ConnectorException(e);
+ }
+ }
+
}
Modified: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-03-12 21:48:48 UTC (rev 551)
@@ -19,12 +19,12 @@
<ComponentType Name="Apache Derby Embedded Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.941-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.941-06:00">
<PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.apache.derby.jdbc.EmbeddedDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
<PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:derby:<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
- <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
</ComponentType>
<ComponentType Name="Apache Derby Network Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.942-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.942-06:00">
<PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.apache.derby.jdbc.ClientDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
<PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:derby:<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
- <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
</ComponentType>
<ComponentType Name="MS Access Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.954-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.954-06:00">
<PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
@@ -38,13 +38,13 @@
<ComponentType Name="MySQL 4 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.938-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.938-06:00">
<PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
<PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mysql://<host>:3306/<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
- <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.mysql.MySQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.mysql.MySQLTranslator" IsExpert="true" />
<PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
</ComponentType>
<ComponentType Name="PostgreSQL 8 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.940-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.940-06:00">
<PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.postgresql.xa.PGXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
<PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:postgresql://<host>:5432;DatabaseName=/<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
- <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.postgresql.PostgreSQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator" IsExpert="true" />
<PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
</ComponentType>
<ComponentType Name="MetaMatrix JDBC 6 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="metamatrixadmin" LastChangedDate="2005-07-26T14:34:20.960-06:00" CreatedBy="metamatrixadmin" CreationDate="2005-07-26T14:34:20.960-06:00">
Modified: trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties 2009-03-12 21:48:48 UTC (rev 551)
@@ -43,6 +43,9 @@
JDBCConnector.JDBCConnector_stopped._3=JDBCConnector stopped.
JDBCConnector.JDBCConnector_started._4=JDBCConnector started.
JDBCConnector.JDBCConnector_is_not_started._5=JDBCConnector is not started.
+JDBCConnector.unsupported_identity_type=Unsupported identity type.
+JDBCConnector.non_xa_connection_source=Connection source does not support XA.
+JDBCConnector.invalid_source=Specified connection source {0} is not a XADataSource, DataSource, or Driver
BlobValueReference.Unable_to_read_BLOB_data=Unable to read BLOB data from InputStream.
ClobValueReference.Unable_to_read_CLOB_data=Unable to read CLOB data from character stream.
Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCConnector.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCConnector.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -28,16 +28,20 @@
import org.junit.Test;
import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.xa.XAJDBCPropertyNames;
+import org.teiid.connector.jdbc.translator.Translator;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+
public class TestJDBCConnector {
public void helpTestMaxIn(int setting, int expected) throws Exception {
Properties connProps = new Properties();
connProps.setProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE, String.valueOf(setting));
- connProps.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, SimpleCapabilities.class.getName());
- ConnectorCapabilities caps = JDBCConnector.createCapabilities(connProps, this.getClass().getClassLoader());
+ connProps.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, SimpleCapabilities.class.getName());
+ Translator t = new Translator();
+ t.initialize(EnvironmentUtility.createEnvironment(connProps));
+ ConnectorCapabilities caps = t.getConnectorCapabilities();
int maxIn = caps.getMaxInCriteriaSize();
assertEquals(expected, maxIn);
}
@@ -63,11 +67,11 @@
Properties props = new Properties();
JDBCConnector.parseURL(urlWithEmptyProp, props);
- assertEquals("aPort", props.getProperty(XAJDBCPropertyNames.PORT_NUMBER));
- assertEquals("aHost", props.getProperty(XAJDBCPropertyNames.SERVER_NAME));
- assertEquals("XADS_aHost_null", props.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME));
- assertEquals("aBogusProp", props.getProperty("bogusprop"));
- assertNull(props.getProperty("unemptyprop"));
+ assertEquals("aPort", props.getProperty(XAJDBCPropertyNames.PORT_NUMBER)); //$NON-NLS-1$
+ assertEquals("aHost", props.getProperty(XAJDBCPropertyNames.SERVER_NAME)); //$NON-NLS-1$
+ assertEquals("XADS_aHost_null", props.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME)); //$NON-NLS-1$
+ assertEquals("aBogusProp", props.getProperty("bogusprop")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertNull(props.getProperty("unemptyprop")); //$NON-NLS-1$
}
}
Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.List;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
@@ -134,5 +135,10 @@
}
return comment;
}
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return OracleSpatialCapabilities.class;
+ }
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -336,7 +336,7 @@
this.synchWorkers = PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.SYNCH_WORKERS, true);
// Initialize and start the connector
- initStartConnector(connectorName, connectorEnv);
+ initStartConnector(connectorEnv);
this.started = true;
}
@@ -346,7 +346,7 @@
* @param env
* @throws ApplicationLifecycleException
*/
- private void initStartConnector(String connectorName, ConnectorEnvironment env) throws ApplicationLifecycleException {
+ private void initStartConnector(ConnectorEnvironment env) throws ApplicationLifecycleException {
String connectorClassName = env.getProperties().getProperty(ConnectorPropertyNames.CONNECTOR_CLASS);
if(classloader == null){
classloader = getClass().getClassLoader();
@@ -363,12 +363,15 @@
} catch (MetaMatrixCoreException e) {
throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_find_Connector_class", connectorClassName)); //$NON-NLS-1$
}
- if(c instanceof XAConnector){
- this.isXa = true;
+ this.isXa = PropertiesUtils.getBooleanProperty(env.getProperties(), ConnectorPropertyNames.IS_XA, false);
+ if (this.isXa) {
+ if(!(c instanceof XAConnector)){
+ throw new ApplicationLifecycleException(DQPPlugin.Util.getString("non_xa_connector", connectorName)); //$NON-NLS-1$
+ }
if (this.getTransactionService() == null) {
throw new ApplicationLifecycleException(DQPPlugin.Util.getString("no_txn_manager", connectorName)); //$NON-NLS-1$
}
- }
+ }
if (this.synchWorkers) {
SynchronousWorkers synchWorkerAnnotation = (SynchronousWorkers) c.getClass().getAnnotation(SynchronousWorkers.class);
if (synchWorkerAnnotation != null) {
Modified: trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-03-12 21:48:48 UTC (rev 551)
@@ -57,6 +57,7 @@
ConnectorManager.cannot_restart=Cannot restart ConnectorManager
ConnectorManager.cannot_add_to_recovery=Connector ''{0}'' does not support single identity connections, it cannot participate in recovery
ConnectorManager.asynch_worker_warning=Setting ''{0}'' to false with pooling enabled is not recommended. If connector threads become exhausted normal execution closure will not be possible.
+non_xa_connector=Connector \"{0}\" was configured to support XA transactions, but the connector is not an XAConnector
no_txn_manager=No Transaction Manger found in the configuration, Failed to start connector \"{0}\"
Connector_State_not_active=Connector request state is not active for request {0} in Connector {1}
Missing_required_property=Connector is missing required property {0} or wrong value supplied {1}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java 2009-03-12 16:07:02 UTC (rev 550)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java 2009-03-12 21:48:48 UTC (rev 551)
@@ -137,13 +137,22 @@
ConnectorManager cm = new ConnectorManager();
Properties props = new Properties();
props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
+ props.setProperty(ConnectorPropertyNames.IS_XA, Boolean.TRUE.toString());
startConnectorManager(cm, props);
assertTrue(cm.isXa());
cm.stop();
- cm = new ConnectorManager();
+ }
+
+ public void testIsXA_Failure() throws Exception {
+ ConnectorManager cm = new ConnectorManager();
+ Properties props = new Properties();
props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeSourceConnectionFactory.class.getName());
- startConnectorManager(cm, props);
- assertFalse(cm.isXa());
+ props.setProperty(ConnectorPropertyNames.IS_XA, Boolean.TRUE.toString());
+ try {
+ startConnectorManager(cm, props);
+ } catch (ApplicationLifecycleException e) {
+ assertEquals("Connector \"Unknown_Binding_Name<null>\" was configured to support XA transactions, but the connector is not an XAConnector", e.getMessage()); //$NON-NLS-1$
+ }
cm.stop();
}
@@ -151,7 +160,7 @@
ConnectorManager cm = new ConnectorManager();
Properties props = new Properties();
final String connectorName = FakeConnector.class.getName();
- props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, connectorName);//$NON-NLS-1$
+ props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, connectorName);
URLClassLoader cl = new URLClassLoader(new URL[0]);
startConnectorManager(cm, props);
((FakeConnector)cm.getConnector().getActualConnector()).setClassloader(cl);
16 years, 6 months
teiid SVN: r550 - in trunk: common-core/src/main/java/com/metamatrix/common/types/basic and 8 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-12 12:07:02 -0400 (Thu, 12 Mar 2009)
New Revision: 550
Added:
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestFunctionResolving.java
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java
trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java
trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionParameter.java
trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
Log:
TEIID-243 TEIID-413 TEIID-414 adding vararg support, better java method resolution, and fixing isNarrowing for long and integer conversions
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -30,6 +30,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -136,10 +137,10 @@
}
/** Base data type names and classes, Type name --> Type class */
- private static Map<String, Class> dataTypeNames = new HashMap<String, Class>();
+ private static Map<String, Class> dataTypeNames = new LinkedHashMap<String, Class>();
/** Base data type names and classes, Type class --> Type name */
- private static Map<Class, String> dataTypeClasses = new HashMap<Class, String>();
+ private static Map<Class, String> dataTypeClasses = new LinkedHashMap<Class, String>();
private static Set<String> DATA_TYPE_NAMES = Collections
.unmodifiableSet(dataTypeNames.keySet());
@@ -516,8 +517,6 @@
* Load default data types.
*/
static void loadDataTypes() {
- DataTypeManager.addDataType(DefaultDataTypes.STRING,
- DefaultDataClasses.STRING);
DataTypeManager.addDataType(DefaultDataTypes.BOOLEAN,
DefaultDataClasses.BOOLEAN);
DataTypeManager.addDataType(DefaultDataTypes.BYTE,
@@ -544,16 +543,18 @@
DefaultDataClasses.TIME);
DataTypeManager.addDataType(DefaultDataTypes.TIMESTAMP,
DefaultDataClasses.TIMESTAMP);
+ DataTypeManager.addDataType(DefaultDataTypes.STRING,
+ DefaultDataClasses.STRING);
+ DataTypeManager.addDataType(DefaultDataTypes.CLOB,
+ DefaultDataClasses.CLOB);
+ DataTypeManager.addDataType(DefaultDataTypes.XML,
+ DefaultDataClasses.XML);
DataTypeManager.addDataType(DefaultDataTypes.OBJECT,
DefaultDataClasses.OBJECT);
DataTypeManager.addDataType(DefaultDataTypes.NULL,
DefaultDataClasses.NULL);
DataTypeManager.addDataType(DefaultDataTypes.BLOB,
DefaultDataClasses.BLOB);
- DataTypeManager.addDataType(DefaultDataTypes.CLOB,
- DefaultDataClasses.CLOB);
- DataTypeManager.addDataType(DefaultDataTypes.XML,
- DefaultDataClasses.XML);
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -58,5 +58,10 @@
public Class getTargetType() {
return Float.class;
}
+
+ @Override
+ public boolean isNarrowing() {
+ return true;
+ }
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -58,5 +58,10 @@
public Class getTargetType() {
return Double.class;
}
+
+ @Override
+ public boolean isNarrowing() {
+ return true;
+ }
}
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-03-12 16:07:02 UTC (rev 550)
@@ -1591,13 +1591,13 @@
</row>
<row>
<entry>
- <para>COALESCE(x,y)</para>
+ <para>COALESCE(x,y+)</para>
</entry>
<entry>
<para>Returns the first non-null parameter</para>
</entry>
<entry>
- <para>x, y can be any type</para>
+ <para>x and all y's can be any compatible types</para>
</entry>
</row>
</tbody>
@@ -2125,12 +2125,6 @@
</para>
</listitem>
<listitem>
- <para>All input arguments defined on function must be java.lang.Object.</para>
- </listitem>
- <listitem>
- <para>Returned value must be declared as java.lang.Object.</para>
- </listitem>
- <listitem>
<para>Any exception can be thrown, but Teiid will rethrow the exception as a <classname>FunctionExecutionException</classname>.</para>
</listitem>
</itemizedlist>
@@ -2146,10 +2140,11 @@
* @param doubleCelsiusTemp
* @return Fahrenheit
*/
- public static Object celsiusToFahrenheit(Object doubleCelsiusTemp){
- double celsiusTemp = ((Double)doubleCelsiusTemp).doubleValue();
- double fahrenheitTemp = (celsiusTemp)*9/5 + 32;
- return new Double(fahrenheitTemp);
+ public static Double celsiusToFahrenheit(Double doubleCelsiusTemp){
+ if (doubleCelsiusTemp == null) {
+ return null;
+ }
+ return (doubleCelsiusTemp)*9/5 + 32;
}
}]]></programlisting>
</example>
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -238,8 +238,9 @@
//Iterate over the parameters adding conversions where required or failing when
//no implicit conversion is possible
int i = 0;
- for(; i < types.length; i++) {
- final String tmpTypeName = methodTypes[i].getType();
+ for(; i < types.length; i++) {
+ //treat all varags as the same type
+ final String tmpTypeName = methodTypes[Math.min(i, methodTypes.length - 1)].getType();
Class targetType = DataTypeManager.getDataTypeClass(tmpTypeName);
Class sourceType = types[i];
@@ -322,6 +323,14 @@
if(fd == null) {
throw new InvalidFunctionException(ErrorMessageKeys.FUNCTION_0001, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0001, fd));
+ }
+
+ if (!fd.isNullDependent()) {
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] == null) {
+ return null;
+ }
+ }
}
// If descriptor is missing invokable method, find this VM's descriptor
@@ -338,10 +347,16 @@
if (method == null){
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0002, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0002, localDescriptor.getName()));
}
- }
-
+ }
+
// Invoke the method and return the result
- try {
+ try {
+ if (method.isVarArgs()) {
+ int i = method.getParameterTypes().length;
+ Object[] newValues = Arrays.copyOf(values, i);
+ newValues[i - 1] = Arrays.copyOfRange(values, i - 1, values.length);
+ values = newValues;
+ }
Object result = method.invoke(null, values);
result = DataTypeManager.convertToRuntimeType(result);
result = DataTypeManager.transformValue(result, fd.getReturnType());
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -50,9 +50,7 @@
// ================== Function = plus =====================
public static Object plus(Object x, Object y) throws FunctionExecutionException {
- if(x == null || y == null) {
- return null;
- } else if(x instanceof Integer) {
+ if(x instanceof Integer) {
if(y instanceof Integer) {
return new Integer(((Integer)x).intValue() + ((Integer)y).intValue());
}
@@ -84,9 +82,7 @@
// ================== Function = minus =====================
public static Object minus(Object x, Object y) throws FunctionExecutionException {
- if(x == null || y == null) {
- return null;
- } else if(x instanceof Integer) {
+ if(x instanceof Integer) {
if(y instanceof Integer) {
return new Integer(((Integer)x).intValue() - ((Integer)y).intValue());
}
@@ -118,9 +114,7 @@
// ================== Function = multiply =====================
public static Object multiply(Object x, Object y) throws FunctionExecutionException {
- if(x == null || y == null) {
- return null;
- } else if(x instanceof Integer) {
+ if(x instanceof Integer) {
if(y instanceof Integer) {
return new Integer(((Integer)x).intValue() * ((Integer)y).intValue());
}
@@ -152,9 +146,7 @@
// ================== Function = divide =====================
public static Object divide(Object x, Object y) throws FunctionExecutionException {
- if(x == null || y == null) {
- return null;
- } else if(x instanceof Integer) {
+ if(x instanceof Integer) {
if(y instanceof Integer) {
return new Integer(((Integer)x).intValue() / ((Integer)y).intValue());
}
@@ -186,9 +178,7 @@
// ================== Function = abs =====================
public static Object abs(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Integer) {
+ if(x instanceof Integer) {
return new Integer(Math.abs(((Integer)x).intValue()));
} else if(x instanceof Long) {
return new Long(Math.abs(((Long)x).longValue()));
@@ -207,64 +197,34 @@
// ================== Function = ceiling =====================
- public static Object ceiling(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Double) {
- return new Double(Math.ceil(((Double)x).doubleValue()));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "ceiling", x.getClass().getName())); //$NON-NLS-1$
+ public static Object ceiling(Double x) {
+ return new Double(Math.ceil(x));
}
// ================== Function = exp =====================
- public static Object exp(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Double) {
- return new Double(Math.exp(((Double)x).doubleValue()));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "exp", x.getClass().getName())); //$NON-NLS-1$
+ public static Object exp(Double x) {
+ return new Double(Math.exp(x));
}
// ================== Function = floor =====================
- public static Object floor(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Double) {
- return new Double(Math.floor(((Double)x).doubleValue()));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "floor", x.getClass().getName())); //$NON-NLS-1$
+ public static Object floor(Double x) {
+ return new Double(Math.floor(x.doubleValue()));
}
// ================== Function = log =====================
- public static Object log(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Double) {
- return new Double(Math.log(((Double)x).doubleValue()));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "log", x.getClass().getName())); //$NON-NLS-1$
+ public static Object log(Double x) {
+ return new Double(Math.log(x));
}
// ================== Function = log10 =====================
private static final double log10baseE = Math.log(10);
- public static Object log10(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Double) {
- return new Double( Math.log(((Double)x).doubleValue()) / log10baseE);
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "log10", x.getClass().getName())); //$NON-NLS-1$
+ public static Object log10(Double x) {
+ return new Double( Math.log(x) / log10baseE);
}
// ================== Function = rand=====================
@@ -429,20 +389,8 @@
// ================== Function = sqrt =====================
- public static Object sqrt(Object x) throws FunctionExecutionException {
- if(x == null) {
- return null;
- } else if(x instanceof Integer) {
- return new Double( Math.sqrt(((Integer)x).intValue()));
- } else if(x instanceof Long) {
- return new Double( Math.sqrt(((Long)x).longValue()));
- } else if(x instanceof Float) {
- return new Double( Math.sqrt(((Float)x).floatValue()));
- } else if(x instanceof Double) {
- return new Double( Math.sqrt(((Double)x).doubleValue()));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "sqrt", x.getClass().getName())); //$NON-NLS-1$
+ public static Object sqrt(Number x) {
+ return new Double( Math.sqrt(x.doubleValue()));
}
// ================== Function = currentDate =====================
@@ -477,116 +425,44 @@
static final String[] dayNames = new String[] {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- public static Object dayName(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- // Day of week is 1-based - convert to 0-based for lookup
- return dayNames[getField((Date)x, Calendar.DAY_OF_WEEK) - 1];
- } else if(x instanceof Timestamp) {
- // Day of week is 1-based - convert to 0-based for lookup
- return dayNames[getField((Timestamp)x, Calendar.DAY_OF_WEEK) - 1];
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayName", x.getClass().getName())); //$NON-NLS-1$
+ public static Object dayName(Date x) {
+ return dayNames[getField(x, Calendar.DAY_OF_WEEK) - 1];
}
// ================== Function = dayofmonth =====================
- public static Object dayOfMonth(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.DATE));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.DATE));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfMonth", x.getClass().getName())); //$NON-NLS-1$
+ public static Object dayOfMonth(Date x) {
+ return Integer.valueOf(getField(x, Calendar.DATE));
}
// ================== Function = dayofweek =====================
- public static Object dayOfWeek(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.DAY_OF_WEEK));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.DAY_OF_WEEK));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfWeek", x.getClass().getName())); //$NON-NLS-1$
+ public static Object dayOfWeek(Date x) {
+ return Integer.valueOf(getField(x, Calendar.DAY_OF_WEEK));
}
// ================== Function = dayofyear =====================
- public static Object dayOfYear(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.DAY_OF_YEAR));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.DAY_OF_YEAR));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfYear", x.getClass().getName())); //$NON-NLS-1$
+ public static Object dayOfYear(Date x) {
+ return Integer.valueOf(getField(x, Calendar.DAY_OF_YEAR));
}
// ================== Function = hour =====================
- public static Object hour(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Time) {
- return Integer.valueOf(getField((Time)x, Calendar.HOUR_OF_DAY));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.HOUR_OF_DAY));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "hour", x.getClass().getName())); //$NON-NLS-1$
+ public static Object hour(Date x) {
+ return Integer.valueOf(getField(x, Calendar.HOUR_OF_DAY));
}
// ================== Function = minute =====================
- public static Object minute(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Time) {
- return Integer.valueOf(getField((Time)x, Calendar.MINUTE));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.MINUTE));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "minute", x.getClass().getName())); //$NON-NLS-1$
+ public static Object minute(Date x) {
+ return Integer.valueOf(getField(x, Calendar.MINUTE));
}
// ================== Function = month =====================
- public static Object month(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.MONTH)+1);
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.MONTH)+1);
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "month", x.getClass().getName())); //$NON-NLS-1$
+ public static Object month(Date x) {
+ return Integer.valueOf(getField(x, Calendar.MONTH)+1);
}
// ================== Function = monthname =====================
@@ -595,81 +471,34 @@
"January", "February", "March", "April", "May", "June", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"July", "August", "September", "October", "November", "December" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- public static Object monthName(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return monthNames[getField((Date)x, Calendar.MONTH)];
- } else if(x instanceof Timestamp) {
- return monthNames[getField((Timestamp)x, Calendar.MONTH)];
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "monthName", x.getClass().getName())); //$NON-NLS-1$
+ public static Object monthName(Date x) {
+ return monthNames[getField(x, Calendar.MONTH)];
}
// ================== Function = second =====================
- public static Object second(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Time) {
- return Integer.valueOf(getField((Time)x, Calendar.SECOND));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.SECOND));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "second", x.getClass().getName())); //$NON-NLS-1$
+ public static Object second(Date x) {
+ return Integer.valueOf(getField(x, Calendar.SECOND));
}
// ================== Function = week =====================
- public static Object week(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.WEEK_OF_YEAR));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.WEEK_OF_YEAR));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "week", x.getClass().getName())); //$NON-NLS-1$
+ public static Object week(Date x) {
+ return Integer.valueOf(getField(x, Calendar.WEEK_OF_YEAR));
}
// ================== Function = year =====================
- public static Object year(Object x)
- throws FunctionExecutionException {
-
- if(x == null) {
- return null;
- } else if(x instanceof Date) {
- return Integer.valueOf(getField((Date)x, Calendar.YEAR));
- } else if(x instanceof Timestamp) {
- return Integer.valueOf(getField((Timestamp)x, Calendar.YEAR));
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "year", x.getClass().getName())); //$NON-NLS-1$
+ public static Object year(Date x) {
+ return Integer.valueOf(getField(x, Calendar.YEAR));
}
// ================== Function = quarter =====================
- public static Object quarter(Object date)
+ public static Object quarter(Date date)
throws FunctionExecutionException {
- int month = 12;
-
- if(date == null) {
- return null;
- } else if(date instanceof Date) {
- month = getField((Date)date, Calendar.MONTH);
- } else if(date instanceof Timestamp) {
- month = getField((Timestamp)date, Calendar.MONTH);
- }
+ int month = getField(date, Calendar.MONTH);
+
if (month > 11) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0066, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0066,
new Object[] {"quarter", date.getClass().getName()})); //$NON-NLS-1$
@@ -679,64 +508,60 @@
// ================== Function = timestampadd =====================
- public static Object timestampAdd(Object interval, Object count, Object timestamp)
- throws FunctionExecutionException {
+ public static Object timestampAdd(String intervalType, Integer count, Timestamp timestamp) {
Calendar cal = TimestampWithTimezone.getCalendar();
- if (interval == null || count == null || timestamp == null) {
- return null;
- } else if (interval instanceof String && count instanceof Integer) {
- String intervalType = (String) interval;
- if (timestamp instanceof Timestamp) {
- int nanos = ((Timestamp) timestamp).getNanos();
- cal.setTime((Timestamp) timestamp);
+ int nanos = timestamp.getNanos();
+ cal.setTime(timestamp);
- // case of interval = 1, fractional seconds (nanos), don't go to branches of addField()
- if (intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_FRAC_SECOND)) {
- int countValue = ((Integer) count).intValue();
- nanos += countValue;
+ // case of interval = 1, fractional seconds (nanos), don't go to branches of addField()
+ if (intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_FRAC_SECOND)) {
+ int countValue = count.intValue();
+ nanos += countValue;
- // Handle the case of nanos > 999,999,999 and increase the second.
- // Since the count number is an interger, so the maximum is definite,
- // and nanos/999,999,999 can at most be added to second
- if ( nanos > 999999999) {
- int addSecond = nanos / 999999999;
- int leftNanos = nanos % 999999999;
- cal.add(Calendar.SECOND, addSecond);
+ // Handle the case of nanos > 999,999,999 and increase the second.
+ // Since the count number is an interger, so the maximum is definite,
+ // and nanos/999,999,999 can at most be added to second
+ if ( nanos > 999999999) {
+ int addSecond = nanos / 999999999;
+ int leftNanos = nanos % 999999999;
+ cal.add(Calendar.SECOND, addSecond);
- Timestamp ts = new Timestamp(cal.getTime().getTime());
- ts.setNanos(leftNanos);
- return ts;
- }
- // nanos <= 999,999,999
- Timestamp ts = new Timestamp(cal.getTime().getTime());
- ts.setNanos(nanos);
- return ts;
- }
- // for interval from 2 to 9
- addField(intervalType, (Integer)count, cal);
Timestamp ts = new Timestamp(cal.getTime().getTime());
-
- //rectify returned timestamp with original nanos
- ts.setNanos(nanos);
+ ts.setNanos(leftNanos);
return ts;
- } else if (timestamp instanceof Time) {
- // Note: if dates are different, for example, days are different, the times
- // are still different even they may have the same hours, minutes and seconds.
- cal.setTime((Time) timestamp);
- addField(intervalType, (Integer)count, cal);
- return TimestampWithTimezone.createTime(cal.getTime());
- } else if (timestamp instanceof Date) {
- cal.setTime((Date) timestamp);
- addField(intervalType, (Integer)count, cal);
- return TimestampWithTimezone.createDate(cal.getTime());
- }
+ }
+ // nanos <= 999,999,999
+ Timestamp ts = new Timestamp(cal.getTime().getTime());
+ ts.setNanos(nanos);
+ return ts;
}
+ // for interval from 2 to 9
+ addField(intervalType, count, cal);
+ Timestamp ts = new Timestamp(cal.getTime().getTime());
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0067, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0067,
- new Object[] {"timestampAdd", interval.getClass().getName(), count.getClass().getName(), timestamp.getClass().getName() })); //$NON-NLS-1$
+ //rectify returned timestamp with original nanos
+ ts.setNanos(nanos);
+ return ts;
}
+
+ public static Object timestampAdd(String intervalType, Integer count, java.sql.Date timestamp) {
+ Calendar cal = TimestampWithTimezone.getCalendar();
+ // Note: if dates are different, for example, days are different, the times
+ // are still different even they may have the same hours, minutes and seconds.
+ cal.setTime(timestamp);
+ addField(intervalType, count, cal);
+ return TimestampWithTimezone.createDate(cal.getTime());
+ }
+
+ public static Object timestampAdd(String intervalType, Integer count, Time timestamp) {
+ Calendar cal = TimestampWithTimezone.getCalendar();
+ cal.setTime(timestamp);
+ addField(intervalType, count, cal);
+ return TimestampWithTimezone.createTime(cal.getTime());
+ }
+
/** Helper method for timestampAdd method
* @param interval Integer
* @param count Integer
@@ -768,6 +593,10 @@
// ================== Function = timestampdiff =====================
+ public static Object timestampDiff(String intervalType, Time timestamp1, Time timestamp2) {
+ return timestampDiff(intervalType, new Timestamp(timestamp1.getTime()), new Timestamp(timestamp2.getTime()));
+ }
+
/**
* This method truncates (ignores) figures
* @param interval
@@ -776,59 +605,36 @@
* @return
* @throws FunctionExecutionException
*/
- public static Object timestampDiff(Object interval, Object timestamp1, Object timestamp2)
- throws FunctionExecutionException {
+ public static Object timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) {
+ long ts1 = ts1Obj.getTime() / 1000 * 1000000000 + ts1Obj.getNanos();
+ long ts2 = ts2Obj.getTime() / 1000 * 1000000000 + ts2Obj.getNanos();
+
+ long tsDiff = ts2 - ts1;
- if (interval == null || timestamp1 == null || timestamp2 == null) {
- return null;
- } else if (interval instanceof String) {
- String intervalType = (String) interval;
- // Incoming can be time or timestamp - convert to timestamp
- if(timestamp1 instanceof Time) {
- Time t1 = (Time)timestamp1;
- timestamp1 = new Timestamp(t1.getTime());
- }
- if(timestamp2 instanceof Time) {
- Time t2 = (Time)timestamp2;
- timestamp2 = new Timestamp(t2.getTime());
- }
- // In nanos
- Timestamp ts1Obj = (Timestamp)timestamp1;
- Timestamp ts2Obj = (Timestamp)timestamp2;
-
- long ts1 = ts1Obj.getTime() / 1000 * 1000000000 + ts1Obj.getNanos();
- long ts2 = ts2Obj.getTime() / 1000 * 1000000000 + ts2Obj.getNanos();
-
- long tsDiff = ts2 - ts1;
-
- long count = 0;
- if(interval.equals(ReservedWords.SQL_TSI_FRAC_SECOND)) {
- count = tsDiff;
- } else {
- tsDiff = tsDiff / 1000000; //convert to milliseconds
- if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_SECOND)) {
- count = tsDiff / 1000;
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_MINUTE)) {
- count = (tsDiff / 1000) / 60;
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_HOUR)) {
- count = (tsDiff / 1000) / (60*60);
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_DAY)) {
- count = (tsDiff / 1000) / (60*60*24);
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_WEEK)) {
- count = (tsDiff / 1000) / (60*60*24*7);
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_MONTH)) {
- count = (tsDiff / 1000) / (60*60*24*30);
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_QUARTER)) {
- count = (tsDiff / 1000) / (60*60*24*91);
- } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_YEAR)) {
- count = (tsDiff / 1000) / (60*60*24*365);
- }
- }
- return new Long(count);
+ long count = 0;
+ if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_FRAC_SECOND)) {
+ count = tsDiff;
+ } else {
+ tsDiff = tsDiff / 1000000; //convert to milliseconds
+ if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_SECOND)) {
+ count = tsDiff / 1000;
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_MINUTE)) {
+ count = (tsDiff / 1000) / 60;
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_HOUR)) {
+ count = (tsDiff / 1000) / (60*60);
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_DAY)) {
+ count = (tsDiff / 1000) / (60*60*24);
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_WEEK)) {
+ count = (tsDiff / 1000) / (60*60*24*7);
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_MONTH)) {
+ count = (tsDiff / 1000) / (60*60*24*30);
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_QUARTER)) {
+ count = (tsDiff / 1000) / (60*60*24*91);
+ } else if(intervalType.equalsIgnoreCase(ReservedWords.SQL_TSI_YEAR)) {
+ count = (tsDiff / 1000) / (60*60*24*365);
+ }
}
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0067, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0067,
- new Object[] {"timestampDiff", interval.getClass().getName(),timestamp1.getClass().getName(),timestamp2.getClass().getName() })); //$NON-NLS-1$
+ return new Long(count);
}
// ================== Function = timestampcreate =====================
@@ -841,19 +647,14 @@
* @return
* @throws FunctionExecutionException
*/
- public static Object timestampCreate(Object date, Object time) {
-
- if (date == null || time == null) {
- return null;
- }
-
+ public static Object timestampCreate(java.sql.Date date, Time time) {
Calendar tsCal = TimestampWithTimezone.getCalendar();
- tsCal.setTime((java.sql.Time)time);
+ tsCal.setTime(time);
int hour = tsCal.get(Calendar.HOUR_OF_DAY);
int minute = tsCal.get(Calendar.MINUTE);
int second = tsCal.get(Calendar.SECOND);
- tsCal.setTime((java.sql.Date)date);
+ tsCal.setTime(date);
tsCal.set(Calendar.HOUR_OF_DAY, hour);
tsCal.set(Calendar.MINUTE, minute);
@@ -864,51 +665,19 @@
// ================== Function = length =====================
- public static Object length(Object str)
- throws FunctionExecutionException {
-
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- return new Integer(((String)str).length());
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "length", str.getClass().getName())); //$NON-NLS-1$
+ public static Object length(String str) {
+ return new Integer(str.length());
}
// ================== Function = concat =====================
- public static Object concat(Object str1, Object str2)
- throws FunctionExecutionException {
-
- if(str1 == null || str2 == null) {
- return null;
- } else if(str1 instanceof String && str2 instanceof String) {
- return (String) str1 + (String) str2;
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"concat", str1.getClass().getName(), str2.getClass().getName()})); //$NON-NLS-1$
+ public static Object concat(String str1, String str2) {
+ return str1 + str2;
}
// ================== Function = substring =====================
- public static Object substring(Object str, Object start, Object length)
- throws FunctionExecutionException {
-
- if(str == null || start == null || length == null) {
- return null;
- }
- if(str instanceof String && start instanceof Integer && length instanceof Integer) {
- String string = (String) str;
- int startVal = ((Integer)start).intValue();
- int lengthVal = ((Integer)length).intValue();
- return substring(string, startVal, lengthVal);
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0013, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0013, new Object[]{"substring", str.getClass().getName(), start.getClass().getName(), length.getClass().getName()} )); //$NON-NLS-1$
- }
-
- private static Object substring(String string, int startVal, int lengthVal) {
+ public static Object substring(String string, Integer startVal, Integer lengthVal) {
if (startVal < 0) {
startVal = string.length() + startVal;
} else if (startVal > 0){
@@ -928,280 +697,178 @@
return string.substring(startVal, endVal);
}
- public static Object substring(Object str, Object start)
- throws FunctionExecutionException {
-
- if(str == null || start == null) {
- return null;
- } else if(str instanceof String && start instanceof Integer) {
- String string = (String) str;
- int startVal = ((Integer)start).intValue();
- return substring(string, startVal, string.length());
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"substring", str.getClass().getName(), start.getClass().getName()})); //$NON-NLS-1$
+ public static Object substring(String string, Integer start) {
+ int startVal = start.intValue();
+ return substring(string, startVal, string.length());
}
// ================== Function = left =====================
- public static Object left(Object str, Object count)
+ public static Object left(String string, Integer count)
throws FunctionExecutionException {
-
- if(str == null || count == null) {
- return null;
- } else if(str instanceof String && count instanceof Integer) {
-
- String string = (String) str;
- int countValue = ((Integer)count).intValue();
- if(countValue < 0) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0017, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0017, countValue));
- } else if(string.length() < countValue) {
- return string;
- } else {
- return string.substring(0, countValue);
- }
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"left", str.getClass().getName(), count.getClass().getName()})); //$NON-NLS-1$
+ int countValue = count.intValue();
+ if(countValue < 0) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0017, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0017, countValue));
+ }
+ if(string.length() < countValue) {
+ return string;
+ }
+ return string.substring(0, countValue);
}
// ================== Function = right =====================
- public static Object right(Object str, Object count)
+ public static Object right(String string, Integer count)
throws FunctionExecutionException {
-
- if(str == null || count == null) {
- return null;
- } else if(str instanceof String && count instanceof Integer) {
-
- String string = (String) str;
- int countValue = ((Integer)count).intValue();
- if(countValue < 0) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0017, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0017, countValue));
- } else if(string.length() < countValue) {
- return string;
- } else {
- return string.substring(string.length() - countValue);
- }
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"right", str.getClass().getName(), count.getClass().getName()})); //$NON-NLS-1$
+ int countValue = count.intValue();
+ if(countValue < 0) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0017, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0017, countValue));
+ } else if(string.length() < countValue) {
+ return string;
+ } else {
+ return string.substring(string.length() - countValue);
+ }
}
// ================== Function = lowercase =====================
- public static Object lowerCase(Object str)
- throws FunctionExecutionException {
-
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- return ((String)str).toLowerCase();
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "lowerCase", str.getClass().getName())); //$NON-NLS-1$
+ public static Object lowerCase(String str) {
+ return str.toLowerCase();
}
// ================== Function = uppercase =====================
- public static Object upperCase(Object str)
- throws FunctionExecutionException {
-
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- return ((String)str).toUpperCase();
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "upperCase", str.getClass().getName())); //$NON-NLS-1$
+ public static Object upperCase(String str) {
+ return str.toUpperCase();
}
// ================== Function = locate =====================
- public static Object locate(Object sub, Object str)
- throws FunctionExecutionException {
-
- if(str == null || sub == null) {
- return null;
- } else if(sub instanceof String && str instanceof String) {
- return new Integer(((String)str).indexOf((String)sub) + 1);
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"locate", sub.getClass().getName(), str.getClass().getName()})); //$NON-NLS-1$
+ public static Object locate(String sub, String str) {
+ return locate(sub, str, 1);
}
- public static Object locate(Object sub, Object str, Object start)
- throws FunctionExecutionException {
-
+ /**
+ * TODO: The treatment of negative start indexes is inconsistent here.
+ * We're treating the null value like Derby, but not throwing an
+ * exception if the value is less than 1 (less than 0 in DB2).
+ */
+ public static Object locate(String sub, String str, Integer start) {
if(str == null || sub == null) {
return null;
- } else if(sub instanceof String && str instanceof String) {
- if(start == null) {
- return new Integer(((String)str).indexOf((String)sub) + 1);
- } else if(start instanceof Integer) {
- return new Integer(((String)str).indexOf((String)sub, ((Integer)start).intValue() - 1) + 1);
- }
+ }
+ if (start == null) {
+ start = 1;
}
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0013, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0013, new Object[]{"locate", sub.getClass().getName() ,str.getClass().getName(), start.getClass().getName()})); //$NON-NLS-1$
+ return new Integer(str.indexOf(sub, start.intValue() - 1) + 1);
}
// ================== Function = lefttrim =====================
private static final char SPACE = ' ';
- public static Object leftTrim(Object str)
- throws FunctionExecutionException {
-
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- String string = (String) str;
- for(int i=0; i<string.length(); i++) {
- if(string.charAt(i) != SPACE) {
- // end of trim, return what's left
- return string.substring(i);
- }
+ public static Object leftTrim(String string) {
+ for(int i=0; i<string.length(); i++) {
+ if(string.charAt(i) != SPACE) {
+ // end of trim, return what's left
+ return string.substring(i);
}
-
- // All spaces, so trim it all
- return ""; //$NON-NLS-1$
}
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "leftTrim", str.getClass().getName())); //$NON-NLS-1$
+ // All spaces, so trim it all
+ return ""; //$NON-NLS-1$
}
// ================== Function = righttrim =====================
- public static Object rightTrim(Object str)
- throws FunctionExecutionException {
-
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- String string = (String) str;
-
- for(int i=string.length()-1; i>=0; i--) {
- if(string.charAt(i) != SPACE) {
- // end of trim, return what's left
- return string.substring(0, i+1);
- }
+ public static Object rightTrim(String string) {
+ for(int i=string.length()-1; i>=0; i--) {
+ if(string.charAt(i) != SPACE) {
+ // end of trim, return what's left
+ return string.substring(0, i+1);
}
-
- // All spaces, so trim it all
- return ""; //$NON-NLS-1$
}
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "rightTrim", str.getClass().getName())); //$NON-NLS-1$
+ // All spaces, so trim it all
+ return ""; //$NON-NLS-1$
}
// ================== Function = replace =====================
- public static Object replace(Object str, Object sub, Object replace)
- throws FunctionExecutionException {
+ public static Object replace(String string, String subString, String replaceString) {
+ // Check some simple cases that require no work
+ if(subString.length() > string.length() || string.length() == 0 || subString.length() == 0) {
+ return string;
+ }
- if(str == null || sub == null || replace == null) {
- return null;
- } else if(str instanceof String && sub instanceof String && replace instanceof String) {
- String string = (String) str;
- String subString = (String) sub;
- String replaceString = (String) replace;
+ StringBuffer result = new StringBuffer();
+ int index = 0;
- // Check some simple cases that require no work
- if(subString.length() > string.length() || string.length() == 0 || subString.length() == 0) {
- return string;
- }
+ while(true) {
+ int newIndex = string.indexOf(subString, index);
+ if(newIndex < 0) {
+ // No more replacement sections, grab from old index to end of string
+ result.append( string.substring(index) );
- StringBuffer result = new StringBuffer();
- int index = 0;
+ // Break out of loop
+ break;
- while(true) {
- int newIndex = string.indexOf(subString, index);
- if(newIndex < 0) {
- // No more replacement sections, grab from old index to end of string
- result.append( string.substring(index) );
+ }
+ // Matched the substring at newIndex
- // Break out of loop
- break;
+ // First append section from old index to new
+ result.append( string.substring( index, newIndex) );
- }
- // Matched the substring at newIndex
+ // Then append replacement section for sub
+ result.append( replaceString );
- // First append section from old index to new
- result.append( string.substring( index, newIndex) );
-
- // Then append replacement section for sub
- result.append( replaceString );
-
- // Then move the index counter forward
- index = newIndex + subString.length();
- }
-
- return result.toString();
+ // Then move the index counter forward
+ index = newIndex + subString.length();
}
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0013, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0013, new Object[]{"replace", str.getClass().getName(), sub.getClass().getName(), replace.getClass().getName()})); //$NON-NLS-1$
+ return result.toString();
}
// ================== Function = insert =====================
- public static Object insert(Object str1, Object start, Object length, Object str2)
+ public static Object insert(String string1, Integer start, Integer length, String str2)
throws FunctionExecutionException {
+ int startValue = start.intValue();
+ int len = length.intValue();
- if(str1 == null || start == null || length == null || str2 == null) {
- return null;
- } else if(str1 instanceof String && str2 instanceof String
- && start instanceof Integer && length instanceof Integer) {
+ // Check some invalid cases
+ if(startValue < 1 || (startValue-1) > string1.length()) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0061, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0061, start, string1));
+ } else if (len < 0) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0062, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0062, len));
+ } else if (string1.length() == 0 && (startValue > 1 || len >0) ) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0063, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0063));
+ }
- String string1 = (String) str1;
- int startValue = ((Integer) start).intValue();
- int len = ((Integer) length).intValue();
+ StringBuffer result = new StringBuffer();
+ result.append(string1.substring(0, startValue-1));
+ int endValue = startValue + len - 1;
- // Check some invalid cases
- if(startValue < 1 || (startValue-1) > ((String)str1).length()) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0061, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0061, start, str1));
- } else if (len < 0) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0062, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0062, len));
- } else if (((String) str1).length() == 0 && (startValue > 1 || len >0) ) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0063, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0063));
- }
-
- StringBuffer result = new StringBuffer();
- result.append(string1.substring(0, startValue-1));
- int endValue = startValue + len - 1;
-
- // str2.length() = 0 is a valid case
- if (endValue > ((String)str1).length()) {
- result.append((String) str2);
- } else {
- result.append((String) str2);
- result.append(string1.substring( endValue ));
- }
-
- return result.toString();
+ // str2.length() = 0 is a valid case
+ if (endValue > string1.length()) {
+ result.append(str2);
+ } else {
+ result.append(str2);
+ result.append(string1.substring( endValue ));
}
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0064, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0064,
- new Object[] {"insert", str1.getClass().getName(), start.getClass().getName(), length.getClass().getName() , str2.getClass().getName()})); //$NON-NLS-1$
+ return result.toString();
}
// ================== Function = repeat =====================
- public static Object repeat(Object str, Object count)
- throws FunctionExecutionException {
- if (str == null || count == null) {
- return null;
- } else if (str instanceof String && count instanceof Integer) {
- int repeatCount = ((Integer) count).intValue();
- StringBuffer result = new StringBuffer();
+ public static Object repeat(String str, Integer count) {
+ int repeatCount = count.intValue();
+ StringBuffer result = new StringBuffer();
- for (int i = 0; i < repeatCount && result.length() <= DataTypeManager.MAX_STRING_LENGTH; i++) {
- result.append((String)str);
- }
- return result.toString();
+ for (int i = 0; i < repeatCount && result.length() <= DataTypeManager.MAX_STRING_LENGTH; i++) {
+ result.append(str);
}
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0065, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0065,
- new Object[] {"repeat", str.getClass().getName(), count.getClass().getName()})); //$NON-NLS-1$
+ return result.toString();
}
// ================== Function = ascii =====================
@@ -1209,10 +876,6 @@
public static Object ascii(Object ch)
throws FunctionExecutionException {
- if(ch == null) {
- return null;
- }
-
char c = 0;
if(ch instanceof Character) {
c = ((Character) ch).charValue();
@@ -1232,65 +895,43 @@
// ================== Function = chr =====================
- public static Object chr(Object intValue) {
-
- if(intValue == null) {
- return null;
- }
-
- Integer theInt = (Integer) intValue;
-
- return new Character((char) theInt.intValue());
+ public static Object chr(int intValue) {
+ return new Character((char) intValue);
}
// ================== Function = initCap =====================
- public static Object initCap(Object str)
- throws FunctionExecutionException {
+ public static Object initCap(String s) {
+ StringBuffer cap = new StringBuffer();
- if(str == null) {
- return null;
- } else if(str instanceof String) {
- String s = (String) str;
- StringBuffer cap = new StringBuffer();
+ boolean checkCap = true;
+ for(int i=0; i<s.length(); i++) {
+ char c = s.charAt(i);
- boolean checkCap = true;
- for(int i=0; i<s.length(); i++) {
- char c = s.charAt(i);
-
- // Decide whether to upper case
- if(checkCap) {
- cap.append(Character.toUpperCase(c));
- } else {
- cap.append(Character.toLowerCase(c));
- }
-
- // Reset flag for next character
- checkCap = Character.isWhitespace(c);
+ // Decide whether to upper case
+ if(checkCap) {
+ cap.append(Character.toUpperCase(c));
+ } else {
+ cap.append(Character.toLowerCase(c));
}
- return cap.toString();
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "initCap", str.getClass().getName())); //$NON-NLS-1$
+ // Reset flag for next character
+ checkCap = Character.isWhitespace(c);
+ }
+ return cap.toString();
}
// ================== Function = lpad =====================
- public static Object lpad(Object inputString, Object padLength, Object padStr)
+ public static Object lpad(String inputString, Integer padLength, String padStr)
throws FunctionExecutionException {
return pad(inputString, padLength, padStr, true);
}
- public static Object pad(Object inputString, Object padLength, Object padStr, boolean left)
+ public static Object pad(String str, Integer padLength, String padStr, boolean left)
throws FunctionExecutionException {
-
- if(inputString == null || padLength == null || padStr == null) {
- return null;
- }
-
- String str = (String) inputString;
- int length = ((Integer)padLength).intValue();
+ int length = padLength.intValue();
if(length < 1) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0025, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0025));
}
@@ -1301,17 +942,16 @@
length = DataTypeManager.MAX_STRING_LENGTH;
}
// Get pad character
- String pad = (String) padStr;
- if(pad.length() == 0) {
+ if(padStr.length() == 0) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0027, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0027));
}
// Pad string
StringBuffer outStr = new StringBuffer(str);
while(outStr.length() < length) {
if (left) {
- outStr.insert(0, pad);
+ outStr.insert(0, padStr);
} else {
- outStr.append(pad);
+ outStr.append(padStr);
}
}
if (left) {
@@ -1323,7 +963,7 @@
public static final String SPACE_CHAR = " "; //$NON-NLS-1$
- public static Object lpad(Object inputString, Object padLength)
+ public static Object lpad(String inputString, Integer padLength)
throws FunctionExecutionException {
return lpad(inputString, padLength, SPACE_CHAR);
@@ -1331,13 +971,13 @@
// ================== Function = rpad =====================
- public static Object rpad(Object inputString, Object padLength, Object padStr)
+ public static Object rpad(String inputString, Integer padLength, String padStr)
throws FunctionExecutionException {
return pad(inputString, padLength, padStr, false);
}
- public static Object rpad(Object inputString, Object padLength)
+ public static Object rpad(String inputString, Integer padLength)
throws FunctionExecutionException {
return rpad(inputString, padLength, SPACE_CHAR);
@@ -1345,23 +985,14 @@
// ================== Function = translate =====================
- public static Object translate(Object inputString, Object srcChars, Object destChars)
+ public static Object translate(String str, String in, String out)
throws FunctionExecutionException {
-
- if(inputString == null || srcChars == null || destChars == null) {
- return null;
- }
-
- String str = (String) inputString;
- String in = (String) srcChars;
- String out = (String) destChars;
-
if(in.length() != out.length()) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0031, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0031));
}
if(in.length() == 0 || str.length() == 0) {
- return inputString;
+ return str;
}
StringBuffer translated = new StringBuffer(str.length());
@@ -1386,22 +1017,13 @@
// ================== Function = convert =====================
@SuppressWarnings("unchecked")
- public static Object convert(Object src, Object type)
+ public static Object convert(Object src, String type)
throws FunctionExecutionException {
-
- if(src == null) {
- return null;
- } else if(type instanceof String) {
- String typeStr = (String) type;
-
- try {
- return DataTypeManager.transformValue(src, DataTypeManager.getDataTypeClass(typeStr));
- } catch(TransformationException e) {
- throw new FunctionExecutionException(e, ErrorMessageKeys.FUNCTION_0033, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0033, new Object[]{src, DataTypeManager.getDataTypeName(src.getClass()), typeStr}));
- }
+ try {
+ return DataTypeManager.transformValue(src, DataTypeManager.getDataTypeClass(type));
+ } catch(TransformationException e) {
+ throw new FunctionExecutionException(e, ErrorMessageKeys.FUNCTION_0033, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0033, new Object[]{src, DataTypeManager.getDataTypeName(src.getClass()), type}));
}
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0034, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0034, type));
}
// ================== Function = context and rowlimit =====================
@@ -1462,24 +1084,31 @@
throw new UnsupportedOperationException("This method should never be called."); //$NON-NLS-1$
}
-
+
// ================== Function = nvl =====================
-
- public static Object ifnull(Object value, Object valueIfNull) {
-
- if(value == null) {
- return valueIfNull;
- }
- return value;
+
+ public static Object ifnull(Object value, Object ifNullValue) {
+ return coalesce(value, ifNullValue);
}
+
+ public static Object coalesce(Object value, Object value1, Object... other) {
+ if (value != null) {
+ return value;
+ }
+ if (value1 != null) {
+ return value1;
+ }
+ for (Object object : other) {
+ if (object != null) {
+ return object;
+ }
+ }
+ return null;
+ }
// ================== Format date/time/timestamp TO String ==================
public static Object formatDate(Object date, Object format)
throws FunctionExecutionException {
- if (date == null || format == null) {
- return null;
- }
-
try {
SimpleDateFormat sdf = new SimpleDateFormat((String)format);
return sdf.format((Date)date);
@@ -1491,10 +1120,6 @@
public static Object formatTime(Object time, Object format)
throws FunctionExecutionException {
- if (time == null || format == null) {
- return null;
- }
-
try {
SimpleDateFormat sdf = new SimpleDateFormat((String)format);
return sdf.format((Time)time);
@@ -1506,10 +1131,6 @@
public static Object formatTimestamp(Object timestamp, Object format)
throws FunctionExecutionException {
- if (timestamp == null || format == null) {
- return null;
- }
-
try {
SimpleDateFormat sdf = new SimpleDateFormat((String)format);
return sdf.format((Timestamp) timestamp);
@@ -1520,17 +1141,11 @@
}
// ================== Parse String TO date/time/timestamp ==================
- public static Object parseDate(Object date, Object format)
+ public static Object parseDate(String date, String format)
throws FunctionExecutionException {
- java.util.Date parsedDate = null;
-
- if (date == null || format == null) {
- return null;
- }
-
try {
- DateFormat df= new SimpleDateFormat((String) format);
- parsedDate = df.parse((String) date);
+ DateFormat df= new SimpleDateFormat(format);
+ Date parsedDate = df.parse(date);
return TimestampWithTimezone.createDate(parsedDate);
} catch (java.text.ParseException pe) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
@@ -1538,17 +1153,12 @@
}
}
- public static Object parseTime(Object time, Object format)
+ public static Object parseTime(String time, String format)
throws FunctionExecutionException {
- java.util.Date date = null;
- if (time == null || format == null) {
- return null;
- }
-
try {
- DateFormat df= new SimpleDateFormat((String) format);
- date = df.parse((String) time);
+ DateFormat df= new SimpleDateFormat(format);
+ Date date = df.parse(time);
return TimestampWithTimezone.createTime(date);
} catch (java.text.ParseException pe) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
@@ -1556,17 +1166,12 @@
}
}
- public static Object parseTimestamp(Object timestamp, Object format)
+ public static Object parseTimestamp(String timestamp, String format)
throws FunctionExecutionException {
- java.util.Date date = null;
- if (timestamp == null || format == null) {
- return null;
- }
-
try {
- DateFormat df= new SimpleDateFormat((String) format);
- date = df.parse((String) timestamp);
+ DateFormat df= new SimpleDateFormat(format);
+ Date date = df.parse(timestamp);
return new Timestamp(date.getTime());
} catch (java.text.ParseException pe) {
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
@@ -1679,82 +1284,38 @@
}
// ================== Function - ACOS =====================
- public static Object acos(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.acos(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "acos", number.getClass().getName())); //$NON-NLS-1$
+ public static Object acos(Double number) {
+ return new Double(Math.acos(number.doubleValue()));
}
// ================== Function - ASIN =====================
- public static Object asin(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.asin(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "asin", number.getClass().getName())); //$NON-NLS-1$
+ public static Object asin(Double number) {
+ return new Double(Math.asin(number.doubleValue()));
}
-
// ================== Function - ATAN =====================
- public static Object atan(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.atan(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "atan", number.getClass().getName())); //$NON-NLS-1$
+ public static Object atan(Double number) {
+ return new Double(Math.atan(number.doubleValue()));
}
// ================== Function - ATAN2 =====================
- public static Object atan2(Object number1, Object number2) throws FunctionExecutionException {
- if(number1 == null || number2 == null){
- return null;
- }
- if(number1 instanceof Double && number2 instanceof Double ){
- return new Double(Math.atan2(((Double)number1).doubleValue(), ((Double)number2).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, "atan2", number1.getClass().getName(), number2.getClass().getName())); //$NON-NLS-1$
+ public static Object atan2(Double number1, Double number2) {
+ return new Double(Math.atan2(number1.doubleValue(), number2.doubleValue()));
}
// ================== Function - COS =====================
- public static Object cos(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.cos(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "cos", number.getClass().getName())); //$NON-NLS-1$
+ public static Object cos(Double number) {
+ return new Double(Math.cos(number.doubleValue()));
}
// ================== Function - COT =====================
- public static Object cot(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(1/Math.tan(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "cot", number.getClass().getName())); //$NON-NLS-1$
+ public static Object cot(Double number) {
+ return new Double(1/Math.tan(number.doubleValue()));
}
-
// ================== Function - DEGREES =====================
- public static Object degrees(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.toDegrees(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "degrees", number.getClass().getName())); //$NON-NLS-1$
+ public static Object degrees(Double number) {
+ return new Double(Math.toDegrees(number.doubleValue()));
}
// ================== Function - PI =====================
@@ -1763,89 +1324,38 @@
}
// ================== Function - RADIANS =====================
- public static Object radians(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.toRadians(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "redians", number.getClass().getName())); //$NON-NLS-1$
+ public static Object radians(Double number) {
+ return new Double(Math.toRadians(number.doubleValue()));
}
// ================== Function - SIN =====================
- public static Object sin(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.sin(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "sin", number.getClass().getName())); //$NON-NLS-1$
+ public static Object sin(Double number) {
+ return new Double(Math.sin(number.doubleValue()));
}
// ================== Function - TAN =====================
- public static Object tan(Object number) throws FunctionExecutionException {
- if(number == null){
- return null;
- }
- if(number instanceof Double){
- return new Double(Math.tan(((Double)number).doubleValue()));
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "tan", number.getClass().getName())); //$NON-NLS-1$
+ public static Object tan(Double number) {
+ return new Double(Math.tan(number.doubleValue()));
}
// ================== Function - BITAND =====================
- public static Object bitand(Object x, Object y) throws FunctionExecutionException {
- if (x == null || y == null) {
- return null;
- }
- if (!(x instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitand", x.getClass().getName())); //$NON-NLS-1$
- }
- if (!(y instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitand", y.getClass().getName())); //$NON-NLS-1$
- }
- return new Integer(((Integer)x).intValue() & ((Integer)y).intValue());
+ public static Object bitand(int x, int y) {
+ return x & y;
}
// ================== Function - BITOR =====================
- public static Object bitor(Object x, Object y) throws FunctionExecutionException {
- if (x == null || y == null) {
- return null;
- }
- if (!(x instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitor", x.getClass().getName())); //$NON-NLS-1$
- }
- if (!(y instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitor", y.getClass().getName())); //$NON-NLS-1$
- }
- return new Integer(((Integer)x).intValue() | ((Integer)y).intValue());
+ public static Object bitor(int x, int y) {
+ return x | y;
}
// ================== Function - BITXOR =====================
- public static Object bitxor(Object x, Object y) throws FunctionExecutionException {
- if (x == null || y == null) {
- return null;
- }
- if (!(x instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitxor", x.getClass().getName())); //$NON-NLS-1$
- }
- if (!(y instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitxor", y.getClass().getName())); //$NON-NLS-1$
- }
- return new Integer(((Integer)x).intValue() ^ ((Integer)y).intValue());
+ public static Object bitxor(int x, int y) {
+ return x ^ y;
}
// ================== Function - BITNOT =====================
- public static Object bitnot(Object x) throws FunctionExecutionException {
- if (x == null) {
- return null;
- }
- if (!(x instanceof Integer)) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "bitxor", x.getClass().getName())); //$NON-NLS-1$
- }
- return new Integer(((Integer)x).intValue() ^ 0xFFFFFFFF);
+ public static int bitnot(int x) {
+ return x ^ 0xFFFFFFFF;
}
// ================= Function - USER ========================
@@ -1863,57 +1373,42 @@
return payload.toString();
}
- public static Object commandPayload(CommandContext context, Object param)
+ public static Object commandPayload(CommandContext context, String param)
throws ExpressionEvaluationException, FunctionExecutionException{
Serializable payload = context.getCommandPayload();
- if(payload == null || param == null) {
+ if(payload == null) {
return null;
}
- if (param instanceof String) {
- // 1-arg form - assume payload is a Properties object
- if(payload instanceof Properties) {
- String property = (String)param;
- return ((Properties)payload).getProperty(property);
- }
- // Payload was bad
- throw new ExpressionEvaluationException(QueryPlugin.Util.getString("ExpressionEvaluator.Expected_props_for_payload_function", "commandPayload", payload.getClass().getName())); //$NON-NLS-1$ //$NON-NLS-2$
- }
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0071, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0070, "commandPayload", param.getClass().getName())); //$NON-NLS-1$
+ // 1-arg form - assume payload is a Properties object
+ if(payload instanceof Properties) {
+ return ((Properties)payload).getProperty(param);
+ }
+ // Payload was bad
+ throw new ExpressionEvaluationException(QueryPlugin.Util.getString("ExpressionEvaluator.Expected_props_for_payload_function", "commandPayload", payload.getClass().getName())); //$NON-NLS-1$ //$NON-NLS-2$
}
// ================= Function - ENV ========================
- public static Object env(CommandContext context, Object param) throws FunctionExecutionException {
- if (param == null) {
- return null;
- }
- if (param instanceof String) {
- // All context property keys must be lowercase - we lowercase the incoming key here to match regardless of case
- String propertyName = ((String)param);
- String propertyNameNocase = propertyName.toLowerCase();
- Properties envProps = context.getEnvironmentProperties();
- if(envProps != null && envProps.containsKey(propertyNameNocase)) {
- return envProps.getProperty(propertyNameNocase);
- }
- String value = System.getProperty(propertyName);
- if (value == null) {
- value = System.getProperty(propertyNameNocase);
- }
- return value;
+ public static Object env(CommandContext context, String propertyName) {
+ // All context property keys must be lowercase - we lowercase the incoming key here to match regardless of case
+ String propertyNameNocase = propertyName.toLowerCase();
+ Properties envProps = context.getEnvironmentProperties();
+ if(envProps != null && envProps.containsKey(propertyNameNocase)) {
+ return envProps.getProperty(propertyNameNocase);
}
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0070, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0070, "env", param.getClass().getName())); //$NON-NLS-1$
+ String value = System.getProperty(propertyName);
+ if (value == null) {
+ value = System.getProperty(propertyNameNocase);
+ }
+ return value;
}
// ================= Function - MODIFYTIMEZONE ========================
- public static Object modifyTimeZone(Object value, Object originalTimezoneString, Object targetTimezoneString) {
- if (value == null || originalTimezoneString == null || targetTimezoneString == null) {
- return null;
- }
+ public static Object modifyTimeZone(Timestamp value, String originalTimezoneString, String targetTimezoneString) {
+ TimeZone originalTimeZone = TimeZone.getTimeZone(originalTimezoneString);
+ TimeZone dbmsTimeZone = TimeZone.getTimeZone(targetTimezoneString);
- TimeZone originalTimeZone = TimeZone.getTimeZone((String)originalTimezoneString);
- TimeZone dbmsTimeZone = TimeZone.getTimeZone((String)targetTimezoneString);
-
// Check that the dbms time zone is really different than the local time zone
if (originalTimeZone.equals(dbmsTimeZone)) {
return value;
@@ -1921,24 +1416,15 @@
Calendar cal = Calendar.getInstance(dbmsTimeZone);
- Timestamp in = (Timestamp)value;
-
- return TimestampWithTimezone.createTimestamp(in, originalTimeZone, cal);
+ return TimestampWithTimezone.createTimestamp(value, originalTimeZone, cal);
}
- public static Object modifyTimeZone(CommandContext context, Object value, Object targetTimezoneString) {
- if (value == null || targetTimezoneString == null) {
- return null;
- }
+ public static Object modifyTimeZone(CommandContext context, Timestamp value, String targetTimezoneString) {
+ TimeZone dbmsTimeZone = TimeZone.getTimeZone(targetTimezoneString);
- TimeZone dbmsTimeZone = TimeZone.getTimeZone((String)targetTimezoneString);
-
Calendar cal = Calendar.getInstance(dbmsTimeZone);
- Timestamp in = (Timestamp)value;
-
- return TimestampWithTimezone.createTimestamp(in, context.getServerTimeZone(), cal);
+ return TimestampWithTimezone.createTimestamp(value, context.getServerTimeZone(), cal);
}
}
-
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -22,14 +22,15 @@
package com.metamatrix.query.function;
+import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -38,10 +39,12 @@
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.Assertion;
+import com.metamatrix.core.util.ReflectionHelper;
import com.metamatrix.query.QueryPlugin;
import com.metamatrix.query.function.metadata.FunctionCategoryConstants;
import com.metamatrix.query.function.metadata.FunctionMethod;
import com.metamatrix.query.function.metadata.FunctionParameter;
+import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ErrorMessageKeys;
import com.metamatrix.query.util.LogConstants;
@@ -247,21 +250,11 @@
* @return Corresponding form or null if not found
*/
FunctionForm findFunctionForm(String name, int args) {
- List methods = (List) functionsByName.get(name.toUpperCase());
- if(methods == null || methods.size() == 0) {
- return null;
- }
-
- Iterator iter = methods.iterator();
- while(iter.hasNext()) {
- FunctionMethod method = (FunctionMethod) iter.next();
- if(method.getInputParameterCount() == args) {
- return new FunctionForm(method);
- }
- }
-
- // Didn't find it
- return null;
+ List<FunctionMethod> results = findFunctionMethods(name, args);
+ if (results.size() > 0) {
+ return new FunctionForm(results.get(0));
+ }
+ return null;
}
/**
@@ -270,18 +263,16 @@
* @param args Number of arguments
* @return Corresponding form or null if not found
*/
- Collection findFunctionMethods(String name, int args) {
- final Collection allMatches = new ArrayList();
- List methods = (List) functionsByName.get(name.toUpperCase());
+ List<FunctionMethod> findFunctionMethods(String name, int args) {
+ final List<FunctionMethod> allMatches = new ArrayList<FunctionMethod>();
+ List<FunctionMethod> methods = (List<FunctionMethod>) functionsByName.get(name.toUpperCase());
if(methods == null || methods.size() == 0) {
return allMatches;
}
- Iterator iter = methods.iterator();
- while(iter.hasNext()) {
- FunctionMethod method = (FunctionMethod) iter.next();
- if(method.getInputParameterCount() == args) {
- allMatches.add(method);
+ for (FunctionMethod functionMethod : methods) {
+ if(functionMethod.getInputParameterCount() == args || functionMethod.isVarArgs() && args >= functionMethod.getInputParameterCount() - 1) {
+ allMatches.add(functionMethod);
}
}
@@ -301,17 +292,21 @@
// Get input types for path
FunctionParameter[] inputParams = method.getInputParameters();
- Class[] inputTypes = null;
- if(inputParams == null) {
- inputTypes = new Class[0];
- } else {
- inputTypes = new Class[inputParams.length];
+ List<Class> inputTypes = new LinkedList<Class>();
+ if(inputParams != null) {
for(int i=0; i<inputParams.length; i++) {
String typeName = inputParams[i].getType();
- inputTypes[i] = DataTypeManager.getDataTypeClass(typeName);
+ inputTypes.add(DataTypeManager.getDataTypeClass(typeName));
}
}
+ Class[] types = inputTypes.toArray(new Class[inputTypes.size()]);
+ if (method.isVarArgs()) {
+ inputTypes.set(inputTypes.size() - 1, Array.newInstance(inputTypes.get(inputTypes.size() - 1), 0).getClass());
+ }
+
+ inputTypes.add(0, CommandContext.class);
+
// Get return type
FunctionParameter outputParam = method.getOutputParameter();
Class outputType = null;
@@ -319,100 +314,57 @@
outputType = DataTypeManager.getDataTypeClass(outputParam.getType());
}
- // Build path
- Object[] path = buildPath(methodName, inputTypes);
-
- // Create function descriptor
- FunctionDescriptor descriptor = createFunctionDescriptor(source, method, inputTypes, outputType);
-
- // Store this path in the function tree
- Map node = treeRoot;
- for(int pathIndex = 0; pathIndex < path.length; pathIndex++) {
- Object pathPart = path[pathIndex];
- Map children = (Map) node.get(pathPart);
- if(children == null) {
- children = new HashMap();
- node.put(pathPart, children);
- }
- node = children;
- }
-
- // Store the leaf descriptor in the tree
- node.put(DESCRIPTOR_KEY, descriptor);
- }
-
- /**
- * @param method
- * @param inputTypes
- * @param outputType
- * @return
- */
- private FunctionDescriptor createFunctionDescriptor(FunctionMetadataSource source, FunctionMethod method, Class[] inputTypes, Class outputType) {
Method invocationMethod = null;
boolean requiresContext = false;
+ // Defect 20007 - Ignore the invocation method if pushdown is not required.
if (method.getPushdown() == FunctionMethod.CAN_PUSHDOWN || method.getPushdown() == FunctionMethod.CANNOT_PUSHDOWN) {
- // Defect 20007 - Ignore the invocation method if pushdown is required.
- Class[] methodSignature = null;
try {
+ Class methodClass = source.getInvocationClass(method.getInvocationClass());
+ ReflectionHelper helper = new ReflectionHelper(methodClass);
try {
- methodSignature = methodSignatureWithContext(inputTypes.length);
- invocationMethod = lookupMethod(source, method.getInvocationClass(), method.getInvocationMethod(), methodSignature);
- requiresContext = true;
- }catch(NoSuchMethodException e) {
- methodSignature = methodSignature(inputTypes.length);
- invocationMethod = lookupMethod(source, method.getInvocationClass(), method.getInvocationMethod(), methodSignature);
- }
+ invocationMethod = helper.findBestMethodWithSignature(method.getInvocationMethod(), inputTypes);
+ requiresContext = true;
+ } catch (NoSuchMethodException e) {
+ inputTypes = inputTypes.subList(1, inputTypes.size());
+ invocationMethod = helper.findBestMethodWithSignature(method.getInvocationMethod(), inputTypes);
+ }
} catch (ClassNotFoundException e) {
// Failed to load class, so can't load method - this will fail at invocation time.
// We don't fail here because this situation can occur in the modeler, which does
// not have the function jar files. The modeler never invokes, so this isn't a
// problem.
} catch (Exception e) {
- throw new MetaMatrixRuntimeException(e, ErrorMessageKeys.FUNCTION_0047, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0047, new Object[]{method.getInvocationClass(), invocationMethod, Arrays.asList(methodSignature)}));
+ throw new MetaMatrixRuntimeException(e, ErrorMessageKeys.FUNCTION_0047, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0047, new Object[]{method.getInvocationClass(), invocationMethod, inputTypes}));
}
+ if(invocationMethod != null && !FunctionTree.isValidMethod(invocationMethod)) {
+ throw new MetaMatrixRuntimeException(ErrorMessageKeys.FUNCTION_0047, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0047, new Object[]{method.getInvocationClass(), invocationMethod, inputTypes}));
+ }
}
- return new FunctionDescriptor(method.getName(), method.getPushdown(), inputTypes, outputType, invocationMethod, requiresContext, method.isNullDependent(), method.getDeterministic());
- }
- /**
- * Find the invocation method for a function.
- * @param source The function metadata source, which knows how to obtain the invocation class
- * @param invocationClass The class to invoke for this function
- * @param invocationMethod The method to invoke for this function
- * @param numArgs Number of arguments in method
- */
- private Method lookupMethod(FunctionMetadataSource source, String invocationClass, String invocationMethod, Class[] methodSignature)
- throws NoSuchMethodException, ClassNotFoundException {
+ FunctionDescriptor descriptor = new FunctionDescriptor(method.getName(), method.getPushdown(), types, outputType, invocationMethod, requiresContext, method.isNullDependent(), method.getDeterministic());
+ // Store this path in the function tree
+ Map node = treeRoot;
+ Object[] path = buildPath(methodName, types);
+ for(int pathIndex = 0; pathIndex < path.length; pathIndex++) {
+ Object pathPart = path[pathIndex];
+ Map children = (Map) node.get(pathPart);
+ if(children == null) {
+ children = new HashMap();
+ node.put(pathPart, children);
+ }
+ if (method.isVarArgs() && pathIndex == path.length - 1) {
+ node.put(DESCRIPTOR_KEY, descriptor);
+ }
+ node = children;
+ }
- Class methodClass = source.getInvocationClass(invocationClass);
- Method method = methodClass.getMethod(invocationMethod, methodSignature);
-
- // Validate method
- if(! FunctionTree.isValidMethod(method)) {
- return null;
+ if (method.isVarArgs()) {
+ node.put(types[types.length - 1], node);
}
- return method;
+ // Store the leaf descriptor in the tree
+ node.put(DESCRIPTOR_KEY, descriptor);
}
- private Class[] methodSignatureWithContext(int numArgs) {
- // Build parameter signature
- Class[] objectSignature = new Class[numArgs+1];
- objectSignature[0] = com.metamatrix.query.util.CommandContext.class;
- for(int i=1; i<numArgs+1; i++) {
- objectSignature[i] = java.lang.Object.class;
- }
- return objectSignature;
- }
-
- private Class[] methodSignature(int numArgs) {
- // Build parameter signature
- Class[] objectSignature = new Class[numArgs];
- for(int i=0; i<numArgs; i++) {
- objectSignature[i] = java.lang.Object.class;
- }
- return objectSignature;
- }
-
/**
* Validate a method looked up by reflection. The method should have a non-void return type
* and be a public static method.
@@ -454,12 +406,9 @@
// Walk path in tree
Map node = treeRoot;
for(int i=0; i<path.length; i++) {
- if(node.containsKey(path[i])) {
- // Walk path
- node = (Map) node.get(path[i]);
- } else {
- // No known path for this part - no match
- return null;
+ node = (Map)node.get(path[i]);
+ if (node == null) {
+ return null;
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -473,5 +473,12 @@
public void setDeterministic(int deterministic) {
this.deterministic = deterministic;
}
+
+ public boolean isVarArgs() {
+ if (this.inputParameters != null && this.inputParameters.length > 0) {
+ return inputParameters[inputParameters.length - 1].isVarArg();
+ }
+ return false;
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionParameter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionParameter.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionParameter.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -38,6 +38,7 @@
private String name;
private String type;
private String description;
+ private boolean isVarArg;
/**
* Construct a function parameter with no attributes.
@@ -51,8 +52,7 @@
* @param type Type from standard set of types
*/
public FunctionParameter(String name, String type) {
- setName(name);
- setType(type);
+ this(name, type, null);
}
/**
@@ -62,10 +62,15 @@
* @param description Description
*/
public FunctionParameter(String name, String type, String description) {
+ this(name, type, description, false);
+ }
+
+ public FunctionParameter(String name, String type, String description, boolean vararg) {
setName(name);
setType(type);
setDescription(description);
- }
+ this.isVarArg = vararg;
+ }
/**
* Return name of parameter.
@@ -143,17 +148,15 @@
public boolean equals(Object obj) {
if(obj == this) {
return true;
- } else if(obj == null) {
- return false;
- } else if(obj instanceof FunctionParameter) {
- FunctionParameter other = (FunctionParameter) obj;
- if(other.getType() == null) {
- return (this.getType() == null);
- }
- return other.getType().equals(this.getType());
- } else {
- return false;
- }
+ }
+ if(!(obj instanceof FunctionParameter)) {
+ return false;
+ }
+ FunctionParameter other = (FunctionParameter) obj;
+ if(other.getType() == null) {
+ return (this.getType() == null);
+ }
+ return other.getType().equals(this.getType()) && this.isVarArg == other.isVarArg;
}
/**
@@ -161,7 +164,15 @@
* @return String representation of function parameter
*/
public String toString() {
- return type + " " + name; //$NON-NLS-1$
+ return type + (isVarArg?"... ":" ") + name; //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public void setVarArg(boolean isVarArg) {
+ this.isVarArg = isVarArg;
+ }
+
+ public boolean isVarArg() {
+ return isVarArg;
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -58,10 +58,10 @@
*/
public SystemSource() {
// +, -, *, /
- addArithmeticFunction(SourceSystemFunctions.ADD_OP, QueryPlugin.Util.getString("SystemSource.Add_desc"), "plus", QueryPlugin.Util.getString("SystemSource.Add_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addArithmeticFunction(SourceSystemFunctions.SUBTRACT_OP, QueryPlugin.Util.getString("SystemSource.Subtract_desc"), "minus", QueryPlugin.Util.getString("SystemSource.Subtract_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addArithmeticFunction(SourceSystemFunctions.MULTIPLY_OP, QueryPlugin.Util.getString("SystemSource.Multiply_desc"), "multiply", QueryPlugin.Util.getString("SystemSource.Multiply_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addArithmeticFunction(SourceSystemFunctions.DIVIDE_OP, QueryPlugin.Util.getString("SystemSource.Divide_desc"), "divide", QueryPlugin.Util.getString("SystemSource.Divide_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addArithmeticFunction(SourceSystemFunctions.ADD_OP, QueryPlugin.Util.getString("SystemSource.Add_desc"), "plus", QueryPlugin.Util.getString("SystemSource.Add_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addArithmeticFunction(SourceSystemFunctions.SUBTRACT_OP, QueryPlugin.Util.getString("SystemSource.Subtract_desc"), "minus", QueryPlugin.Util.getString("SystemSource.Subtract_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addArithmeticFunction(SourceSystemFunctions.MULTIPLY_OP, QueryPlugin.Util.getString("SystemSource.Multiply_desc"), "multiply", QueryPlugin.Util.getString("SystemSource.Multiply_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addArithmeticFunction(SourceSystemFunctions.DIVIDE_OP, QueryPlugin.Util.getString("SystemSource.Divide_desc"), "divide", QueryPlugin.Util.getString("SystemSource.Divide_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// numeric
addAbsFunction();
@@ -71,45 +71,45 @@
addRoundFunction();
addSignFunction();
addSqrtFunction();
- addDoubleFunction(SourceSystemFunctions.ACOS, QueryPlugin.Util.getString("SystemSource.Acos_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.ASIN, QueryPlugin.Util.getString("SystemSource.Asin_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.ATAN, QueryPlugin.Util.getString("SystemSource.Atan_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addAtan2Function(SourceSystemFunctions.ATAN2, QueryPlugin.Util.getString("SystemSource.Atan2_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.COS, QueryPlugin.Util.getString("SystemSource.Cos_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.COT, QueryPlugin.Util.getString("SystemSource.Cot_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.DEGREES, QueryPlugin.Util.getString("SystemSource.Degrees_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addPiFunction(SourceSystemFunctions.PI, QueryPlugin.Util.getString("SystemSource.Pi_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.RADIANS, QueryPlugin.Util.getString("SystemSource.Radians_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.SIN, QueryPlugin.Util.getString("SystemSource.Sin_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.TAN, QueryPlugin.Util.getString("SystemSource.Tan_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.LOG, QueryPlugin.Util.getString("SystemSource.Log_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.LOG10, QueryPlugin.Util.getString("SystemSource.Log10_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.CEILING, QueryPlugin.Util.getString("SystemSource.Ceiling_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.EXP, QueryPlugin.Util.getString("SystemSource.Exp_desc")); //$NON-NLS-1$ //$NON-NLS-2$
- addDoubleFunction(SourceSystemFunctions.FLOOR, QueryPlugin.Util.getString("SystemSource.Floor_desc")); //$NON-NLS-1$ //$NON-NLS-2$
+ addDoubleFunction(SourceSystemFunctions.ACOS, QueryPlugin.Util.getString("SystemSource.Acos_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.ASIN, QueryPlugin.Util.getString("SystemSource.Asin_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.ATAN, QueryPlugin.Util.getString("SystemSource.Atan_desc")); //$NON-NLS-1$
+ addAtan2Function(SourceSystemFunctions.ATAN2, QueryPlugin.Util.getString("SystemSource.Atan2_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.COS, QueryPlugin.Util.getString("SystemSource.Cos_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.COT, QueryPlugin.Util.getString("SystemSource.Cot_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.DEGREES, QueryPlugin.Util.getString("SystemSource.Degrees_desc")); //$NON-NLS-1$
+ addPiFunction(SourceSystemFunctions.PI, QueryPlugin.Util.getString("SystemSource.Pi_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.RADIANS, QueryPlugin.Util.getString("SystemSource.Radians_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.SIN, QueryPlugin.Util.getString("SystemSource.Sin_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.TAN, QueryPlugin.Util.getString("SystemSource.Tan_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.LOG, QueryPlugin.Util.getString("SystemSource.Log_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.LOG10, QueryPlugin.Util.getString("SystemSource.Log10_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.CEILING, QueryPlugin.Util.getString("SystemSource.Ceiling_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.EXP, QueryPlugin.Util.getString("SystemSource.Exp_desc")); //$NON-NLS-1$
+ addDoubleFunction(SourceSystemFunctions.FLOOR, QueryPlugin.Util.getString("SystemSource.Floor_desc")); //$NON-NLS-1$
// bit
- addBitFunction(SourceSystemFunctions.BITAND, QueryPlugin.Util.getString("SystemSource.Bitand_desc"), "bitand", 2, QueryPlugin.Util.getString("SystemSource.Bitand_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addBitFunction(SourceSystemFunctions.BITOR, QueryPlugin.Util.getString("SystemSource.Bitor_desc"), "bitor", 2, QueryPlugin.Util.getString("SystemSource.Bitor_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addBitFunction(SourceSystemFunctions.BITXOR, QueryPlugin.Util.getString("SystemSource.Bitxor_desc"), "bitxor", 2, QueryPlugin.Util.getString("SystemSource.Bitxor_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addBitFunction(SourceSystemFunctions.BITNOT, QueryPlugin.Util.getString("SystemSource.Bitnot_desc"), "bitnot", 1, QueryPlugin.Util.getString("SystemSource.Bitnot_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addBitFunction(SourceSystemFunctions.BITAND, QueryPlugin.Util.getString("SystemSource.Bitand_desc"), "bitand", 2, QueryPlugin.Util.getString("SystemSource.Bitand_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addBitFunction(SourceSystemFunctions.BITOR, QueryPlugin.Util.getString("SystemSource.Bitor_desc"), "bitor", 2, QueryPlugin.Util.getString("SystemSource.Bitor_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addBitFunction(SourceSystemFunctions.BITXOR, QueryPlugin.Util.getString("SystemSource.Bitxor_desc"), "bitxor", 2, QueryPlugin.Util.getString("SystemSource.Bitxor_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addBitFunction(SourceSystemFunctions.BITNOT, QueryPlugin.Util.getString("SystemSource.Bitnot_desc"), "bitnot", 1, QueryPlugin.Util.getString("SystemSource.Bitnot_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// date
- addConstantDateFunction(SourceSystemFunctions.CURDATE, QueryPlugin.Util.getString("SystemSource.Curdate_desc"), "currentDate", DataTypeManager.DefaultDataTypes.DATE); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addConstantDateFunction(SourceSystemFunctions.CURTIME, QueryPlugin.Util.getString("SystemSource.Curtime_desc"), "currentTime", DataTypeManager.DefaultDataTypes.TIME); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addConstantDateFunction(SourceSystemFunctions.NOW, QueryPlugin.Util.getString("SystemSource.Now_desc"), "currentTimestamp", DataTypeManager.DefaultDataTypes.TIMESTAMP); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addDateFunction(SourceSystemFunctions.DAYNAME, "dayName", QueryPlugin.Util.getString("SystemSource.Dayname_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayname_result_ts_desc"), DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.DAYOFMONTH, "dayOfMonth", QueryPlugin.Util.getString("SystemSource.Dayofmonth_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofmonth_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.DAYOFWEEK, "dayOfWeek", QueryPlugin.Util.getString("SystemSource.Dayofweek_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofweek_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.DAYOFYEAR, "dayOfYear", QueryPlugin.Util.getString("SystemSource.Dayofyear_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofyear_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.MONTH, "month", QueryPlugin.Util.getString("SystemSource.Month_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Month_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.MONTHNAME, "monthName", QueryPlugin.Util.getString("SystemSource.Monthname_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Monthname_result_ts_desc"), DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.WEEK, "week", QueryPlugin.Util.getString("SystemSource.Week_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Week_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addDateFunction(SourceSystemFunctions.YEAR, "year", QueryPlugin.Util.getString("SystemSource.Year_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Year_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addTimeFunction(SourceSystemFunctions.HOUR, "hour", QueryPlugin.Util.getString("SystemSource.Hour_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Hour_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addTimeFunction(SourceSystemFunctions.MINUTE, "minute", QueryPlugin.Util.getString("SystemSource.Minute_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Minute_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addTimeFunction(SourceSystemFunctions.SECOND, "second", QueryPlugin.Util.getString("SystemSource.Second_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Second_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addQuarterFunction(SourceSystemFunctions.QUARTER, "quarter", QueryPlugin.Util.getString("SystemSource.Quarter_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Quarter_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addConstantDateFunction(SourceSystemFunctions.CURDATE, QueryPlugin.Util.getString("SystemSource.Curdate_desc"), "currentDate", DataTypeManager.DefaultDataTypes.DATE); //$NON-NLS-1$ //$NON-NLS-2$
+ addConstantDateFunction(SourceSystemFunctions.CURTIME, QueryPlugin.Util.getString("SystemSource.Curtime_desc"), "currentTime", DataTypeManager.DefaultDataTypes.TIME); //$NON-NLS-1$ //$NON-NLS-2$
+ addConstantDateFunction(SourceSystemFunctions.NOW, QueryPlugin.Util.getString("SystemSource.Now_desc"), "currentTimestamp", DataTypeManager.DefaultDataTypes.TIMESTAMP); //$NON-NLS-1$ //$NON-NLS-2$
+ addDateFunction(SourceSystemFunctions.DAYNAME, "dayName", QueryPlugin.Util.getString("SystemSource.Dayname_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayname_result_ts_desc"), DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.DAYOFMONTH, "dayOfMonth", QueryPlugin.Util.getString("SystemSource.Dayofmonth_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofmonth_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.DAYOFWEEK, "dayOfWeek", QueryPlugin.Util.getString("SystemSource.Dayofweek_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofweek_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.DAYOFYEAR, "dayOfYear", QueryPlugin.Util.getString("SystemSource.Dayofyear_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Dayofyear_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.MONTH, "month", QueryPlugin.Util.getString("SystemSource.Month_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Month_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.MONTHNAME, "monthName", QueryPlugin.Util.getString("SystemSource.Monthname_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Monthname_result_ts_desc"), DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.WEEK, "week", QueryPlugin.Util.getString("SystemSource.Week_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Week_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addDateFunction(SourceSystemFunctions.YEAR, "year", QueryPlugin.Util.getString("SystemSource.Year_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Year_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addTimeFunction(SourceSystemFunctions.HOUR, "hour", QueryPlugin.Util.getString("SystemSource.Hour_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Hour_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addTimeFunction(SourceSystemFunctions.MINUTE, "minute", QueryPlugin.Util.getString("SystemSource.Minute_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Minute_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addTimeFunction(SourceSystemFunctions.SECOND, "second", QueryPlugin.Util.getString("SystemSource.Second_result_t_desc"), QueryPlugin.Util.getString("SystemSource.Second_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addQuarterFunction(SourceSystemFunctions.QUARTER, "quarter", QueryPlugin.Util.getString("SystemSource.Quarter_result_d_desc"), QueryPlugin.Util.getString("SystemSource.Quarter_result_ts_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addTimestampAddFunction();
addTimestampDiffFunction();
addTimeZoneFunctions();
@@ -117,13 +117,13 @@
addUnixTimeFunctions();
// string
- addStringFunction(SourceSystemFunctions.LENGTH, QueryPlugin.Util.getString("SystemSource.Length_result"), "length", DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addStringFunction(SourceSystemFunctions.UCASE, QueryPlugin.Util.getString("SystemSource.Ucase_result"), "upperCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addStringFunction(SourceSystemFunctions.LCASE, QueryPlugin.Util.getString("SystemSource.Lcase_result"), "lowerCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addStringFunction(SourceSystemFunctions.LENGTH, QueryPlugin.Util.getString("SystemSource.Length_result"), "length", DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$
+ addStringFunction(SourceSystemFunctions.UCASE, QueryPlugin.Util.getString("SystemSource.Ucase_result"), "upperCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$
+ addStringFunction(SourceSystemFunctions.LCASE, QueryPlugin.Util.getString("SystemSource.Lcase_result"), "lowerCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$
addStringFunction("lower", QueryPlugin.Util.getString("SystemSource.Lower_result"), "lowerCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addStringFunction("upper", QueryPlugin.Util.getString("SystemSource.Upper_result"), "upperCase", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addStringFunction(SourceSystemFunctions.LTRIM, QueryPlugin.Util.getString("SystemSource.Left_result"), "leftTrim", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addStringFunction(SourceSystemFunctions.RTRIM, QueryPlugin.Util.getString("SystemSource.Right_result"), "rightTrim", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addStringFunction(SourceSystemFunctions.LTRIM, QueryPlugin.Util.getString("SystemSource.Left_result"), "leftTrim", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$
+ addStringFunction(SourceSystemFunctions.RTRIM, QueryPlugin.Util.getString("SystemSource.Right_result"), "rightTrim", DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$ //$NON-NLS-2$
addConcatFunction();
addSubstringFunction();
addLeftRightFunctions();
@@ -140,8 +140,8 @@
addInsertFunction();
// clob
- addClobFunction(SourceSystemFunctions.UCASE, QueryPlugin.Util.getString("SystemSource.UcaseClob_result"), "upperCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addClobFunction(SourceSystemFunctions.LCASE, QueryPlugin.Util.getString("SystemSource.LcaseClob_result"), "lowerCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addClobFunction(SourceSystemFunctions.UCASE, QueryPlugin.Util.getString("SystemSource.UcaseClob_result"), "upperCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$
+ addClobFunction(SourceSystemFunctions.LCASE, QueryPlugin.Util.getString("SystemSource.LcaseClob_result"), "lowerCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$
addClobFunction("lower", QueryPlugin.Util.getString("SystemSource.LowerClob_result"), "lowerCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addClobFunction("upper", QueryPlugin.Util.getString("SystemSource.UpperClob_result"), "upperCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -160,16 +160,16 @@
addIfNullFunctions();
// format
- addFormatTimeFunction(SourceSystemFunctions.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"), "formatTime", QueryPlugin.Util.getString("SystemSource.Formattime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addFormatDateFunction(SourceSystemFunctions.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"), "formatDate", QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addFormatTimestampFunction(SourceSystemFunctions.FORMATTIMESTAMP, QueryPlugin.Util.getString("SystemSource.Formattimestamp_desc"), "formatTimestamp", QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatTimeFunction(SourceSystemFunctions.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"), "formatTime", QueryPlugin.Util.getString("SystemSource.Formattime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addFormatDateFunction(SourceSystemFunctions.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"), "formatDate", QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addFormatTimestampFunction(SourceSystemFunctions.FORMATTIMESTAMP, QueryPlugin.Util.getString("SystemSource.Formattimestamp_desc"), "formatTimestamp", QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addFormatNumberFunctions();
// parse
- addParseTimeFunction(SourceSystemFunctions.PARSETIME, QueryPlugin.Util.getString("SystemSource.Parsetime_desc"), "parseTime", QueryPlugin.Util.getString("SystemSource.Parsetime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addParseDateFunction(SourceSystemFunctions.PARSEDATE, QueryPlugin.Util.getString("SystemSource.Parsedate_desc"), "parseDate", QueryPlugin.Util.getString("SystemSource.Parsedate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addParseTimestampFunction(SourceSystemFunctions.PARSETIMESTAMP, QueryPlugin.Util.getString("SystemSource.Parsetimestamp_desc"), "parseTimestamp", QueryPlugin.Util.getString("SystemSource.Parsetimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseTimeFunction(SourceSystemFunctions.PARSETIME, QueryPlugin.Util.getString("SystemSource.Parsetime_desc"), "parseTime", QueryPlugin.Util.getString("SystemSource.Parsetime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addParseDateFunction(SourceSystemFunctions.PARSEDATE, QueryPlugin.Util.getString("SystemSource.Parsedate_desc"), "parseDate", QueryPlugin.Util.getString("SystemSource.Parsedate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addParseTimestampFunction(SourceSystemFunctions.PARSETIMESTAMP, QueryPlugin.Util.getString("SystemSource.Parsetimestamp_desc"), "parseTimestamp", QueryPlugin.Util.getString("SystemSource.Parsetimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addParseNumberFunctions();
@@ -195,21 +195,21 @@
}
private void addFormatNumberFunctions() {
- addFormatNumberFunction(SourceSystemFunctions.FORMATINTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_desc"), "formatInteger", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addFormatNumberFunction(SourceSystemFunctions.FORMATLONG, QueryPlugin.Util.getString("SystemSource.Formatlong_desc"), "formatLong", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Formatlong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addFormatNumberFunction(SourceSystemFunctions.FORMATDOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_desc"), "formatDouble", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addFormatNumberFunction(SourceSystemFunctions.FORMATFLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_desc"), "formatFloat", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addFormatNumberFunction(SourceSystemFunctions.FORMATBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_desc"), "formatBigInteger", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addFormatNumberFunction(SourceSystemFunctions.FORMATBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_desc"), "formatBigDecimal", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATINTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_desc"), "formatInteger", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATLONG, QueryPlugin.Util.getString("SystemSource.Formatlong_desc"), "formatLong", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Formatlong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATDOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_desc"), "formatDouble", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATFLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_desc"), "formatFloat", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_desc"), "formatBigInteger", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addFormatNumberFunction(SourceSystemFunctions.FORMATBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_desc"), "formatBigDecimal", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
private void addParseNumberFunctions() {
- addParseNumberFunction(SourceSystemFunctions.PARSEINTEGER, QueryPlugin.Util.getString("SystemSource.Parseinteger_desc"), "parseInteger", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Parseinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addParseNumberFunction(SourceSystemFunctions.PARSELONG, QueryPlugin.Util.getString("SystemSource.Parselong_desc"), "parseLong", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Parselong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addParseNumberFunction(SourceSystemFunctions.PARSEDOUBLE, QueryPlugin.Util.getString("SystemSource.Parsedouble_desc"), "parseDouble", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Parsedouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addParseNumberFunction(SourceSystemFunctions.PARSEFLOAT, QueryPlugin.Util.getString("SystemSource.Parsefloat_desc"), "parseFloat", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Parsefloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addParseNumberFunction(SourceSystemFunctions.PARSEBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Parsebiginteger_desc"), "parseBigInteger", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Parsebiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- addParseNumberFunction(SourceSystemFunctions.PARSEBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Parsebigdecimal_desc"), "parseBigDecimal", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Parsebigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ addParseNumberFunction(SourceSystemFunctions.PARSEINTEGER, QueryPlugin.Util.getString("SystemSource.Parseinteger_desc"), "parseInteger", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Parseinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseNumberFunction(SourceSystemFunctions.PARSELONG, QueryPlugin.Util.getString("SystemSource.Parselong_desc"), "parseLong", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Parselong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseNumberFunction(SourceSystemFunctions.PARSEDOUBLE, QueryPlugin.Util.getString("SystemSource.Parsedouble_desc"), "parseDouble", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Parsedouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseNumberFunction(SourceSystemFunctions.PARSEFLOAT, QueryPlugin.Util.getString("SystemSource.Parsefloat_desc"), "parseFloat", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Parsefloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseNumberFunction(SourceSystemFunctions.PARSEBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Parsebiginteger_desc"), "parseBigInteger", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Parsebiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addParseNumberFunction(SourceSystemFunctions.PARSEBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Parsebigdecimal_desc"), "parseBigDecimal", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Parsebigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
private void addArithmeticFunction(String functionName, String description, String methodName, String resultsDescription) {
@@ -241,7 +241,7 @@
private void addTypedAbsFunction(String type) {
functions.add(
- new FunctionMethod(SourceSystemFunctions.ABS, QueryPlugin.Util.getString("SystemSource.Abs_desc"), NUMERIC, FUNCTION_CLASS, "abs", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.ABS, QueryPlugin.Util.getString("SystemSource.Abs_desc"), NUMERIC, FUNCTION_CLASS, "abs", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("number", type, QueryPlugin.Util.getString("SystemSource.Abs_arg")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", type, QueryPlugin.Util.getString("SystemSource.Abs_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -249,13 +249,13 @@
private void addRandFunction() {
// With Seed
- FunctionMethod rand = new FunctionMethod(SourceSystemFunctions.RAND, QueryPlugin.Util.getString("SystemSource.Rand_desc"), NUMERIC, FUNCTION_CLASS, "rand", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FunctionMethod rand = new FunctionMethod(SourceSystemFunctions.RAND, QueryPlugin.Util.getString("SystemSource.Rand_desc"), NUMERIC, FUNCTION_CLASS, "rand", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {new FunctionParameter("seed", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Rand_arg")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Rand_result_desc")), FunctionMethod.NONDETERMINISTIC ); //$NON-NLS-1$ //$NON-NLS-2$
rand.setNullDependent(true);
functions.add(rand);
// Without Seed
- functions.add( new FunctionMethod(SourceSystemFunctions.RAND, QueryPlugin.Util.getString("SystemSource.Rand_desc"), NUMERIC, FUNCTION_CLASS, "rand", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ functions.add( new FunctionMethod(SourceSystemFunctions.RAND, QueryPlugin.Util.getString("SystemSource.Rand_desc"), NUMERIC, FUNCTION_CLASS, "rand", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {},
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Rand_result_desc")), FunctionMethod.NONDETERMINISTIC ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -285,11 +285,11 @@
}
private void addModFunction() {
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.LONG); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.FLOAT); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.DOUBLE); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.BIG_INTEGER); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$
+ addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.LONG); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+ addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.FLOAT); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+ addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.DOUBLE); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+ addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.BIG_INTEGER); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
}
private void addPowerFunction() {
@@ -299,7 +299,7 @@
private void addTypedPowerFunction(String baseType, String powerType) {
functions.add(
- new FunctionMethod(SourceSystemFunctions.POWER, QueryPlugin.Util.getString("SystemSource.Power_desc"), NUMERIC, FUNCTION_CLASS, "power", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.POWER, QueryPlugin.Util.getString("SystemSource.Power_desc"), NUMERIC, FUNCTION_CLASS, "power", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("base", baseType, QueryPlugin.Util.getString("SystemSource.Power_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("power", powerType, QueryPlugin.Util.getString("SystemSource.Power_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -315,7 +315,7 @@
private void addTypedRoundFunction(String roundType) {
functions.add(
- new FunctionMethod(SourceSystemFunctions.ROUND, QueryPlugin.Util.getString("SystemSource.Round_desc"), NUMERIC, FUNCTION_CLASS, "round", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.ROUND, QueryPlugin.Util.getString("SystemSource.Round_desc"), NUMERIC, FUNCTION_CLASS, "round", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("number", roundType, QueryPlugin.Util.getString("SystemSource.Round_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("places", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Round_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -333,22 +333,20 @@
private void addTypedSignFunction(String type) {
functions.add(
- new FunctionMethod(SourceSystemFunctions.SIGN, QueryPlugin.Util.getString("SystemSource.Sign_desc"), NUMERIC, FUNCTION_CLASS, "sign", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.SIGN, QueryPlugin.Util.getString("SystemSource.Sign_desc"), NUMERIC, FUNCTION_CLASS, "sign", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("number", type, QueryPlugin.Util.getString("SystemSource.Sign_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Sign_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
private void addSqrtFunction() {
- addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.INTEGER);
addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.LONG);
- addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.FLOAT);
addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.DOUBLE);
}
private void addTypedSqrtFunction(String type) {
functions.add(
- new FunctionMethod(SourceSystemFunctions.SQRT, QueryPlugin.Util.getString("SystemSource.Sqrt_desc"), NUMERIC, FUNCTION_CLASS, "sqrt", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.SQRT, QueryPlugin.Util.getString("SystemSource.Sqrt_desc"), NUMERIC, FUNCTION_CLASS, "sqrt", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("number", type, QueryPlugin.Util.getString("SystemSource.Sqrt_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Sqrt_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -393,21 +391,21 @@
private void addTimestampAddFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD, QueryPlugin.Util.getString("SystemSource.Timestampadd_d_desc"), DATETIME, FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD, QueryPlugin.Util.getString("SystemSource.Timestampadd_d_desc"), DATETIME, FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$
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$
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, FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD, QueryPlugin.Util.getString("SystemSource.Timestampadd_t_desc"), DATETIME, FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$
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$
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$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPADD, QueryPlugin.Util.getString("SystemSource.Timestampadd_ts_desc"), DATETIME, FUNCTION_CLASS, "timestampAdd", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Timestampadd_ts_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Timestampadd_ts_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -417,14 +415,14 @@
private void addTimestampDiffFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPDIFF, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_desc"), DATETIME, FUNCTION_CLASS, "timestampDiff", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPDIFF, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_desc"), DATETIME, FUNCTION_CLASS, "timestampDiff", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("time1", DataTypeManager.DefaultDataTypes.TIME, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("time2", DataTypeManager.DefaultDataTypes.TIME, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_arg3"))}, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Timestampdiff_t_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPDIFF, QueryPlugin.Util.getString("SystemSource.Timestampdiff_ts_desc"), DATETIME, FUNCTION_CLASS, "timestampDiff", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPDIFF, QueryPlugin.Util.getString("SystemSource.Timestampdiff_ts_desc"), DATETIME, FUNCTION_CLASS, "timestampDiff", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("interval", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Timestampdiff_ts_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("timestamp1", DataTypeManager.DefaultDataTypes.TIMESTAMP, QueryPlugin.Util.getString("SystemSource.Timestampdiff_ts_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -434,7 +432,7 @@
private void addTimestampCreateFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.TIMESTAMPCREATE, QueryPlugin.Util.getString("SystemSource.TimestampCreate_desc"), DATETIME, FUNCTION_CLASS, "timestampCreate", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TIMESTAMPCREATE, QueryPlugin.Util.getString("SystemSource.TimestampCreate_desc"), DATETIME, FUNCTION_CLASS, "timestampCreate", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("date", DataTypeManager.DefaultDataTypes.DATE, QueryPlugin.Util.getString("SystemSource.TimestampCreate_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("time", DataTypeManager.DefaultDataTypes.TIME, QueryPlugin.Util.getString("SystemSource.TimestampCreate_arg2"))}, //$NON-NLS-1$ //$NON-NLS-2$
@@ -472,7 +470,7 @@
private void addConcatFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.CONCAT, QueryPlugin.Util.getString("SystemSource.Concat_desc"), STRING, FUNCTION_CLASS, "concat", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.CONCAT, QueryPlugin.Util.getString("SystemSource.Concat_desc"), STRING, FUNCTION_CLASS, "concat", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
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$
@@ -494,14 +492,14 @@
private void addSubstringFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.SUBSTRING, QueryPlugin.Util.getString("SystemSource.Substring_desc"), STRING, FUNCTION_CLASS, "substring", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.SUBSTRING, QueryPlugin.Util.getString("SystemSource.Substring_desc"), STRING, FUNCTION_CLASS, "substring", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Substring_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("index", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Substring_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Substring_arg3")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Substring_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.SUBSTRING, QueryPlugin.Util.getString("SystemSource.Susbstring2_desc"), STRING, FUNCTION_CLASS, "substring", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.SUBSTRING, QueryPlugin.Util.getString("SystemSource.Susbstring2_desc"), STRING, FUNCTION_CLASS, "substring", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Substring2_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("index", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Substring2_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -510,13 +508,13 @@
private void addLeftRightFunctions() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.LEFT, QueryPlugin.Util.getString("SystemSource.Left_desc"), STRING, FUNCTION_CLASS, "left", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.LEFT, QueryPlugin.Util.getString("SystemSource.Left_desc"), STRING, FUNCTION_CLASS, "left", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Left_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Left_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Left2_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.RIGHT, QueryPlugin.Util.getString("SystemSource.Right_desc"), STRING, FUNCTION_CLASS, "right", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.RIGHT, QueryPlugin.Util.getString("SystemSource.Right_desc"), STRING, FUNCTION_CLASS, "right", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Right_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Right_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -524,15 +522,17 @@
}
private void addLocateFunction() {
- functions.add(
- new FunctionMethod(SourceSystemFunctions.LOCATE, QueryPlugin.Util.getString("SystemSource.Locate_desc"), STRING, FUNCTION_CLASS, "locate", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FunctionMethod func =
+ new FunctionMethod(SourceSystemFunctions.LOCATE, QueryPlugin.Util.getString("SystemSource.Locate_desc"), STRING, FUNCTION_CLASS, "locate", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("index", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate_arg3")) }, //$NON-NLS-1$ //$NON-NLS-2$
- new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate_result")) ); //$NON-NLS-1$ //$NON-NLS-2$
+ func.setNullDependent(true);
+ functions.add(func);
functions.add(
- new FunctionMethod(SourceSystemFunctions.LOCATE, QueryPlugin.Util.getString("SystemSource.Locate2_desc"), STRING, FUNCTION_CLASS, "locate", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.LOCATE, QueryPlugin.Util.getString("SystemSource.Locate2_desc"), STRING, FUNCTION_CLASS, "locate", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate2_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate2_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -541,7 +541,7 @@
private void addReplaceFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.REPLACE, QueryPlugin.Util.getString("SystemSource.Replace_desc"), STRING, FUNCTION_CLASS, "replace", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.REPLACE, QueryPlugin.Util.getString("SystemSource.Replace_desc"), STRING, FUNCTION_CLASS, "replace", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Replace_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Replace_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -551,7 +551,7 @@
private void addRepeatFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.REPEAT, QueryPlugin.Util.getString("SystemSource.Repeat_desc"), STRING, FUNCTION_CLASS, "repeat", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.REPEAT, QueryPlugin.Util.getString("SystemSource.Repeat_desc"), STRING, FUNCTION_CLASS, "repeat", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Repeat_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("count", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Repeat_arg2"))}, //$NON-NLS-1$ //$NON-NLS-2$
@@ -560,7 +560,7 @@
private void addSpaceFunction() {
functions.add(
- new FunctionMethod(FunctionLibrary.SPACE, QueryPlugin.Util.getString("SystemSource.Space_desc"), STRING, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(FunctionLibrary.SPACE, QueryPlugin.Util.getString("SystemSource.Space_desc"), STRING, FunctionMethod.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$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Space_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -568,7 +568,7 @@
private void addInsertFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.INSERT, QueryPlugin.Util.getString("SystemSource.Insert_desc"), STRING, FUNCTION_CLASS, "insert", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.INSERT, QueryPlugin.Util.getString("SystemSource.Insert_desc"), STRING, FUNCTION_CLASS, "insert", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("str1", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Insert_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("start", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Insert_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -579,12 +579,12 @@
private void addAsciiFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.ASCII, QueryPlugin.Util.getString("SystemSource.Ascii_desc"), STRING, FUNCTION_CLASS, "ascii", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.ASCII, QueryPlugin.Util.getString("SystemSource.Ascii_desc"), STRING, FUNCTION_CLASS, "ascii", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Ascii_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Ascii_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.ASCII, QueryPlugin.Util.getString("SystemSource.Ascii2_desc"), STRING, FUNCTION_CLASS, "ascii", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.ASCII, QueryPlugin.Util.getString("SystemSource.Ascii2_desc"), STRING, FUNCTION_CLASS, "ascii", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("char", DataTypeManager.DefaultDataTypes.CHAR, QueryPlugin.Util.getString("SystemSource.Ascii2_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Ascii2_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -592,7 +592,7 @@
private void addCharFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.CHAR, QueryPlugin.Util.getString("SystemSource.Char_desc"), STRING, FUNCTION_CLASS, "chr", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.CHAR, QueryPlugin.Util.getString("SystemSource.Char_desc"), STRING, FUNCTION_CLASS, "chr", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("code", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Char_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.CHAR, QueryPlugin.Util.getString("SystemSource.Char_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -605,7 +605,7 @@
private void addInitCapFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.INITCAP, QueryPlugin.Util.getString("SystemSource.Initcap_desc"), STRING, FUNCTION_CLASS, "initCap", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.INITCAP, QueryPlugin.Util.getString("SystemSource.Initcap_desc"), STRING, FUNCTION_CLASS, "initCap", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Initcap_arg1")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Initcap_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -613,13 +613,13 @@
private void addLpadFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.LPAD, QueryPlugin.Util.getString("SystemSource.Lpad_desc"), STRING, FUNCTION_CLASS, "lpad", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.LPAD, QueryPlugin.Util.getString("SystemSource.Lpad_desc"), STRING, FUNCTION_CLASS, "lpad", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Lpad_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Lpad_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Lpad_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.LPAD, QueryPlugin.Util.getString("SystemSource.Lpad3_desc"), STRING, FUNCTION_CLASS, "lpad", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.LPAD, QueryPlugin.Util.getString("SystemSource.Lpad3_desc"), STRING, FUNCTION_CLASS, "lpad", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Lpad3_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Lpad3_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -629,13 +629,13 @@
private void addRpadFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.RPAD, QueryPlugin.Util.getString("SystemSource.Rpad1_desc"), STRING, FUNCTION_CLASS, "rpad", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.RPAD, QueryPlugin.Util.getString("SystemSource.Rpad1_desc"), STRING, FUNCTION_CLASS, "rpad", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Rpad1_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Rpad1_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Rpad1_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.RPAD, QueryPlugin.Util.getString("SystemSource.Rpad3_desc"), STRING, FUNCTION_CLASS, "rpad", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.RPAD, QueryPlugin.Util.getString("SystemSource.Rpad3_desc"), STRING, FUNCTION_CLASS, "rpad", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Rpad3_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("length", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Rpad3_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -645,7 +645,7 @@
private void addTranslateFunction() {
functions.add(
- new FunctionMethod(SourceSystemFunctions.TRANSLATE, QueryPlugin.Util.getString("SystemSource.Translate_desc"), STRING, FUNCTION_CLASS, "translate", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FunctionMethod(SourceSystemFunctions.TRANSLATE, QueryPlugin.Util.getString("SystemSource.Translate_desc"), STRING, FUNCTION_CLASS, "translate", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Translate_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("source", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Translate_arg2")), //$NON-NLS-1$ //$NON-NLS-2$
@@ -655,7 +655,7 @@
private void addConversionFunctions() {
for (String type : DataTypeManager.getAllDataTypeNames()) {
- addTypedConversionFunction(SourceSystemFunctions.CONVERT, type); //$NON-NLS-1$
+ addTypedConversionFunction(SourceSystemFunctions.CONVERT, type);
addTypedConversionFunction("cast", type); //$NON-NLS-1$
}
}
@@ -898,13 +898,13 @@
* @since 4.2
*/
private void addXpathFunction() {
- functions.add(new FunctionMethod(SourceSystemFunctions.XPATHVALUE, QueryPlugin.Util.getString("SystemSource.xpath_description"), XML, XML_FUNCTION_CLASS, "xpathValue", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ functions.add(new FunctionMethod(SourceSystemFunctions.XPATHVALUE, QueryPlugin.Util.getString("SystemSource.xpath_description"), XML, XML_FUNCTION_CLASS, "xpathValue", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("document", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.xpath_param1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("xpath", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.xpath_param2"))}, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.xpath_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
- functions.add(new FunctionMethod(SourceSystemFunctions.XPATHVALUE, QueryPlugin.Util.getString("SystemSource.xpath_description"), XML, XML_FUNCTION_CLASS, "xpathValue", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ functions.add(new FunctionMethod(SourceSystemFunctions.XPATHVALUE, QueryPlugin.Util.getString("SystemSource.xpath_description"), XML, XML_FUNCTION_CLASS, "xpathValue", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("document", DataTypeManager.DefaultDataTypes.XML, QueryPlugin.Util.getString("SystemSource.xpath_param1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("xpath", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.xpath_param2"))}, //$NON-NLS-1$ //$NON-NLS-2$
@@ -913,14 +913,14 @@
}
private void addTimeZoneFunctions() {
- functions.add(new FunctionMethod(SourceSystemFunctions.MODIFYTIMEZONE, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_description"), DATETIME, FUNCTION_CLASS, "modifyTimeZone", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ functions.add(new FunctionMethod(SourceSystemFunctions.MODIFYTIMEZONE, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_description"), DATETIME, FUNCTION_CLASS, "modifyTimeZone", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.TIMESTAMP, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_param1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("startTimeZone", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_param2")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("endTimeZone", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_param3"))}, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIMESTAMP, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
- functions.add(new FunctionMethod(SourceSystemFunctions.MODIFYTIMEZONE, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_description"), DATETIME, FUNCTION_CLASS, "modifyTimeZone", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ functions.add(new FunctionMethod(SourceSystemFunctions.MODIFYTIMEZONE, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_description"), DATETIME, FUNCTION_CLASS, "modifyTimeZone", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
new FunctionParameter("timestamp", DataTypeManager.DefaultDataTypes.TIMESTAMP, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_param1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("endTimeZone", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.modifyTimeZone_param3"))}, //$NON-NLS-1$ //$NON-NLS-2$
@@ -945,13 +945,13 @@
new FunctionParameter("result", type, QueryPlugin.Util.getString("SystemSource.nullif_result")), true, FunctionMethod.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
}
- //TODO: add support for varargs
private void addTypedCoalesceFunction(String type) {
functions.add(
- new FunctionMethod(FunctionLibrary.COALESCE, QueryPlugin.Util.getString("SystemSource.coalesce_description"), MISCELLANEOUS, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
+ new FunctionMethod(FunctionLibrary.COALESCE, QueryPlugin.Util.getString("SystemSource.coalesce_description"), MISCELLANEOUS, FunctionMethod.CAN_PUSHDOWN, FUNCTION_CLASS, "coalesce", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
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("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, FunctionMethod.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -165,12 +165,12 @@
private static final Map<String, String> ALIASED_FUNCTIONS = new HashMap<String, String>();
static {
- ALIASED_FUNCTIONS.put("lower", SourceSystemFunctions.LCASE);
- ALIASED_FUNCTIONS.put("upper", SourceSystemFunctions.UCASE);
- ALIASED_FUNCTIONS.put("cast", SourceSystemFunctions.CONVERT);
- ALIASED_FUNCTIONS.put("nvl", SourceSystemFunctions.IFNULL);
- ALIASED_FUNCTIONS.put("||", SourceSystemFunctions.CONCAT);
- ALIASED_FUNCTIONS.put("chr", SourceSystemFunctions.CHAR);
+ ALIASED_FUNCTIONS.put("lower", SourceSystemFunctions.LCASE); //$NON-NLS-1$
+ ALIASED_FUNCTIONS.put("upper", SourceSystemFunctions.UCASE); //$NON-NLS-1$
+ ALIASED_FUNCTIONS.put("cast", SourceSystemFunctions.CONVERT); //$NON-NLS-1$
+ ALIASED_FUNCTIONS.put("nvl", SourceSystemFunctions.IFNULL); //$NON-NLS-1$
+ ALIASED_FUNCTIONS.put("||", SourceSystemFunctions.CONCAT); //$NON-NLS-1$
+ ALIASED_FUNCTIONS.put("chr", SourceSystemFunctions.CHAR); //$NON-NLS-1$
}
private QueryRewriter() { }
@@ -2016,7 +2016,7 @@
if (function.getName().equalsIgnoreCase(FunctionLibrary.SPACE)) {
//change the function into timestampadd
Function result = new Function(SourceSystemFunctions.REPEAT,
- new Expression[] {new Constant(" "), function.getArg(0)});
+ new Expression[] {new Constant(" "), function.getArg(0)}); //$NON-NLS-1$
//resolve the function
FunctionDescriptor descriptor =
FunctionLibraryManager.getFunctionLibrary().findFunction(SourceSystemFunctions.REPEAT, new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.INTEGER});
@@ -2049,7 +2049,6 @@
return rewriteExpression(caseExpr, procCommand, context, metadata);
}
- //TODO: add proper support for COALESCE
if (function.getName().equalsIgnoreCase(FunctionLibrary.COALESCE)) {
Expression[] args = function.getArgs();
if (args.length == 2) {
@@ -2062,22 +2061,6 @@
result.setType(function.getType());
return rewriteFunction(result, procCommand, context, metadata);
}
-
- //rewrite coalesce(a, b) => case when (a is not null) then a when (b is not null) b else null
- List<Criteria> when = new ArrayList<Criteria>(args.length);
- List<Expression> then = new ArrayList<Expression>(args.length);
- for (int i = 0; i < args.length; i++) {
- IsNullCriteria inc = new IsNullCriteria(args[i]);
- inc.setNegated(true);
- when.add(inc);
- then.add(args[i]);
- }
-
- Constant nullConstant = new Constant(null, function.getType());
- SearchedCaseExpression caseExpr = new SearchedCaseExpression(when, then);
- caseExpr.setElseExpression(nullConstant);
- caseExpr.setType(function.getType());
- return rewriteExpression(caseExpr, procCommand, context, metadata);
}
//rewrite concat2 - CONCAT2(a, b) ==> CASE WHEN (a is NULL AND b is NULL) THEN NULL ELSE CONCAT( NVL(a, ''), NVL(b, '') )
Modified: trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-03-12 16:07:02 UTC (rev 550)
@@ -784,8 +784,7 @@
SystemSource.nullif_param2=Second parameter
SystemSource.nullif_result=null if the parameters are equivalent else param1
SystemSource.coalesce_description=Returns the first non-null parameter
-SystemSource.coalesce_param1=First parameter
-SystemSource.coalesce_param2=Second parameter
+SystemSource.coalesce_param1=parameter
SystemSource.coalesce_result=The first non-null parameter
TempMetadataAdapter.Element_____{0}_____not_found._1=Element ''{0}'' not found.
TempMetadataAdapter.Group_____{0}_____not_found._1=Group ''{0}'' not found.
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -48,12 +48,12 @@
// ################################## TEST HELPERS ################################
- private void helpConcat(Object s1, Object s2, Object expected) throws FunctionExecutionException {
+ private void helpConcat(String s1, String s2, Object expected) throws FunctionExecutionException {
Object actual = FunctionMethods.concat(s1, s2);
assertEquals("concat(" + s1 + ", " + s2 + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public static void helpTrim(Object str, boolean left, Object expected) throws FunctionExecutionException {
+ public static void helpTrim(String str, boolean left, Object expected) {
Object actual = null;
if (left) {
actual = FunctionMethods.leftTrim(str);
@@ -64,27 +64,27 @@
}
}
- public static void helpLeft(Object str, int count, Object expected) throws FunctionExecutionException {
+ public static void helpLeft(String str, int count, Object expected) throws FunctionExecutionException {
Object actual = FunctionMethods.left(str, new Integer(count));
assertEquals("left(" + str + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$
}
- public static void helpRight(Object str, int count, Object expected) throws FunctionExecutionException {
+ public static void helpRight(String str, int count, Object expected) throws FunctionExecutionException {
Object actual = FunctionMethods.right(str, new Integer(count));
assertEquals("right(" + str + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$
}
- public static void helpReplace(Object str, Object sub, Object replace, Object expected) throws FunctionExecutionException {
+ public static void helpReplace(String str, String sub, String replace, Object expected) {
Object actual = FunctionMethods.replace(str, sub, replace);
assertEquals("replace(" + str + "," + sub + "," + replace + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public static void helpSubstring(Object str, Object start, Object length, Object expected) throws FunctionExecutionException {
+ public static void helpSubstring(String str, Integer start, Integer length, Object expected) throws FunctionExecutionException {
Object actual = FunctionMethods.substring(str, start, length);
assertEquals("substring(" + str + "," + start + "," + length + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public static void helpSubstring(Object str, Object start, Object expected) throws FunctionExecutionException {
+ public static void helpSubstring(String str, Integer start, Object expected) throws FunctionExecutionException {
Object actual = FunctionMethods.substring(str, start);
assertEquals("substring(" + str + "," + start + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -102,7 +102,7 @@
}
}
- public static void helpTestInitCap(String input, String expected) throws FunctionExecutionException {
+ public static void helpTestInitCap(String input, String expected) {
String actual = (String) FunctionMethods.initCap(input);
assertEquals("Didn't get expected result from initCap", expected, actual); //$NON-NLS-1$
}
@@ -138,8 +138,8 @@
assertEquals("Didn't get expected result from locate", expectedLocation, actualLocation); //$NON-NLS-1$
}
- public static void helpTestLocate(String locateString, String input, int start, int expectedLocation) throws FunctionExecutionException {
- Integer location = (Integer) FunctionMethods.locate(locateString, input, new Integer(start));
+ public static void helpTestLocate(String locateString, String input, Integer start, int expectedLocation) {
+ Integer location = (Integer) FunctionMethods.locate(locateString, input, start);
int actualLocation = location.intValue();
assertEquals("Didn't get expected result from locate", expectedLocation, actualLocation); //$NON-NLS-1$
}
@@ -175,13 +175,19 @@
expected, actual.toString());
}
- public static void helpTestTimestampAdd(String intervalType, int intervalCount, Object datetime, String expected) throws FunctionExecutionException {
- Object actual = FunctionMethods.timestampAdd(intervalType, new Integer(intervalCount), datetime);
- assertEquals("timestampadd(" + intervalType + ", " + intervalCount + ", " + datetime + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- expected, new Constant(actual).toString());
- }
+ public static void helpTestTimestampDiff(String intervalType, Timestamp timeStamp1, Timestamp timeStamp2, Long expected) throws FunctionExecutionException {
+ Object actual = FunctionMethods.timestampDiff(intervalType, timeStamp1, timeStamp2);
+ assertEquals("timestampDiff(" + intervalType + ", " + timeStamp1 + ", " + timeStamp2 + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ expected, actual);
- public static void helpTestTimestampDiff(String intervalType, Object timeStamp1, Object timeStamp2, Long expected) throws FunctionExecutionException {
+ // test reverse - should be
+ Long expected2 = new Long(0 - expected.longValue());
+ Object actual2 = FunctionMethods.timestampDiff(intervalType, timeStamp2, timeStamp1);
+ assertEquals("timestampDiff(" + intervalType + ", " + timeStamp2 + ", " + timeStamp1 + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ expected2, actual2);
+ }
+
+ public static void helpTestTimestampDiff(String intervalType, Time timeStamp1, Time timeStamp2, Long expected) throws FunctionExecutionException {
Object actual = FunctionMethods.timestampDiff(intervalType, timeStamp1, timeStamp2);
assertEquals("timestampDiff(" + intervalType + ", " + timeStamp1 + ", " + timeStamp2 + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
expected, actual);
@@ -207,32 +213,12 @@
helpConcat("x", "y", "xy"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConcat2() throws FunctionExecutionException {
- helpConcat(null, "x", null); //$NON-NLS-1$
- }
-
- public void testConcat3() throws FunctionExecutionException {
- helpConcat("x", null, null); //$NON-NLS-1$
- }
-
- public void testConcat4() throws FunctionExecutionException {
- helpConcat(null, null, null);
- }
-
public void testConcat5() throws FunctionExecutionException {
helpConcat("", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
// ------------------------------ TRIM ------------------------------
- public void testTrim1() throws FunctionExecutionException {
- helpTrim(null, true, null);
- }
-
- public void testTrim2() throws FunctionExecutionException {
- helpTrim(null, false, null);
- }
-
public void testTrim3() throws FunctionExecutionException {
helpTrim("", true, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -283,10 +269,6 @@
helpLeft("abcd", 3, "abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft3() throws FunctionExecutionException {
- helpLeft(null, 2, null);
- }
-
public void testLeft4() throws FunctionExecutionException {
helpLeft("", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -313,10 +295,6 @@
helpRight("abcd", 3, "bcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight3() throws FunctionExecutionException {
- helpRight(null, 2, null);
- }
-
public void testRight4() throws FunctionExecutionException {
helpRight("", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -351,10 +329,6 @@
helpSubstring("abc", new Integer(3), new Integer(0), ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring5() throws FunctionExecutionException {
- helpSubstring(null, new Integer(3), new Integer(3), null);
- }
-
public void testSubstring6() throws FunctionExecutionException {
helpSubstring("abc", new Integer(3), "c"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -529,11 +503,6 @@
assertEquals("Didn't get expected code", 32, code.intValue()); //$NON-NLS-1$
}
- public void testAscii3() throws FunctionExecutionException {
- Integer code = (Integer) FunctionMethods.ascii(null);
- assertEquals("Didn't get expected code", null, code); //$NON-NLS-1$
- }
-
public void testAscii4() {
try {
FunctionMethods.ascii(""); //$NON-NLS-1$
@@ -552,11 +521,6 @@
assertEquals("Didn't get expected character", ' ', chr.charValue()); //$NON-NLS-1$
}
- public void testChr2() {
- Character chr = (Character) FunctionMethods.chr(null);
- assertEquals("Didn't get expected character", null, chr); //$NON-NLS-1$
- }
-
public void testNvl1() {
String ret = (String) FunctionMethods.ifnull("x", "y"); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Didn't get expected value", "x", ret); //$NON-NLS-1$ //$NON-NLS-2$
@@ -572,11 +536,7 @@
assertEquals("Didn't get expected value", null, ret); //$NON-NLS-1$
}
- public void testInitCap1() throws FunctionExecutionException {
- helpTestInitCap(null, null);
- }
-
- public void testInitCap2() throws FunctionExecutionException {
+ public void testInitCap2() throws Exception {
helpTestInitCap("abc", "Abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -596,10 +556,6 @@
helpTestLpad("x", 4, " x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLpad2() throws FunctionExecutionException {
- helpTestLpad(null, 4, null);
- }
-
public void testLpad3() throws FunctionExecutionException {
helpTestLpad("x", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -609,25 +565,21 @@
}
public void testLpad5() throws FunctionExecutionException {
- helpTestLpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestLpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testLpad6() throws FunctionExecutionException {
- helpTestLpad("10", 6, "0", "000010"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestLpad("10", 6, "0", "000010"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testLpad7() throws FunctionExecutionException {
- helpTestLpad("x", 4, "yq", "qyqx" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ helpTestLpad("x", 4, "yq", "qyqx" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testRpad1() throws FunctionExecutionException {
helpTestRpad("x", 4, "x "); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRpad2() throws FunctionExecutionException {
- helpTestRpad(null, 4, null);
- }
-
public void testRpad3() throws FunctionExecutionException {
helpTestRpad("x", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -637,11 +589,11 @@
}
public void testRpad5() throws FunctionExecutionException {
- helpTestRpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestRpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testRpad6() throws FunctionExecutionException {
- helpTestRpad("10", 6, "0", "100000"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestRpad("10", 6, "0", "100000"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testTranslate1() throws FunctionExecutionException {
@@ -680,82 +632,48 @@
helpTestLocate("y", "xx", 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate5() throws FunctionExecutionException {
+ public void testLocate5() throws Exception {
helpTestLocate("b", "abab", 3, 4); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate6() throws FunctionExecutionException {
+ public void testLocate6() throws Exception {
helpTestLocate("z", "abab", 0, 0); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public void testLocate7() throws Exception {
+ helpTestLocate("z", "abab", null, 0); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testLocate8() throws Exception {
+ helpTestLocate("z", "abab", -1, 0); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- public void testBitand() throws FunctionExecutionException {
+ public void testBitand() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitand(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0x0F0", 0x0F0, result.intValue()); //$NON-NLS-1$
- // first value is not an integer, but second is
- try {
- FunctionMethods.bitand(new String("0xFFF"), new Integer(0x0F0)); //$NON-NLS-1$
- fail("bitand function should expect integer as first param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
- // first value is an integer, but second is not
- try {
- FunctionMethods.bitand(new Integer(0xFFF), new Long(0x0F0L));
- fail("bitand function should expect integer as second param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
}
- public void testBitor() throws FunctionExecutionException {
+ public void testBitor() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitor(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xFFF", 0xFFF, result.intValue()); //$NON-NLS-1$
- // first value is not an integer, but second is
- try {
- FunctionMethods.bitor(new String("0xFFF"), new Integer(0x0F0)); //$NON-NLS-1$
- fail("bitor function should expect integer as first param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
- // first value is an integer, but second is not
- try {
- FunctionMethods.bitor(new Integer(0xFFF), new Long(0x0F0L));
- fail("bitor function should expect integer as second param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
}
- public void testBitxor() throws FunctionExecutionException {
+ public void testBitxor() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitxor(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xF0F", 0xF0F, result.intValue()); //$NON-NLS-1$
- // first value is not an integer, but second is
- try {
- FunctionMethods.bitxor(new String("0xFFF"), new Integer(0x0F0)); //$NON-NLS-1$
- fail("bitxor function should expect integer as first param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
- // first value is an integer, but second is not
- try {
- FunctionMethods.bitxor(new Integer(0xFFF), new Long(0x0F0L));
- fail("bitxor function should expect integer as second param"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
}
- public void testBitnot() throws FunctionExecutionException {
+ public void testBitnot() {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitnot(new Integer(0xF0F));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xFFFFF0F0", 0xFFFFF0F0, result.intValue()); //$NON-NLS-1$
- // first value is not an integer, but second is
- try {
- FunctionMethods.bitnot(new String("0xFFF")); //$NON-NLS-1$
- fail("bitnot function should expect an integer"); //$NON-NLS-1$
- } catch (FunctionExecutionException e) {
- }
}
public void testRoundInteger1() throws FunctionExecutionException {
@@ -950,17 +868,16 @@
helpTestTimestampCreate(TimestampUtil.createDate(103, 11, 1), TimestampUtil.createTime(23, 59, 59), "2003-12-01 23:59:59.0"); //$NON-NLS-1$
}
- public void testTimestampAdd1() throws FunctionExecutionException {
- helpTestTimestampAdd(ReservedWords.SQL_TSI_DAY, 3, TimestampUtil.createDate(103, 11, 1), "{d'2003-12-04'}"); //$NON-NLS-1$
+ public void testTimestampAdd1() throws Exception {
+ assertEquals(TimestampUtil.createDate(103, 11, 4), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_DAY, 3, TimestampUtil.createDate(103, 11, 1)));
}
- public void testTimestampAdd2() throws FunctionExecutionException {
- helpTestTimestampAdd(ReservedWords.SQL_TSI_HOUR, 3, TimestampUtil.createTimestamp(103, 11, 1, 15, 20, 30, 0),
- "{ts'2003-12-01 18:20:30.0'}"); //$NON-NLS-1$
+ public void testTimestampAdd2() throws Exception {
+ assertEquals(TimestampUtil.createTimestamp(103, 11, 1, 18, 20, 30, 0), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_HOUR, 3, TimestampUtil.createTimestamp(103, 11, 1, 15, 20, 30, 0)));
}
- public void testTimestampAdd3() throws FunctionExecutionException {
- helpTestTimestampAdd(ReservedWords.SQL_TSI_MINUTE, 90, TimestampUtil.createTime(10, 20, 30), "{t'11:50:30'}"); //$NON-NLS-1$
+ public void testTimestampAdd3() throws Exception {
+ assertEquals(TimestampUtil.createTime(11, 50, 30), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_MINUTE, 90, TimestampUtil.createTime(10, 20, 30)));
}
public void testTimestampDiffTimeStamp_FracSec_1() throws FunctionExecutionException {
@@ -1170,10 +1087,6 @@
* against the system default timezone (not the startTz shown below). The fianl date value is also being read
* against the default timezone and not the endTz shown.
*/
- public void testModifyTimeZoneNull() throws Exception {
- helpTestModifyTimeZone(null, "GMT+00:00", "GMT-01:00", null); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
public void testModifyTimeZoneGMT() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:19:59.123456789", "GMT+00:00", "GMT-01:00", "2004-10-03 16:19:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -32,7 +32,11 @@
import java.util.Properties;
import java.util.TimeZone;
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.connector.api.SourceSystemFunctions;
import com.metamatrix.api.exception.query.FunctionExecutionException;
import com.metamatrix.api.exception.query.InvalidFunctionException;
@@ -43,7 +47,7 @@
import com.metamatrix.query.unittest.TimestampUtil;
import com.metamatrix.query.util.CommandContext;
-public class TestFunctionLibrary extends TestCase {
+public class TestFunctionLibrary {
// These are just used as shorthand convenience to make unit tests more readable below
private static final Class T_STRING = DataTypeManager.DefaultDataClasses.STRING;
@@ -60,17 +64,11 @@
private FunctionLibrary library = FunctionLibraryManager.getFunctionLibrary();
- // ################################## FRAMEWORK ################################
-
- public TestFunctionLibrary(String name) {
- super(name);
- }
-
- public void setUp() {
+ @Before public void setUp() {
TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
}
- public void tearDown() {
+ @After public void tearDown() {
TimestampWithTimezone.resetCalendar(null);
}
@@ -260,90 +258,90 @@
}
// ################################## ACTUAL TESTS ################################
- public void testFindFunction1() {
+ @Test public void testFindFunction1() {
helpFindFunction("convert", new Class[] { T_INTEGER, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_INTEGER, T_STRING }) );
}
- public void testFindFunction2() {
+ @Test public void testFindFunction2() {
helpFindFunction("cast", new Class[] { T_INTEGER, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor(FunctionLibrary.CAST, new Class[] { T_INTEGER, T_STRING }) );
}
- public void testFindFunction3() {
+ @Test public void testFindFunction3() {
helpFindFunction("curdate", new Class[0], //$NON-NLS-1$
helpCreateDescriptor("curdate", new Class[0])); //$NON-NLS-1$
}
- public void testFindFunction4() {
+ @Test public void testFindFunction4() {
helpFindFunctionFail("curdate", new Class[] { T_INTEGER }); //$NON-NLS-1$
}
- public void testFindFunction5() {
+ @Test public void testFindFunction5() {
helpFindFunction("+", new Class[] { T_INTEGER, T_INTEGER }, //$NON-NLS-1$
helpCreateDescriptor("+", new Class[] { T_INTEGER, T_INTEGER }) ); //$NON-NLS-1$
}
- public void testFindFunction6() {
+ @Test public void testFindFunction6() {
helpFindFunctionFail("+", new Class[] {T_INTEGER, T_FLOAT}); //$NON-NLS-1$
}
- public void testFindFunction7() {
+ @Test public void testFindFunction7() {
helpFindFunctionFail("+", new Class[] {T_INTEGER, T_FLOAT, T_INTEGER}); //$NON-NLS-1$
}
- public void testFindFunction8() {
+ @Test public void testFindFunction8() {
helpFindFunctionFail("+", new Class[] {T_INTEGER}); //$NON-NLS-1$
}
- public void testFindFunction9() {
+ @Test public void testFindFunction9() {
helpFindFunctionFail("+", new Class[] {T_INTEGER, T_NULL }); //$NON-NLS-1$
}
- public void testFindFunction10() {
+ @Test public void testFindFunction10() {
helpFindFunction("substring", new Class[] { T_STRING, T_INTEGER, T_INTEGER }, //$NON-NLS-1$
helpCreateDescriptor("substring", new Class[] { T_STRING, T_INTEGER, T_INTEGER }) ); //$NON-NLS-1$
}
- public void testFindFunction11() {
+ @Test public void testFindFunction11() {
helpFindFunction("substring", new Class[] { T_STRING, T_INTEGER }, //$NON-NLS-1$
helpCreateDescriptor("substring", new Class[] { T_STRING, T_INTEGER }) ); //$NON-NLS-1$
}
- public void testFindFunction12() {
+ @Test public void testFindFunction12() {
helpFindFunction("context", new Class[] { T_STRING, T_INTEGER }, //$NON-NLS-1$
helpCreateDescriptor("context", new Class[] { T_STRING, T_INTEGER }) ); //$NON-NLS-1$
}
- public void testFindFunction12a() {
+ @Test public void testFindFunction12a() {
helpFindFunction("rowlimit", new Class[] { T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("rowlimit", new Class[] { T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction12b() {
+ @Test public void testFindFunction12b() {
helpFindFunction("rowlimitexception", new Class[] { T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("rowlimitexception", new Class[] { T_STRING }) ); //$NON-NLS-1$
}
- public void testFind0ArgConversion1() {
+ @Test public void testFind0ArgConversion1() {
helpFindConversions(
"curdate", new Class[] {}, //$NON-NLS-1$
new FunctionDescriptor[0] );
}
- public void testFind0ArgConversion2() {
+ @Test public void testFind0ArgConversion2() {
helpFindConversions(
"curdate", new Class[] { T_INTEGER }, //$NON-NLS-1$
null );
}
- public void testFind1ArgConversion1() {
+ @Test public void testFind1ArgConversion1() {
helpFindConversions(
"length", new Class[] { T_STRING }, //$NON-NLS-1$
new FunctionDescriptor[1] );
}
- public void testFind1ArgConversion2() {
+ @Test public void testFind1ArgConversion2() {
helpFindConversions(
"length", new Class[] { T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -351,7 +349,7 @@
} );
}
- public void testFind1ArgConversion3() {
+ @Test public void testFind1ArgConversion3() {
helpFindConversions(
"length", new Class[] { DataTypeManager.DefaultDataClasses.TIMESTAMP }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -359,13 +357,13 @@
} );
}
- public void testFind2ArgConversion1() {
+ @Test public void testFind2ArgConversion1() {
helpFindConversions(
"+", new Class[] { T_INTEGER, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[2] );
}
- public void testFind2ArgConversion2() {
+ @Test public void testFind2ArgConversion2() {
helpFindConversions(
"+", new Class[] { T_INTEGER, T_FLOAT }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -373,7 +371,7 @@
null } );
}
- public void testFind2ArgConversion3() {
+ @Test public void testFind2ArgConversion3() {
helpFindConversions(
"+", new Class[] { T_FLOAT, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -381,13 +379,13 @@
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_INTEGER, T_STRING }) } );
}
- public void testFind2ArgConversion4() {
+ @Test public void testFind2ArgConversion4() {
helpFindConversions(
"+", new Class[] { T_STRING, T_FLOAT }, //$NON-NLS-1$
null );
}
- public void testFind2ArgConversion5() {
+ @Test public void testFind2ArgConversion5() {
helpFindConversions(
"+", new Class[] { T_NULL, T_NULL }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -395,7 +393,7 @@
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_NULL, T_STRING }) } );
}
- public void testFind2ArgConversion6() {
+ @Test public void testFind2ArgConversion6() {
helpFindConversions(
"+", new Class[] { T_NULL, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -403,7 +401,7 @@
null } );
}
- public void testFind2ArgConversion7() {
+ @Test public void testFind2ArgConversion7() {
helpFindConversions(
"+", new Class[] { T_INTEGER, T_NULL }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -411,13 +409,13 @@
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_NULL, T_STRING }) } );
}
- public void testFind3ArgConversion1() {
+ @Test public void testFind3ArgConversion1() {
helpFindConversions(
"substring", new Class[] { T_STRING, T_INTEGER, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[3] );
}
- public void testFind3ArgConversion2() {
+ @Test public void testFind3ArgConversion2() {
helpFindConversions(
"substring", new Class[] { T_INTEGER, T_INTEGER, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -427,7 +425,7 @@
} );
}
- public void testFind3ArgConversion3() {
+ @Test public void testFind3ArgConversion3() {
helpFindConversions(
"substring", new Class[] { T_INTEGER, T_INTEGER, DataTypeManager.DefaultDataClasses.SHORT }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -437,13 +435,13 @@
} );
}
- public void testFind3ArgConversion4() {
+ @Test public void testFind3ArgConversion4() {
helpFindConversions(
"substring", new Class[] { T_STRING, T_INTEGER, DataTypeManager.DefaultDataClasses.TIMESTAMP }, //$NON-NLS-1$
null );
}
- public void testFind3ArgConversion5() {
+ @Test public void testFind3ArgConversion5() {
helpFindConversions(
"substring", new Class[] { T_STRING, DataTypeManager.DefaultDataClasses.SHORT, DataTypeManager.DefaultDataClasses.SHORT }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -453,7 +451,7 @@
} );
}
- public void testFind3ArgConversion6() {
+ @Test public void testFind3ArgConversion6() {
helpFindConversions(
"substring", new Class[] { T_INTEGER, DataTypeManager.DefaultDataClasses.SHORT, DataTypeManager.DefaultDataClasses.SHORT }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -463,7 +461,7 @@
} );
}
- public void testFind3ArgConversion7() {
+ @Test public void testFind3ArgConversion7() {
helpFindConversions(
"substring", new Class[] { T_NULL, T_INTEGER, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -473,7 +471,7 @@
);
}
- public void testFind3ArgConversion8() {
+ @Test public void testFind3ArgConversion8() {
helpFindConversions(
"substring", new Class[] { T_NULL, T_NULL, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -483,7 +481,7 @@
);
}
- public void testFind3ArgConversion9() {
+ @Test public void testFind3ArgConversion9() {
helpFindConversions(
"substring", new Class[] { T_NULL, T_NULL, T_NULL }, //$NON-NLS-1$
new FunctionDescriptor[] {
@@ -494,7 +492,7 @@
}
// Walk through all functions by metadata
- public void testEnumerateForms() {
+ @Test public void testEnumerateForms() {
FunctionLibrary lib = FunctionLibraryManager.getFunctionLibrary();
Collection categories = lib.getFunctionCategories();
@@ -515,623 +513,623 @@
}
}
- public void testFindForm1() {
+ @Test public void testFindForm1() {
helpFindForm("convert", 2); //$NON-NLS-1$
}
- public void testFindForm2() {
+ @Test public void testFindForm2() {
helpFindForm("locate", 2); //$NON-NLS-1$
}
- public void testFindForm3() {
+ @Test public void testFindForm3() {
helpFindForm("locate", 3); //$NON-NLS-1$
}
- public void testFindForm4() {
+ @Test public void testFindForm4() {
helpFindForm("substring", 2); //$NON-NLS-1$
}
- public void testFindForm5() {
+ @Test public void testFindForm5() {
helpFindForm("substring", 3); //$NON-NLS-1$
}
- public void testFindForm6() {
+ @Test public void testFindForm6() {
helpFindForm("now", 0); //$NON-NLS-1$
}
- public void testInvokePlus1() {
+ @Test public void testInvokePlus1() {
helpInvokeMethod("+", new Object[] { new Integer(3), new Integer(2) }, new Integer(5)); //$NON-NLS-1$
}
- public void testInvokePlus2() {
+ @Test public void testInvokePlus2() {
helpInvokeMethod("+", new Object[] { new Long(3), new Long(2) }, new Long(5)); //$NON-NLS-1$
}
- public void testInvokePlus3() {
+ @Test public void testInvokePlus3() {
helpInvokeMethod("+", new Object[] { new Float(3), new Float(2) }, new Float(5)); //$NON-NLS-1$
}
- public void testInvokePlus4() {
+ @Test public void testInvokePlus4() {
helpInvokeMethod("+", new Object[] { new Double(3), new Double(2) }, new Double(5)); //$NON-NLS-1$
}
- public void testInvokePlus5() {
+ @Test public void testInvokePlus5() {
helpInvokeMethod("+", new Object[] { new BigInteger("3"), new BigInteger("2") }, new BigInteger("5")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokePlus6() {
+ @Test public void testInvokePlus6() {
helpInvokeMethod("+", new Object[] { new BigDecimal("3"), new BigDecimal("2") }, new BigDecimal("5")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeMinus1() {
+ @Test public void testInvokeMinus1() {
helpInvokeMethod("-", new Object[] { new Integer(3), new Integer(2) }, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeMinus2() {
+ @Test public void testInvokeMinus2() {
helpInvokeMethod("-", new Object[] { new Long(3), new Long(2) }, new Long(1)); //$NON-NLS-1$
}
- public void testInvokeMinus3() {
+ @Test public void testInvokeMinus3() {
helpInvokeMethod("-", new Object[] { new Float(3), new Float(2) }, new Float(1)); //$NON-NLS-1$
}
- public void testInvokeMinus4() {
+ @Test public void testInvokeMinus4() {
helpInvokeMethod("-", new Object[] { new Double(3), new Double(2) }, new Double(1)); //$NON-NLS-1$
}
- public void testInvokeMinus5() {
+ @Test public void testInvokeMinus5() {
helpInvokeMethod("-", new Object[] { new BigInteger("3"), new BigInteger("2") }, new BigInteger("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeMinus6() {
+ @Test public void testInvokeMinus6() {
helpInvokeMethod("-", new Object[] { new BigDecimal("3"), new BigDecimal("2") }, new BigDecimal("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeMultiply1() {
+ @Test public void testInvokeMultiply1() {
helpInvokeMethod("*", new Object[] { new Integer(3), new Integer(2) }, new Integer(6)); //$NON-NLS-1$
}
- public void testInvokeMultiply2() {
+ @Test public void testInvokeMultiply2() {
helpInvokeMethod("*", new Object[] { new Long(3), new Long(2) }, new Long(6)); //$NON-NLS-1$
}
- public void testInvokeMultiply3() {
+ @Test public void testInvokeMultiply3() {
helpInvokeMethod("*", new Object[] { new Float(3), new Float(2) }, new Float(6)); //$NON-NLS-1$
}
- public void testInvokeMultiply4() {
+ @Test public void testInvokeMultiply4() {
helpInvokeMethod("*", new Object[] { new Double(3), new Double(2) }, new Double(6)); //$NON-NLS-1$
}
- public void testInvokeMultiply5() {
+ @Test public void testInvokeMultiply5() {
helpInvokeMethod("*", new Object[] { new BigInteger("3"), new BigInteger("2") }, new BigInteger("6")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeMultiply6() {
+ @Test public void testInvokeMultiply6() {
helpInvokeMethod("*", new Object[] { new BigDecimal("3"), new BigDecimal("2") }, new BigDecimal("6")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeDivide1() {
+ @Test public void testInvokeDivide1() {
helpInvokeMethod("/", new Object[] { new Integer(3), new Integer(2) }, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeDivide2() {
+ @Test public void testInvokeDivide2() {
helpInvokeMethod("/", new Object[] { new Long(3), new Long(2) }, new Long(1)); //$NON-NLS-1$
}
- public void testInvokeDivide3() {
+ @Test public void testInvokeDivide3() {
helpInvokeMethod("/", new Object[] { new Float(3), new Float(2) }, new Float(1.5)); //$NON-NLS-1$
}
- public void testInvokeDivide4() {
+ @Test public void testInvokeDivide4() {
helpInvokeMethod("/", new Object[] { new Double(3), new Double(2) }, new Double(1.5)); //$NON-NLS-1$
}
- public void testInvokeDivide5() {
+ @Test public void testInvokeDivide5() {
helpInvokeMethod("/", new Object[] { new BigInteger("3"), new BigInteger("2") }, new BigInteger("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
// one digit precision
- public void testInvokeDivide6() {
+ @Test public void testInvokeDivide6() {
helpInvokeMethod("/", new Object[] { new BigDecimal("3"), new BigDecimal("2") }, new BigDecimal("2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeAbs1() {
+ @Test public void testInvokeAbs1() {
helpInvokeMethod("abs", new Object[] { new Integer(-3) }, new Integer(3)); //$NON-NLS-1$
}
- public void testInvokeAbs2() {
+ @Test public void testInvokeAbs2() {
helpInvokeMethod("abs", new Object[] { new Long(-3) }, new Long(3)); //$NON-NLS-1$
}
- public void testInvokeAbs3() {
+ @Test public void testInvokeAbs3() {
helpInvokeMethod("abs", new Object[] { new Float(-3) }, new Float(3)); //$NON-NLS-1$
}
- public void testInvokeAbs4() {
+ @Test public void testInvokeAbs4() {
helpInvokeMethod("abs", new Object[] { new Double(-3) }, new Double(3)); //$NON-NLS-1$
}
- public void testInvokeAbs5() {
+ @Test public void testInvokeAbs5() {
helpInvokeMethod("abs", new Object[] { new BigInteger("-3") }, new BigInteger("3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeAbs6() {
+ @Test public void testInvokeAbs6() {
helpInvokeMethod("abs", new Object[] { new BigDecimal("-3") }, new BigDecimal("3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeAcos() {
+ @Test public void testInvokeAcos() {
helpInvokeMethod("acos", new Object[] { new Double(0.05) }, new Double(1.5207754699891267)); //$NON-NLS-1$
}
- public void testInvokeAsin() {
+ @Test public void testInvokeAsin() {
helpInvokeMethod("asin", new Object[] { new Double(0.05) }, new Double(0.050020856805770016)); //$NON-NLS-1$
}
- public void testInvokeAtan() {
+ @Test public void testInvokeAtan() {
helpInvokeMethod("atan", new Object[] { new Double(0.05) }, new Double(0.049958395721942765)); //$NON-NLS-1$
}
- public void testInvokeAtan2() {
+ @Test public void testInvokeAtan2() {
helpInvokeMethod("atan2", new Object[] { new Double(0.05), new Double(0.07) }, new Double(0.6202494859828215)); //$NON-NLS-1$
}
- public void testInvokeCos() {
+ @Test public void testInvokeCos() {
helpInvokeMethod("cos", new Object[] { new Double(1.57) }, new Double(7.963267107332633E-4)); //$NON-NLS-1$
}
- public void testInvokeCot() {
+ @Test public void testInvokeCot() {
helpInvokeMethod("cot", new Object[] { new Double(1.57) }, new Double(7.963269632231926E-4)); //$NON-NLS-1$
}
- public void testInvokeDegrees() {
+ @Test public void testInvokeDegrees() {
helpInvokeMethod("degrees", new Object[] { new Double(1.57) }, new Double(89.95437383553926)); //$NON-NLS-1$
}
- public void testInvokePI() {
+ @Test public void testInvokePI() {
helpInvokeMethod("pi", new Object[] { }, new Double(3.141592653589793)); //$NON-NLS-1$
}
- public void testInvokeRadians() {
+ @Test public void testInvokeRadians() {
helpInvokeMethod("radians", new Object[] { new Double(89.95437383553926) }, new Double(1.57)); //$NON-NLS-1$
}
- public void testInvokeSin() {
+ @Test public void testInvokeSin() {
helpInvokeMethod("sin", new Object[] { new Double(1.57) }, new Double(0.9999996829318346)); //$NON-NLS-1$
}
- public void testInvokeTan() {
+ @Test public void testInvokeTan() {
helpInvokeMethod("tan", new Object[] { new Double(0.785) }, new Double(0.9992039901050427)); //$NON-NLS-1$
}
- public void testInvokeAscii() {
+ @Test public void testInvokeAscii() {
helpInvokeMethod("ascii", new Object[] { " " }, new Integer(32)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInvokeChr() {
+ @Test public void testInvokeChr() {
helpInvokeMethod("chr", new Object[] { new Integer(32) }, new Character(' ')); //$NON-NLS-1$
}
- public void testInvokeNvl() {
+ @Test public void testInvokeNvl() {
helpInvokeMethod("nvl", new Object[] { new Integer(5), new Integer(10) }, new Integer(5) ); //$NON-NLS-1$
}
- public void testInvokeConcatOperator() {
+ @Test public void testInvokeConcatOperator() {
helpInvokeMethod("||", new Object[] { "a", "b" }, "ab" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeInitcap() {
+ @Test public void testInvokeInitcap() {
helpInvokeMethod("initcap", new Object[] { "my test\ndata" }, "My Test\nData" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeLpad1() {
+ @Test public void testInvokeLpad1() {
helpInvokeMethod("lpad", new Object[] { "x", new Integer(3) }, " x" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeLpad2() {
- helpInvokeMethod("lpad", new Object[] { "x", new Integer(3), "y" }, "yyx" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ @Test public void testInvokeLpad2() {
+ helpInvokeMethod("lpad", new Object[] { "x", new Integer(3), "y" }, "yyx" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeRpad1() {
+ @Test public void testInvokeRpad1() {
helpInvokeMethod("rpad", new Object[] { "x", new Integer(3) }, "x " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeRpad2() {
- helpInvokeMethod("rpad", new Object[] { "x", new Integer(3), "y" }, "xyy" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ @Test public void testInvokeRpad2() {
+ helpInvokeMethod("rpad", new Object[] { "x", new Integer(3), "y" }, "xyy" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeTranslate() {
+ @Test public void testInvokeTranslate() {
helpInvokeMethod("translate", new Object[] { "ababcd", "ad", "da" }, "dbdbca" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
- public void testFindFunction13() {
+ @Test public void testFindFunction13() {
helpFindFunction("formatTime", new Class[] { T_TIME, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatTime", new Class[] { T_TIME, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction14() {
+ @Test public void testFindFunction14() {
helpFindFunction("formatDate", new Class[] { T_DATE, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatDate", new Class[] { T_DATE, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction15() {
+ @Test public void testFindFunction15() {
helpFindFunction("formatTimestamp", new Class[] { T_TIMESTAMP, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatTimestamp", new Class[] { T_TIMESTAMP, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction16() {
+ @Test public void testFindFunction16() {
helpFindFunction("parseTime", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseTime", new Class[] { T_STRING, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction17() {
+ @Test public void testFindFunction17() {
helpFindFunction("parseDate", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseDate", new Class[] { T_STRING, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction18() {
+ @Test public void testFindFunction18() {
helpFindFunction("parseTimestamp", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseTimestamp", new Class[] { T_STRING, T_STRING }) ); //$NON-NLS-1$
}
- public void testFindFunction19() {
+ @Test public void testFindFunction19() {
helpFindFunction("env", new Class[] {T_STRING}, //$NON-NLS-1$
helpCreateDescriptor("env", new Class[] {T_STRING})); //$NON-NLS-1$
}
- public void testInvokeFormatTime1() {
+ @Test public void testInvokeFormatTime1() {
helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(3,5,12), new String("h:mm a") }, "3:05 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTime2() {
+ @Test public void testInvokeFormatTime2() {
helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("K:mm a, z") }, "1:05 PM, GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTime3() {
+ @Test public void testInvokeFormatTime3() {
helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("HH:mm:ss z") }, "13:05:12 GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTime4() {
+ @Test public void testInvokeFormatTime4() {
TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("America/Chicago")); //$NON-NLS-1$
helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("hh a, zzzz") }, "01 PM, Central Standard Time"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTimeFail() {
+ @Test public void testInvokeFormatTimeFail() {
helpInvokeMethodFail("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("hh i, www") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
- public void testInvokeFormatDate1() {
+ @Test public void testInvokeFormatDate1() {
helpInvokeMethod("formatDate", new Object[] {TimestampUtil.createDate(103, 2, 5), new String("yyyy.MM.dd G") }, "2003.03.05 AD"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatDate2() {
+ @Test public void testInvokeFormatDate2() {
helpInvokeMethod("formatDate", new Object[] {TimestampUtil.createDate(103, 2, 5), new String("EEE, MMM d, '' yy") }, "Wed, Mar 5, ' 03"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatDate3() {
+ @Test public void testInvokeFormatDate3() {
helpInvokeMethod("formatDate", new Object[] {new Date(12345678), new String("yyyy.MMMMM.dd GGG hh:mm aaa") }, "1969.December.31 AD 09:25 PM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatDateFail() {
+ @Test public void testInvokeFormatDateFail() {
helpInvokeMethodFail("formatTime", new Object[] {TimestampUtil.createTime(103, 2, 5), new String("yyyy.i.www") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
- public void testInvokeFormatTimestamp1() {
+ @Test public void testInvokeFormatTimestamp1() {
helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/yy h:mm a") }, "04/05/03 3:04 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTimestamp2() {
+ @Test public void testInvokeFormatTimestamp2() {
helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd k:mm a z") }, "2003-04-05 3:04 AM GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTimestamp3() {
+ @Test public void testInvokeFormatTimestamp3() {
helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd hh:mm:ss.SSSS") }, "2003-04-05 03:04:12.0000"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatTimestampFail() {
+ @Test public void testInvokeFormatTimestampFail() {
helpInvokeMethodFail("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/nn h:mm a") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
- public void testInvokeParseTime1() {
+ @Test public void testInvokeParseTime1() {
helpInvokeMethod("parseTime", new Object[] {new String("3:12 PM"), new String("h:mm a") }, TimestampUtil.createTime(15, 12, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseTime2() {
+ @Test public void testInvokeParseTime2() {
helpInvokeMethod("parseTime", new Object[] {new String("03:12:23 CST"), new String("hh:mm:ss z") }, TimestampUtil.createTime(3, 12, 23)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseDate1() {
+ @Test public void testInvokeParseDate1() {
helpInvokeMethod("parseDate", new Object[] {new String("03/05/03"), new String("MM/dd/yy") }, TimestampUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseDate2() {
+ @Test public void testInvokeParseDate2() {
helpInvokeMethod("parseDate", new Object[] {new String("05-Mar-03"), new String("dd-MMM-yy") }, TimestampUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseTimestamp1() {
+ @Test public void testInvokeParseTimestamp1() {
helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23 CST"), new String("dd MMM yyyy HH:mm:ss z") }, TimestampUtil.createTimestamp(103, 2, 5, 3, 12, 23, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseTimestamp2() {
+ @Test public void testInvokeParseTimestamp2() {
helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23.333"), new String("dd MMM yyyy HH:mm:ss.SSS") }, TimestampUtil.createTimestamp(103, 2, 5, 3, 12, 23, 333*1000000)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testFindFormatInteger() {
+ @Test public void testFindFormatInteger() {
helpFindFunction("formatInteger", new Class[] { T_INTEGER, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatInteger", new Class[] { T_INTEGER, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindFormatFloat() {
+ @Test public void testFindFormatFloat() {
helpFindFunction("formatFloat", new Class[] { T_FLOAT, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatFloat", new Class[] { T_FLOAT, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindFormatDouble() {
+ @Test public void testFindFormatDouble() {
helpFindFunction("formatDouble", new Class[] { T_DOUBLE, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatDouble", new Class[] { T_DOUBLE, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindFormatLong() {
+ @Test public void testFindFormatLong() {
helpFindFunction("formatLong", new Class[] { T_LONG, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatLong", new Class[] { T_LONG, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindFormatBigInteger() {
+ @Test public void testFindFormatBigInteger() {
helpFindFunction("formatBigInteger", new Class[] { T_BIG_INTEGER, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatBigInteger", new Class[] { T_BIG_INTEGER, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindFormatBigDecimal() {
+ @Test public void testFindFormatBigDecimal() {
helpFindFunction("formatBigDecimal", new Class[] { T_BIG_DECIMAL, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("formatBigDecimal", new Class[] { T_BIG_DECIMAL, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseInteger() {
+ @Test public void testFindParseInteger() {
helpFindFunction("parseInteger", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseInteger", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseLong() {
+ @Test public void testFindParseLong() {
helpFindFunction("parseLong", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseLong", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseDouble() {
+ @Test public void testFindParseDouble() {
helpFindFunction("parseDouble", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseDouble", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseFloat() {
+ @Test public void testFindParseFloat() {
helpFindFunction("parseFloat", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseFloat", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseBigInteger() {
+ @Test public void testFindParseBigInteger() {
helpFindFunction("parseBigInteger", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseBigInteger", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testFindParseBigDecimal() {
+ @Test public void testFindParseBigDecimal() {
helpFindFunction("parseBigDecimal", new Class[] { T_STRING, T_STRING }, //$NON-NLS-1$
helpCreateDescriptor("parseBigDecimal", new Class[] { T_STRING, T_STRING}) ); //$NON-NLS-1$
}
- public void testInvokeParseInteger() {
+ @Test public void testInvokeParseInteger() {
helpInvokeMethod("parseInteger", new Object[] {new String("-1234"), new String("######")}, new Integer(-1234)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseLong() {
+ @Test public void testInvokeParseLong() {
helpInvokeMethod("parseLong", new Object[] {new String("123456"), new String("######.##")}, new Long(123456)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseDouble() {
+ @Test public void testInvokeParseDouble() {
helpInvokeMethod("parseDouble", new Object[] {new String("123456.78"), new String("#####.#")}, new Double(123456.78)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseFloat() {
+ @Test public void testInvokeParseFloat() {
helpInvokeMethod("parseFloat", new Object[] {new String("1234.56"), new String("####.###")}, new Float(1234.56)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeParseBigInteger() {
+ @Test public void testInvokeParseBigInteger() {
helpInvokeMethod("parseBigInteger", new Object[] {new String("12345678"), new String("###,###")}, new BigInteger("12345678")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeParseBigDecimal() {
+ @Test public void testInvokeParseBigDecimal() {
helpInvokeMethod("parseBigDecimal", new Object[] {new String("1234.56"), new String("#####")}, new BigDecimal("1234.56")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeFormatInteger() {
+ @Test public void testInvokeFormatInteger() {
helpInvokeMethod("formatInteger", new Object[] {new Integer(-1234), new String("######")}, "-1234"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatLong() {
+ @Test public void testInvokeFormatLong() {
helpInvokeMethod("formatLong", new Object[] {new Long(123456788), new String("##,###,#")}, "1,2,3,4,5,6,7,8,8"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatDouble() {
+ @Test public void testInvokeFormatDouble() {
helpInvokeMethod("formatDouble", new Object[] {new Double(1234.67), new String("####.##")}, "1234.67"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatFloat() {
+ @Test public void testInvokeFormatFloat() {
helpInvokeMethod("formatFloat", new Object[] {new Float(1234.67), new String("###.###")}, "1234.67"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFormatBigInteger() {
+ @Test public void testInvokeFormatBigInteger() {
helpInvokeMethod("formatBigInteger", new Object[] {new BigInteger("45"), new String("###.###")}, "45"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeFormatBigDecimal() {
+ @Test public void testInvokeFormatBigDecimal() {
helpInvokeMethod("formatBigDecimal", new Object[] {new BigDecimal("1234.56"), new String("###.###")}, "1234.56"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeQuarter1() {
+ @Test public void testInvokeQuarter1() {
// 2003-5-15
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 4, 15)}, new Integer(2)); //$NON-NLS-1$
}
- public void testInvokeQuarter2() {
+ @Test public void testInvokeQuarter2() {
// 2003-5-1
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 3, 31)}, new Integer(2)); //$NON-NLS-1$
}
- public void testInvokeQuarter3() {
+ @Test public void testInvokeQuarter3() {
// 2003-1-31
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 0, 31)}, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeQuarter4() {
+ @Test public void testInvokeQuarter4() {
// 2003-9-30
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 8, 30)}, new Integer(3)); //$NON-NLS-1$
}
- public void testInvokeQuarter5() {
+ @Test public void testInvokeQuarter5() {
// 2003-12-31
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 11, 31)}, new Integer(4)); //$NON-NLS-1$
}
- public void testInvokeQuarter6() {
+ @Test public void testInvokeQuarter6() {
//bad date such as 2003-13-45
helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 12, 45)}, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeIfNull() {
+ @Test public void testInvokeIfNull() {
helpInvokeMethod("ifnull", new Object[] {new Integer(5), new Integer(10)}, new Integer(5)); //$NON-NLS-1$
}
- public void testInvokeLower() {
+ @Test public void testInvokeLower() {
helpInvokeMethod("lower", new Object[] {new String("LOWER")}, new String("lower")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeUpper() {
+ @Test public void testInvokeUpper() {
helpInvokeMethod("upper", new Object[] {new String("upper")}, new String("UPPER")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeRepeat() {
+ @Test public void testInvokeRepeat() {
helpInvokeMethod("repeat", new Object[] {new String("cat"), new Integer(3)}, new String("catcatcat")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeChar() {
+ @Test public void testInvokeChar() {
helpInvokeMethod("char", new Object[] {new Integer(32) }, new Character(' ')); //$NON-NLS-1$
}
/** normal input */
- public void testInvokeInsert1() {
+ @Test public void testInvokeInsert1() {
helpInvokeMethod("insert", new Object[] {new String("Downtown"), new Integer(4), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(2), new String("cat")}, new String("Dowcatown")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** empty string2 */
- public void testInvokeInsert2() {
+ @Test public void testInvokeInsert2() {
helpInvokeMethod("insert", new Object[] {new String("Downtown"), new Integer(4), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(2), new String("")}, new String("Dowown")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** empty string1 with start = 1 and length = 0, so result is just string2 */
- public void testInvokeInsert3() {
+ @Test public void testInvokeInsert3() {
helpInvokeMethod("insert", new Object[] {new String(""), new Integer(1), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(0), new String("cat")}, new String("cat")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** should fail, with start > string1.length() */
- public void testInvokeInsert4() {
+ @Test public void testInvokeInsert4() {
helpInvokeMethodFail("insert", new Object[] {new String(""), new Integer(2), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(0), new String("cat")}, new FunctionExecutionException("")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** should fail, with length > 0 and input string1.length() = 0 */
- public void testInvokeInsert5() {
+ @Test public void testInvokeInsert5() {
helpInvokeMethodFail("insert", new Object[] {new String(""), new Integer(1), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(1), new String("cat")}, new FunctionExecutionException("")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** (length + start) > string1.length(), then just append str2 starting at start position */
- public void testInvokeInsert6() {
+ @Test public void testInvokeInsert6() {
helpInvokeMethod("insert", new Object[] {new String("Downtown"), new Integer(7), //$NON-NLS-1$ //$NON-NLS-2$
new Integer(5), new String("cat")}, new String("Downtocat")); //$NON-NLS-1$ //$NON-NLS-2$
}
/** date + day --> count=28, inteval=day, result should be 2003-6-12 */
- public void testInvokeTimestampAddDate1() {
+ @Test public void testInvokeTimestampAddDate1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_DAY, //$NON-NLS-1$
new Integer(28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 5, 12));
}
- public void testInvokeTimestampAddDate_ignore_case() {
+ @Test public void testInvokeTimestampAddDate_ignore_case() {
helpInvokeMethod("timestampAdd", new Object[] {"sql_TSI_day", //$NON-NLS-1$ //$NON-NLS-2$
new Integer(28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 5, 12));
}
/** date + day --> count=-28, inteval=day, result should be 2003-4-17 */
- public void testInvokeTimestampAddDate1a() {
+ @Test public void testInvokeTimestampAddDate1a() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_DAY, //$NON-NLS-1$
new Integer(-28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 3, 17));
}
/** date + month --> count=18, inteval=month, result should be 2004-11-15 */
- public void testInvokeTimestampAddDate2() {
+ @Test public void testInvokeTimestampAddDate2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MONTH, //$NON-NLS-1$
new Integer(18), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(104, 10, 15));
}
/** date + month --> count=-18, inteval=month, result should be 2001-11-15 */
- public void testInvokeTimestampAddDate2a() {
+ @Test public void testInvokeTimestampAddDate2a() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MONTH, //$NON-NLS-1$
new Integer(-18), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(101, 10, 15));
}
/** date + week --> count=6, inteval=week, result should be 2003-04-03 */
- public void testInvokeTimestampAddDate3() {
+ @Test public void testInvokeTimestampAddDate3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_WEEK, //$NON-NLS-1$
new Integer(-6), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 3, 3));
}
/** date + quarter --> count=3, inteval=quarter, result should be 2004-2-15 */
- public void testInvokeTimestampAddDate4() {
+ @Test public void testInvokeTimestampAddDate4() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_QUARTER, //$NON-NLS-1$
new Integer(3), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(104, 1, 15));
}
/** date + year --> count=-1, inteval=year, result should be 2002-5-15 */
- public void testInvokeTimestampAddDate5() {
+ @Test public void testInvokeTimestampAddDate5() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_YEAR, //$NON-NLS-1$
new Integer(-1), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(102, 4, 15));
}
/** time + minute --> count=23, inteval=3, result should be 03:32:12 */
- public void testInvokeTimestampAddTime1() {
+ @Test public void testInvokeTimestampAddTime1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MINUTE, //$NON-NLS-1$
new Integer(23), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(3, 32, 12));
}
/** time + hour --> count=21, inteval=4, result should be 00:09:12 and overflow */
- public void testInvokeTimestampAddTime2() {
+ @Test public void testInvokeTimestampAddTime2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
new Integer(21), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(0, 9, 12));
}
/** time + hour --> count=2, inteval=4, result should be 01:12:12*/
- public void testInvokeTimestampAddTime3() {
+ @Test public void testInvokeTimestampAddTime3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
new Integer(2), TimestampUtil.createTime(23, 12, 12)}, TimestampUtil.createTime(1, 12, 12));
}
/** time + second --> count=23, inteval=2, result should be 03:10:01 */
- public void testInvokeTimestampAddTime4() {
+ @Test public void testInvokeTimestampAddTime4() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_SECOND, //$NON-NLS-1$
new Integer(49), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(3, 10, 1));
}
/** timestamp + second --> count=23, inteval=2, result should be 2003-05-15 03:09:35.100 */
- public void testInvokeTimestampAddTimestamp1() {
+ @Test public void testInvokeTimestampAddTimestamp1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_SECOND, //$NON-NLS-1$
new Integer(23), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 35, 100));
}
/** timestamp + nanos --> count=1, inteval=1, result should be 2003-05-15 03:09:12.000000101 */
- public void testInvokeTimestampAddTimestamp2() {
+ @Test public void testInvokeTimestampAddTimestamp2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
new Integer(1), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 101));
@@ -1140,20 +1138,20 @@
/** timestamp + nanos --> count=2100000000, inteval=1, result should be 2003-05-15 03:10:01.100000003
* with increase in second and minutes, because second already at 59 sec originally
*/
- public void testInvokeTimestampAddTimestamp3() {
+ @Test public void testInvokeTimestampAddTimestamp3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
new Integer(2100000000), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 59, 1)},
TimestampUtil.createTimestamp(103, 4, 15, 3, 10, 1, 100000003));
}
/** time --> interval=hour, time1 = 03:04:45, time2= 05:05:36 return = 2 */
- public void testInvokeTimestampDiffTime1() {
+ @Test public void testInvokeTimestampDiffTime1() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
TimestampUtil.createTime(3, 4, 45), TimestampUtil.createTime(5, 5, 36) },
new Long(2));
}
- public void testInvokeTimestampDiffTime1_ignorecase() {
+ @Test public void testInvokeTimestampDiffTime1_ignorecase() {
helpInvokeMethod("timestampDiff", new Object[] {"SQL_tsi_HOUR", //$NON-NLS-1$ //$NON-NLS-2$
TimestampUtil.createTime(3, 4, 45), TimestampUtil.createTime(5, 5, 36) },
new Long(2));
@@ -1163,7 +1161,7 @@
* timestamp --> interval=week, time1 = 2002-06-21 03:09:35.100,
* time2= 2003-05-02 05:19:35.500 return = 45
*/
- public void testInvokeTimestampDiffTimestamp1() {
+ @Test public void testInvokeTimestampDiffTimestamp1() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_WEEK, //$NON-NLS-1$
TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100), TimestampUtil.createTimestamp(103, 4, 2, 5, 19, 35, 500) },
new Long(45));
@@ -1173,7 +1171,7 @@
* timestamp --> interval=frac_second, time1 = 2002-06-21 03:09:35.000000001,
* time2= 2002-06-21 03:09:35.100000000 return = 999999999
*/
- public void testInvokeTimestampDiffTimestamp2() {
+ @Test public void testInvokeTimestampDiffTimestamp2() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 1), TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100000000) },
new Long(99999999));
@@ -1183,53 +1181,53 @@
* timestamp --> interval=frac_second, time1 = 2002-06-21 03:09:35.000000002,
* time2= 2002-06-22 03:09:35.000000001 return =
*/
- public void testInvokeTimestampDiffTimestamp3() {
+ @Test public void testInvokeTimestampDiffTimestamp3() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 2), TimestampUtil.createTimestamp(102, 5, 22, 3, 9, 35, 1) },
new Long(86399999999999L));
}
- public void testInvokeTimestampCreate1() {
+ @Test public void testInvokeTimestampCreate1() {
helpInvokeMethod("timestampCreate", new Object[] {TimestampUtil.createDate(103, 4, 15), //$NON-NLS-1$
TimestampUtil.createTime(23, 59, 59)},
TimestampUtil.createTimestamp(103, 4, 15, 23, 59, 59, 0));
}
- public void testInvokeBitand() {
+ @Test public void testInvokeBitand() {
helpInvokeMethod("bitand", new Object[] {new Integer(0xFFF), new Integer(0x0F0)}, new Integer(0x0F0)); //$NON-NLS-1$
}
- public void testInvokeBitor() {
+ @Test public void testInvokeBitor() {
helpInvokeMethod("bitor", new Object[] {new Integer(0xFFF), new Integer(0x0F0)}, new Integer(0xFFF)); //$NON-NLS-1$
}
- public void testInvokeBitxor() {
+ @Test public void testInvokeBitxor() {
helpInvokeMethod("bitxor", new Object[] {new Integer(0xFFF), new Integer(0x0F0)}, new Integer(0xF0F)); //$NON-NLS-1$
}
- public void testInvokeBitnot() {
+ @Test public void testInvokeBitnot() {
helpInvokeMethod("bitnot", new Object[] {new Integer(0xF0F)}, new Integer(0xFFFFF0F0)); //$NON-NLS-1$
}
- public void testInvokeRound1() {
+ @Test public void testInvokeRound1() {
helpInvokeMethod("round", new Object[] {new Integer(123), new Integer(-1)}, new Integer(120)); //$NON-NLS-1$
}
- public void testInvokeRound2() {
+ @Test public void testInvokeRound2() {
helpInvokeMethod("round", new Object[] {new Float(123.456), new Integer(2)}, new Float(123.46)); //$NON-NLS-1$
}
- public void testInvokeRound3() {
+ @Test public void testInvokeRound3() {
helpInvokeMethod("round", new Object[] {new Double(123.456), new Integer(2)}, new Double(123.46)); //$NON-NLS-1$
}
- public void testInvokeRound4() {
+ @Test public void testInvokeRound4() {
helpInvokeMethod("round", new Object[] {new BigDecimal("123.456"), new Integer(2)}, new BigDecimal("123.460")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/** defect 10941 */
- public void testInvokeConvertTime() {
+ @Test public void testInvokeConvertTime() {
helpInvokeMethod("convert", new Object[] {"05:00:00", "time"}, TimestampUtil.createTime(5, 0, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeXpath1() {
+ @Test public void testInvokeXpath1() {
helpInvokeMethod("xpathValue", //$NON-NLS-1$
new Object[] {
"<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b><c>test</c></b></a>", //$NON-NLS-1$
@@ -1237,7 +1235,7 @@
"test"); //$NON-NLS-1$
}
- public void testInvokeXpathWithNill() {
+ @Test public void testInvokeXpathWithNill() {
helpInvokeMethod("xpathValue", //$NON-NLS-1$
new Object[] {
"<?xml version=\"1.0\" encoding=\"utf-8\" ?><a xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><b xsi:nil=\"true\"/></a>", //$NON-NLS-1$
@@ -1245,7 +1243,7 @@
null);
}
- public void testInvokeXpathWithNill1() {
+ @Test public void testInvokeXpathWithNill1() {
helpInvokeMethod("xpathValue", //$NON-NLS-1$
new Object[] {
"<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b>value</b></a>", //$NON-NLS-1$
@@ -1253,7 +1251,7 @@
"value"); //$NON-NLS-1$
}
- public void testInvokeModifyTimeZone() {
+ @Test public void testInvokeModifyTimeZone() {
Timestamp ts = Timestamp.valueOf("2004-10-03 23:59:59.123"); //$NON-NLS-1$
Timestamp out = Timestamp.valueOf("2004-10-03 22:59:59.123"); //$NON-NLS-1$
helpInvokeMethod("modifyTimeZone", new Object[] {ts, "America/Chicago", "America/New_York" }, out); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1266,20 +1264,20 @@
helpInvokeMethod("modifyTimeZone", new Object[] {ts, "America/New_York" }, out); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInvokeRand() {
+ @Test public void testInvokeRand() {
helpInvokeMethod("rand", new Object[] {new Integer(100)}, new Double(0.7220096548596434)); //$NON-NLS-1$
helpInvokeMethodFail("rand", new Class[] {Integer.class}, new Object[] {new Double(100)}, new FunctionExecutionException("")); //$NON-NLS-1$ //$NON-NLS-2$
// this does not actually fail but returns a result
helpInvokeMethodFail("rand", new Class[] {Integer.class}, new Object[] {null}, new FunctionExecutionException("")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInvokeUser() throws Exception {
+ @Test public void testInvokeUser() throws Exception {
CommandContext c = new CommandContext();
c.setUserName("foodude"); //$NON-NLS-1$
helpInvokeMethod("user", new Class[] {}, new Object[] {}, c, "foodude"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInvokeEnv() throws Exception {
+ @Test public void testInvokeEnv() throws Exception {
CommandContext c = new CommandContext();
Properties props = new Properties();
props.setProperty("env_test", "env_value"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1288,7 +1286,7 @@
helpInvokeMethod("env", new Class[] {String.class}, new Object[] {null}, c, null); //$NON-NLS-1$
}
- public void testInvokeCommandPayload() throws Exception {
+ @Test public void testInvokeCommandPayload() throws Exception {
CommandContext c = new CommandContext();
c.setCommandPayload("payload_too heavy"); //$NON-NLS-1$
helpInvokeMethod("commandpayload", new Class[] {}, new Object[] {}, c, "payload_too heavy"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1299,7 +1297,7 @@
helpInvokeMethod("commandpayload", new Class[] {String.class}, new Object[] {"payload"}, c, "payload_too heavy"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testNullDependent() {
+ @Test public void testNullDependent() {
FunctionDescriptor actual = library.findFunction("concat2", new Class[] {String.class, String.class}); //$NON-NLS-1$
assertTrue(actual.isNullDependent());
@@ -1307,95 +1305,102 @@
assertFalse(actual.isNullDependent());
}
- public void testInvokeCeiling() {
+ @Test public void testInvokeCeiling() {
helpInvokeMethod("ceiling", new Object[] { new Double("3.14") }, new Double("4")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeFloor() {
+ @Test public void testInvokeFloor() {
helpInvokeMethod("floor", new Object[] { new Double("3.14") }, new Double("3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeExp() {
+ @Test public void testInvokeExp() {
helpInvokeMethod("exp", new Object[] { new Double("0") }, new Double("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeLog() {
+ @Test public void testInvokeLog() {
helpInvokeMethod("log", new Object[] { new Double("1") }, new Double("0")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeLog10() {
+ @Test public void testInvokeLog10() {
helpInvokeMethod("log10", new Object[] { new Double("10") }, new Double("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokePower() {
+ @Test public void testInvokePower() {
helpInvokeMethod("power", new Object[] { new Double("10"), new Double("2") }, new Double("100")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testInvokeSqrt() {
+ @Test public void testInvokeSqrt() {
helpInvokeMethod("sqrt", new Object[] { new Double("4")}, new Double("2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testInvokeDayName() {
- TimestampUtil util = new TimestampUtil();
+ @Test public void testInvokeDayName() {
for (int i = 0; i < FunctionMethods.dayNames.length; i++) {
- Date time = util.createDate(100, 0, i + 2);
+ Date time = TimestampUtil.createDate(100, 0, i + 2);
helpInvokeMethod("dayName", new Object[] { time }, FunctionMethods.dayNames[i]); //$NON-NLS-1$
}
}
- public void testInvokeDayOfMonth() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeDayOfMonth() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("dayOfMonth", new Object[] { time }, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeDayOfWeek() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeDayOfWeek() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("dayOfWeek", new Object[] { time }, new Integer(7)); //$NON-NLS-1$
}
- public void testInvokeDayOfYear() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 2, 1, 2, 3, 4);
+ @Test public void testInvokeDayOfYear() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 2, 1, 2, 3, 4);
helpInvokeMethod("dayOfYear", new Object[] { time }, new Integer(2)); //$NON-NLS-1$
}
- public void testInvokeMonth() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeMonth() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("month", new Object[] { time }, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeMonthName() {
- TimestampUtil util = new TimestampUtil();
+ @Test public void testInvokeMonthName() {
for (int i = 0; i < FunctionMethods.monthNames.length; i++) {
- Date time = util.createDate(100, i, 1);
+ Date time = TimestampUtil.createDate(100, i, 1);
helpInvokeMethod("monthName", new Object[] { time }, FunctionMethods.monthNames[i]); //$NON-NLS-1$
}
}
- public void testInvokeMinute() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeMinute() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("minute", new Object[] { time }, new Integer(2)); //$NON-NLS-1$
}
- public void testInvokeSecond() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeSecond() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("second", new Object[] { time }, new Integer(3)); //$NON-NLS-1$
}
- public void testInvokeWeek() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeWeek() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("week", new Object[] { time }, new Integer(1)); //$NON-NLS-1$
}
- public void testInvokeYear() {
- TimestampUtil util = new TimestampUtil();
- Timestamp time = util.createTimestamp(100, 0, 1, 1, 2, 3, 4);
+ @Test public void testInvokeYear() {
+ Timestamp time = TimestampUtil.createTimestamp(100, 0, 1, 1, 2, 3, 4);
helpInvokeMethod("year", new Object[] { time }, new Integer(2000)); //$NON-NLS-1$
}
+
+ @Test public void testInvokeCoalesce() {
+ helpInvokeMethod(FunctionLibrary.COALESCE, new Object[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2) }, Integer.valueOf(0));
+ }
+
+ @Test public void testInvokeCoalesce1() {
+ helpInvokeMethod(FunctionLibrary.COALESCE, new Object[] { null, null}, null);
+ }
+
+ @Test public void testInvokeNull() throws Exception {
+ helpInvokeMethod(SourceSystemFunctions.LTRIM, new Class[] {DataTypeManager.DefaultDataClasses.STRING}, new Object[] { null }, null, null);
+ }
+
+ @Test public void testInvokeNull1() throws Exception {
+ helpInvokeMethod(SourceSystemFunctions.CONCAT, new Class[] {DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING}, new Object[] { null, String.valueOf(1) }, null, null);
+ }
+
}
Added: trunk/engine/src/test/java/com/metamatrix/query/resolver/TestFunctionResolving.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/resolver/TestFunctionResolving.java (rev 0)
+++ trunk/engine/src/test/java/com/metamatrix/query/resolver/TestFunctionResolving.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -0,0 +1,128 @@
+/*
+ * 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 com.metamatrix.query.resolver;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.query.QueryParserException;
+import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.query.parser.QueryParser;
+import com.metamatrix.query.resolver.util.ResolverVisitorUtil;
+import com.metamatrix.query.sql.symbol.Constant;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.query.sql.symbol.Expression;
+import com.metamatrix.query.sql.symbol.Function;
+import com.metamatrix.query.sql.symbol.Reference;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
+
+public class TestFunctionResolving {
+
+ @Test public void testResolveBadConvert() throws Exception {
+ Function function = new Function("convert", new Expression[] {new Constant(new Character('a')), new Constant(DataTypeManager.DefaultDataTypes.DATE)}); //$NON-NLS-1$
+
+ try {
+ ResolverVisitorUtil.resolveFunction(function, FakeMetadataFactory.example1Cached());
+ fail("excpetion expected"); //$NON-NLS-1$
+ } catch (QueryResolverException err) {
+ assertEquals("The conversion from char to date is not allowed.", err.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ @Test public void testResolvesClosestType() throws Exception {
+ ElementSymbol e1 = new ElementSymbol("pm1.g1.e1"); //$NON-NLS-1$
+ e1.setType(DataTypeManager.DefaultDataClasses.BYTE);
+ Function function = new Function("abs", new Expression[] {e1}); //$NON-NLS-1$
+
+ ResolverVisitorUtil.resolveFunction(function, FakeMetadataFactory.example1Cached());
+
+ assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, function.getType());
+ }
+
+ @Test public void testResolveConvertReference() throws Exception {
+ Function function = new Function("convert", new Expression[] {new Reference(0), new Constant(DataTypeManager.DefaultDataTypes.BOOLEAN)}); //$NON-NLS-1$
+
+ ResolverVisitorUtil.resolveFunction(function, FakeMetadataFactory.example1Cached());
+
+ assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getType());
+ assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getArgs()[0].getType());
+ }
+
+ @Test public void testResolveAmbiguousFunction() throws Exception {
+ Function function = new Function("LCASE", new Expression[] {new Reference(0)}); //$NON-NLS-1$
+
+ try {
+ ResolverVisitorUtil.resolveFunction(function, FakeMetadataFactory.example1Cached());
+ fail("excpetion expected"); //$NON-NLS-1$
+ } catch (QueryResolverException err) {
+ assertEquals("The function 'LCASE(?)' has more than one possible signature.", err.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ @Test public void testResolveCoalesce() throws Exception {
+ String sql = "coalesce('', '')"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ @Test public void testResolveCoalesce1() throws Exception {
+ String sql = "coalesce('', '', '')"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ /**
+ * Should resolve using varags logic
+ */
+ @Test public void testResolveCoalesce1a() throws Exception {
+ String sql = "coalesce('', '', '', '')"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ /**
+ * Should resolve as 1 is implicitly convertable to string
+ */
+ @Test public void testResolveCoalesce2() throws Exception {
+ String sql = "coalesce('', 1, '', '')"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ @Test public void testResolveCoalesce3() throws Exception {
+ String sql = "coalesce('', 1, null, '')"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ @Test public void testResolveCoalesce4() throws Exception {
+ String sql = "coalesce({d'2009-03-11'}, 1)"; //$NON-NLS-1$
+ helpResolveFunction(sql);
+ }
+
+ private Function helpResolveFunction(String sql) throws QueryParserException,
+ QueryResolverException, MetaMatrixComponentException {
+ Function func = (Function)QueryParser.getQueryParser().parseExpression(sql);
+ ResolverVisitorUtil.resolveFunction(func, FakeMetadataFactory.example1Cached());
+ assertEquals(DataTypeManager.DefaultDataClasses.STRING, func.getType());
+ return func;
+ }
+
+}
Property changes on: trunk/engine/src/test/java/com/metamatrix/query/resolver/TestFunctionResolving.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java 2009-03-11 23:11:24 UTC (rev 549)
+++ trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java 2009-03-12 16:07:02 UTC (rev 550)
@@ -4257,48 +4257,7 @@
helpResolveException(sql);
}
-
- public void testResolvesClosestType() throws Exception {
- ElementSymbol e1 = new ElementSymbol("pm1.g1.e1"); //$NON-NLS-1$
- e1.setType(DataTypeManager.DefaultDataClasses.BYTE);
- Function function = new Function("abs", new Expression[] {e1}); //$NON-NLS-1$
-
- ResolverVisitorUtil.resolveFunction(function, metadata);
-
- assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, function.getType());
- }
-
- public void testResolveConvertReference() throws Exception {
- Function function = new Function("convert", new Expression[] {new Reference(0), new Constant(DataTypeManager.DefaultDataTypes.BOOLEAN)}); //$NON-NLS-1$
-
- ResolverVisitorUtil.resolveFunction(function, metadata);
-
- assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getType());
- assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getArgs()[0].getType());
- }
-
- public void testResolveAmbiguousFunction() throws Exception {
- Function function = new Function("LCASE", new Expression[] {new Reference(0)}); //$NON-NLS-1$
-
- try {
- ResolverVisitorUtil.resolveFunction(function, metadata);
- fail("excpetion expected"); //$NON-NLS-1$
- } catch (QueryResolverException err) {
- assertEquals("The function 'LCASE(?)' has more than one possible signature.", err.getMessage()); //$NON-NLS-1$
- }
- }
-
- public void testResolvBadConvert() throws Exception {
- Function function = new Function("convert", new Expression[] {new Constant(new Character('a')), new Constant(DataTypeManager.DefaultDataTypes.DATE)}); //$NON-NLS-1$
-
- try {
- ResolverVisitorUtil.resolveFunction(function, metadata);
- fail("excpetion expected"); //$NON-NLS-1$
- } catch (QueryResolverException err) {
- assertEquals("The conversion from char to date is not allowed.", err.getMessage()); //$NON-NLS-1$
- }
- }
-
+
public void testCreateAfterImplicitTempTable() {
StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
.append("\nBEGIN") //$NON-NLS-1$
16 years, 6 months
teiid SVN: r549 - in trunk/connectors: connector-jdbc/src/main/resources and 10 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-11 19:11:24 -0400 (Wed, 11 Mar 2009)
New Revision: 549
Added:
trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
trunk/connectors/connector-text/src/main/resources/connector-text.xml
trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
Modified:
trunk/connectors/connector-jdbc/src/assembly/bundle.xml
trunk/connectors/connector-ldap/src/assembly/bundle.xml
trunk/connectors/connector-loopback/src/assembly/bundle.xml
trunk/connectors/connector-salesforce/src/assembly/bundle.xml
trunk/connectors/connector-text/src/assembly/bundle.xml
trunk/connectors/connector-xml/src/assembly/bundle.xml
Log:
TEIID-413: Moving the cdk portion of the config.xml to connector, so that connectors can define their own CDK files with out server config.xml change
Modified: trunk/connectors/connector-jdbc/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-jdbc/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -8,7 +8,15 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
-
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
Added: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,83 @@
+ <ComponentType Name="JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.952-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.952-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:jdbcconn.jar" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="UseBindVariables" DisplayName="Use prepared statements and bind variables" ShortDescription="" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="ExtensionCapabilityClass" DisplayName="Extension Capability Class" ShortDescription="" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.JDBCConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="DatabaseTimeZone" DisplayName="Database time zone" ShortDescription="Time zone of the database, if different than Integration Server" IsExpert="true" />
+ <PropertyDefinition Name="TransactionIsolationLevel" DisplayName="Transaction Isolation Level" ShortDescription="Set the data source transaction isolation level" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="Password" DisplayName="Password" ShortDescription="" Multiplicity="0" IsConstrainedToAllowedValues="false" IsMasked="true" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:<protocol>:<url>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.translator.Translator" IsExpert="true" />
+ <PropertyDefinition Name="SetCriteriaBatchSize" DisplayName="Max Values in IN Predicate" ShortDescription="Max number of values in an IN Predicate. Must be >= 0." DefaultValue="1000" PropertyType="Integer" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="User" DisplayName="User Name" ShortDescription="" Multiplicity="0" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="TrimStrings" DisplayName="Trim string flag" ShortDescription="Right Trim fixed character types returned as Strings" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="false" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ <PropertyDefinition Name="UseCommentsInSourceQuery" DisplayName="Use informational comments in Source Queries" ShortDescription="This will embed /*comment*/ style comment with session/request id in source SQL query for informational purposes" DefaultValue="false" PropertyType="Boolean" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="Apache Derby Embedded Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.941-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.941-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.apache.derby.jdbc.EmbeddedDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:derby:<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="Apache Derby Network Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.942-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.942-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.apache.derby.jdbc.ClientDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:derby:<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.derby.DerbySQLTranslator" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="MS Access Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.954-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.954-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=<data-source-name>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.access.AccessSQLTranslator" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="MS Excel Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2006-02-08T11:02:36.029-06:00" CreatedBy="ConfigurationStartup" CreationDate="2006-02-08T11:02:36.029-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:odbc:Driver={MicroSoft Excel Driver (*.xls)};DBQ=<filePathToExcelFile>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="MySQL 4 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.938-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.938-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mysql://<host>:3306/<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.mysql.MySQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="PostgreSQL 8 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.940-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.940-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.postgresql.xa.PGXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:postgresql://<host>:5432;DatabaseName=/<databaseName>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.postgresql.PostgreSQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="MetaMatrix JDBC 6 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="metamatrixadmin" LastChangedDate="2005-07-26T14:34:20.960-06:00" CreatedBy="metamatrixadmin" CreationDate="2005-07-26T14:34:20.960-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbc.MMDataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:metamatrix:<vdbName>@mm://<host>:<port>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="JDBC ODBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.953-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.953-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:odbc:<data-source-name>[;UID=<xxx> ;PWD=<xxx>]" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="Datadirect DB2 8 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.928-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.928-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbcx.db2.DB2DataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mmx:db2://<host>:50000;DatabaseName=<databasename>;CollectionID=<collectionid>;PackageName=<packagename>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.db2.DB2SQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="Datadirect Oracle 9 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.923-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.923-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbcx.oracle.OracleDataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mmx:oracle://<host>:1521;SID=<sid>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.oracle.OracleSQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="Datadirect SQL Server 2003 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.935-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.935-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbcx.sqlserver.SQLServerDataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mmx:sqlserver://<host>:1433;DatabaseName=<databasename>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="Datadirect Sybase 12 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.930-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.930-06:00">
+ <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbcx.sybase.SybaseDataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mmx:sybase://<host>:5000;DatabaseName=<databasename>" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.sybase.SybaseSQLTranslator" IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+ <PropertyDefinition Name="SetCriteriaBatchSize" DisplayName="Max Values in IN Predicate" ShortDescription="Max number of values in an IN Predicate. Must be >= 0." DefaultValue="250" PropertyType="Integer" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ </ComponentType>
\ No newline at end of file
Property changes on: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-ldap/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-ldap/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-ldap/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -8,7 +8,15 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
-
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
Added: trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
===================================================================
--- trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml (rev 0)
+++ trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,22 @@
+ <ComponentType Name="LDAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.946-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.946-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:ldapconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="SearchDefaultBaseDN" DisplayName="Default Search Base DN" ShortDescription="Default Base DN for LDAP Searches" IsExpert="true" />
+ <PropertyDefinition Name="com.metamatrix.data.pool.cleaning_interval" DisplayName="Pool cleaning Interval (seconds)" ShortDescription="Set the interval to cleaning the pool" DefaultValue="300" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="LdapAdminUserDN" DisplayName="Ldap Admin User DN" ShortDescription="User DN for the LDAP admin account." DefaultValue="cn=<>,ou=<>,dc=<>" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.ldap.LDAPConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="LdapMaxCriteria" DisplayName="Ldap Max Criteria" ShortDescription="Maximum number of criteria supported in an LDAP search filter." DefaultValue="1000" Multiplicity="1" />
+ <PropertyDefinition Name="LdapAdminUserPassword" DisplayName="Ldap Admin Password" ShortDescription="Password of the LDAP admin user account." Multiplicity="1" IsMasked="true" IsPreferred="true" />
+ <PropertyDefinition Name="SearchDefaultScope" DisplayName="Default Search Scope" ShortDescription="Default Scope for LDAP Searches" DefaultValue="SUBTREE_SCOPE" Multiplicity="1">
+ <AllowedValue>OBJECT_SCOPE</AllowedValue>
+ <AllowedValue>ONELEVEL_SCOPE</AllowedValue>
+ <AllowedValue>SUBTREE_SCOPE</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="RestrictToObjectClass" DisplayName="Restrict Searches To Named Object Class" ShortDescription="Restrict Searches to objectClass named in the Name field for a table" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="com.metamatrix.data.pool.max_connections" DisplayName="Pool Maximum Connections" ShortDescription="Set the maximum number of connections for the connection pool" DefaultValue="100" Multiplicity="1" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="LdapTxnTimeoutInMillis" DisplayName="Ldap Transaction Timeout (ms)" ShortDescription="Timeout value for LDAP searches. Defaults to TCP timeout value." />
+ <PropertyDefinition Name="com.metamatrix.data.pool.wait_for_source_time" DisplayName="Pool Connection Waiting Time (milliseconds)" ShortDescription="Set the time to wait if the connection is not available" DefaultValue="60000" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="LdapUrl" DisplayName="Ldap URL" ShortDescription="Ldap URL of the server, including port number." DefaultValue="ldap://<ldapServer>:<389>" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="com.metamatrix.data.pool.live_and_unused_time" DisplayName="Pool Connection Idle Time (seconds)" ShortDescription="Set the idle time of the connection before it should be closed if pool shrinking is enabled" DefaultValue="300" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="com.metamatrix.data.pool.enable_shrinking" DisplayName="Pool Shrinking Enabled" ShortDescription="Set whether to enable the pool shrinking" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
+ </ComponentType>
\ No newline at end of file
Property changes on: trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-loopback/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-loopback/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-loopback/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -8,7 +8,15 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
-
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
Added: trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
===================================================================
--- trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml (rev 0)
+++ trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,8 @@
+ <ComponentType Name="Loopback Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.945-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.945-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:loopbackconn.jar;extensionjar:jdbcconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="CapabilitiesClass" DisplayName="Capabilities Class" ShortDescription="" DefaultValue="com.metamatrix.connector.loopback.LoopbackCapabilities" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="WaitTime" DisplayName="Max Random Wait Time" ShortDescription="" DefaultValue="0" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.loopback.LoopbackConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="RowCount" DisplayName="Rows Per Query" ShortDescription="" DefaultValue="1" Multiplicity="1" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ </ComponentType>
\ No newline at end of file
Property changes on: trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-salesforce/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-salesforce/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -8,6 +8,14 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
<dependencySets>
<dependencySet>
Added: trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml (rev 0)
+++ trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,11 @@
+ <ComponentType Name="Salesforce Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.916-06:00" CreationDate="2008-10-31T10:26:19.916-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="ClassPath" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-codec-1.2.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:axis.jar;extensionjar:salesforce.jar;extensionjar:salesforceconn.jar" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="username" DisplayName="User Name" ShortDescription="Name value for Salesforce authentication" DefaultValue="" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.salesforce.ConnectorState" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.salesforce.Connector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="InLimit" DisplayName="IN Criteria Limit" ShortDescription="The maximum number of values that can be supplied in an IN criteria" DefaultValue="-1" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="password" DisplayName="Password" ShortDescription="Password value for Salesforce authentication" DefaultValue="" Multiplicity="1" IsMasked="true" IsPreferred="true" />
+ <PropertyDefinition Name="URL" DisplayName="Salesforce URL" ShortDescription="URL for connecting to Salesforce" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.salesforce.SalesforceCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ </ComponentType>
\ No newline at end of file
Property changes on: trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-text/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-text/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-text/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -9,6 +9,15 @@
<includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
Added: trunk/connectors/connector-text/src/main/resources/connector-text.xml
===================================================================
--- trunk/connectors/connector-text/src/main/resources/connector-text.xml (rev 0)
+++ trunk/connectors/connector-text/src/main/resources/connector-text.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,10 @@
+ <ComponentType Name="Text File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2008-10-31T10:26:19.945-06:00" CreatedBy="ConfigurationStartup" CreationDate="2008-10-31T10:26:19.945-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:textconn.jar" Multiplicity="1" />
+ <PropertyDefinition Name="PartialStartupAllowed" DisplayName="Partial Startup Allowed" ShortDescription="" DefaultValue="true" Multiplicity="1" PropertyType="Boolean" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="DescriptorFile" DisplayName="Text File Descriptor" ShortDescription="" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.text.TextConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="EnforceColumnCount" DisplayName="Enforce Column Count" ShortDescription="This forces the number of columns in text file to match what was modeled" DefaultValue="false" PropertyType="Boolean" IsConstrainedToAllowedValues="false" />
+ <PropertyDefinition Name="DateResultFormatsDelimiter" DisplayName="Date Result Formats Delimiter" ShortDescription="" IsExpert="true" />
+ <PropertyDefinition Name="DateResultFormats" DisplayName="Date Result Formats" ShortDescription="" IsExpert="true" />
+ </ComponentType>
\ No newline at end of file
Property changes on: trunk/connectors/connector-text/src/main/resources/connector-text.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-xml/src/assembly/bundle.xml
===================================================================
--- trunk/connectors/connector-xml/src/assembly/bundle.xml 2009-03-10 18:40:29 UTC (rev 548)
+++ trunk/connectors/connector-xml/src/assembly/bundle.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -9,6 +9,14 @@
<includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes><include>${project.artifactId}.xml</include></includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
Added: trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
===================================================================
--- trunk/connectors/connector-xml/src/main/resources/connector-xml.xml (rev 0)
+++ trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-03-11 23:11:24 UTC (rev 549)
@@ -0,0 +1,131 @@
+ <ComponentType Name="XML File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar" Multiplicity="1" />
+ <PropertyDefinition Name="CharacterEncodingScheme" DisplayName="File Encoding Used" ShortDescription="A character-encoding scheme is a mapping between a coded character set and a set of octet (eight-bit byte) sequences. Some samples are UTF-8,ISO-8859-1,UTF-16)" DefaultValue="ISO-8859-1" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xmlsource.XMLSourceConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="ConnectionType" DisplayName="Type Of XML Connection" ShortDescription="Connection type used to get the XML data" DefaultValue="com.metamatrix.connector.xmlsource.file.FileConnection" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="DirectoryLocation" DisplayName="XML File(s) Directory Location" ShortDescription="" DefaultValue="" Multiplicity="1" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="XML SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.917-06:00" CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:axis.jar" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="AuthPassword" DisplayName="Authentication User Password" ShortDescription="Password value for authentication" DefaultValue="" IsExpert="true" IsMasked="true" IsPreferred="true" />
+ <PropertyDefinition Name="SAMLPropertyFile" DisplayName="SAML Property File (only required when SAML profile used)" ShortDescription="SAML Security property file (saml.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="wsdl" DisplayName="WSDL File (URL)" ShortDescription="URL to Web Service Definition File" DefaultValue="" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="AuthUserName" DisplayName="Authentication User Name" ShortDescription="Name value for authentication" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="WSSecurityType" DisplayName="WS-Security Type(UsernameToken, SAML..)" ShortDescription="Type of WS-Security to be used; Combinations of multiple security types can be used with a space in-between. Allowed types are: (UsernameToken, UsernameToken-Digest, SAMLTokenUnsigned, SAMLTokenSigned, Signature, Timestamp, Encrypt)" DefaultValue="" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xmlsource.XMLSourceConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="EncryptUserName" DisplayName="Encrypt UserName (only if Encrypt profile used)" ShortDescription="The username to be used in the encryption; if blank uses auth username" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="EndPoint" DisplayName="Alternate End Point" ShortDescription="An alternate service endpoint other than one specified in WSDL, to execute the service" DefaultValue="" IsPreferred="true" />
+ <PropertyDefinition Name="SecurityType" DisplayName="WebService Security Used(None, HTTPBasic, WS-Security)" ShortDescription="Type of Authentication to used with the web service; If WS-Secuirty is being used, then WS-Secuirty type must be defined" DefaultValue="None" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="CryptoPropertyFile" DisplayName="User Crypto Property File (If SAML or Signature profile used)" ShortDescription="The file defines properties of cryptography;defines the certificates;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectionType" DisplayName="Type Of XML Connection" ShortDescription="Connection type used to get the XML data" DefaultValue="com.metamatrix.connector.xmlsource.soap.SoapConnection" Multiplicity="1" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="EncryptPropertyFile" DisplayName="Encrypt crypto property file (only if Encrypt profile used)" ShortDescription="The file defines properties of cryptography for encryption of the message;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="TrustType" DisplayName="Trust Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the service are known to the service and have pre-registered their certificate chains before using the service. The direct-reference method presumes that the service operator trusts all users with certificates issued by a trusted CA." DefaultValue="DirectReference" IsExpert="true" IsPreferred="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.918-06:00" CreationDate="2008-10-31T10:26:19.918-06:00">
+ <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="FilePath" DisplayName="File Path" ShortDescription="" Multiplicity="1" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:ConnectorCommons.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar" Multiplicity="1" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
+ <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.base.XMLConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.file.FileConnectorState" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="LogRequestResponseDocs" DisplayName="Log XML Request and Response Documents" ShortDescription="Write the request and response documents to the log at Info level" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="FileName" DisplayName="File Name" ShortDescription="" DefaultValue="" />
+ <PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational HTTP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.920-06:00" CreationDate="2008-10-31T10:26:19.921-06:00">
+ <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
+ <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="XMLParmName" DisplayName="XML Parameter Name" ShortDescription="" />
+ <PropertyDefinition Name="RequestTimeout" DisplayName="Request Timeout (in Milliseconds)" ShortDescription="" DefaultValue="10000" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="Authenticate" DisplayName="Authentication Required" ShortDescription="" DefaultValue="false" Multiplicity="1" PropertyType="Boolean" IsHidden="true" />
+ <PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.http.HTTPConnectorState" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="HttpBasicAuthPassword" DisplayName="HTTP Basic Authentication Password" ShortDescription="Password value for HTTP basic authentication" DefaultValue="" IsExpert="true" IsMasked="true" />
+ <PropertyDefinition Name="AccessMethod" DisplayName="Access Method" ShortDescription="" DefaultValue="get" Multiplicity="1">
+ <AllowedValue>get</AllowedValue>
+ <AllowedValue>post</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ProxyUri" DisplayName="Proxy Server URI" ShortDescription="The URI of the proxy server" DefaultValue="" />
+ <PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:ConnectorCommons.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar;extensionjar:commons-codec-1.2.jar" Multiplicity="1" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="HttpBasicAuthUserName" DisplayName="HTTP Basic Authentication Name" ShortDescription="Name value for HTTP basic authentication" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.base.XMLConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="Uri" DisplayName="Server URI" ShortDescription="The URI of the HTTP source" Multiplicity="1" />
+ <PropertyDefinition Name="UseHttpBasic" DisplayName="Use HTTP Basic authentication" ShortDescription="Use basic HTTP Authentication" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="LogRequestResponseDocs" DisplayName="Log XML Request and Response Documents" ShortDescription="Write the request and response documents to the log at Info level" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="TrustDeserializerClass" DisplayName="Trust Deserializer Class" ShortDescription="The class to use to process trusted payloads and execution payloads" DefaultValue="com.metamatrix.connector.xml.http.DefaultTrustDeserializer" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ParameterMethod" DisplayName="Parameter Method" ShortDescription="" DefaultValue="None" Multiplicity="1">
+ <AllowedValue>None</AllowedValue>
+ <AllowedValue>Name/Value</AllowedValue>
+ <AllowedValue>XMLRequest</AllowedValue>
+ <AllowedValue>XMLInQueryString</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="HostnameVerifier" DisplayName="Hostname Verifier" ShortDescription="Class implementing javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround." IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.919-06:00" CreationDate="2008-10-31T10:26:19.919-06:00">
+ <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="AuthPassword" DisplayName="Authentication User Password" ShortDescription="Password value for authentication" DefaultValue="" IsExpert="true" IsMasked="true" IsPreferred="true" />
+ <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
+ <PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="AuthUserName" DisplayName="Authentication User Name" ShortDescription="Name value for authentication" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="WSSecurityType" DisplayName="WS-Security Type(UsernameToken, SAML..)" ShortDescription="Type of WS-Security to be used; Combinations of multiple security types can be used with a space in-between. Allowed types are: (UsernameToken, UsernameToken-Digest, SAMLTokenUnsigned, SAMLTokenSigned, Signature, Timestamp, Encrypt)" DefaultValue="" IsPreferred="true" />
+ <PropertyDefinition Name="XMLParmName" DisplayName="XML Parameter Name" ShortDescription="" DefaultValue="" IsHidden="true" IsModifiable="false" />
+ <PropertyDefinition Name="EncryptUserName" DisplayName="Encrypt UserName (only if Encrypt profile used)" ShortDescription="The username to be used in the encryption; if blank uses auth username" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="ExceptionOnSOAPFault" DisplayName="Exception on SOAP Fault" ShortDescription="Throw connector exception when SOAP fault is returned from source." DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="RequestTimeout" DisplayName="Request Timeout (in Milliseconds)" ShortDescription="" DefaultValue="10000" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="CryptoPropertyFile" DisplayName="User Crypto Property File (If SAML or Signature profile used)" ShortDescription="The file defines properties of cryptography;defines the certificates;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.soap.SOAPConnectorState" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="SOAPAction" DisplayName="SOAP-Action" ShortDescription="Value for SOAP-Action header" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="AccessMethod" DisplayName="Access Method (Get, Post)" ShortDescription="" DefaultValue="post" Multiplicity="1" IsHidden="true" IsModifiable="false">
+ <AllowedValue>get</AllowedValue>
+ <AllowedValue>post</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ProxyUri" DisplayName="Proxy Server URI" ShortDescription="The URI of the proxy server" DefaultValue="" />
+ <PropertyDefinition Name="EncryptPropertyFile" DisplayName="Encrypt crypto property file (only if Encrypt profile used)" ShortDescription="The file defines properties of cryptography for encryption of the message;(crypto.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:connector_patch.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:XMLConnectorFramework.jar;extensionjar:jaxen-1.1.jar;extensionjar:jdom.jar;extensionjar:commons-logging.jar;extensionjar:commons-codec-1.2.jar;extensionjar:axis.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:saaj.jar;extensionjar:jaxrpc.jar" Multiplicity="1" />
+ <PropertyDefinition Name="SAMLPropertyFile" DisplayName="SAML Property File (only required when SAML profile used)" ShortDescription="SAML Security property file (saml.properties)" DefaultValue="" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
+ <PropertyDefinition Name="EncodingStyle" DisplayName="Encoding Style (RPC - Encoded, RPC - Literal, Document - Literal, Document - Encoded)" ShortDescription="Encoding Style" DefaultValue="Document - Literal" Multiplicity="1">
+ <AllowedValue>RPC - Encoded</AllowedValue>
+ <AllowedValue>RPC - Literal</AllowedValue>
+ <AllowedValue>Document - Literal</AllowedValue>
+ <AllowedValue>Document - Encoded</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.base.XMLConnector" Multiplicity="1" IsExpert="true" />
+ <PropertyDefinition Name="Uri" DisplayName="Server URI" ShortDescription="The URI of the HTTP source" Multiplicity="1" />
+ <PropertyDefinition Name="SecurityType" DisplayName="WebService Security Used(None, HTTPBasic, WS-Security)" ShortDescription="Type of Authentication to used with the web service; If WS-Secuirty is being used, then WS-Secuirty type must be defined" DefaultValue="None" Multiplicity="1" IsPreferred="true" />
+ <PropertyDefinition Name="LogRequestResponseDocs" DisplayName="Log XML Request and Response Documents" ShortDescription="Write the request and response documents to the log at Info level" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="TrustDeserializerClass" DisplayName="Trust Deserializer Class" ShortDescription="The class to use to process trusted payloads and execution payloads" DefaultValue="com.metamatrix.connector.xml.soap.DefaultSoapTrustDeserializer" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="ParameterMethod" DisplayName="Parameter Method (None, Name/Value, XMLRequest, XMLInQueryString)" ShortDescription="" DefaultValue="XMLRequest" Multiplicity="1" IsHidden="true" IsModifiable="false">
+ <AllowedValue>None</AllowedValue>
+ <AllowedValue>Name/Value</AllowedValue>
+ <AllowedValue>XMLRequest</AllowedValue>
+ <AllowedValue>XMLInQueryString</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" Multiplicity="1" PropertyType="Integer" />
+ <PropertyDefinition Name="HostnameVerifier" DisplayName="Hostname Verifier" ShortDescription="a class implmenting javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround." IsConstrainedToAllowedValues="false" IsExpert="true" />
+ <PropertyDefinition Name="TrustType" DisplayName="Trust Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the service are known to the service and have pre-registered their certificate chains before using the service. The direct-reference method presumes that the service operator trusts all users with certificates issued by a trusted CA." DefaultValue="DirectReference" IsExpert="true" IsPreferred="true" />
+ <PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsConstrainedToAllowedValues="false" IsExpert="true" />
+ </ComponentType>
+
\ No newline at end of file
Property changes on: trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 6 months
teiid SVN: r548 - trunk/common-core/src/main/java/com/metamatrix/common/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-10 14:40:29 -0400 (Tue, 10 Mar 2009)
New Revision: 548
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
Log:
TEIID-412 fix for supporting pre-JDBC 4.0 drivers
Modified: trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java 2009-03-10 18:33:45 UTC (rev 547)
+++ trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java 2009-03-10 18:40:29 UTC (rev 548)
@@ -65,7 +65,7 @@
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
try {
- if (method.getName().equals("close")) {
+ if (method.getName().equals("close")) { //$NON-NLS-1$
boolean isShutdown = shutdown;
if (!isShutdown) {
connections.add((Connection)proxy);
@@ -74,13 +74,19 @@
if (!isShutdown) {
return null;
}
- } else if (method.getName().equals("isValid")) {
+ } else if (method.getName().equals("isValid")) { //$NON-NLS-1$
long now = System.currentTimeMillis();
if (lastTest + testInterval > now) {
return valid;
}
lastTest = now;
- valid = (Boolean)method.invoke(c, args);
+ try {
+ valid = c.isValid((Integer)args[0]);
+ } catch (AbstractMethodError e) {
+ valid = !c.isClosed();
+ } catch (SQLFeatureNotSupportedException e) {
+ valid = !c.isClosed();
+ }
return valid;
}
return method.invoke(c, args);
@@ -133,7 +139,7 @@
}
if (c == null) {
if (shutdown) {
- throw new SQLException("pool shutdown");
+ throw new SQLException("pool shutdown"); //$NON-NLS-1$
}
try {
c = createConnection();
16 years, 7 months