teiid SVN: r2891 - in trunk: build/kits/jboss-container/deploy/teiid and 20 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 16:12:16 -0500 (Mon, 31 Jan 2011)
New Revision: 2891
Added:
trunk/runtime/src/test/java/org/teiid/transport/TestFailover.java
Modified:
trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
trunk/engine/src/main/java/org/teiid/cache/Cache.java
trunk/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java
trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionForm.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMetadataValidator.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/test/java/org/teiid/query/function/TestFunctionMetadataReader.java
trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java
trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
trunk/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
Log:
forward merge of 7.3
Modified: trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -22,7 +22,9 @@
package org.teiid.metadata;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@@ -103,8 +105,9 @@
private boolean nullOnNull;
private Determinism determinism = Determinism.DETERMINISTIC;
-
- private FunctionParameter[] inputParameters;
+
+ @XmlElement(name="inputParameters")
+ protected List<FunctionParameter> inParameters = new ArrayList<FunctionParameter>();
private FunctionParameter outputParameter;
protected FunctionMethod() {
@@ -131,7 +134,9 @@
setPushdown(pushdown);
setInvocationClass(invocationClass);
setInvocationMethod(invocationMethod);
- setInputParameters(inputParams);
+ if (inputParams != null) {
+ setInputParameters(Arrays.asList(inputParams));
+ }
setOutputParameter(outputParam);
setNullOnNull(nullOnNull);
setDeterminism(deterministic);
@@ -269,27 +274,28 @@
* @return Number of input parameters
*/
public int getInputParameterCount() {
- if(this.inputParameters == null) {
+ if(this.inParameters == null) {
return 0;
}
- return this.inputParameters.length;
+ return this.inParameters.size();
}
/**
* Get input parameters
* @return Array of input parameters, may be null if 0 parameters
*/
- @XmlElement
- public FunctionParameter[] getInputParameters() {
- return this.inputParameters;
+
+ public List<FunctionParameter> getInputParameters() {
+ return this.inParameters;
}
/**
* Set input parameters.
* @param params Input parameters
*/
- public void setInputParameters(FunctionParameter[] params) {
- this.inputParameters = params;
+ public void setInputParameters(List<FunctionParameter> params) {
+ this.inParameters.clear();
+ this.inParameters.addAll(params);
}
/**
@@ -322,8 +328,8 @@
*/
public int hashCode() {
int hash = HashCodeUtil.hashCode(0, super.getName());
- if(inputParameters != null) {
- hash = HashCodeUtil.hashCode(hash, Arrays.hashCode(inputParameters));
+ if(inParameters != null) {
+ hash = HashCodeUtil.hashCode(hash, inParameters.hashCode());
}
return hash;
}
@@ -356,16 +362,16 @@
}
// Compare types of parameters
- FunctionParameter[] thisInputs = this.getInputParameters();
- if(thisInputs != null && thisInputs.length > 0) {
+ List<FunctionParameter> thisInputs = this.getInputParameters();
+ if(thisInputs != null && thisInputs.size() > 0) {
// If thisInputs is not null and >0 and other parameter
// count matched this parameter count, otherInputs MUST be
// non null to have more than one parameter - so we don't
// need to check it here.
- FunctionParameter[] otherInputs = other.getInputParameters();
+ List<FunctionParameter> otherInputs = other.getInputParameters();
- for(int i=0; i<thisInputs.length; i++) {
- boolean paramMatch = compareWithNull(thisInputs[i], otherInputs[i]);
+ for(int i=0; i<thisInputs.size(); i++) {
+ boolean paramMatch = compareWithNull(thisInputs.get(i), otherInputs.get(i));
if(! paramMatch) {
return false;
}
@@ -412,15 +418,15 @@
// Print parameters
str.append("("); //$NON-NLS-1$
- if(inputParameters != null) {
- for(int i=0; i<inputParameters.length; i++) {
- if(inputParameters[i] != null) {
- str.append(inputParameters[i].toString());
+ if(inParameters != null) {
+ for(int i=0; i<inParameters.size(); i++) {
+ if(inParameters.get(i) != null) {
+ str.append(inParameters.get(i).toString());
} else {
str.append("<unknown>"); //$NON-NLS-1$
}
- if(i < (inputParameters.length-1)) {
+ if(i < (inParameters.size()-1)) {
str.append(", "); //$NON-NLS-1$
}
}
@@ -462,8 +468,8 @@
}
public boolean isVarArgs() {
- if (this.inputParameters != null && this.inputParameters.length > 0) {
- return inputParameters[inputParameters.length - 1].isVarArg();
+ if (this.inParameters != null && this.inParameters.size() > 0) {
+ return inParameters.get(inParameters.size() - 1).isVarArg();
}
return false;
}
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 21:12:16 UTC (rev 2891)
@@ -66,7 +66,8 @@
<!-- Allowed values are LRU, EXPIRATION.
Setting this value to LRU will cause cache hint TTL values
to be ignored. (default EXPIRATION) -->
- <property name="type">EXPIRATION</property>
+ <property name="type">EXPIRATION</property>
+ <property name="location">resultset</property>
</bean>
<bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
Modified: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -31,7 +31,6 @@
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.core.TeiidRuntimeException;
public class ClusterableCacheFactory implements CacheFactory, Serializable {
@@ -42,7 +41,7 @@
private String cacheManagerName;
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (this.delegate == null) {
Object cacheManager = getClusteredCache();
if (cacheManager == null) {
@@ -56,7 +55,7 @@
}
}
}
- return delegate.get(type, config);
+ return delegate.get(location, config);
}
public void setResultsetCacheName(String name) {
Modified: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -36,7 +36,6 @@
import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
@@ -55,7 +54,7 @@
/**
* {@inheritDoc}
*/
- public Cache get(Type type, CacheConfiguration config) {
+ public Cache get(String location, CacheConfiguration config) {
if (!destroyed) {
if (!this.cacheStore.getCacheStatus().allowInvocations()) {
@@ -63,7 +62,7 @@
}
Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
- Node node = cacheRoot.addChild(Fqn.fromString(type.location()));
+ Node node = cacheRoot.addChild(Fqn.fromString(location));
node.setResident(true);
Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -214,7 +214,7 @@
this.errors = errors;
}
- public List<ValidationError> getValidationErrors(ValidationError.Severity severity){
+ public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
if (this.errors == null) {
return Collections.emptyList();
}
@@ -227,7 +227,7 @@
return list;
}
- public ValidationError addError(String severity, String message) {
+ public synchronized ValidationError addError(String severity, String message) {
if (this.errors == null) {
this.errors = new ArrayList<ValidationError>();
}
@@ -236,14 +236,14 @@
return ve;
}
- public boolean removeError(ValidationError remove) {
+ public synchronized boolean removeError(ValidationError remove) {
if (this.errors == null) {
return false;
}
return this.errors.remove(remove);
}
- public void clearErrors() {
+ public synchronized void clearErrors() {
this.errors.clear();
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -48,6 +48,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.teiid.client.ResultsMessage;
@@ -146,6 +147,9 @@
rmetadata = new FilteredResultsMetadata(rmetadata, resultColumns);
}
this.fetchSize = statement.getFetchSize();
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Creating ResultSet requestID: " + requestID + " beginRow: " + resultsMsg.getFirstRow() + " resultsColumns: " + resultColumns + " parameters: " + parameters); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
}
public void setMaxFieldSize(int maxFieldSize) {
@@ -356,7 +360,9 @@
}
public Batch requestBatch(int beginRow) throws SQLException{
- logger.fine("CursorResultsImpl.requestBatch] thread name: " + Thread.currentThread().getName() + " requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("requestBatch requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
checkClosed();
try {
ResultsFuture<ResultsMessage> results = statement.getDQP().processCursorRequest(requestID, beginRow, fetchSize);
@@ -365,6 +371,11 @@
timeoutSeconds = Integer.MAX_VALUE;
}
ResultsMessage currentResultMsg = results.get(timeoutSeconds, TimeUnit.SECONDS);
+
+ if (currentResultMsg.getException() != null) {
+ throw TeiidSQLException.create(currentResultMsg.getException());
+ }
+
this.accumulateWarnings(currentResultMsg);
return getCurrentBatch(currentResultMsg);
} catch (TeiidProcessingException e) {
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -28,6 +28,7 @@
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
@@ -387,7 +388,9 @@
throws SQLException {
checkStatement();
resetExecutionState();
-
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Executing: requestID " + getCurrentRequestID() + " commands: " + Arrays.toString(commands) + " expecting: " + resultsMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
if (commands.length == 1) {
Matcher match = SET_STATEMENT.matcher(commands[0]);
if (match.matches()) {
@@ -406,6 +409,7 @@
}
match = TRANSACTION_STATEMENT.matcher(commands[0]);
if (match.matches()) {
+ logger.finer("Executing as transaction statement"); //$NON-NLS-1$
if (resultsMode == ResultsMode.RESULTSET) {
throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
}
@@ -422,6 +426,7 @@
}
match = SHOW_STATEMENT.matcher(commands[0]);
if (match.matches()) {
+ logger.finer("Executing as show statement"); //$NON-NLS-1$
if (resultsMode == ResultsMode.UPDATECOUNT) {
throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
}
@@ -503,7 +508,9 @@
for (int i = 0; i < results.length; i++) {
updateCounts[i] = (Integer)results[i].get(0);
}
-
+ if (logger.isLoggable(Level.FINER)) {
+ logger.fine(JDBCPlugin.Util.getString("Recieved update counts: " + Arrays.toString(updateCounts))); //$NON-NLS-1$
+ }
// In update scenarios close the statement implicitly
try {
getDQP().closeRequest(getCurrentRequestID());
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -282,6 +282,7 @@
this.logonResults.remove(this.serverInstance.getHostInfo());
if (this.logonResult != null) {
this.connectionFactory.disconnected(this.serverInstance, this.logonResult.getSessionToken());
+ this.logonResult = null;
}
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -41,6 +41,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
+import org.mockito.Mockito;
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
@@ -696,6 +697,19 @@
assertTrue(rs.previous());
}
}
+
+ @Test(expected=TeiidSQLException.class) public void testResultsMessageException() throws Exception {
+ ResultsMessage resultsMsg = exampleMessage(exampleResults1(1), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
+ resultsMsg.setFinalRow(-1);
+ ResultsMessage next = new ResultsMessage();
+ next.setException(new Throwable());
+ ResultsFuture<ResultsMessage> rf = new ResultsFuture<ResultsMessage>();
+ rf.getResultsReceiver().receiveResults(next);
+ Mockito.stub(statement.getDQP().processCursorRequest(0, 2, 0)).toReturn(rf);
+ ResultSetImpl cs = new ResultSetImpl(resultsMsg, statement, null, 2);
+ cs.next();
+ cs.next();
+ }
static ResultSetImpl helpTestBatching(StatementImpl statement, int fetchSize, int batchLength,
int totalLength) throws InterruptedException, ExecutionException,
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -138,6 +138,9 @@
String nameInSource = procedureName;
if (useProcedureSpecificName && rsColumns >= 9) {
procedureName = procedures.getString(9);
+ if (procedureName == null) {
+ procedureName = nameInSource;
+ }
}
String fullProcedureName = getFullyQualifiedName(procedureCatalog, procedureSchema, procedureName);
Procedure procedure = metadataFactory.addProcedure(useFullSchemaName?fullProcedureName:procedureName);
Modified: trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -24,6 +24,7 @@
import static org.junit.Assert.*;
import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
@@ -34,15 +35,19 @@
import org.teiid.language.Select;
import org.teiid.metadata.Column;
import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
import org.teiid.metadata.Schema;
import org.teiid.metadata.Table;
import org.teiid.metadata.Column.SearchType;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TypeFacility;
import org.teiid.translator.salesforce.Constants;
import org.teiid.translator.salesforce.SalesforceConnection;
import org.teiid.translator.salesforce.execution.QueryExecutionImpl;
@@ -101,6 +106,16 @@
Column obj = contactCols.get(i);
obj.setNameInSource(contactNameInSource[i]);
}
+
+
+ List<ProcedureParameter> params = new LinkedList<ProcedureParameter>();
+ params.add(RealMetadataFactory.createParameter("type", SPParameter.IN, TypeFacility.RUNTIME_NAMES.STRING));
+ params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
+ params.add(RealMetadataFactory.createParameter("end", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
+
+ Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params, "GetUpdated");
+ getUpdated.setResultSet(RealMetadataFactory.createResultSet("rs", new String[] {"updated"}, new String[] {TypeFacility.RUNTIME_NAMES.STRING}));
+
return new TransformationMetadata(null, new CompositeMetadataStore(store), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
}
Modified: trunk/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -28,29 +28,7 @@
* Abstraction over cache providers
*/
public interface Cache<K, V> {
-
- public enum Type {
- MATTABLES("MatTables"), //$NON-NLS-1$
- MATTABLEUPDATES("MatTableUpdates"), //$NON-NLS-1$
- RESULTSET("ResultSet"), //$NON-NLS-1$
- RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
- PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
- private String location;
-
- Type(String location){
- this.location = location;
- }
-
- Type(Type base, String location){
- this.location = base.location+"/"+location; //$NON-NLS-1$
- }
-
- public String location() {
- return this.location;
- }
- }
-
/**
* Retrieves the value for the given Key
*
Modified: trunk/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -30,9 +30,7 @@
@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
public class CacheConfiguration {
-
- public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
-
+
public enum Policy {
LRU, // Least Recently Used
EXPIRATION
@@ -43,14 +41,16 @@
private int maxEntries;
private boolean enabled = true;
private String name;
-
+ private String location;
+
public CacheConfiguration() {
}
- public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
+ public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes, String location) {
this.policy = policy;
this.maxage = maxAgeInSeconds;
this.maxEntries = maxNodes;
+ this.location = location;
}
public Policy getPolicy() {
@@ -89,6 +89,15 @@
this.name = name;
}
+ @ManagementProperty(description="location prefix in cache", readOnly=true)
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified: trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -30,7 +30,7 @@
* @param config configuration setup for the cache
* @return
*/
- <K,V> Cache<K, V> get(Cache.Type type, CacheConfiguration config);
+ <K,V> Cache<K, V> get(String location, CacheConfiguration config);
/**
* Destroy the cache factory and any caches underneath.
Modified: trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -23,18 +23,19 @@
import java.io.Serializable;
-import org.teiid.cache.Cache.Type;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
public class DefaultCacheFactory implements CacheFactory, Serializable {
private static final long serialVersionUID = -5541424157695857527L;
+ private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
DefaultCache cacheRoot;
private volatile boolean destroyed = false;
public DefaultCacheFactory() {
- this(CacheConfiguration.DEFAULT);
+ this(DEFAULT);
}
public DefaultCacheFactory(CacheConfiguration config) {
@@ -47,9 +48,9 @@
}
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (!destroyed) {
- return cacheRoot.addChild(type.location());
+ return cacheRoot.addChild(location);
}
throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -44,7 +44,6 @@
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.CacheConfiguration.Policy;
@@ -683,24 +682,23 @@
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
- this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
+ this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
this.rsCache.setBufferManager(this.bufferManager);
}
//prepared plan cache
- prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
+ prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount(), "PreparedCache")); //$NON-NLS-1$
prepPlanCache.setBufferManager(this.bufferManager);
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1));
+ matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1, "MaterilizationTables")); //$NON-NLS-1$
matTables.setBufferManager(this.bufferManager);
}
- dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
- this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
+ dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
}
public void setBufferService(BufferService service) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -51,6 +51,10 @@
*/
public class SessionAwareCache<T> {
public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
+ public enum Type {
+ RESULTSET,
+ PREPAREDPLAN;
+ }
private Cache<CacheID, T> localCache;
private Cache<CacheID, T> distributedCache;
@@ -68,23 +72,24 @@
}
SessionAwareCache(int maxSize){
- this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
+ this(new DefaultCacheFactory(), Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize, "default")); //$NON-NLS-1$
}
- SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
+ SessionAwareCache (final CacheFactory cacheFactory, final Type type, final CacheConfiguration config){
this.maxSize = config.getMaxEntries();
if(this.maxSize < 0){
this.maxSize = Integer.MAX_VALUE;
}
this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
- if (type == Cache.Type.PREPAREDPLAN) {
+ if (type == Type.PREPAREDPLAN) {
this.distributedCache = localCache;
}
else {
- this.distributedCache = cacheFactory.get(type, config);
- if (type == Cache.Type.RESULTSET) {
- this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+ String location = config.getLocation()+"/"+type.name(); //$NON-NLS-1$
+ this.distributedCache = cacheFactory.get(location, config);
+ if (type == Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(location+"/batches", config); //$NON-NLS-1$
}
else {
this.tupleBatchCache = this.distributedCache;
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionForm.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionForm.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionForm.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -66,17 +66,17 @@
this.category = method.getCategory().toUpperCase();
// Get input parameter stuff
- FunctionParameter[] inputParams = method.getInputParameters();
+ List<FunctionParameter> inputParams = method.getInputParameters();
if(inputParams == null) {
inputParamNames = new ArrayList(0);
inputParamDescs = new ArrayList(0);
} else {
- inputParamNames = new ArrayList(inputParams.length);
- inputParamDescs = new ArrayList(inputParams.length);
+ inputParamNames = new ArrayList(inputParams.size());
+ inputParamDescs = new ArrayList(inputParams.size());
- for(int i=0; i<inputParams.length; i++) {
- inputParamNames.add(inputParams[i].getName().toUpperCase());
- inputParamDescs.add(inputParams[i].getDescription());
+ for(int i=0; i<inputParams.size(); i++) {
+ inputParamNames.add(inputParams.get(i).getName().toUpperCase());
+ inputParamDescs.add(inputParams.get(i).getDescription());
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -228,7 +228,7 @@
for (FunctionMethod nextMethod : functionMethods) {
int currentScore = 0;
- final FunctionParameter[] methodTypes = nextMethod.getInputParameters();
+ final List<FunctionParameter> methodTypes = nextMethod.getInputParameters();
//Holder for current signature with converts where required
FunctionDescriptor[] currentSignature = new FunctionDescriptor[types.length];
@@ -237,7 +237,7 @@
int i = 0;
for(; i < types.length; i++) {
//treat all varags as the same type
- final String tmpTypeName = methodTypes[Math.min(i, methodTypes.length - 1)].getType();
+ final String tmpTypeName = methodTypes.get(Math.min(i, methodTypes.size() - 1)).getType();
Class<?> targetType = DataTypeManager.getDataTypeClass(tmpTypeName);
Class<?> sourceType = types[i];
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -263,11 +263,11 @@
String methodName = method.getName();
// Get input types for path
- FunctionParameter[] inputParams = method.getInputParameters();
+ List<FunctionParameter> inputParams = method.getInputParameters();
List<Class> inputTypes = new LinkedList<Class>();
if(inputParams != null) {
- for(int i=0; i<inputParams.length; i++) {
- String typeName = inputParams[i].getType();
+ for(int i=0; i<inputParams.size(); i++) {
+ String typeName = inputParams.get(i).getType();
inputTypes.add(DataTypeManager.getDataTypeClass(typeName));
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMetadataValidator.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/function/metadata/FunctionMetadataValidator.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -23,6 +23,7 @@
package org.teiid.query.function.metadata;
import java.util.Collection;
+import java.util.List;
import org.teiid.api.exception.query.FunctionMetadataException;
import org.teiid.core.types.DataTypeManager;
@@ -90,10 +91,10 @@
validateInvocationMethod(method.getInvocationClass(), method.getInvocationMethod(), method.getPushdown());
// Validate input parameters
- FunctionParameter[] params = method.getInputParameters();
- if(params != null) {
- for(int i=0; i<params.length; i++) {
- validateFunctionParameter(params[i]);
+ List<FunctionParameter> params = method.getInputParameters();
+ if(params != null && !params.isEmpty()) {
+ for(int i=0; i<params.size(); i++) {
+ validateFunctionParameter(params.get(i));
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -179,10 +179,11 @@
return false;
}
//metadata hack
- if (!(this.expression.getMetadataID() instanceof TempMetadataID)) {
+ if (this.expression.getGroupSymbol() == null || !(this.expression.getGroupSymbol().getMetadataID() instanceof TempMetadataID)) {
return true;
}
- TempMetadataID tid = (TempMetadataID)this.expression.getMetadataID();
+
+ TempMetadataID tid = (TempMetadataID)this.expression.getGroupSymbol().getMetadataID();
return !tid.isScalarGroup();
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -153,8 +153,8 @@
this.cache = cache;
this.distributedCache = distibutedCache;
if (distibutedCache != null) {
- CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1);
- tables = cacheFactory.get(Cache.Type.MATTABLES, cc);
+ CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1, "MaterializationUpdates"); //$NON-NLS-1$
+ tables = cacheFactory.get(cc.getLocation(), cc);
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionMetadataReader.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestFunctionMetadataReader.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestFunctionMetadataReader.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -54,7 +54,7 @@
assertNull(m.getDescription());
assertEquals(1, m.getInputParameterCount());
- FunctionParameter in = m.getInputParameters()[0];
+ FunctionParameter in = m.getInputParameters().get(0);
assertEquals("prop", in.getName());
assertEquals("string", in.getType());
assertNull(in.getDescription());
Modified: trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/test/java/org/teiid/query/function/metadata/TestFunctionMethod.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -45,6 +45,16 @@
UnitTestUtil.helpTestEquivalence(0, m1, m1);
}
+ public void testEquivalence11() {
+ FunctionParameter pout = new FunctionParameter("out", "string"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ FunctionMethod m1 = new FunctionMethod("length", "", FunctionCategoryConstants.STRING, //$NON-NLS-1$ //$NON-NLS-2$
+ "com.metamatrix.query.function.FunctionMethods", "length", //$NON-NLS-1$ //$NON-NLS-2$
+ null, pout );
+
+ UnitTestUtil.helpTestEquivalence(0, m1, m1);
+ }
+
public void testEquivalence2() {
FunctionParameter p1 = new FunctionParameter("in", "string"); //$NON-NLS-1$ //$NON-NLS-2$
FunctionParameter pout = new FunctionParameter("out", "string"); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -2675,7 +2675,8 @@
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("create local temporary table x (y string);\n"); //$NON-NLS-1$
- procedure.append("update x set y = in1 || 'foo';\n"); //$NON-NLS-1$
+ procedure.append("declare string s = 'foo';\n"); //$NON-NLS-1$
+ procedure.append("update x set y = in1 || s;\n"); //$NON-NLS-1$
procedure.append("update pm1.g1 set e1 = lookup('pm1.g1', 'e1', 'e2', in1);\n"); //$NON-NLS-1$
procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -150,21 +150,23 @@
} catch (IOException e1) {
LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ boolean valid = true;
+ synchronized (deployment) {
+ if (!preview) {
+ valid = validateSources(cmr, deployment);
- boolean valid = true;
- if (!preview) {
- valid = validateSources(cmr, deployment);
-
- // Check if the VDB is fully configured.
- if (valid) {
+ // Check if the VDB is fully configured.
+ if (valid) {
+ deployment.setStatus(VDB.Status.ACTIVE);
+ } else {
+ deployment.setStatus(VDB.Status.INACTIVE);
+ }
+ }
+ else {
deployment.setStatus(VDB.Status.ACTIVE);
- } else {
- deployment.setStatus(VDB.Status.INACTIVE);
- }
+ }
}
- else {
- deployment.setStatus(VDB.Status.ACTIVE);
- }
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -341,7 +343,7 @@
}
}
- synchronized (this) {
+ synchronized (vdb) {
if (!loaded) {
vdb.setStatus(VDB.Status.INACTIVE);
String msg = RuntimePlugin.Util.getString("failed_to_retrive_metadata", vdb.getName()+"-"+vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -146,7 +146,7 @@
// check to see if the vdb has been modified when server is down; if it is then clear the old files
if (this.serializer.isStale(cacheFile, unit.getRoot().getLastModified())) {
this.serializer.removeAttachments(unit);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
}
MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
if (stores == null) {
@@ -155,7 +155,7 @@
stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
}
else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" has being loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
}
unit.addAttachment(MetadataStoreGroup.class, stores);
}
@@ -176,7 +176,7 @@
unit.addAttachment(UDFMetaData.class, udf);
}
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
return vdb;
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -67,39 +67,41 @@
if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
continue;
}
- ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (model.getErrors().isEmpty()) {
- continue;
+ synchronized (vdb) {
+ ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
+
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (model.getErrors().isEmpty()) {
+ continue;
+ }
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ model.clearErrors();
+ String status = cm.getStausMessage();
+ if (status != null && status.length() > 0) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
+ }
+ }
}
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- model.clearErrors();
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
- }
+
+ boolean valid = true;
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (!model.getErrors().isEmpty()) {
+ valid = false;
+ break;
+ }
}
- }
-
- boolean valid = true;
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (!model.getErrors().isEmpty()) {
- valid = false;
- break;
+
+ if (valid) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
}
-
- if (valid) {
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
}
}
@@ -108,25 +110,26 @@
if (vdb.isPreview()) {
continue;
}
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String msg = null;
- if (translator) {
- msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ synchronized (vdb) {
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ String msg = null;
+ if (translator) {
+ msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ else {
+ msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
- else {
- msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
- }
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
- }
+ }
}
}
Copied: trunk/runtime/src/test/java/org/teiid/transport/TestFailover.java (from rev 2887, branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java)
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestFailover.java (rev 0)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.transport;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.net.InetSocketAddress;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Test;
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.LogonException;
+import org.teiid.client.security.LogonResult;
+import org.teiid.client.security.SessionToken;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.ComponentNotFoundException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.dqp.service.SessionService;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.HostInfo;
+import org.teiid.net.TeiidURL;
+import org.teiid.net.socket.SocketServerConnection;
+import org.teiid.net.socket.SocketServerConnectionFactory;
+import org.teiid.net.socket.UrlServerDiscovery;
+import org.teiid.transport.TestSocketRemoting.FakeService;
+
+
+@SuppressWarnings("nls")
+public class TestFailover {
+
+ SocketListener listener;
+ SocketListener listener1;
+
+ private SocketServerConnectionFactory sscf;
+ private InetSocketAddress addr = new InetSocketAddress(0);
+ private int logonAttempts;
+
+ @After public void tearDown() {
+ if (this.listener != null) {
+ this.listener.stop();
+ }
+ if (this.listener1 != null) {
+ this.listener1.stop();
+ }
+ }
+
+ private SocketServerConnection helpEstablishConnection(boolean clientSecure, SSLConfiguration config, Properties socketConfig) throws CommunicationException,
+ ConnectionException {
+ listener = createListener(addr, config);
+ listener1 = createListener(addr, config);
+ listener1.stop();
+ Properties p = new Properties();
+ TeiidURL teiidUrl = new TeiidURL(addr.getHostName(), listener.getPort(), clientSecure);
+ teiidUrl.getHostInfo().add(new HostInfo(addr.getHostName(), listener1.getPort()));
+ String url = teiidUrl.getAppServerURL();
+ p.setProperty(TeiidURL.CONNECTION.SERVER_URL, url);
+ p.setProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
+ p.setProperty(TeiidURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
+ if (sscf == null) {
+ sscf = new SocketServerConnectionFactory();
+ sscf.initialize(socketConfig);
+ }
+ return sscf.getConnection(p);
+ }
+
+ private SocketListener createListener(InetSocketAddress address, SSLConfiguration config) {
+ ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
+ server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
+ @Override
+ public LogonResult logon(Properties connProps)
+ throws LogonException, ComponentNotFoundException {
+ logonAttempts++;
+ return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
+ }
+
+ @Override
+ public ResultsFuture<?> ping() throws InvalidSessionException,
+ TeiidComponentException {
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ @Override
+ public void assertIdentity(SessionToken checkSession)
+ throws InvalidSessionException, TeiidComponentException {
+ throw new InvalidSessionException();
+ }
+
+ }, null);
+ server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
+ return new SocketListener(address.getPort(), address.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
+ }
+
+ @Test public void testFailover() throws Exception {
+ SSLConfiguration config = new SSLConfiguration();
+ Properties p = new Properties();
+ SocketServerConnection conn = helpEstablishConnection(false, config, p);
+ assertTrue(conn.isOpen(1000));
+ //restart the second instance now that we know the connection was made to the first
+ listener1 = createListener(new InetSocketAddress(addr.getAddress(), listener1.getPort()), config);
+ listener.stop();
+ conn.isOpen(1000); //there is a chance this call can fail
+ assertTrue(conn.isOpen(1000));
+ listener1.stop();
+ //both instances are down
+ assertFalse(conn.isOpen(1000));
+ //bring the first back up
+ listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
+ assertTrue(conn.isOpen(1000));
+ assertEquals(3, logonAttempts);
+ conn.close();
+ }
+
+}
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -87,7 +87,7 @@
});
DQPConfiguration config = new DQPConfiguration();
- config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250));
+ config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.start(config);
this.sessionService.setDqp(this.dqp);
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 16:09:14 UTC (rev 2890)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 21:12:16 UTC (rev 2891)
@@ -39,8 +39,10 @@
import java.util.Collections;
import java.util.List;
+import org.teiid.jdbc.TeiidSQLException;
+
/**
* TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
* in order to call out.print instead of out.println
@@ -73,8 +75,22 @@
public static void printThrowable(Throwable t, String sql, PrintStream out) {
out.println(sql);
+
+ Throwable answer = t;
+ if (t instanceof TeiidSQLException) {
+ TeiidSQLException sqle = (TeiidSQLException) t;
+ SQLException se = sqle.getNextException();
+ if (se != null) {
+ SQLException s = null;
+ while( (s = se.getNextException()) != null) {
+ se = s;
+ }
+
+ answer = se;
+ }
+ }
- out.print(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
+ out.print(t.getClass().getName() + " : " + answer.getMessage()); //$NON-NLS-1$
}
13 years, 10 months
teiid SVN: r2890 - in branches/7.3.x: adminshell and 35 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 11:09:14 -0500 (Mon, 31 Jan 2011)
New Revision: 2890
Modified:
branches/7.3.x/adminshell/pom.xml
branches/7.3.x/api/pom.xml
branches/7.3.x/build/pom.xml
branches/7.3.x/cache-jbosscache/pom.xml
branches/7.3.x/client/pom.xml
branches/7.3.x/common-core/pom.xml
branches/7.3.x/connectors/connector-file/pom.xml
branches/7.3.x/connectors/connector-ldap/pom.xml
branches/7.3.x/connectors/connector-salesforce/pom.xml
branches/7.3.x/connectors/connector-ws/pom.xml
branches/7.3.x/connectors/pom.xml
branches/7.3.x/connectors/salesforce-api/pom.xml
branches/7.3.x/connectors/sandbox/pom.xml
branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml
branches/7.3.x/connectors/translator-file/pom.xml
branches/7.3.x/connectors/translator-jdbc/pom.xml
branches/7.3.x/connectors/translator-ldap/pom.xml
branches/7.3.x/connectors/translator-loopback/pom.xml
branches/7.3.x/connectors/translator-salesforce/pom.xml
branches/7.3.x/connectors/translator-ws/pom.xml
branches/7.3.x/console/pom.xml
branches/7.3.x/documentation/admin-guide/pom.xml
branches/7.3.x/documentation/caching-guide/pom.xml
branches/7.3.x/documentation/client-developers-guide/pom.xml
branches/7.3.x/documentation/developer-guide/pom.xml
branches/7.3.x/documentation/pom.xml
branches/7.3.x/documentation/quick-start-example/pom.xml
branches/7.3.x/documentation/reference/pom.xml
branches/7.3.x/engine/pom.xml
branches/7.3.x/hibernate-dialect/pom.xml
branches/7.3.x/jboss-integration/pom.xml
branches/7.3.x/metadata/pom.xml
branches/7.3.x/pom.xml
branches/7.3.x/runtime/pom.xml
branches/7.3.x/test-integration/common/pom.xml
branches/7.3.x/test-integration/db/pom.xml
branches/7.3.x/test-integration/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: branches/7.3.x/adminshell/pom.xml
===================================================================
--- branches/7.3.x/adminshell/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/adminshell/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: branches/7.3.x/api/pom.xml
===================================================================
--- branches/7.3.x/api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/api/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: branches/7.3.x/build/pom.xml
===================================================================
--- branches/7.3.x/build/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/build/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: branches/7.3.x/cache-jbosscache/pom.xml
===================================================================
--- branches/7.3.x/cache-jbosscache/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/cache-jbosscache/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: branches/7.3.x/client/pom.xml
===================================================================
--- branches/7.3.x/client/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/client/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: branches/7.3.x/common-core/pom.xml
===================================================================
--- branches/7.3.x/common-core/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/common-core/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: branches/7.3.x/connectors/connector-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/connector-file/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: branches/7.3.x/connectors/connector-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/connector-ldap/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: branches/7.3.x/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/connector-salesforce/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: branches/7.3.x/connectors/connector-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/connector-ws/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: branches/7.3.x/connectors/pom.xml
===================================================================
--- branches/7.3.x/connectors/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/connectors/salesforce-api/pom.xml
===================================================================
--- branches/7.3.x/connectors/salesforce-api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/salesforce-api/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: branches/7.3.x/connectors/sandbox/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/sandbox/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: branches/7.3.x/connectors/translator-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-file/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: branches/7.3.x/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-jdbc/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-jdbc/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: branches/7.3.x/connectors/translator-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-ldap/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: branches/7.3.x/connectors/translator-loopback/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-loopback/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-loopback/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: branches/7.3.x/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-salesforce/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: branches/7.3.x/connectors/translator-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/connectors/translator-ws/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: branches/7.3.x/console/pom.xml
===================================================================
--- branches/7.3.x/console/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/console/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.3.x/documentation/admin-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/admin-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/admin-guide/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: branches/7.3.x/documentation/caching-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/caching-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/caching-guide/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: branches/7.3.x/documentation/client-developers-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/client-developers-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/client-developers-guide/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: branches/7.3.x/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/developer-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/developer-guide/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: branches/7.3.x/documentation/pom.xml
===================================================================
--- branches/7.3.x/documentation/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/documentation/quick-start-example/pom.xml
===================================================================
--- branches/7.3.x/documentation/quick-start-example/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/quick-start-example/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: branches/7.3.x/documentation/reference/pom.xml
===================================================================
--- branches/7.3.x/documentation/reference/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/documentation/reference/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: branches/7.3.x/engine/pom.xml
===================================================================
--- branches/7.3.x/engine/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/engine/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: branches/7.3.x/hibernate-dialect/pom.xml
===================================================================
--- branches/7.3.x/hibernate-dialect/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/hibernate-dialect/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: branches/7.3.x/jboss-integration/pom.xml
===================================================================
--- branches/7.3.x/jboss-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/jboss-integration/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/metadata/pom.xml
===================================================================
--- branches/7.3.x/metadata/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/metadata/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: branches/7.3.x/pom.xml
===================================================================
--- branches/7.3.x/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -5,15 +5,15 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</developerConnection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
</scm>
<licenses>
<license>
Modified: branches/7.3.x/runtime/pom.xml
===================================================================
--- branches/7.3.x/runtime/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/runtime/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/test-integration/common/pom.xml
===================================================================
--- branches/7.3.x/test-integration/common/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/test-integration/common/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: branches/7.3.x/test-integration/db/pom.xml
===================================================================
--- branches/7.3.x/test-integration/db/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/test-integration/db/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.3.x/test-integration/pom.xml
===================================================================
--- branches/7.3.x/test-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
+++ branches/7.3.x/test-integration/pom.xml 2011-01-31 16:09:14 UTC (rev 2890)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.Final</version>
+ <version>7.3.1.Alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
13 years, 10 months
teiid SVN: r2889 - in tags: teiid-parent-7.3.0.Final and 54 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 11:08:16 -0500 (Mon, 31 Jan 2011)
New Revision: 2889
Added:
tags/teiid-parent-7.3.0.Final/
tags/teiid-parent-7.3.0.Final/adminshell/pom.xml
tags/teiid-parent-7.3.0.Final/api/pom.xml
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.3.0.Final/build/pom.xml
tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml
tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
tags/teiid-parent-7.3.0.Final/client/pom.xml
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
tags/teiid-parent-7.3.0.Final/common-core/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml
tags/teiid-parent-7.3.0.Final/console/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml
tags/teiid-parent-7.3.0.Final/engine/pom.xml
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml
tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml
tags/teiid-parent-7.3.0.Final/metadata/pom.xml
tags/teiid-parent-7.3.0.Final/pom.xml
tags/teiid-parent-7.3.0.Final/runtime/pom.xml
tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
tags/teiid-parent-7.3.0.Final/runtime/src/test/java/org/teiid/transport/TestFailover.java
tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml
tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml
tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
tags/teiid-parent-7.3.0.Final/test-integration/pom.xml
Removed:
tags/teiid-parent-7.3.0.Final/adminshell/pom.xml
tags/teiid-parent-7.3.0.Final/api/pom.xml
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.3.0.Final/build/pom.xml
tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml
tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
tags/teiid-parent-7.3.0.Final/client/pom.xml
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java
tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
tags/teiid-parent-7.3.0.Final/common-core/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml
tags/teiid-parent-7.3.0.Final/console/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml
tags/teiid-parent-7.3.0.Final/engine/pom.xml
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml
tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml
tags/teiid-parent-7.3.0.Final/metadata/pom.xml
tags/teiid-parent-7.3.0.Final/pom.xml
tags/teiid-parent-7.3.0.Final/runtime/pom.xml
tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml
tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml
tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
tags/teiid-parent-7.3.0.Final/test-integration/pom.xml
Log:
[maven-release-plugin] copy for tag teiid-parent-7.3.0.Final
Copied: tags/teiid-parent-7.3.0.Final (from rev 2878, branches/7.3.x)
Deleted: tags/teiid-parent-7.3.0.Final/adminshell/pom.xml
===================================================================
--- branches/7.3.x/adminshell/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/adminshell/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-adminshell</artifactId>
- <name>Adminshell</name>
- <description>Adminshell for Teiid</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.94</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.fusesource.jansi</groupId>
- <artifactId>jansi</artifactId>
- <version>1.2.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/adminshell/pom.xml (from rev 2888, branches/7.3.x/adminshell/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/adminshell/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/adminshell/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-adminshell</artifactId>
+ <name>Adminshell</name>
+ <description>Adminshell for Teiid</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.7.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.fusesource.jansi</groupId>
+ <artifactId>jansi</artifactId>
+ <version>1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/api/pom.xml
===================================================================
--- branches/7.3.x/api/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-api</artifactId>
- <name>Teiid Translator API</name>
- <description>API for creating Translators and other common extenders in Teiid</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/api/pom.xml (from rev 2888, branches/7.3.x/api/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/api/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-api</artifactId>
+ <name>Teiid Translator API</name>
+ <description>API for creating Translators and other common extenders in Teiid</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt
===================================================================
--- branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,4 +0,0 @@
-Portions Copyright (C) 2008-2009 Red Hat, Inc.
-Portions Copyright (C) 2000-2007 MetaMatrix, Inc.
-Portions Copyright (c) 2000, 2003, 2008 IBM Corporation and others.
-Portions Copyright (c) 1997-2000 Sun Microsystems, Inc.
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt (from rev 2886, branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt)
===================================================================
--- tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt (rev 0)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/COPYRIGHT.txt 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,4 @@
+Portions Copyright (C) 2008-2011 Red Hat, Inc.
+Portions Copyright (C) 2000-2007 MetaMatrix, Inc.
+Portions Copyright (c) 2000, 2003, 2008 IBM Corporation and others.
+Portions Copyright (c) 1997-2000 Sun Microsystems, Inc.
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,227 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- Teiid Services -->
- <bean name="SessionService" class="org.teiid.services.SessionServiceImpl">
- <property name="VDBRepository"><inject bean="VDBRepository"/></property>
- <property name="securityHelper"><inject bean="SecurityHelper"/></property>
- <!-- Comma separated list of domains to be used to login into Teiid using JDBC connection-->
- <property name="securityDomains">teiid-security</property>
- <!-- security domain to be used with Admin API (please do not change this, as this should be same as profile service) -->
- <property name="adminSecurityDomain">jmx-console</property>
- <!-- Maximum number of sessions allowed by the system (default 5000) -->
- <property name="sessionMaxLimit">5000</property>
- <!-- Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0) -->
- <property name="sessionExpirationTimeLimit">0</property>
- </bean>
-
- <bean name="BufferService" class="org.teiid.services.BufferServiceImpl">
- <!-- Use disk for buffer management -->
- <property name="useDisk">true</property>
- <!-- Directory location for the buffer files -->
- <property name="diskDirectory">${jboss.server.temp.dir}/teiid</property>
- <!-- The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512) -->
- <property name="processorBatchSize">512</property>
- <!-- The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024) -->
- <property name="connectorBatchSize">1024</property>
- <!--
- The number of batch columns to allow in memory (default 16384).
- This value should be set lower or higher depending on the available memory to Teiid in the VM.
- 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.
- -->
- <property name="maxReserveBatchColumns">16384</property>
- <!--
- The number of batch columns guaranteed to a processing operation. Set this value lower if the workload typically
- processes larger numbers of concurrent queries with large intermediate results from operations such as sorting,
- grouping, etc. (default 128)
- -->
- <property name="maxProcessingBatchesColumns">128</property>
- <!-- Max File size in MB (default 2GB)-->
- <property name="maxFileSize">2048</property>
- <!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
- <property name="maxBufferSpace">51200</property>
- <!-- Max open buffer files (default 64) -->
- <property name="maxOpenFiles">64</property>
- </bean>
-
- <bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
- <property name="enabled">true</property>
- <property name="cacheManager">java:TeiidCacheManager</property>
- <property name="resultsetCacheName">teiid-resultset-cache</property>
- </bean>
-
- <!-- Configuration for result set caching.
- There will be 2 caches with these settings.
- One cache holds results that are specific to sessions.
- The other cache holds vdb scoped results and can
- be replicated.
- -->
- <bean name="ResultsetCacheConfig" class="org.teiid.cache.CacheConfiguration">
- <property name="name">ResultSetCacheConfig</property>
- <property name="enabled">true</property>
- <!-- Max Entries allowed for ResultSet Cache (default 1024) -->
- <property name="maxEntries">1024</property>
- <!-- Max age in seconds (default 7200 - 2 hours) -->
- <property name="maxAgeInSeconds">7200</property>
- <!-- Allowed values are LRU, EXPIRATION.
- Setting this value to LRU will cause cache hint TTL values
- to be ignored. (default EXPIRATION) -->
- <property name="type">EXPIRATION</property>
- </bean>
-
- <bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
- <property name="jndiName">teiid/engine-deployer</property>
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="jdbcSocketConfiguration"><inject bean="JdbcSocketConfiguration"/></property>
- <property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
- <property name="odbcSocketConfiguration"><inject bean="OdbcSocketConfiguration"/></property>
- <property name="workManager"><inject bean="WorkManager"/></property>
- <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
- <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
- <property name="sessionService"><inject bean="SessionService"/></property>
- <property name="bufferService"><inject bean="BufferService"/></property>
- <property name="securityHelper"><inject bean="SecurityHelper"/></property>
- <property name="VDBRepository"><inject bean="VDBRepository"/></property>
- <property name="cacheFactory"><inject bean="CacheFactory"/></property>
- <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
-
- <!-- Process pool maximum thread count. (default 64) -->
- <property name="maxThreads">64</property>
- <!-- Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts. -->
- <property name="maxActivePlans">20</property>
- <!-- Query processor time slice, in milliseconds. (default 2000) -->
- <property name="timeSliceInMilli">2000</property>
- <!-- Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480) -->
- <property name="maxRowsFetchSize">20480</property>
- <!-- The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default) -->
- <property name="lobChunkSizeInKB">100</property>
- <!-- The maximum number of query plans that are cached.
- This includes both user plans and internal prepared plans.
- Note: this is a memory based cache. (default 512) -->
- <property name="preparedPlanCacheMaxCount">512</property>
- <!-- Turn on role checking based upon the data roles defined in VDBs. (default true) -->
- <property name="useDataRoles">true</property>
- <!-- Sets whether temporary table usage is enabled by default (default true) -->
- <property name="allowCreateTemporaryTablesByDefault">true</property>
- <!-- Long running query threshold, after which a alert can be generated by tooling if configured-->
- <property name="queryThresholdInSecs">600</property>
- <!-- Maximum rows allowed from a source query. -1 indicates no limit. (default -1)-->
- <property name="maxSourceRows">-1</property>
- <!-- Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. -->
- <property name="exceptionOnMaxSourceRows">true</property>
- </bean>
-
- <!-- JDBC Socket connection properties (SSL see below) -->
- <bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">JdbcSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">31000</property>
- <!-- Max number of threads dedicated to initial request processing (default 15) -->
- <property name="maxSocketThreads">15</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="JdbcSslConfiguration"/></property>
- </bean>
-
- <bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled, login, or enabled
- disabled = no transport or message level security will be used
- login = only the login traffic will be encrypted at a message level
- using 128 bit AES with an ephemerial DH key exchange.
- No other config values are needed in this mode
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">login</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">1-way</property>
- </bean>
-
- <!-- Admin Socket connection settings (SSL see below) -->
- <bean name="AdminSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">AdminSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">31443</property>
- <!-- Max number of threads dedicated to Admin and initial request processing (default 4) -->
- <property name="maxSocketThreads">4</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="AdminSslConfiguration"/></property>
- </bean>
-
- <bean name="AdminSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled, login, or enabled
- disabled = no transport or message level security will be used
- login = only the login traffic will be encrypted at a message level
- using 128 bit AES with an ephemerial DH key exchange.
- No other config values are needed in this mode
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">enabled</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">anonymous</property>
- </bean>
-
- <!-- JDBC Socket connection properties (SSL see below) -->
- <bean name="OdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">OdbcSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">35432</property>
- <!-- Max number of threads dedicated to initial request processing (default 15) -->
- <property name="maxSocketThreads">15</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="OdbcSslConfiguration"/></property>
- </bean>
-
- <bean name="OdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled or enabled
- disabled = no transport or message level security will be used
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">disabled</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">1-way</property>
- </bean>
-
- <!-- teiid's default security domain, replace this with your own if needs to be any other JAAS domain -->
- <application-policy xmlns="urn:jboss:security-beans:1.0" name="teiid-security">
- <authentication>
- <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
- <!-- property files can found under conf/props directory -->
- <module-option name="usersProperties">props/teiid-security-users.properties</module-option>
- <module-option name="rolesProperties">props/teiid-security-roles.properties</module-option>
- </login-module>
- </authentication>
- </application-policy>
-
-</deployment>
Copied: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (from rev 2886, branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Teiid Services -->
+ <bean name="SessionService" class="org.teiid.services.SessionServiceImpl">
+ <property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ <property name="securityHelper"><inject bean="SecurityHelper"/></property>
+ <!-- Comma separated list of domains to be used to login into Teiid using JDBC connection-->
+ <property name="securityDomains">teiid-security</property>
+ <!-- security domain to be used with Admin API (please do not change this, as this should be same as profile service) -->
+ <property name="adminSecurityDomain">jmx-console</property>
+ <!-- Maximum number of sessions allowed by the system (default 5000) -->
+ <property name="sessionMaxLimit">5000</property>
+ <!-- Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0) -->
+ <property name="sessionExpirationTimeLimit">0</property>
+ </bean>
+
+ <bean name="BufferService" class="org.teiid.services.BufferServiceImpl">
+ <!-- Use disk for buffer management -->
+ <property name="useDisk">true</property>
+ <!-- Directory location for the buffer files -->
+ <property name="diskDirectory">${jboss.server.temp.dir}/teiid</property>
+ <!-- The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512) -->
+ <property name="processorBatchSize">512</property>
+ <!-- The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024) -->
+ <property name="connectorBatchSize">1024</property>
+ <!--
+ The number of batch columns to allow in memory (default 16384).
+ This value should be set lower or higher depending on the available memory to Teiid in the VM.
+ 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.
+ -->
+ <property name="maxReserveBatchColumns">16384</property>
+ <!--
+ The number of batch columns guaranteed to a processing operation. Set this value lower if the workload typically
+ processes larger numbers of concurrent queries with large intermediate results from operations such as sorting,
+ grouping, etc. (default 128)
+ -->
+ <property name="maxProcessingBatchesColumns">128</property>
+ <!-- Max File size in MB (default 2GB)-->
+ <property name="maxFileSize">2048</property>
+ <!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
+ <property name="maxBufferSpace">51200</property>
+ <!-- Max open buffer files (default 64) -->
+ <property name="maxOpenFiles">64</property>
+ </bean>
+
+ <bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
+ <property name="enabled">true</property>
+ <property name="cacheManager">java:TeiidCacheManager</property>
+ <property name="resultsetCacheName">teiid-resultset-cache</property>
+ </bean>
+
+ <!-- Configuration for result set caching.
+ There will be 2 caches with these settings.
+ One cache holds results that are specific to sessions.
+ The other cache holds vdb scoped results and can
+ be replicated.
+ -->
+ <bean name="ResultsetCacheConfig" class="org.teiid.cache.CacheConfiguration">
+ <property name="name">ResultSetCacheConfig</property>
+ <property name="enabled">true</property>
+ <!-- Max Entries allowed for ResultSet Cache (default 1024) -->
+ <property name="maxEntries">1024</property>
+ <!-- Max age in seconds (default 7200 - 2 hours) -->
+ <property name="maxAgeInSeconds">7200</property>
+ <!-- Allowed values are LRU, EXPIRATION.
+ Setting this value to LRU will cause cache hint TTL values
+ to be ignored. (default EXPIRATION) -->
+ <property name="type">EXPIRATION</property>
+ <property name="location">resultset</property>
+ </bean>
+
+ <bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
+ <property name="jndiName">teiid/engine-deployer</property>
+ <property name="profileService"><inject bean="ProfileService"/></property>
+ <property name="jdbcSocketConfiguration"><inject bean="JdbcSocketConfiguration"/></property>
+ <property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
+ <property name="odbcSocketConfiguration"><inject bean="OdbcSocketConfiguration"/></property>
+ <property name="workManager"><inject bean="WorkManager"/></property>
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
+ <property name="sessionService"><inject bean="SessionService"/></property>
+ <property name="bufferService"><inject bean="BufferService"/></property>
+ <property name="securityHelper"><inject bean="SecurityHelper"/></property>
+ <property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ <property name="cacheFactory"><inject bean="CacheFactory"/></property>
+ <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
+
+ <!-- Process pool maximum thread count. (default 64) -->
+ <property name="maxThreads">64</property>
+ <!-- Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts. -->
+ <property name="maxActivePlans">20</property>
+ <!-- Query processor time slice, in milliseconds. (default 2000) -->
+ <property name="timeSliceInMilli">2000</property>
+ <!-- Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480) -->
+ <property name="maxRowsFetchSize">20480</property>
+ <!-- The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default) -->
+ <property name="lobChunkSizeInKB">100</property>
+ <!-- The maximum number of query plans that are cached.
+ This includes both user plans and internal prepared plans.
+ Note: this is a memory based cache. (default 512) -->
+ <property name="preparedPlanCacheMaxCount">512</property>
+ <!-- Turn on role checking based upon the data roles defined in VDBs. (default true) -->
+ <property name="useDataRoles">true</property>
+ <!-- Sets whether temporary table usage is enabled by default (default true) -->
+ <property name="allowCreateTemporaryTablesByDefault">true</property>
+ <!-- Long running query threshold, after which a alert can be generated by tooling if configured-->
+ <property name="queryThresholdInSecs">600</property>
+ <!-- Maximum rows allowed from a source query. -1 indicates no limit. (default -1)-->
+ <property name="maxSourceRows">-1</property>
+ <!-- Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. -->
+ <property name="exceptionOnMaxSourceRows">true</property>
+ </bean>
+
+ <!-- JDBC Socket connection properties (SSL see below) -->
+ <bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">JdbcSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">31000</property>
+ <!-- Max number of threads dedicated to initial request processing (default 15) -->
+ <property name="maxSocketThreads">15</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="JdbcSslConfiguration"/></property>
+ </bean>
+
+ <bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled, login, or enabled
+ disabled = no transport or message level security will be used
+ login = only the login traffic will be encrypted at a message level
+ using 128 bit AES with an ephemerial DH key exchange.
+ No other config values are needed in this mode
+ enabled = traffic will be secured using this configuration
+ -->
+ <property name="mode">login</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ </bean>
+
+ <!-- Admin Socket connection settings (SSL see below) -->
+ <bean name="AdminSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">AdminSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">31443</property>
+ <!-- Max number of threads dedicated to Admin and initial request processing (default 4) -->
+ <property name="maxSocketThreads">4</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="AdminSslConfiguration"/></property>
+ </bean>
+
+ <bean name="AdminSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled, login, or enabled
+ disabled = no transport or message level security will be used
+ login = only the login traffic will be encrypted at a message level
+ using 128 bit AES with an ephemerial DH key exchange.
+ No other config values are needed in this mode
+ enabled = traffic will be secured using this configuration
+ -->
+ <property name="mode">enabled</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">anonymous</property>
+ </bean>
+
+ <!-- JDBC Socket connection properties (SSL see below) -->
+ <bean name="OdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">OdbcSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">35432</property>
+ <!-- Max number of threads dedicated to initial request processing (default 15) -->
+ <property name="maxSocketThreads">15</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="OdbcSslConfiguration"/></property>
+ </bean>
+
+ <bean name="OdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled or enabled
+ disabled = no transport or message level security will be used
+ enabled = traffic will be secured using this configuration
+ -->
+ <property name="mode">disabled</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ </bean>
+
+ <!-- teiid's default security domain, replace this with your own if needs to be any other JAAS domain -->
+ <application-policy xmlns="urn:jboss:security-beans:1.0" name="teiid-security">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
+ <!-- property files can found under conf/props directory -->
+ <module-option name="usersProperties">props/teiid-security-users.properties</module-option>
+ <module-option name="rolesProperties">props/teiid-security-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+</deployment>
Deleted: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,220 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
- <TITLE>Teiid ${project.version} Release Notes</TITLE>
- <META NAME="CHANGEDBY" CONTENT="Steve Hawkins">
- </STYLE>
-</HEAD>
-<BODY LANG="en-US" DIR="LTR">
-<P><A HREF="http://www.teiid.org/"><IMG SRC="https://www.jboss.org/dms/teiid/images/teiid-banner.png" NAME="graphics1" ALT="Teiid" ALIGN=BOTTOM WIDTH=800></A>
-
-<H1>Teiid ${project.version} Release Notes</H1>
-<P>Teiid ${project.version} adds performance and integration features.
-
-<H2>Overview</H2>
-<UL>
- <LI><A HREF="#Highlights">Highlights</A>
- <LI><A HREF="#Compatibility">Compatibility Issues</A>
- <LI><A HREF="#Configuration">Configuration Issues</A>
- <LI><A HREF="#Other">Other Issues</A>
- <LI><A HREF="#LibraryUpdates">Thirdparty Library Updates</A>
- <LI><A HREF="#Details">Detailed Release Notes</A>
- <LI><A HREF="#Documentation">Additional Docs and Help</A>
- <LI><A HREF="#Licenses">Licenses</A>
- <LI><A HREF="#About">About JBoss</A>
-</UL>
-<H2><A NAME="Highlights"></A>Highlights</H2>
-<UL>
- <LI><B>Subquery Optimization</B> - added rewrite to INNER JOIN for applicable WHERE clause subqueries. Also added cost based SEMI and ANTI-SEMI join handling for applicable non-pushed WHERE and HAVING subqueries.
- <LI><B>Updatable Views</B>
- <UL>
- <LI>Added support to perform simple pass-through and more complicated updates through views by default.
- <LI>Added support for "FOR EACH ROW" update procedure handling (similar to INSTEAD OF triggers in other DBMS's), which should be used instead of the deprecated TRANSLATE criteria approach.
- </UL>
- <LI><B>Temp table enhancements</B> - added support for the SERIAL datatype, which is a not null INTEGER that auto-increments, and the ability to specify a column as NOT NULL.
- <LI><B>UDF</B> - new API objects added to teiid-api to support user defined functions that are capable of pushdown to source.
- <LI><B>Unescape Function</B> - a new system function, unescape, was added to handle common \ escaping in strings including octal, hex/unicode, \b, \r, \n, \f, and \t.
- <LI><B>Predicate Optimization</B> - expanded optimizations for detecting always false conditions when using IS NULL, IN, or comparison predicates with literal values.
- <LI><B>Partition-wise Optimizations</B> - Views defined by partitioned unions (union alls where each branch has a projected literal or an IN predicate that makes its values mutually exclusive from the other branches) can
- be used in aggregation or joins and the optimizer will take advantage of the partitioning information. For example, when a partitioned union is joined against another partitioned union, the optimizer will reorganize the join of unions into a union of joins.
- <LI><B>Delegate Translator</B> - A new translator base class was added that is capable of delegating all the calls to another configured translator.
- <LI><B>JDBC Reauthentication</B> - Teiid connections (defined by the org.teiid.jdbc.TeiidConnection interface) now support the changeUser method to reauthenticate a given connection.
- <LI><B>Lob Caching</B> - Lobs are allowed to cache to disk as part of ResultSet caching. Distributed lob caching is not allowed.
-</UL>
-
-<h2><a name="Compatibility">Compatibility Issues</a></h2>
-<ul>
- <li>TRANSLATE/HAS CRITERIA has been deprecated. An alternative approach to update procedures will be introduced in a subsequent version.
- <li>Support for named parameter syntax using param=value has been deprecated, since it is ambiguous with a comparison predicate boolean value expression. param<b>=></b>value should be used instead.
-</ul>
-<h4>from 7.2</h4>
-<ul>
- <li>The default JDBC credentials are user/user - not admin/teiid
- <li>Unordered limits are no longer pushed through conditions, dup removal, or UNION not all. This prevents the possibility of getting less results than the logical intent of the limit.
-</ul>
-<h4>from 7.1</h4>
-<ul>
- <li>Subqueries are no longer allowed to be SELECT INTO.
- <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "UPDATE ...; SELECT VARIABLES.ROWCOUNT;".
- <li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
- SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
- <li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
- <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
- <li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
- <li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
- <li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
- <li>The use of VARIABLES.ROWCOUNT is now reserved.
- <li>Exec statements of the form "var = EXEC foo()" are only valid if the procedure foo has a return parameter.
- <li>Cache hint now supports "scope" definition. For ex: /* cache(scope:user) */ select * from T1; This hint will override the computed scope based on the query.
-</ul>
-<h4>from 7.0</h4>
-<ul>
- <li>The term data policy was replaced with data role. The AdminAPI methods for adding role mappings have changed from addRoleToDataPolicy and removeRoleFromDataPolicy to addDataRoleMapping and removeDataRoleMapping respectively.
-</ul>
-<h4>from 6.2</h4>
-<ul>
- <li>The connector API has changed substantially. Custom connectors need to be retargeted to the new Translator API. See <a href="https://jira.jboss.org/browse/TEIID-1003">TEIID-1003</a> and the <a href="teiid-docs/teiid_developers_guide.pdf">Developer's Guide</a> for more information.
- <li>Connector bindings are no longer valid. Use the Designer Tooling or see the AdminShell download for a migration utility.
- <li>Calling out to web services and xml processing has been dramatically simplified and improved, but is a breaking change from prior releases.
- XML/Relational processing has been replaced by XMLTABLE, retrieving XML from file has been replaced by the File Translator/Resource Adapter, and
- web service calls have been replaced by the WS Translator/Resource Adapter. See <a href="https://jira.jboss.org/browse/TEIID-1118">TEIID-1118</a>, <a href="https://jira.jboss.org/browse/TEIID-1114">TEIID-1114</a>, and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>The direct usage of XQuery has been replaced with the XMLQuery function.
- <li>The text connector file processing has been replaced with the TEXTTABLE function. See <a href="https://jira.jboss.org/browse/TEIID-1102">TEIID-1102</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information
- <li>Double quoted values are now parsed as identifiers by default. See <a href="https://jira.jboss.org/browse/TEIID-145">TEIID-145</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>The system information schema has changed from System to SYS. The tables and table structures have also changed. See <a href="https://jira.jboss.org/browse/TEIID-871">TEIID-871</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>Client control over query plans has changed. OPTION PLANONLY, DEBUG, and SHOWPLAN are no longer allowed. This behavior should not be controlled by the SET statement, SET SHOWPLAN (ON|OFF|DEBUG) and SET NOEXEC (ON|OFF). Usage of the client PlanNode class will also need to be updated.
- <li>Teiid specific JDBC client interfaces and methods have changed. In general these custom features have mostly been moved to other more standard locations or been removed. See <a href="https://jira.jboss.org/browse/TEIID-1020">TEIID-1020</a> and the <a href="teiid-docs/teiid_client_developers_guide.pdf">Client Developers</a> guide for more information.
- <li>Teiid's reserved words have changed. Many of the Teiid specific reserved words have become non-reserved words. All of SQL Foundation and SQL/MED 2003, and SQL/XML from SQL 2006 reserved words have been added as reserved words. It is generally required to double quote all reserved words. It is advisable to double quote all non-reserved words as well. The use of the INPUT qualifier for procedure inputs has been deprecated in favor of INPUTS. The use of the USING qualifier for dynamic SQL inputs has been deprecated in favor of DVARS.
- <li>The AdminApi has been redesigned for use with the new Translator/JCA split and for deployment in JBoss AS.
- <li>The AdminShell is based on Groovy. Most BeanShell syntax is also valid in Groovy, but there are extensive changes in the AdminAPI that may necessitate rewriting scripts.
- <li>OPTION NO CACHE <table list> will now only by-pass cache for the given tables at their immediate view layer. Previously all caches would have transitively been skipped. See <a href="https://jira.jboss.org/browse/TEIID-900">TEIID-900</a> for more information.
- <li>Nan and +-Infinity are no longer allowed as numerical results by default. This may be changed via the system property org.teiid.allowNanInfinity.
- <li>The scale of BigDecimal values is now adjusted to allow for more intuitive results. Conversion from floating numeric types will preserve the approximate scale and division results will allow for additional scale. See <a href="https://jira.jboss.org/browse/TEIID-159">TEIID-159</a> for more information.
- <li>The 7.0 client is not compatible with 6.x or vice versa. It is expected that 7.0 clients will be compatible with 7.x releases for standard JDBC operations.
-</ul>
-
-<h2><a name="Configuration">Configuration Issues</a></h2>
-
-See the <a href="teiid-docs/teiid_admin_guide.pdf">Admin Guide</a> for more on configuration and installation.
-
-<h4>from 7.2</h4>
-<ul>
- <LI>Temporary tables can now be restricted by data roles. Use the data-role attribute allow-create-temporary-tables to explicitly enable or disable the usage of temporary tables.
-There is also a allowCreateTemporaryTablesByDefault property in the teiid-jboss-beans.xml to control whether usage is allowed by default. For compatibility with prior 7.x releases, the default is to allow
-temporary table access.
-</ul>
-
-<h4>from 7.1</h4>
-<ul>
- <li>Teiid clients now allow the usage of anonymous SSL by default.
- This changes allows the admin port (default 31443) to use anonymous SSL by default, rather than just securing login traffic.
- Admin clients should therefore use the mms protocol instead of mm. This will encrypt all admin traffic and ensure that any passwords in configuration files will
- be encrypted in transit. See the Admin Guide to upgrade from anonymous SSL to 1-way or 2-way authentication.
- The config properties sslEnabled and clientEncryptionEnabled for SSLConfiguration beans have been combined to a single property mode, that can have the values disabled|login|enabled.
- <li>Apache CXF is now expected to be used as the web services stack provider through JBossWS-CXF. See the Admin Guide for instructions on
- installing CXF for use with Teiid's Salesforce and web service connectors. The WS Resource Adapter's -ds.xml files should no longer use
- WSSecurityConfigURL and WSSecurityConfigName, rather they should be ConfigFile and ConfigName respectively. The property values should no longer
- refer to jboss-wsse-client.xml, but instead they should reference a CXF Spring configuration file and particular port configuration. See the Admin Guide
- for more on using CXF configuration files.
- <li>The default for data role checking is now "true". However only VDBs with data roles will have roles enforced.
- <li>The default prepared plan cache size was increased to 512, since it is targeted by internal plans as well.
-</ul>
-
-<h4>from 7.0</h4>
-<ul>
- <li>The property to enable data roles in teiid-jboss-beans.xml has changed from useEntitlements to useDataRoles.
- <li>Rar file names no longer contain version numbers. -ds.xml files should be updated from connector-XXX-version.rar to teiid-connector-XXX.rar
- <li>Code table relate configuration properties have been removed. Code tables are now implemented as materialized views.
-</ul>
-
-<h4>from 6.2</h4>
-<ul>
- <li>A JBoss AS instance is now required. Embedded mode is also currently not supported.</li>
- <li>Engine configuration is now handled through the admin console or deploy/teiid/teiid-jboss-beans.xml
- <li>Logging is now done through the container's log4j instance. Any Teiid specific logging changes, see the conf/jboss-teiid-log4j.xml, need to be incorporated into the master jboss-log4j.xml.
-</ul>
-
-<h2><a name="Other">Other Issues</a></h2>
-<ul>
- <li>For compatibility with the 7.0 release if a stored procedure parameter list begins with identifier=, then it will be parsed as a named parameter invocation even if the intent was to use a comparison predicate
- as the first parameter value. The workaround is to use nesting parens, e.g. call proc((identifier=value), ...), which clarifies that this is positional value. This workaround will not be needed in later releases.
-</ul>
-<h4>from 7.0</h4>
-<ul>
- <li>Fixed xsd type handling for SQL/XML and XML document models. xsd:date, xsd:dateTime, and xsd:time types will now all be displayed using the GMT timezone (Z). SQL types, such as timestamp, used for an XMLTABLE column will now expect their values to be in the form of the corresponding xsd type.
-</ul>
-<h4>From 6.2</h4>
-<ul>
- <li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
- <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
- the parseTime function cannot be pushed down. This should be addressed in future releases.
-</ul>
-
-<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
-
-The following components have been updated:
-<h4>From 7.1</h4>
-<ul>
- <li>json-simple 1.1 was added.
- <li>Netty was upgraded to 3.2.1
-</ul>
-<h4>From 7.0</h4>
-<ul>
- <li>Direct integration of JBossCache jars was removed.
- <li>Netty was upgraded to 3.2.0
- <li>JDOM was removed.
-</ul>
-<h4>From 6.2</h4>
-<ul>
- <li>Netty was upgraded to 3.1.5
- <li>Saxon was upgraded to 9.1.0.8
- <li>A 5.1 container's version of Arjuna is newer than what was previously included in Teiid 6.x.
- <li>Various other dependencies have been removed as they are no longer needed or now provided by the container.
-</ul>
-
-<h2><a name="Details">Detailed Release Notes</a></h2>
- Detailed Release Notes - Teiid - Version ${project.version}
-
-<h2><a name="Documentation">Documentation and Help</a></h2>
-
-The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.
-Documentation and help may be obtained from the local distribution under <a href="teiid-docs">teiid-docs</a> or the following locations.
-<ul>
-
-<li><a href="http://www.jboss.org/teiid/docs">Online Documentation</a></li>
-<li><a href="https://community.jboss.org/wiki/TheTeiidProject">Wiki</a></li>
-<li><a href="http://jira.jboss.org/jira/browse/TEIID">JIRA</a></li>
-<li><a href="http://community.jboss.org/en/teiid?view=discussions">Forums</a></li>
-</ul>
-
-
-<h2><a name="Licenses">Licenses</a></h2>
-
-<p>Teiid is licensed under the <a href="LICENSE-lgpl-2.1.txt">LGPL</a>. The
-license texts for Teiid and the thirdparty components it uses may be found in the teiid-docs/licenses
-directory of the distribution. <a href="teiid-docs/licenses">Browse
-Licenses</a>
-
-</p>
-
-<h2><a name="About">About JBoss, a
-division of Red Hat</a></h2>
-
-<p>JBoss, a division of <a href="http://www.redhat.com/jboss/">Red
-Hat</a>, is in the business of
-providing
-superior technical support to our customers. Our goal is to make
-Professional Open Source™ the <b>SAFE
-CHOICE</b>
-for you. We accomplish this by backing up our open source Java products
-with technical support services that are delivered by the core
-developers themselves. We can help you to train your staff and provide
-you with support at every stage of the application lifecycle - from
-development and integration through deployment and maintenance. Visit
-the <a href="http://www.jboss.com/services/index">JBoss
-Services</a> page for more
-information.</p>
-
-</BODY>
-</HTML>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html (from rev 2887, branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html)
===================================================================
--- tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html (rev 0)
+++ tags/teiid-parent-7.3.0.Final/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,362 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Teiid ${project.version} Release Notes</TITLE>
+ <META NAME="CHANGEDBY" CONTENT="Steve Hawkins">
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" DIR="LTR">
+<P><A HREF="http://www.teiid.org/"><IMG SRC="https://www.jboss.org/dms/teiid/images/teiid-banner.png" NAME="graphics1" ALT="Teiid" ALIGN=BOTTOM WIDTH=800></A>
+
+<H1>Teiid ${project.version} Release Notes</H1>
+<P>Teiid ${project.version} adds updatable view, performance, and integration features.
+
+<H2>Overview</H2>
+<UL>
+ <LI><A HREF="#Highlights">Highlights</A>
+ <LI><A HREF="#Compatibility">Compatibility Issues</A>
+ <LI><A HREF="#Configuration">Configuration Issues</A>
+ <LI><A HREF="#Other">Other Issues</A>
+ <LI><A HREF="#LibraryUpdates">Thirdparty Library Updates</A>
+ <LI><A HREF="#Details">Detailed Release Notes</A>
+ <LI><A HREF="#Documentation">Additional Docs and Help</A>
+ <LI><A HREF="#Licenses">Licenses</A>
+ <LI><A HREF="#About">About JBoss</A>
+</UL>
+<H2><A NAME="Highlights"></A>Highlights</H2>
+<UL>
+ <LI><B>Subquery Optimization</B> - added rewrite to INNER JOIN for applicable WHERE clause subqueries. Also added cost based SEMI and ANTI-SEMI join handling for applicable non-pushed WHERE and HAVING subqueries.
+ <LI><B>Updatable Views</B>
+ <UL>
+ <LI>Added support to perform simple pass-through and more complicated updates through views by default.
+ <LI>Added support for "FOR EACH ROW" update procedure handling (similar to INSTEAD OF triggers in other DBMS's), which should be used instead of the deprecated TRANSLATE criteria approach.
+ </UL>
+ <LI><B>Temp table enhancements</B> - added support for the SERIAL datatype, which is a not null INTEGER that auto-increments, and the ability to specify a column as NOT NULL.
+ <LI><B>UDF</B> - new API objects added to teiid-api to support user defined functions that are capable of pushdown to source.
+ <LI><B>Unescape Function</B> - a new system function, unescape, was added to handle common \ escaping in strings including octal, hex/unicode, \b, \r, \n, \f, and \t.
+ <LI><B>Predicate Optimization</B> - expanded optimizations for detecting always false conditions when using IS NULL, IN, or comparison predicates with literal values.
+ <LI><B>Partition-wise Optimizations</B> - Views defined by partitioned unions (union alls where each branch has a projected literal or an IN predicate that makes its values mutually exclusive from the other branches) can
+ be used in aggregation or joins and the optimizer will take advantage of the partitioning information. For example, when a partitioned union is joined against another partitioned union, the optimizer will reorganize the join of unions into a union of joins.
+ <LI><B>Delegate Translator</B> - A new translator base class was added that is capable of delegating all the calls to another configured translator.
+ <LI><B>JDBC Reauthentication</B> - Teiid connections (defined by the org.teiid.jdbc.TeiidConnection interface) now support the changeUser method to reauthenticate a given connection.
+ <LI><B>Lob Caching</B> - Lobs are allowed to cache to disk as part of ResultSet caching. Distributed lob caching is not allowed.
+</UL>
+
+<h2><a name="Compatibility">Compatibility Issues</a></h2>
+<ul>
+ <li>TRANSLATE/HAS CRITERIA has been deprecated. An alternative approach to update procedures will be introduced in a subsequent version.
+ <li>Support for named parameter syntax using param=value has been deprecated, since it is ambiguous with a comparison predicate boolean value expression. param<b>=></b>value should be used instead.
+</ul>
+<h4>from 7.2</h4>
+<ul>
+ <li>The default JDBC credentials are user/user - not admin/teiid
+ <li>Unordered limits are no longer pushed through conditions, dup removal, or UNION not all. This prevents the possibility of getting less results than the logical intent of the limit.
+</ul>
+<h4>from 7.1</h4>
+<ul>
+ <li>Subqueries are no longer allowed to be SELECT INTO.
+ <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "UPDATE ...; SELECT VARIABLES.ROWCOUNT;".
+ <li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
+ SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
+ <li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
+ <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
+ <li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
+ <li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
+ <li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
+ <li>The use of VARIABLES.ROWCOUNT is now reserved.
+ <li>Exec statements of the form "var = EXEC foo()" are only valid if the procedure foo has a return parameter.
+ <li>Cache hint now supports "scope" definition. For ex: /* cache(scope:user) */ select * from T1; This hint will override the computed scope based on the query.
+</ul>
+<h4>from 7.0</h4>
+<ul>
+ <li>The term data policy was replaced with data role. The AdminAPI methods for adding role mappings have changed from addRoleToDataPolicy and removeRoleFromDataPolicy to addDataRoleMapping and removeDataRoleMapping respectively.
+</ul>
+<h4>from 6.2</h4>
+<ul>
+ <li>The connector API has changed substantially. Custom connectors need to be retargeted to the new Translator API. See <a href="https://jira.jboss.org/browse/TEIID-1003">TEIID-1003</a> and the <a href="teiid-docs/teiid_developers_guide.pdf">Developer's Guide</a> for more information.
+ <li>Connector bindings are no longer valid. Use the Designer Tooling or see the AdminShell download for a migration utility.
+ <li>Calling out to web services and xml processing has been dramatically simplified and improved, but is a breaking change from prior releases.
+ XML/Relational processing has been replaced by XMLTABLE, retrieving XML from file has been replaced by the File Translator/Resource Adapter, and
+ web service calls have been replaced by the WS Translator/Resource Adapter. See <a href="https://jira.jboss.org/browse/TEIID-1118">TEIID-1118</a>, <a href="https://jira.jboss.org/browse/TEIID-1114">TEIID-1114</a>, and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>The direct usage of XQuery has been replaced with the XMLQuery function.
+ <li>The text connector file processing has been replaced with the TEXTTABLE function. See <a href="https://jira.jboss.org/browse/TEIID-1102">TEIID-1102</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information
+ <li>Double quoted values are now parsed as identifiers by default. See <a href="https://jira.jboss.org/browse/TEIID-145">TEIID-145</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>The system information schema has changed from System to SYS. The tables and table structures have also changed. See <a href="https://jira.jboss.org/browse/TEIID-871">TEIID-871</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>Client control over query plans has changed. OPTION PLANONLY, DEBUG, and SHOWPLAN are no longer allowed. This behavior should not be controlled by the SET statement, SET SHOWPLAN (ON|OFF|DEBUG) and SET NOEXEC (ON|OFF). Usage of the client PlanNode class will also need to be updated.
+ <li>Teiid specific JDBC client interfaces and methods have changed. In general these custom features have mostly been moved to other more standard locations or been removed. See <a href="https://jira.jboss.org/browse/TEIID-1020">TEIID-1020</a> and the <a href="teiid-docs/teiid_client_developers_guide.pdf">Client Developers</a> guide for more information.
+ <li>Teiid's reserved words have changed. Many of the Teiid specific reserved words have become non-reserved words. All of SQL Foundation and SQL/MED 2003, and SQL/XML from SQL 2006 reserved words have been added as reserved words. It is generally required to double quote all reserved words. It is advisable to double quote all non-reserved words as well. The use of the INPUT qualifier for procedure inputs has been deprecated in favor of INPUTS. The use of the USING qualifier for dynamic SQL inputs has been deprecated in favor of DVARS.
+ <li>The AdminApi has been redesigned for use with the new Translator/JCA split and for deployment in JBoss AS.
+ <li>The AdminShell is based on Groovy. Most BeanShell syntax is also valid in Groovy, but there are extensive changes in the AdminAPI that may necessitate rewriting scripts.
+ <li>OPTION NO CACHE <table list> will now only by-pass cache for the given tables at their immediate view layer. Previously all caches would have transitively been skipped. See <a href="https://jira.jboss.org/browse/TEIID-900">TEIID-900</a> for more information.
+ <li>Nan and +-Infinity are no longer allowed as numerical results by default. This may be changed via the system property org.teiid.allowNanInfinity.
+ <li>The scale of BigDecimal values is now adjusted to allow for more intuitive results. Conversion from floating numeric types will preserve the approximate scale and division results will allow for additional scale. See <a href="https://jira.jboss.org/browse/TEIID-159">TEIID-159</a> for more information.
+ <li>The 7.0 client is not compatible with 6.x or vice versa. It is expected that 7.0 clients will be compatible with 7.x releases for standard JDBC operations.
+</ul>
+
+<h2><a name="Configuration">Configuration Issues</a></h2>
+
+See the <a href="teiid-docs/teiid_admin_guide.pdf">Admin Guide</a> for more on configuration and installation.
+
+<h4>from 7.2</h4>
+<ul>
+ <LI>Temporary tables can now be restricted by data roles. Use the data-role attribute allow-create-temporary-tables to explicitly enable or disable the usage of temporary tables.
+There is also a allowCreateTemporaryTablesByDefault property in the teiid-jboss-beans.xml to control whether usage is allowed by default. For compatibility with prior 7.x releases, the default is to allow
+temporary table access.
+</ul>
+
+<h4>from 7.1</h4>
+<ul>
+ <li>Teiid clients now allow the usage of anonymous SSL by default.
+ This changes allows the admin port (default 31443) to use anonymous SSL by default, rather than just securing login traffic.
+ Admin clients should therefore use the mms protocol instead of mm. This will encrypt all admin traffic and ensure that any passwords in configuration files will
+ be encrypted in transit. See the Admin Guide to upgrade from anonymous SSL to 1-way or 2-way authentication.
+ The config properties sslEnabled and clientEncryptionEnabled for SSLConfiguration beans have been combined to a single property mode, that can have the values disabled|login|enabled.
+ <li>Apache CXF is now expected to be used as the web services stack provider through JBossWS-CXF. See the Admin Guide for instructions on
+ installing CXF for use with Teiid's Salesforce and web service connectors. The WS Resource Adapter's -ds.xml files should no longer use
+ WSSecurityConfigURL and WSSecurityConfigName, rather they should be ConfigFile and ConfigName respectively. The property values should no longer
+ refer to jboss-wsse-client.xml, but instead they should reference a CXF Spring configuration file and particular port configuration. See the Admin Guide
+ for more on using CXF configuration files.
+ <li>The default for data role checking is now "true". However only VDBs with data roles will have roles enforced.
+ <li>The default prepared plan cache size was increased to 512, since it is targeted by internal plans as well.
+</ul>
+
+<h4>from 7.0</h4>
+<ul>
+ <li>The property to enable data roles in teiid-jboss-beans.xml has changed from useEntitlements to useDataRoles.
+ <li>Rar file names no longer contain version numbers. -ds.xml files should be updated from connector-XXX-version.rar to teiid-connector-XXX.rar
+ <li>Code table relate configuration properties have been removed. Code tables are now implemented as materialized views.
+</ul>
+
+<h4>from 6.2</h4>
+<ul>
+ <li>A JBoss AS instance is now required. Embedded mode is also currently not supported.</li>
+ <li>Engine configuration is now handled through the admin console or deploy/teiid/teiid-jboss-beans.xml
+ <li>Logging is now done through the container's log4j instance. Any Teiid specific logging changes, see the conf/jboss-teiid-log4j.xml, need to be incorporated into the master jboss-log4j.xml.
+</ul>
+
+<h2><a name="Other">Other Issues</a></h2>
+<ul>
+ <li>For compatibility with the 7.0 release if a stored procedure parameter list begins with identifier=, then it will be parsed as a named parameter invocation even if the intent was to use a comparison predicate
+ as the first parameter value. The workaround is to use nesting parens, e.g. call proc((identifier=value), ...), which clarifies that this is positional value. This workaround will not be needed in later releases.
+</ul>
+<h4>from 7.0</h4>
+<ul>
+ <li>Fixed xsd type handling for SQL/XML and XML document models. xsd:date, xsd:dateTime, and xsd:time types will now all be displayed using the GMT timezone (Z). SQL types, such as timestamp, used for an XMLTABLE column will now expect their values to be in the form of the corresponding xsd type.
+</ul>
+<h4>From 6.2</h4>
+<ul>
+ <li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
+ <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
+ the parseTime function cannot be pushed down. This should be addressed in future releases.
+</ul>
+
+<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
+
+The following components have been updated:
+<h4>From 7.1</h4>
+<ul>
+ <li>json-simple 1.1 was added.
+ <li>Netty was upgraded to 3.2.1
+</ul>
+<h4>From 7.0</h4>
+<ul>
+ <li>Direct integration of JBossCache jars was removed.
+ <li>Netty was upgraded to 3.2.0
+ <li>JDOM was removed.
+</ul>
+<h4>From 6.2</h4>
+<ul>
+ <li>Netty was upgraded to 3.1.5
+ <li>Saxon was upgraded to 9.1.0.8
+ <li>A 5.1 container's version of Arjuna is newer than what was previously included in Teiid 6.x.
+ <li>Various other dependencies have been removed as they are no longer needed or now provided by the container.
+</ul>
+
+<h2><a name="Details">Detailed Release Notes</a></h2>
+ Detailed Release Notes - Teiid - Version ${project.version}
+
+<h2> Bug
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-89'>TEIID-89</a>] - Data roles should account for the ability to create temp tables
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1350'>TEIID-1350</a>] - Teiid 7.2 in JBoss EAP cluster (with clustered cache on) will not deploy VDBs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1357'>TEIID-1357</a>] - Provide an example of an ODBC ds file to be used with a JDBC-ODBC bridge connection
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1360'>TEIID-1360</a>] - with clause not processed in views
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1361'>TEIID-1361</a>] - Salesforce IN predicate handling
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1362'>TEIID-1362</a>] - salesforce push down queries won't get resolved correctly
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1370'>TEIID-1370</a>] - Error Code:107 Message:'The column prefix 'custsale' does not match with a table name or alias name used in the query - But query is valid
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1372'>TEIID-1372</a>] - Change the default Teiid user from "admin" to something else
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1373'>TEIID-1373</a>] - Document that 'OID' column in the system tables is not durable across different versions of the same VDB.
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1381'>TEIID-1381</a>] - pushdown validation not accurate for all update
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1387'>TEIID-1387</a>] - Restrict access of default port 31000 to JDBC and 31443 to Admin connections
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1390'>TEIID-1390</a>] - Partial multi-byte char values misread in InputStreamReader
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1391'>TEIID-1391</a>] - Changes to the use of SSL when connecting with the Teiid Driver are ignored after a successful connection
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1395'>TEIID-1395</a>] - XMLPARSE error message references XMLSERIALIZE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1396'>TEIID-1396</a>] - XML_PLAN output to server log too verbose for DEBUG level logging
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1399'>TEIID-1399</a>] - Adding ORDER BY to SELECT COUNT(*) FROM ... returns org.teiid.core.TeiidProcessingException: null to client - Needs clearer message
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1401'>TEIID-1401</a>] - QueryRewriter issue with certain UDFs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1402'>TEIID-1402</a>] - SELECTing data from salesforce with a WHERE condition which includes ID results in a NPE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1404'>TEIID-1404</a>] - The teiid runtime jar overrides commons logging configuration
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1406'>TEIID-1406</a>] - Salesforce connector does not parse {ts'2003-03-11 11:42:10.5'} - gets mismatched character ' ' expecting ':'
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1407'>TEIID-1407</a>] - Client code fails while inserting "lobs" in few situations
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1408'>TEIID-1408</a>] - SalesForce.com - Unable to get managed connection - java.lang.NullPointerException
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1410'>TEIID-1410</a>] - MALFORMED Query when trying to execute a query with OUTER JOINs which only contains elements from JOINed source
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1411'>TEIID-1411</a>] - Incorrect IN behavior when using a SELECT clause as IN values
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1414'>TEIID-1414</a>] - Execution of a Prepared Statement may receive LanguageBridgeFactory AssertionError
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1416'>TEIID-1416</a>] - Admin console shows no information about sessions
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1418'>TEIID-1418</a>] - Metadata loaded incorrectly
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1420'>TEIID-1420</a>] - Adminshell getTransactions() fails - exception = org.teiid.adminapi.AdminComponentException:
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1422'>TEIID-1422</a>] - Limit pushing can result in inconsistent xml results
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1426'>TEIID-1426</a>] - NPE when SELECTing NULL columns from JOINed tables
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1427'>TEIID-1427</a>] - Class not found in Teiid JON agent
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1428'>TEIID-1428</a>] - ODBC connection fails if the TeiidDriver is not registered.
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1434'>TEIID-1434</a>] - Example dynamicvdb-portfolio customer-schema.sql INSERT INTO HOLDINGS has PRODUCT_ID references that don't exist in PRODUCT table causing sql to fail
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1435'>TEIID-1435</a>] - SQL type boolean imported as object for dynamic vdbs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1439'>TEIID-1439</a>] - Adminshell/API - sequence of datasource creation/VDB deployment and queries results in deployment error
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1441'>TEIID-1441</a>] - java.lang.NullPointerException - on queries involving lookup (temp table cache does not have buffermanager set on it)
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1442'>TEIID-1442</a>] - clearCache("QUERY_SERVICE_RESULT_SET_CACHE") - in ER7 - totalEntries is not reset to zero
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1443'>TEIID-1443</a>] - SalesForce connector execution of procedure fails with NPE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1444'>TEIID-1444</a>] - Jopr Plugin has description for refreshing Materialized Views that's awkward: "Refresh a given any Materialized View for this VDB"
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1445'>TEIID-1445</a>] - ConcurrentModificationException during the startup of the Server
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1446'>TEIID-1446</a>] - Error during startup when CXF is installed
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1451'>TEIID-1451</a>] - Teiid does not handle failover correctly
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1456'>TEIID-1456</a>] - Processing errors after the first batch has been returned may not be reported
+</li>
+</ul>
+
+<h2> Feature Request
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-146'>TEIID-146</a>] - Translate Criteria enhancement
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-192'>TEIID-192</a>] - Add the ability to switch the identity on connections
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-211'>TEIID-211</a>] - subquery optimization
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-229'>TEIID-229</a>] - Support update of the view column using a column
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-231'>TEIID-231</a>] - Ability to support Connector Level UDF functions in the System
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1227'>TEIID-1227</a>] - Lob values should be cachable
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1253'>TEIID-1253</a>] - Allow for cache scope to be set in the cache hint
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1267'>TEIID-1267</a>] - Add support for non-pushdown subquery evaluation on update statements
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1330'>TEIID-1330</a>] - API request: Delegating Translator
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1338'>TEIID-1338</a>] - Add transitive join conditions across sources
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1349'>TEIID-1349</a>] - Better default update procedure handling
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1351'>TEIID-1351</a>] - Replace translate criteria
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1376'>TEIID-1376</a>] - Add support for pushing joins through a union
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1385'>TEIID-1385</a>] - Add a way to support escaped strings
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1389'>TEIID-1389</a>] - Add additional detection for conflicting criteria to help optimize query plan
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1412'>TEIID-1412</a>] - Teiid should take care of salesforce query limits by itself
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1421'>TEIID-1421</a>] - Support better scrolling of cached results
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1433'>TEIID-1433</a>] - Temp tables should support count(*)
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1440'>TEIID-1440</a>] - Add support for not null and auto increment for temp table columns
+</li>
+</ul>
+
+<h2> Quality Risk
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1368'>TEIID-1368</a>] - "Each" should be a parser keyword
+</li>
+</ul>
+
+
+<h2><a name="Documentation">Documentation and Help</a></h2>
+
+The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.
+Documentation and help may be obtained from the local distribution under <a href="teiid-docs">teiid-docs</a> or the following locations.
+<ul>
+
+<li><a href="http://www.jboss.org/teiid/docs">Online Documentation</a></li>
+<li><a href="https://community.jboss.org/wiki/TheTeiidProject">Wiki</a></li>
+<li><a href="http://jira.jboss.org/jira/browse/TEIID">JIRA</a></li>
+<li><a href="http://community.jboss.org/en/teiid?view=discussions">Forums</a></li>
+</ul>
+
+
+<h2><a name="Licenses">Licenses</a></h2>
+
+<p>Teiid is licensed under the <a href="LICENSE-lgpl-2.1.txt">LGPL</a>. The
+license texts for Teiid and the thirdparty components it uses may be found in the teiid-docs/licenses
+directory of the distribution. <a href="teiid-docs/licenses">Browse
+Licenses</a>
+
+</p>
+
+<h2><a name="About">About JBoss, a
+division of Red Hat</a></h2>
+
+<p>JBoss, a division of <a href="http://www.redhat.com/jboss/">Red
+Hat</a>, is in the business of
+providing
+superior technical support to our customers. Our goal is to make
+Professional Open Source™ the <b>SAFE
+CHOICE</b>
+for you. We accomplish this by backing up our open source Java products
+with technical support services that are delivered by the core
+developers themselves. We can help you to train your staff and provide
+you with support at every stage of the application lifecycle - from
+development and integration through deployment and maintenance. Visit
+the <a href="http://www.jboss.com/services/index">JBoss
+Services</a> page for more
+information.</p>
+
+</BODY>
+</HTML>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/build/pom.xml
===================================================================
--- branches/7.3.x/build/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/build/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,93 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid</artifactId>
- <name>Build</name>
- <description>Teiid Build</description>
- <build>
- <outputDirectory>target/kits</outputDirectory>
- <resources>
- <resource>
- <directory>kits</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- <include>**/*.sh</include>
- <include>**/*.bat</include>
- <include>**/*.html</include>
- </includes>
- </resource>
- <resource>
- <directory>kits</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- <exclude>**/*.sh</exclude>
- <exclude>**/*.bat</exclude>
- <exclude>**/*.html</exclude>
- </excludes>
- </resource>
- </resources>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
-
- <configuration>
- <descriptors>
- <descriptor>assembly/client-jar.xml</descriptor>
- <descriptor>assembly/jboss-container/dist.xml</descriptor>
- <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
- </descriptors>
- </configuration>
-
- <executions>
- <execution>
- <id>create-assemblies</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <!--
- This profile is activated manually, as in "mvn ... -P release ..."
- -->
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>assembly/src.xml</descriptor>
- <descriptor>assembly/docs.xml</descriptor>
- <descriptor>assembly/client-jar.xml</descriptor>
- <descriptor>assembly/jboss-container/dist.xml</descriptor>
- <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/build/pom.xml (from rev 2888, branches/7.3.x/build/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/build/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/build/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid</artifactId>
+ <name>Build</name>
+ <description>Teiid Build</description>
+ <build>
+ <outputDirectory>target/kits</outputDirectory>
+ <resources>
+ <resource>
+ <directory>kits</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ <include>**/*.sh</include>
+ <include>**/*.bat</include>
+ <include>**/*.html</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>kits</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ <exclude>**/*.sh</exclude>
+ <exclude>**/*.bat</exclude>
+ <exclude>**/*.html</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/client-jar.xml</descriptor>
+ <descriptor>assembly/jboss-container/dist.xml</descriptor>
+ <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>create-assemblies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/src.xml</descriptor>
+ <descriptor>assembly/docs.xml</descriptor>
+ <descriptor>assembly/client-jar.xml</descriptor>
+ <descriptor>assembly/jboss-container/dist.xml</descriptor>
+ <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml
===================================================================
--- branches/7.3.x/cache-jbosscache/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-cache-jbosscache</artifactId>
- <name>JBoss Cache</name>
- <description>JBossCache provider.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml (from rev 2888, branches/7.3.x/cache-jbosscache/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <name>JBoss Cache</name>
+ <description>JBossCache provider.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import java.io.Serializable;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.Cache.Type;
-import org.teiid.core.TeiidRuntimeException;
-
-public class ClusterableCacheFactory implements CacheFactory, Serializable {
- private static final long serialVersionUID = -1992994494154581234L;
- private CacheFactory delegate;
- private String resultsetCacheName;
- private boolean enabled = false;
- private String cacheManagerName;
-
- @Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
- if (this.delegate == null) {
- Object cacheManager = getClusteredCache();
- if (cacheManager == null) {
- this.delegate = new DefaultCacheFactory(config);
- }
- else {
- try {
- this.delegate = new JBossCacheFactory(this.resultsetCacheName, cacheManager);
- } catch (Exception e) {
- throw new TeiidRuntimeException("Failed to obtain the clusted cache"); //$NON-NLS-1$
- }
- }
- }
- return delegate.get(type, config);
- }
-
- public void setResultsetCacheName(String name) {
- this.resultsetCacheName = name;
- }
-
- @Override
- public void destroy() {
- if (this.delegate != null) {
- this.delegate.destroy();
- }
- }
-
- private Object getClusteredCache() {
- if (this.enabled && this.cacheManagerName != null) {
- try {
- Context ctx = new InitialContext();
- return ctx.lookup(this.cacheManagerName);
- } catch (NamingException e) {
- return null;
- }
- }
- return null;
- }
-
- public void setEnabled(boolean value) {
- this.enabled = value;
- }
-
- public void setCacheManager(String mgrName) {
- this.cacheManagerName = mgrName;
- }
-
- @Override
- public boolean isReplicated() {
- if (delegate == null) {
- return false;
- }
- return delegate.isReplicated();
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java (from rev 2886, branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,99 @@
+/*
+ * 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.cache.jboss;
+
+import java.io.Serializable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.core.TeiidRuntimeException;
+
+public class ClusterableCacheFactory implements CacheFactory, Serializable {
+ private static final long serialVersionUID = -1992994494154581234L;
+ private CacheFactory delegate;
+ private String resultsetCacheName;
+ private boolean enabled = false;
+ private String cacheManagerName;
+
+ @Override
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
+ if (this.delegate == null) {
+ Object cacheManager = getClusteredCache();
+ if (cacheManager == null) {
+ this.delegate = new DefaultCacheFactory(config);
+ }
+ else {
+ try {
+ this.delegate = new JBossCacheFactory(this.resultsetCacheName, cacheManager);
+ } catch (Exception e) {
+ throw new TeiidRuntimeException("Failed to obtain the clusted cache"); //$NON-NLS-1$
+ }
+ }
+ }
+ return delegate.get(location, config);
+ }
+
+ public void setResultsetCacheName(String name) {
+ this.resultsetCacheName = name;
+ }
+
+ @Override
+ public void destroy() {
+ if (this.delegate != null) {
+ this.delegate.destroy();
+ }
+ }
+
+ private Object getClusteredCache() {
+ if (this.enabled && this.cacheManagerName != null) {
+ try {
+ Context ctx = new InitialContext();
+ return ctx.lookup(this.cacheManagerName);
+ } catch (NamingException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public void setEnabled(boolean value) {
+ this.enabled = value;
+ }
+
+ public void setCacheManager(String mgrName) {
+ this.cacheManagerName = mgrName;
+ }
+
+ @Override
+ public boolean isReplicated() {
+ if (delegate == null) {
+ return false;
+ }
+ return delegate.isReplicated();
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache.jboss;
-
-import java.io.Serializable;
-
-import org.jboss.cache.CacheManager;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.Region;
-import org.jboss.cache.config.EvictionAlgorithmConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-import org.jboss.cache.eviction.LRUAlgorithmConfig;
-import org.jboss.cache.eviction.RemoveOnEvictActionPolicy;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.Cache.Type;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.core.TeiidRuntimeException;
-
-
-public class JBossCacheFactory implements CacheFactory, Serializable{
- private static final long serialVersionUID = -2767452034178675653L;
- private transient org.jboss.cache.Cache cacheStore;
- private volatile boolean destroyed = false;
-
-
- public JBossCacheFactory(String name, Object cm) throws Exception {
- CacheManager cachemanager = (CacheManager)cm;
- this.cacheStore = cachemanager.getCache(name, true);
- }
-
- /**
- * {@inheritDoc}
- */
- public Cache get(Type type, CacheConfiguration config) {
- if (!destroyed) {
-
- if (!this.cacheStore.getCacheStatus().allowInvocations()) {
- this.cacheStore.start();
- }
-
- Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
- Node node = cacheRoot.addChild(Fqn.fromString(type.location()));
- node.setResident(true);
-
- Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
- cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
-
- JBossCache jc = null;
- if (config != null && config.getPolicy().equals(Policy.EXPIRATION)) {
- jc = new ExpirationAwareCache(this.cacheStore, node.getFqn());
- }
- else {
- jc = new JBossCache(this.cacheStore, node.getFqn());
- }
-
- jc.setCacheConfiguration(config);
- return jc;
- }
- throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
- }
-
- private EvictionRegionConfig buildEvictionConfig(Fqn rootFqn, CacheConfiguration config) {
- EvictionAlgorithmConfig evictionConfig = null;
-
- if (config.getPolicy() == Policy.LRU) {
- LRUAlgorithmConfig lru = new LRUAlgorithmConfig();
- lru.setMaxNodes(config.getMaxEntries());
- lru.setMaxAge(config.getMaxAgeInSeconds()*1000);
- lru.setTimeToLive(-1); // -1 no limit
- evictionConfig = lru;
- }
- else if (config.getPolicy() == Policy.EXPIRATION) {
- ExpirationAlgorithmConfig lfu = new ExpirationAlgorithmConfig();
- lfu.setMaxNodes(config.getMaxEntries());
- evictionConfig = lfu;
- }
-
- EvictionRegionConfig erc = new EvictionRegionConfig(rootFqn, evictionConfig);
- erc.setEvictionActionPolicyClassName(RemoveOnEvictActionPolicy.class.getName());
- return erc;
- }
-
- public void destroy() {
- this.destroyed = true;
- }
-
- // this will be called by microcontainer.
- public void stop() {
- destroy();
- }
-
- @Override
- public boolean isReplicated() {
- return true;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java (from rev 2886, branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,119 @@
+/*
+ * 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.cache.jboss;
+
+import java.io.Serializable;
+
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.Region;
+import org.jboss.cache.config.EvictionAlgorithmConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+import org.jboss.cache.eviction.LRUAlgorithmConfig;
+import org.jboss.cache.eviction.RemoveOnEvictActionPolicy;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.core.TeiidRuntimeException;
+
+
+public class JBossCacheFactory implements CacheFactory, Serializable{
+ private static final long serialVersionUID = -2767452034178675653L;
+ private transient org.jboss.cache.Cache cacheStore;
+ private volatile boolean destroyed = false;
+
+
+ public JBossCacheFactory(String name, Object cm) throws Exception {
+ CacheManager cachemanager = (CacheManager)cm;
+ this.cacheStore = cachemanager.getCache(name, true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Cache get(String location, CacheConfiguration config) {
+ if (!destroyed) {
+
+ if (!this.cacheStore.getCacheStatus().allowInvocations()) {
+ this.cacheStore.start();
+ }
+
+ Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
+ Node node = cacheRoot.addChild(Fqn.fromString(location));
+ node.setResident(true);
+
+ Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
+ cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
+
+ JBossCache jc = null;
+ if (config != null && config.getPolicy().equals(Policy.EXPIRATION)) {
+ jc = new ExpirationAwareCache(this.cacheStore, node.getFqn());
+ }
+ else {
+ jc = new JBossCache(this.cacheStore, node.getFqn());
+ }
+
+ jc.setCacheConfiguration(config);
+ return jc;
+ }
+ throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
+ }
+
+ private EvictionRegionConfig buildEvictionConfig(Fqn rootFqn, CacheConfiguration config) {
+ EvictionAlgorithmConfig evictionConfig = null;
+
+ if (config.getPolicy() == Policy.LRU) {
+ LRUAlgorithmConfig lru = new LRUAlgorithmConfig();
+ lru.setMaxNodes(config.getMaxEntries());
+ lru.setMaxAge(config.getMaxAgeInSeconds()*1000);
+ lru.setTimeToLive(-1); // -1 no limit
+ evictionConfig = lru;
+ }
+ else if (config.getPolicy() == Policy.EXPIRATION) {
+ ExpirationAlgorithmConfig lfu = new ExpirationAlgorithmConfig();
+ lfu.setMaxNodes(config.getMaxEntries());
+ evictionConfig = lfu;
+ }
+
+ EvictionRegionConfig erc = new EvictionRegionConfig(rootFqn, evictionConfig);
+ erc.setEvictionActionPolicyClassName(RemoveOnEvictActionPolicy.class.getName());
+ return erc;
+ }
+
+ public void destroy() {
+ this.destroyed = true;
+ }
+
+ // this will be called by microcontainer.
+ public void stop() {
+ destroy();
+ }
+
+ @Override
+ public boolean isReplicated() {
+ return true;
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/client/pom.xml
===================================================================
--- branches/7.3.x/client/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-client</artifactId>
- <name>Client</name>
- <description>Contains the packages related to communication, administrative api,
- sessioning and transport level messaging.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/client/pom.xml (from rev 2888, branches/7.3.x/client/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-client</artifactId>
+ <name>Client</name>
+ <description>Contains the packages related to communication, administrative api,
+ sessioning and transport level messaging.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,325 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
-
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "", propOrder = {
- "description",
- "JAXBProperties",
- "sources",
- "errors"
-})
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
-public class ModelMetaData extends AdminObjectImpl implements Model {
-
- private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
- private static final long serialVersionUID = 3714234763056162230L;
-
- @XmlElement(name = "source")
- protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap<SourceMappingMetadata>(new KeyBuilder<SourceMappingMetadata>() {
- private static final long serialVersionUID = 2273673984691112369L;
-
- @Override
- public String getKey(SourceMappingMetadata entry) {
- return entry.getName();
- }
- });
-
- @XmlAttribute(name = "type")
- protected String modelType = Type.PHYSICAL.name();
-
- @XmlElement(name = "description")
- protected String description;
-
- @XmlAttribute(name = "path")
- protected String path;
-
- @XmlAttribute(name = "visible")
- protected Boolean visible = true;
-
- @XmlElement(name = "validation-error")
- protected List<ValidationError> errors;
-
- @ManagementProperty(description="Model Name")
- @XmlAttribute(name = "name", required = true)
- @ManagementObjectID(type="models")
- public String getName() {
- return super.getName();
- }
-
- // This is needed by JAXB
- public void setName(String name) {
- super.setName(name);
- }
-
- @Override
- @ManagementProperty(description = "Model description")
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- @ManagementProperty(description = "Is Model Source model")
- public boolean isSource() {
- return getModelType() == Model.Type.PHYSICAL;
- }
-
- @Override
- @ManagementProperty(description = "Is Model Visible")
- public boolean isVisible() {
- return this.visible;
- }
-
- @Override
- @ManagementProperty(description = "Model Type")
- public Type getModelType() {
- try {
- return Type.valueOf(modelType.toUpperCase());
- } catch(IllegalArgumentException e) {
- return Type.OTHER;
- }
- }
-
- @ManagementProperty(description = "Path to model file inside the archive")
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- @Override
- @ManagementProperty(description = "Does Model supports multi-source bindings")
- public boolean isSupportsMultiSourceBindings() {
- String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
- return Boolean.parseBoolean(supports);
- }
-
- @Override
- @XmlElement(name = "property", type = PropertyMetadata.class)
- @ManagementProperty(description = "Model Properties", managed=true)
- public List<PropertyMetadata> getJAXBProperties(){
- return super.getJAXBProperties();
- }
-
- public void setSupportsMultiSourceBindings(boolean supports) {
- addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
- }
-
- public void setModelType(Model.Type modelType) {
- this.modelType = modelType.name();
- }
-
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
- public String toString() {
- return getName() + this.sources;
- }
-
- public void setVisible(Boolean value) {
- this.visible = value;
- }
-
- @ManagementProperty(description = "Source Mappings (defined by user)", managed=true)
- public List<SourceMappingMetadata> getSourceMappings(){
- return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
- }
-
- public void setSourceMappings(List<SourceMappingMetadata> sources){
- for (SourceMappingMetadata source: sources) {
- addSourceMapping(source.getName(), source.getTranslatorName(), source.getConnectionJndiName());
- }
- }
-
- @Override
- public List<String> getSourceNames() {
- return new ArrayList<String>(this.sources.getMap().keySet());
- }
-
- @Override
- public String getSourceConnectionJndiName(String sourceName) {
- SourceMappingMetadata s = this.sources.getMap().get(sourceName);
- if (s == null) {
- return null;
- }
- return s.getConnectionJndiName();
- }
-
- @Override
- public String getSourceTranslatorName(String sourceName) {
- SourceMappingMetadata s = this.sources.getMap().get(sourceName);
- if (s == null) {
- return null;
- }
- return s.getTranslatorName();
- }
-
- public void addSourceMapping(String name, String translatorName, String connJndiName) {
- this.sources.getMap().put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
- }
-
- @ManagementProperty(description = "Model Validity Errors", readOnly=true, managed=true)
- public List<ValidationError> getErrors(){
- return getValidationErrors(Severity.ERROR);
- }
-
- public void setErrors(List<ValidationError> errors){
- this.errors = errors;
- }
-
- public List<ValidationError> getValidationErrors(ValidationError.Severity severity){
- if (this.errors == null) {
- return Collections.emptyList();
- }
- List<ValidationError> list = new ArrayList<ValidationError>();
- for (ValidationError ve: this.errors) {
- if (Severity.valueOf(ve.severity) == severity) {
- list.add(ve);
- }
- }
- return list;
- }
-
- public ValidationError addError(String severity, String message) {
- if (this.errors == null) {
- this.errors = new ArrayList<ValidationError>();
- }
- ValidationError ve = new ValidationError(severity, message);
- this.errors.add(ve);
- return ve;
- }
-
- public boolean removeError(ValidationError remove) {
- if (this.errors == null) {
- return false;
- }
- return this.errors.remove(remove);
- }
-
- public void clearErrors() {
- this.errors.clear();
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "", propOrder = {
- "value"
- })
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
- public static class ValidationError implements Serializable{
- private static final long serialVersionUID = 2044197069467559527L;
-
- public enum Severity {ERROR, WARNING};
-
- @XmlValue
- protected String value;
-
- @XmlAttribute(name = "severity", required = true)
- protected String severity;
-
- @XmlAttribute(name = "path")
- protected String path;
-
- public ValidationError() {};
-
- public ValidationError(String severity, String msg) {
- this.severity = severity;
- this.value = msg;
- }
-
- @ManagementProperty (description="Error Message")
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @ManagementProperty (description="Severity")
- public String getSeverity() {
- return severity;
- }
-
- public void setSeverity(String severity) {
- this.severity = severity;
- }
-
- @ManagementProperty (description="Path")
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ValidationError other = (ValidationError) obj;
- if (severity == null) {
- if (other.severity != null)
- return false;
- } else if (!severity.equals(other.severity))
- return false;
- if (value == null) {
- if (other.value != null)
- return false;
- } else if (!value.equals(other.value))
- return false;
- return true;
- }
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (from rev 2886, branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,325 @@
+/*
+ * 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.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
+
+
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "", propOrder = {
+ "description",
+ "JAXBProperties",
+ "sources",
+ "errors"
+})
+(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
+public class ModelMetaData extends AdminObjectImpl implements Model {
+
+ private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
+ private static final long serialVersionUID = 3714234763056162230L;
+
+ @XmlElement(name = "source")
+ protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap<SourceMappingMetadata>(new KeyBuilder<SourceMappingMetadata>() {
+ private static final long serialVersionUID = 2273673984691112369L;
+
+ @Override
+ public String getKey(SourceMappingMetadata entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlAttribute(name = "type")
+ protected String modelType = Type.PHYSICAL.name();
+
+ @XmlElement(name = "description")
+ protected String description;
+
+ @XmlAttribute(name = "path")
+ protected String path;
+
+ @XmlAttribute(name = "visible")
+ protected Boolean visible = true;
+
+ @XmlElement(name = "validation-error")
+ protected List<ValidationError> errors;
+
+ @ManagementProperty(description="Model Name")
+ @XmlAttribute(name = "name", required = true)
+ @ManagementObjectID(type="models")
+ public String getName() {
+ return super.getName();
+ }
+
+ // This is needed by JAXB
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ @Override
+ @ManagementProperty(description = "Model description")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Source model")
+ public boolean isSource() {
+ return getModelType() == Model.Type.PHYSICAL;
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Visible")
+ public boolean isVisible() {
+ return this.visible;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model Type")
+ public Type getModelType() {
+ try {
+ return Type.valueOf(modelType.toUpperCase());
+ } catch(IllegalArgumentException e) {
+ return Type.OTHER;
+ }
+ }
+
+ @ManagementProperty(description = "Path to model file inside the archive")
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ @ManagementProperty(description = "Does Model supports multi-source bindings")
+ public boolean isSupportsMultiSourceBindings() {
+ String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
+ return Boolean.parseBoolean(supports);
+ }
+
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ @ManagementProperty(description = "Model Properties", managed=true)
+ public List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+
+ public void setSupportsMultiSourceBindings(boolean supports) {
+ addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
+ }
+
+ public void setModelType(Model.Type modelType) {
+ this.modelType = modelType.name();
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public String toString() {
+ return getName() + this.sources;
+ }
+
+ public void setVisible(Boolean value) {
+ this.visible = value;
+ }
+
+ @ManagementProperty(description = "Source Mappings (defined by user)", managed=true)
+ public List<SourceMappingMetadata> getSourceMappings(){
+ return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
+ }
+
+ public void setSourceMappings(List<SourceMappingMetadata> sources){
+ for (SourceMappingMetadata source: sources) {
+ addSourceMapping(source.getName(), source.getTranslatorName(), source.getConnectionJndiName());
+ }
+ }
+
+ @Override
+ public List<String> getSourceNames() {
+ return new ArrayList<String>(this.sources.getMap().keySet());
+ }
+
+ @Override
+ public String getSourceConnectionJndiName(String sourceName) {
+ SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ if (s == null) {
+ return null;
+ }
+ return s.getConnectionJndiName();
+ }
+
+ @Override
+ public String getSourceTranslatorName(String sourceName) {
+ SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ if (s == null) {
+ return null;
+ }
+ return s.getTranslatorName();
+ }
+
+ public void addSourceMapping(String name, String translatorName, String connJndiName) {
+ this.sources.getMap().put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
+ }
+
+ @ManagementProperty(description = "Model Validity Errors", readOnly=true, managed=true)
+ public List<ValidationError> getErrors(){
+ return getValidationErrors(Severity.ERROR);
+ }
+
+ public void setErrors(List<ValidationError> errors){
+ this.errors = errors;
+ }
+
+ public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
+ if (this.errors == null) {
+ return Collections.emptyList();
+ }
+ List<ValidationError> list = new ArrayList<ValidationError>();
+ for (ValidationError ve: this.errors) {
+ if (Severity.valueOf(ve.severity) == severity) {
+ list.add(ve);
+ }
+ }
+ return list;
+ }
+
+ public synchronized ValidationError addError(String severity, String message) {
+ if (this.errors == null) {
+ this.errors = new ArrayList<ValidationError>();
+ }
+ ValidationError ve = new ValidationError(severity, message);
+ this.errors.add(ve);
+ return ve;
+ }
+
+ public synchronized boolean removeError(ValidationError remove) {
+ if (this.errors == null) {
+ return false;
+ }
+ return this.errors.remove(remove);
+ }
+
+ public synchronized void clearErrors() {
+ this.errors.clear();
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = {
+ "value"
+ })
+ @ManagementObject(properties=ManagementProperties.EXPLICIT)
+ public static class ValidationError implements Serializable{
+ private static final long serialVersionUID = 2044197069467559527L;
+
+ public enum Severity {ERROR, WARNING};
+
+ @XmlValue
+ protected String value;
+
+ @XmlAttribute(name = "severity", required = true)
+ protected String severity;
+
+ @XmlAttribute(name = "path")
+ protected String path;
+
+ public ValidationError() {};
+
+ public ValidationError(String severity, String msg) {
+ this.severity = severity;
+ this.value = msg;
+ }
+
+ @ManagementProperty (description="Error Message")
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @ManagementProperty (description="Severity")
+ public String getSeverity() {
+ return severity;
+ }
+
+ public void setSeverity(String severity) {
+ this.severity = severity;
+ }
+
+ @ManagementProperty (description="Path")
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ValidationError other = (ValidationError) obj;
+ if (severity == null) {
+ if (other.severity != null)
+ return false;
+ } else if (!severity.equals(other.severity))
+ return false;
+ if (value == null) {
+ if (other.value != null)
+ return false;
+ } else if (!value.equals(other.value))
+ return false;
+ return true;
+ }
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,1750 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
-
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.lob.LobChunkInputStream;
-import org.teiid.client.lob.StreamingLobChunckProducer;
-import org.teiid.client.plan.PlanNode;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.BlobImpl;
-import org.teiid.core.types.BlobType;
-import org.teiid.core.types.ClobImpl;
-import org.teiid.core.types.ClobType;
-import org.teiid.core.types.InputStreamFactory;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.Streamable;
-import org.teiid.core.types.XMLType;
-import org.teiid.core.util.SqlUtil;
-import org.teiid.core.util.TimestampWithTimezone;
-import org.teiid.jdbc.BatchResults.Batch;
-import org.teiid.jdbc.BatchResults.BatchFetcher;
-
-
-/**
- * <p>
- * The MMResultSet is the way query results are returned to the requesting
- * client based upon a query given to the server. This abstract class that
- * implements java.sql.ResultSet. This class represents access to results
- * produced by any of the classes on the driver.
- * </p>
- */
-
-public class ResultSetImpl extends WrapperImpl implements ResultSet, BatchFetcher {
- private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
-
- private static final int BEFORE_FIRST_ROW = 0;
-
- // the object which was last read from Results
- private Object currentValue;
-
- // This object represents metadata for this result set.
- private ResultSetMetaData rmetadata;
- // Statement that causes this results
- private StatementImpl statement;
-
- // Cursor related state
- private int cursorType;
- private boolean isClosed;
-
- // reuse the original request's state
- private long requestID;
- private BatchResults batchResults;
- private int columnCount;
- private int resultColumns;
- private int parameters;
- private TimeZone serverTimeZone;
- private PlanNode updatedPlanDescription;
- private int maxFieldSize;
- private int fetchSize;
-
- /**
- * Constructor.
- *
- * @param resultsMsg
- * @param statement
- * @throws SQLException
- */
- ResultSetImpl(ResultsMessage resultsMsg, StatementImpl statement) throws SQLException {
- this(resultsMsg, statement, null, 0);
- }
-
- ResultSetImpl(ResultsMessage resultsMsg, StatementImpl statement,
- ResultSetMetaData metadata, int parameters) throws SQLException {
- this.statement = statement;
- this.parameters = parameters;
- // server latency-related timestamp
- this.requestID = statement.getCurrentRequestID();
- this.cursorType = statement.getResultSetType();
- this.batchResults = new BatchResults(this, getCurrentBatch(resultsMsg), this.cursorType == ResultSet.TYPE_FORWARD_ONLY ? 1 : BatchResults.DEFAULT_SAVED_BATCHES);
- accumulateWarnings(resultsMsg);
- this.serverTimeZone = statement.getServerTimeZone();
-
- if (metadata == null) {
- MetadataProvider provider = new DeferredMetadataProvider(resultsMsg.getColumnNames(),
- resultsMsg.getDataTypes(), statement,
- statement.getCurrentRequestID());
- rmetadata = new ResultSetMetaDataImpl(provider);
- } else {
- rmetadata = metadata;
- }
- // Cache the column count and isLOB values since every call to getObject uses these.
- this.columnCount = rmetadata.getColumnCount();
-
- this.resultColumns = columnCount - parameters;
- if (this.parameters > 0) {
- rmetadata = new FilteredResultsMetadata(rmetadata, resultColumns);
- }
- this.fetchSize = statement.getFetchSize();
- }
-
- public void setMaxFieldSize(int maxFieldSize) {
- this.maxFieldSize = maxFieldSize;
- }
-
- /**
- * Close this result set.
- */
- public void close() throws SQLException{
- if(!isClosed) {
- // close the the server's statement object (if necessary)
- if(this.requestID >= 0){
- try {
- this.statement.getDQP().closeRequest(requestID);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidComponentException e) {
- throw TeiidSQLException.create(e);
- }
- }
- isClosed = true;
- }
- }
-
- public boolean isClosed() throws SQLException {
- return isClosed;
- }
-
- protected void checkClosed() throws SQLException {
- if (isClosed) {
- String msg = JDBCPlugin.Util
- .getString("MMResultSet.Cant_call_closed_resultset"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- }
-
- /**
- * Return the value for output/return parameter given the index
- * of the parameter in the ResultSet
- * @param index Index of the parameter to be retrieved.
- */
- Object getOutputParamValue(int index) throws SQLException {
- if (index <= resultColumns || index > resultColumns + parameters) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StoredProcedureResultsImpl.Invalid_parameter_index__{0}_2", index)); //$NON-NLS-1$
- }
- // Mark the row we're on
- final int originalRow = getAbsoluteRowNumber();
-
- this.batchResults.absolute(-1);
- try {
- return getObjectDirect(index);
- } finally {
- this.batchResults.absolute(originalRow);
- }
- }
-
- /**
- * <p>Get a java object based on the column index for the current row.</p>
- * @param The index of the column whose value needs to be fetched.
- * @return The value of the column as an object.
- * @throws SQLException if a results access error occurs or transform fails.
- */
- public Object getObject(int column) throws SQLException {
- if (isAfterLast()) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StoredProcedureResultsImpl.ResultSet_cursor_is_after_the_last_row._1")); //$NON-NLS-1$
- }
- // only get the Object of the result set
- if(column > resultColumns){
- throw new TeiidSQLException(JDBCPlugin.Util.getString("ResultsImpl.Invalid_col_index", column)); //$NON-NLS-1$
- }
- return getObjectDirect(column);
- }
-
- public int getFetchSize() throws SQLException {
- return this.fetchSize;
- }
-
- /**
- * Move row pointer forward one row. This may cause the cursor
- * to fetch more rows.
- * @return True if the current index is on a valid row, false if
- * the pointer is past the end of the rows
- * @throws SQLException if this result set has an exception
- */
- public boolean next() throws SQLException {
- checkClosed();
- if (hasNext()) {
- return batchResults.next();
- }
- batchResults.next();
- return false;
- }
-
- /**
- * Move row pointer backward one row. This may cause the cursor
- * to fetch more rows.
- * @return True if the current index is on a valid row, false if
- * the pointer is before the beginning of the rows
- * @throws SQLException if this result set has an exception
- */
- public boolean previous() throws SQLException {
- checkClosed();
- checkNotForwardOnly();
- return batchResults.previous();
- }
-
- /**
- * Get current row pointer.
- * @return Index of current row
- * @throws SQLException if this result set has an exception
- */
- public int getRow() throws SQLException {
- checkClosed();
- if (isAfterLast()) {
- return 0;
- }
- return getAbsoluteRowNumber();
- }
-
- /**
- * Get the value of the current row at the column index specified.
- * @param column Column index
- * @return Value at column, which may be null
- * @throws SQLException if this result set has an exception
- */
- public Object getObjectDirect(int column) throws SQLException {
- checkClosed();
- if(column < 1 || column > columnCount) {
- throw new IllegalArgumentException(JDBCPlugin.Util.getString("ResultsImpl.Invalid_col_index", column)); //$NON-NLS-1$
- }
- List cursorRow = batchResults.getCurrentRow();
-
- if (cursorRow == null) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("ResultsImpl.The_cursor_is_not_on_a_valid_row._1")); //$NON-NLS-1$
- }
-
- // defect 13539 - set the currentValue (defined in MMResultSet) so that wasNull() accurately returns whether this value was null
- currentValue = cursorRow.get(column-1);
-
- if (currentValue instanceof Streamable<?>) {
- if (Boolean.getBoolean(Streamable.FORCE_STREAMING)) {
- Object reference = ((Streamable<?>)currentValue).getReference();
- if (reference != null) {
- currentValue = reference;
- return currentValue;
- }
- }
- if(currentValue instanceof ClobType){
- currentValue = new ClobImpl(createInputStreamFactory((ClobType)currentValue), ((ClobType)currentValue).getLength());
- }
- else if (currentValue instanceof BlobType) {
- InputStreamFactory isf = createInputStreamFactory((BlobType)currentValue);
- isf.setLength(((BlobType)currentValue).getLength());
- currentValue = new BlobImpl(isf);
- }
- else if (currentValue instanceof XMLType) {
- XMLType val = (XMLType)currentValue;
- currentValue = new SQLXMLImpl(createInputStreamFactory(val));
- ((SQLXMLImpl)currentValue).setEncoding(val.getEncoding());
- }
- }
- else if (currentValue instanceof java.util.Date) {
- return TimestampWithTimezone.create((java.util.Date)currentValue, serverTimeZone, getDefaultCalendar(), currentValue.getClass());
- }
- else if (maxFieldSize > 0 && currentValue instanceof String) {
- String val = (String)currentValue;
- currentValue = val.substring(0, Math.min(maxFieldSize/2, val.length()));
- }
- return currentValue;
- }
-
- private InputStreamFactory createInputStreamFactory(Streamable<?> type) {
- final StreamingLobChunckProducer.Factory factory = new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, type);
- InputStreamFactory isf = new InputStreamFactory() {
- @Override
- public InputStream getInputStream() throws IOException {
- return new LobChunkInputStream(factory.getLobChunkProducer());
- }
- };
- return isf;
- }
-
- /**
- * Get all values in current record in column order
- * @return List of Object values in current row
- * @throws SQLException if an access error occurs.
- */
- public List getCurrentRecord() throws SQLException {
- checkClosed();
- return batchResults.getCurrentRow();
- }
- /*
- * @see java.sql.ResultSet#getType()
- */
- public int getType() throws SQLException {
- return this.cursorType;
- }
-
- public boolean absolute( int row) throws SQLException {
- checkClosed();
- checkNotForwardOnly();
- return batchResults.absolute(row, getOffset());
- }
-
- protected PlanNode getUpdatedPlanDescription() {
- return updatedPlanDescription;
- }
-
- public Batch requestBatch(int beginRow) throws SQLException{
- logger.fine("CursorResultsImpl.requestBatch] thread name: " + Thread.currentThread().getName() + " requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- checkClosed();
- try {
- ResultsFuture<ResultsMessage> results = statement.getDQP().processCursorRequest(requestID, beginRow, fetchSize);
- int timeoutSeconds = statement.getQueryTimeout();
- if (timeoutSeconds == 0) {
- timeoutSeconds = Integer.MAX_VALUE;
- }
- ResultsMessage currentResultMsg = results.get(timeoutSeconds, TimeUnit.SECONDS);
- this.accumulateWarnings(currentResultMsg);
- return getCurrentBatch(currentResultMsg);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (InterruptedException e) {
- throw TeiidSQLException.create(e);
- } catch (ExecutionException e) {
- throw TeiidSQLException.create(e);
- } catch (TimeoutException e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- private Batch getCurrentBatch(ResultsMessage currentResultMsg) {
- this.updatedPlanDescription = currentResultMsg.getPlanDescription();
- boolean isLast = currentResultMsg.getResults().length == 0 || currentResultMsg.getFinalRow() == currentResultMsg.getLastRow();
- Batch result = new Batch(currentResultMsg.getResults(), currentResultMsg.getFirstRow(), currentResultMsg.getLastRow(), isLast);
- result.setLastRow(currentResultMsg.getFinalRow());
- return result;
- }
-
- protected int getFinalRowNumber() {
- return Math.max(-1, batchResults.getFinalRowNumber() - getOffset());
- }
-
- protected boolean hasNext() throws SQLException {
- return batchResults.hasNext(getOffset() + 1);
- }
-
- protected int getOffset() {
- return parameters > 0 ? 1 : 0;
- }
-
- protected int getAbsoluteRowNumber() {
- return batchResults.getCurrentRowNumber();
- }
-
- public void cancelRowUpdates() throws SQLException {
- // do nothing.
- checkClosed(); // check to see if the ResultSet is closed
- }
-
- @Override
- public void clearWarnings() throws SQLException {
- // do nothing
- checkClosed(); // check to see if the ResultSet is closed
- }
-
- public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
- return DataTypeTransformer.getBigDecimal(getObject(columnIndex));
- }
-
- public BigDecimal getBigDecimal(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getBigDecimal(findColumn(columnName));
- }
-
- public BigDecimal getBigDecimal(int columnIndex, int scale)
- throws SQLException {
-
- // do the necessary transformation depending on the datatype of the
- // object at the given index.
- BigDecimal bigDecimalObject = DataTypeTransformer
- .getBigDecimal(getObject(columnIndex));
-
- if (bigDecimalObject == null) {
- return null;
- }
-
- // set the scale on the bigDecimal
- return bigDecimalObject.setScale(scale);
- }
-
- public BigDecimal getBigDecimal(String columnName, int scale)
- throws SQLException {
- // find the columnIndex for the given column name.
- return getBigDecimal(findColumn(columnName), scale);
- }
-
- public java.io.InputStream getBinaryStream(int columnIndex)
- throws SQLException {
- Object value = getObject(columnIndex);
- if (value == null) {
- return null;
- }
-
- if (value instanceof Blob) {
- return ((Blob) value).getBinaryStream();
- }
-
- if (value instanceof SQLXML) {
- return ((SQLXML)value).getBinaryStream();
- }
-
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$NON-NLS-1$
- }
-
- public java.io.InputStream getBinaryStream(String columnName)
- throws SQLException {
- return getBinaryStream(findColumn(columnName));
- }
-
- public Blob getBlob(int columnIndex) throws SQLException {
- return DataTypeTransformer.getBlob(getObject(columnIndex));
- }
-
- public Blob getBlob(String columnName) throws SQLException {
- return getBlob(findColumn(columnName));
- }
-
- public boolean getBoolean(int columnIndex) throws SQLException {
- return DataTypeTransformer.getBoolean(getObject(columnIndex));
- }
-
- public boolean getBoolean(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getBoolean(findColumn(columnName));
- }
-
- public byte getByte(int columnIndex) throws SQLException {
- return DataTypeTransformer.getByte(getObject(columnIndex));
- }
-
- public byte getByte(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getByte(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as an array of byte
- * values
- *
- * @param columnIndex
- * The column position in the current row whose value is to be read.
- * @return The value of the column at columnIndex as an array of bytes.
- * @throws SQLException
- * if there is an error accessing or converting the result value
- */
- public byte[] getBytes(int columnIndex) throws SQLException {
- return DataTypeTransformer.getBytes(getObject(columnIndex));
- }
-
- /**
- * This method will return the value in the current row as an array of byte
- * values
- *
- * @param columnName
- * The column name in the current row whose value is to be updated.
- * @return byte[]. The value of the column at columnIndex as an array of
- * bytes.
- * @throws SQLException
- * if there is an error accessing or converting the result value
- */
- public byte[] getBytes(String columnName) throws SQLException {
- return getBytes(findColumn(columnName));
- }
-
- /**
- * Get the concurrency type for this ResultSet object. The concurrency was
- * set by the Statement object. The possible concurrency types are
- * CONCUR_READ_ONLY and CONCUR_UPDATABLE.
- *
- * @return The resultSets are not updatable, this method returns
- * CONCUR_READ_ONLY.
- * @throws SQLException
- * if the there is an error accesing results
- */
- public int getConcurrency() throws SQLException {
-
- checkClosed(); // check to see if the ResultSet is closed
- return ResultSet.CONCUR_READ_ONLY;
- }
-
- /**
- * This method will attempt to return the value contained at the index as a
- * java.io.Reader object.
- *
- * @param columnIndex
- * The column position in the current row whose value is to be read.
- * @return The value of the column as a java.io.Reader object.
- */
- public java.io.Reader getCharacterStream(int columnIndex)
- throws SQLException {
- Object value = getObject(columnIndex);
- return DataTypeTransformer.getCharacterStream(value);
- }
-
- /**
- * This method will attempt to return the value at the designated column
- * determined by the columName as a java.io.Reader object.
- *
- * @param columnName
- * The column name in the current row whose value is to be updated.
- * @return The value of the column as a java.io.Reader object.
- */
- public java.io.Reader getCharacterStream(String columnName)
- throws SQLException {
- return getCharacterStream(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a Date object.
- * This will use the timeZone info of the calendar object.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @param Calender
- * object used to get the date value.
- * @return The value of the column as a Date object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Date getDate(int columnIndex, Calendar cal) throws SQLException {
- Date value = DataTypeTransformer.getDate(getObject(columnIndex));
-
- if (value != null && cal != null) {
- value = TimestampWithTimezone.createDate(value,
- getDefaultCalendar().getTimeZone(), cal);
- }
-
- return value;
- }
-
- /**
- * Get the Date value for the given column.
- *
- * @param columnName
- * . The name of the column whose value needs to be fetched.
- * @param Calender
- * object used to get the date value.
- * @return value of the column as an int.
- * @throws SQLException
- * unable to obtain date value for the given column.
- */
- public Date getDate(String columnName, Calendar cal) throws SQLException {
- // find the columnIndex for the given column name.
- return getDate(findColumn(columnName), cal);
- }
-
- /**
- * This method will return the value in the current row as a Date object.
- * This will assume the default timeZone.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a Date object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Date getDate(int columnIndex) throws SQLException {
- return getDate(columnIndex, null);
- }
-
- /**
- * Get the column value as a Date object
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return value of the column as an int.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public Date getDate(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getDate(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a double value.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a double value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public double getDouble(int columnIndex) throws SQLException {
- return DataTypeTransformer.getDouble(getObject(columnIndex));
- }
-
- /**
- * Get a double value based on the column name.
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return value of the column as a double.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public double getDouble(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getDouble(findColumn(columnName));
- }
-
- /**
- * Gets the direction suggested to the driver as the direction in which to
- * fetch rows.
- *
- * @return fetch direction for this ResultSet. This cannot be set and is
- * alwayd FETCH_FORWARD.
- * @throws SQLException
- */
- public int getFetchDirection() throws SQLException {
- checkClosed(); // check to see if the ResultSet is closed
- return ResultSet.FETCH_FORWARD;
- }
-
- /**
- * This method will return the value in the current row as a float value.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a float value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public float getFloat(int columnIndex) throws SQLException {
- return DataTypeTransformer.getFloat(getObject(columnIndex));
- }
-
- /**
- * Get a float value based on the column name.
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return value of the column as a float.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public float getFloat(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getFloat(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a int value.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a int value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public int getInt(int columnIndex) throws SQLException {
- return DataTypeTransformer.getInteger(getObject(columnIndex));
- }
-
- /**
- * Get an integer based on the column index.
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return value of the column as an int.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public int getInt(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getInt(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a long value.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a long value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public long getLong(int columnIndex) throws SQLException {
- return DataTypeTransformer.getLong(getObject(columnIndex));
- }
-
- /**
- * Get a long based on the column name.
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return value of the column as a long.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public long getLong(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getLong(findColumn(columnName));
- }
-
- /**
- * Get a java object based on the column name.
- *
- * @param name
- * of the column in the resultset whose value is to be fetched.
- * @return object which gives the column value.
- * @throw a SQLException if a resultSet access error occurs.
- */
- public Object getObject(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getObject(findColumn(columnName));
- }
-
- /**
- * Get a primitive short based on the column index.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a short value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public short getShort(int columnIndex) throws SQLException {
- return DataTypeTransformer.getShort(getObject(columnIndex));
- }
-
- /**
- * Get a short based on the column name.
- *
- * @param String
- * representing name of the column.
- * @return short value of the column.
- * @throws SQLException
- * if a results access error occurs.
- */
- public short getShort(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getShort(findColumn(columnName));
- }
-
- /**
- * Get a String based on the column index.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a string value.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public String getString(int columnIndex) throws SQLException {
- return DataTypeTransformer.getString(getObject(columnIndex));
- }
-
- /**
- * Get a string based on the column name.
- *
- * @param String
- * representing name of the column.
- * @return String value of the column.
- * @throws SQLException
- * if a results access error occurs.
- */
- public String getString(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getString(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a Time object.
- * This will assume the default timeZone.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a Time object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Time getTime(int columnIndex) throws SQLException {
- return getTime(columnIndex, null);
- }
-
- /**
- * Get a java.sql.Time based on the column name.
- *
- * @param name
- * of the column whose value is to be fetched as a timestamp
- * @return value of the column as a Timestamp object
- * @throws SQLException
- * if a results access error occurs.
- */
- public Time getTime(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getTime(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a Time object.
- * This will use the timeZone info of the calendar object.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @param Calendar
- * object to be used to construct the Time object.
- * @return The value of the column as a Time object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Time getTime(int columnIndex, Calendar cal) throws SQLException {
- Time value = DataTypeTransformer.getTime(getObject(columnIndex));
-
- if (value != null && cal != null) {
- value = TimestampWithTimezone.createTime(value,
- getDefaultCalendar().getTimeZone(), cal);
- }
-
- return value;
- }
-
- /**
- * Get a java.sql.Time based on the column name.
- *
- * @param name
- * of the column whose value is to be fetched as a timestamp
- * @param calender
- * object to include the timezone info in the object returned
- * @return value of the column as a Timestamp object
- * @throws SQLException
- * if a results access error occurs.
- */
- public Time getTime(String columnName, Calendar cal) throws SQLException {
- // find the columnIndex for the given column name.
- return getTime((findColumn(columnName)), cal);
- }
-
- /**
- * This method will return the value in the current row as a Timestamp
- * object. This will assume the default timeZone.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @return The value of the column as a Timestamp object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Timestamp getTimestamp(int columnIndex) throws SQLException {
- return getTimestamp(columnIndex, null);
- }
-
- /**
- * Get a java.sql.Timestamp based on the column name.
- *
- * @param name
- * of the column whose value is to be fetched as a timestamp
- * @return value of the column as a Timestamp object
- * @throws SQLException
- * if a results access error occurs.
- */
- public Timestamp getTimestamp(String columnName) throws SQLException {
- // find the columnIndex for the given column name.
- return getTimestamp(findColumn(columnName));
- }
-
- /**
- * This method will return the value in the current row as a Timestamp
- * object. This will use the timeZone info of the calendar object.
- *
- * @param The
- * index of the column whose value needs to be fetched.
- * @param Calendar
- * object to be used to construct the Timestamp object.
- * @return The value of the column as a Timestamp object.
- * @throws SQLException
- * if a results access error occurs or transform fails.
- */
- public Timestamp getTimestamp(int columnIndex, Calendar cal)
- throws SQLException {
- Timestamp value = DataTypeTransformer.getTimestamp(getObject(columnIndex));
-
- if (value != null && cal != null) {
- value = TimestampWithTimezone.createTimestamp(value,
- getDefaultCalendar().getTimeZone(), cal);
- }
-
- return value;
- }
-
- /**
- * Get a java.sql.Timestamp based on the column name.
- *
- * @param name
- * of the column whose value is to be fetched as a timestamp
- * @param calender
- * object to include the timezone info in the object returned
- * @return value of the column as a Timestamp object
- * @throws SQLException
- * if a results access error occurs.
- */
- public Timestamp getTimestamp(String columnName, Calendar cal)
- throws SQLException {
- // find the columnIndex for the given column name.
- return getTimestamp(findColumn(columnName), cal);
- }
-
- /**
- * Moves the cursor to the remembered cursor position, usually the current
- * row. This method does not have any effect if the cursor is not on the
- * insert row. ResultSet cannot currently be updated.
- */
- public void moveToCurrentRow() throws SQLException {
- // do nothing
- }
-
- /**
- * This will return a boolean value if the last column that was read had a
- * value equal to null. If the last column read was null return true, else
- * return false.
- *
- * @return A boolean value showing if the lastvalue read in was null or not.
- * @throws SQLException
- */
- public boolean wasNull() throws SQLException {
-
- checkClosed(); // check to see if the ResultSet is closed
-
- return currentValue == null;
- }
-
- protected void accumulateWarnings(ResultsMessage resultsMsg) {
- this.statement.accumulateWarnings(resultsMsg.getWarnings());
- }
-
- /**
- * <p>
- * This method returns the meta data of the result set, such as the number,
- * types and properties of this resultSets columns.
- * </p>
- *
- * @return ResultSerMetaData object for these results.
- * @throws SQLException
- * if results access error occurs
- */
- public ResultSetMetaData getMetaData() throws SQLException {
- checkClosed();
- return rmetadata;
- }
-
- /**
- * Retrieves the RequestID for the query that created this ResultSet.
- *
- * @return The requestID for the query that created these results
- * @throws SQLException
- */
- public String getCursorName() throws SQLException {
- return null;
- }
-
- /**
- * <p>
- * Retrieves the Statement object that produced this ResultSet object.
- *
- * @return a Statement object.
- * </p>
- * @throws SQLException
- * if the there is an error accesing results
- */
- public StatementImpl getStatement() throws SQLException {
- checkClosed();
- return statement;
- }
-
- public SQLWarning getWarnings() throws SQLException {
- checkClosed();
-
- return null;
- }
-
- /**
- * True if current record is the first in the result set.
- *
- * @return True if current row is first
- * @throws QueryResultsException
- * if this result set has an exception
- * @throws InvalidatedResultsException
- * if the results were obtained during a transaction and the
- * transaction has been rolled back
- */
- public boolean isFirst() throws SQLException {
- return this.getAbsoluteRowNumber() == BEFORE_FIRST_ROW + 1 && hasNext();
- }
-
- /**
- * True if current record is the last in the result set.
- *
- * @return True if current row is last
- * @throws QueryResultsException
- * if this result set has an exception
- * @throws InvalidatedResultsException
- * if the results were obtained during a transaction and the
- * transaction has been rolled back
- */
- public boolean isLast() throws SQLException {
- return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() == getFinalRowNumber();
- }
-
- /**
- * <p>
- * Determines whether the cursor is after the last row in this ResultSet
- * object. This method should be called only if the result set is
- * scrollable.
- * </p>
- *
- * @return true if the cursor is after the last row in the resultSet.
- * @throws SQLException
- */
- public boolean isAfterLast() throws SQLException {
- if (getFinalRowNumber() == -1) {
- return false;
- }
- // return true if the current row has a next row
- // it is also not the last
- return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() > getFinalRowNumber();
- }
-
- /**
- * <p>
- * Determines whether the cursor is before the first row in this ResultSet
- * object. This method should be called only if the result set is
- * scrollable.
- * </p>
- *
- * @return true if the cursor is before the last row in the resultSet;false
- * if the cursor is at any other position or the result set contains no
- * rows.
- * @throws SQLException
- */
- public boolean isBeforeFirst() throws SQLException {
- // return true if there are rows and the current row is before first
- return getAbsoluteRowNumber() == BEFORE_FIRST_ROW && hasNext();
- }
-
- /**
- * <p>
- * Moves the cursor a number of rows relative to the current row in this
- * ResultSet object. The number of rows may be positive or negative.
- * </p>
- *
- * @param number
- * of rows to move relative to the present row.
- * @return true if the cursor is on a valid row in the resultSet.
- * @throws SQLException
- * if the there is an error accessing results
- */
- public boolean relative(int rows) throws SQLException {
- if (isBeforeFirst() || isAfterLast() || getFinalRowNumber() == 0) {
- throw new TeiidSQLException(
- JDBCPlugin.Util
- .getString("ResultsImpl.The_cursor_is_not_on_a_valid_row._1")); //$NON-NLS-1$
- }
-
- checkNotForwardOnly();
-
- return this.absolute(Math.max(0, getAbsoluteRowNumber() + rows));
- }
-
- /**
- * <p>
- * Moves the cursor to the last row in the in this ResultSet object. This
- * method should be called only if the result set is scrollable.
- * </p>
- *
- * @return true if the cursor is on a validRow, false otherwise or if no
- * rows exist.
- * @throws SQLException
- * if the type of the ResultSet is TYPE_FORWARD_ONLY
- */
- public boolean last() throws SQLException {
- checkNotForwardOnly();
-
- return absolute(-1);
- }
-
- protected void checkNotForwardOnly() throws SQLException {
- if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
- String msg = JDBCPlugin.Util
- .getString("ResultsImpl.Op_invalid_fwd_only"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- }
-
- /**
- * <p>
- * Moves the cursor to the end of the result set, just after the last row.
- * Has no effect if the result set contains no rows.
- * </p>
- *
- * @throws SQLException
- * if a results access error occurs or the result set type is
- * TYPE_FORWARD_ONLY
- */
- public void afterLast() throws SQLException {
- if (last()) {
- next();
- }
- }
-
- /**
- * <p>
- * Moves the cursor to the front of the result set, just before the first
- * row. Has no effect if the result set contains no rows.
- * </p>
- *
- * @exception SQLException
- * if a results can not be accessed or the result set type is
- * TYPE_FORWARD_ONLY
- */
- public void beforeFirst() throws SQLException {
- if (first()) {
- previous();
- }
- }
-
- /**
- * <p>
- * Moves the cursor to the first row in this ResultSet object.
- * </p>
- *
- * @return true if the cursor is on valid row, false if there are no rows in
- * the resultset.
- * @throws SQLException
- * if the ResulSet is of TYPE_FORWARD_ONLY.
- */
- public boolean first() throws SQLException {
- checkNotForwardOnly();
- return absolute(1);
- }
-
- /**
- * <p>
- * This method returns the integer that represents which column represents
- * the column name parameter.
- * </p>
- *
- * @param Name
- * of the column whose position is to be returned.
- * @return Position of column amoung the columns in the ResultSet.
- * @throws SQLException
- * if a database access error occurs.
- */
- public int findColumn(String columnName) throws SQLException {
- checkClosed();
-
- // get the column index using ResultsMetadata object
- return findColumnIndex(columnName);
- }
-
- protected int findColumnIndex(String columnName) throws SQLException {
- int colCount = getMetaData().getColumnCount();
- for (int i = 1; i <= colCount; i++) {
- if (getMetaData().getColumnName(i).equalsIgnoreCase(columnName)) {
- return i;
- }
- }
-
- String msg = JDBCPlugin.Util.getString(
- "MMResultsImpl.Col_doesnt_exist", columnName); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
-
- protected Calendar getDefaultCalendar() {
- return statement.getDefaultCalendar();
- }
-
- public void deleteRow() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Array getArray(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Array getArray(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public InputStream getAsciiStream(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public InputStream getAsciiStream(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Clob getClob(int columnIndex) throws SQLException {
- return DataTypeTransformer.getClob(getObject(columnIndex));
- }
-
- public SQLXML getSQLXML(int columnIndex) throws SQLException {
- return DataTypeTransformer.getSQLXML(getObject(columnIndex));
- }
-
- public Clob getClob(String columnLabel) throws SQLException {
- return getClob(findColumn(columnLabel));
- }
-
-
- public int getHoldability() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Reader getNCharacterStream(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Reader getNCharacterStream(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public NClob getNClob(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public NClob getNClob(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public String getNString(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public String getNString(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Object getObject(int columnIndex, Map<String, Class<?>> map)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Object getObject(String columnLabel, Map<String, Class<?>> map)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Ref getRef(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Ref getRef(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public RowId getRowId(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public RowId getRowId(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public SQLXML getSQLXML(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public InputStream getUnicodeStream(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public InputStream getUnicodeStream(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public URL getURL(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public URL getURL(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void insertRow() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void moveToInsertRow() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void refreshRow() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean rowDeleted() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean rowInserted() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean rowUpdated() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setFetchDirection(int direction) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setFetchSize(int rows) throws SQLException {
- checkClosed();
- if ( rows < 0 ) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size")); //$NON-NLS-1$
- }
- // sets the fetch size on this statement
- if (rows == 0) {
- this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
- } else {
- this.fetchSize = rows;
- }
- }
-
- public void updateArray(int columnIndex, Array x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateArray(String columnLabel, Array x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(int columnIndex, InputStream x, int length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(int columnIndex, InputStream x, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(int columnIndex, InputStream x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(String columnLabel, InputStream x, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateAsciiStream(String columnLabel, InputStream x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBigDecimal(int columnIndex, BigDecimal x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBigDecimal(String columnLabel, BigDecimal x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBinaryStream(int columnIndex, InputStream x, int length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBinaryStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
-
- public void updateBinaryStream(int columnIndex, InputStream x, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBinaryStream(int columnIndex, InputStream x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBinaryStream(String columnLabel, InputStream x,
- long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBinaryStream(String columnLabel, InputStream x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(int columnIndex, Blob x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(String columnLabel, Blob x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(int columnIndex, InputStream inputStream, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(int columnIndex, InputStream inputStream)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(String columnLabel, InputStream inputStream,
- long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBlob(String columnLabel, InputStream inputStream)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBoolean(int columnIndex, boolean x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBoolean(String columnLabel, boolean x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateByte(int columnIndex, byte x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateByte(String columnLabel, byte x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBytes(int columnIndex, byte[] x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateBytes(String columnLabel, byte[] x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
-
- public void updateCharacterStream(int columnIndex, Reader x, int length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(String columnLabel, Reader reader,
- int length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(int columnIndex, Reader x, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(int columnIndex, Reader x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(String columnLabel, Reader reader,
- long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(String columnLabel, Reader reader)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(int columnIndex, Clob x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(String columnLabel, Clob x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(int columnIndex, Reader reader, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(int columnIndex, Reader reader) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(String columnLabel, Reader reader, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateClob(String columnLabel, Reader reader)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateDate(int columnIndex, Date x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateDate(String columnLabel, Date x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateDouble(int columnIndex, double x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateDouble(String columnLabel, double x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateFloat(int columnIndex, float x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateFloat(String columnLabel, float x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateInt(int columnIndex, int x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateInt(String columnLabel, int x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateLong(int columnIndex, long x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateLong(String columnLabel, long x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNCharacterStream(int columnIndex, Reader x, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void updateNCharacterStream(int columnIndex, Reader x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void updateNCharacterStream(String columnLabel, Reader reader,
- long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNCharacterStream(String columnLabel, Reader reader)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void updateNClob(int columnIndex, NClob clob) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNClob(int columnIndex, Reader reader, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNClob(int columnIndex, Reader reader) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNClob(String columnLabel, NClob clob) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNClob(String columnLabel, Reader reader, long length)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNClob(String columnLabel, Reader reader)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNString(int columnIndex, String string)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNString(String columnLabel, String string)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNull(int columnIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateNull(String columnLabel) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateObject(int columnIndex, Object x, int scaleOrLength)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateObject(int columnIndex, Object x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateObject(String columnLabel, Object x, int scaleOrLength)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateObject(String columnLabel, Object x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateRef(int columnIndex, Ref x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateRef(String columnLabel, Ref x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateRow() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateRowId(int columnIndex, RowId x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateRowId(String columnLabel, RowId x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateShort(int columnIndex, short x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateShort(String columnLabel, short x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateSQLXML(int columnIndex, SQLXML xmlObject)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateSQLXML(String columnLabel, SQLXML xmlObject)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateString(int columnIndex, String x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateString(String columnLabel, String x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateTime(int columnIndex, Time x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateTime(String columnLabel, Time x) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateTimestamp(int columnIndex, Timestamp x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void updateTimestamp(String columnLabel, Timestamp x)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java (from rev 2885, branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,1761 @@
+/*
+ * 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.jdbc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.lob.LobChunkInputStream;
+import org.teiid.client.lob.StreamingLobChunckProducer;
+import org.teiid.client.plan.PlanNode;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.BlobImpl;
+import org.teiid.core.types.BlobType;
+import org.teiid.core.types.ClobImpl;
+import org.teiid.core.types.ClobType;
+import org.teiid.core.types.InputStreamFactory;
+import org.teiid.core.types.SQLXMLImpl;
+import org.teiid.core.types.Streamable;
+import org.teiid.core.types.XMLType;
+import org.teiid.core.util.SqlUtil;
+import org.teiid.core.util.TimestampWithTimezone;
+import org.teiid.jdbc.BatchResults.Batch;
+import org.teiid.jdbc.BatchResults.BatchFetcher;
+
+
+/**
+ * <p>
+ * The MMResultSet is the way query results are returned to the requesting
+ * client based upon a query given to the server. This abstract class that
+ * implements java.sql.ResultSet. This class represents access to results
+ * produced by any of the classes on the driver.
+ * </p>
+ */
+
+public class ResultSetImpl extends WrapperImpl implements ResultSet, BatchFetcher {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
+
+ private static final int BEFORE_FIRST_ROW = 0;
+
+ // the object which was last read from Results
+ private Object currentValue;
+
+ // This object represents metadata for this result set.
+ private ResultSetMetaData rmetadata;
+ // Statement that causes this results
+ private StatementImpl statement;
+
+ // Cursor related state
+ private int cursorType;
+ private boolean isClosed;
+
+ // reuse the original request's state
+ private long requestID;
+ private BatchResults batchResults;
+ private int columnCount;
+ private int resultColumns;
+ private int parameters;
+ private TimeZone serverTimeZone;
+ private PlanNode updatedPlanDescription;
+ private int maxFieldSize;
+ private int fetchSize;
+
+ /**
+ * Constructor.
+ *
+ * @param resultsMsg
+ * @param statement
+ * @throws SQLException
+ */
+ ResultSetImpl(ResultsMessage resultsMsg, StatementImpl statement) throws SQLException {
+ this(resultsMsg, statement, null, 0);
+ }
+
+ ResultSetImpl(ResultsMessage resultsMsg, StatementImpl statement,
+ ResultSetMetaData metadata, int parameters) throws SQLException {
+ this.statement = statement;
+ this.parameters = parameters;
+ // server latency-related timestamp
+ this.requestID = statement.getCurrentRequestID();
+ this.cursorType = statement.getResultSetType();
+ this.batchResults = new BatchResults(this, getCurrentBatch(resultsMsg), this.cursorType == ResultSet.TYPE_FORWARD_ONLY ? 1 : BatchResults.DEFAULT_SAVED_BATCHES);
+ accumulateWarnings(resultsMsg);
+ this.serverTimeZone = statement.getServerTimeZone();
+
+ if (metadata == null) {
+ MetadataProvider provider = new DeferredMetadataProvider(resultsMsg.getColumnNames(),
+ resultsMsg.getDataTypes(), statement,
+ statement.getCurrentRequestID());
+ rmetadata = new ResultSetMetaDataImpl(provider);
+ } else {
+ rmetadata = metadata;
+ }
+ // Cache the column count and isLOB values since every call to getObject uses these.
+ this.columnCount = rmetadata.getColumnCount();
+
+ this.resultColumns = columnCount - parameters;
+ if (this.parameters > 0) {
+ rmetadata = new FilteredResultsMetadata(rmetadata, resultColumns);
+ }
+ this.fetchSize = statement.getFetchSize();
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Creating ResultSet requestID: " + requestID + " beginRow: " + resultsMsg.getFirstRow() + " resultsColumns: " + resultColumns + " parameters: " + parameters); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ public void setMaxFieldSize(int maxFieldSize) {
+ this.maxFieldSize = maxFieldSize;
+ }
+
+ /**
+ * Close this result set.
+ */
+ public void close() throws SQLException{
+ if(!isClosed) {
+ // close the the server's statement object (if necessary)
+ if(this.requestID >= 0){
+ try {
+ this.statement.getDQP().closeRequest(requestID);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidComponentException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+ isClosed = true;
+ }
+ }
+
+ public boolean isClosed() throws SQLException {
+ return isClosed;
+ }
+
+ protected void checkClosed() throws SQLException {
+ if (isClosed) {
+ String msg = JDBCPlugin.Util
+ .getString("MMResultSet.Cant_call_closed_resultset"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ }
+
+ /**
+ * Return the value for output/return parameter given the index
+ * of the parameter in the ResultSet
+ * @param index Index of the parameter to be retrieved.
+ */
+ Object getOutputParamValue(int index) throws SQLException {
+ if (index <= resultColumns || index > resultColumns + parameters) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StoredProcedureResultsImpl.Invalid_parameter_index__{0}_2", index)); //$NON-NLS-1$
+ }
+ // Mark the row we're on
+ final int originalRow = getAbsoluteRowNumber();
+
+ this.batchResults.absolute(-1);
+ try {
+ return getObjectDirect(index);
+ } finally {
+ this.batchResults.absolute(originalRow);
+ }
+ }
+
+ /**
+ * <p>Get a java object based on the column index for the current row.</p>
+ * @param The index of the column whose value needs to be fetched.
+ * @return The value of the column as an object.
+ * @throws SQLException if a results access error occurs or transform fails.
+ */
+ public Object getObject(int column) throws SQLException {
+ if (isAfterLast()) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StoredProcedureResultsImpl.ResultSet_cursor_is_after_the_last_row._1")); //$NON-NLS-1$
+ }
+ // only get the Object of the result set
+ if(column > resultColumns){
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("ResultsImpl.Invalid_col_index", column)); //$NON-NLS-1$
+ }
+ return getObjectDirect(column);
+ }
+
+ public int getFetchSize() throws SQLException {
+ return this.fetchSize;
+ }
+
+ /**
+ * Move row pointer forward one row. This may cause the cursor
+ * to fetch more rows.
+ * @return True if the current index is on a valid row, false if
+ * the pointer is past the end of the rows
+ * @throws SQLException if this result set has an exception
+ */
+ public boolean next() throws SQLException {
+ checkClosed();
+ if (hasNext()) {
+ return batchResults.next();
+ }
+ batchResults.next();
+ return false;
+ }
+
+ /**
+ * Move row pointer backward one row. This may cause the cursor
+ * to fetch more rows.
+ * @return True if the current index is on a valid row, false if
+ * the pointer is before the beginning of the rows
+ * @throws SQLException if this result set has an exception
+ */
+ public boolean previous() throws SQLException {
+ checkClosed();
+ checkNotForwardOnly();
+ return batchResults.previous();
+ }
+
+ /**
+ * Get current row pointer.
+ * @return Index of current row
+ * @throws SQLException if this result set has an exception
+ */
+ public int getRow() throws SQLException {
+ checkClosed();
+ if (isAfterLast()) {
+ return 0;
+ }
+ return getAbsoluteRowNumber();
+ }
+
+ /**
+ * Get the value of the current row at the column index specified.
+ * @param column Column index
+ * @return Value at column, which may be null
+ * @throws SQLException if this result set has an exception
+ */
+ public Object getObjectDirect(int column) throws SQLException {
+ checkClosed();
+ if(column < 1 || column > columnCount) {
+ throw new IllegalArgumentException(JDBCPlugin.Util.getString("ResultsImpl.Invalid_col_index", column)); //$NON-NLS-1$
+ }
+ List cursorRow = batchResults.getCurrentRow();
+
+ if (cursorRow == null) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("ResultsImpl.The_cursor_is_not_on_a_valid_row._1")); //$NON-NLS-1$
+ }
+
+ // defect 13539 - set the currentValue (defined in MMResultSet) so that wasNull() accurately returns whether this value was null
+ currentValue = cursorRow.get(column-1);
+
+ if (currentValue instanceof Streamable<?>) {
+ if (Boolean.getBoolean(Streamable.FORCE_STREAMING)) {
+ Object reference = ((Streamable<?>)currentValue).getReference();
+ if (reference != null) {
+ currentValue = reference;
+ return currentValue;
+ }
+ }
+ if(currentValue instanceof ClobType){
+ currentValue = new ClobImpl(createInputStreamFactory((ClobType)currentValue), ((ClobType)currentValue).getLength());
+ }
+ else if (currentValue instanceof BlobType) {
+ InputStreamFactory isf = createInputStreamFactory((BlobType)currentValue);
+ isf.setLength(((BlobType)currentValue).getLength());
+ currentValue = new BlobImpl(isf);
+ }
+ else if (currentValue instanceof XMLType) {
+ XMLType val = (XMLType)currentValue;
+ currentValue = new SQLXMLImpl(createInputStreamFactory(val));
+ ((SQLXMLImpl)currentValue).setEncoding(val.getEncoding());
+ }
+ }
+ else if (currentValue instanceof java.util.Date) {
+ return TimestampWithTimezone.create((java.util.Date)currentValue, serverTimeZone, getDefaultCalendar(), currentValue.getClass());
+ }
+ else if (maxFieldSize > 0 && currentValue instanceof String) {
+ String val = (String)currentValue;
+ currentValue = val.substring(0, Math.min(maxFieldSize/2, val.length()));
+ }
+ return currentValue;
+ }
+
+ private InputStreamFactory createInputStreamFactory(Streamable<?> type) {
+ final StreamingLobChunckProducer.Factory factory = new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, type);
+ InputStreamFactory isf = new InputStreamFactory() {
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new LobChunkInputStream(factory.getLobChunkProducer());
+ }
+ };
+ return isf;
+ }
+
+ /**
+ * Get all values in current record in column order
+ * @return List of Object values in current row
+ * @throws SQLException if an access error occurs.
+ */
+ public List getCurrentRecord() throws SQLException {
+ checkClosed();
+ return batchResults.getCurrentRow();
+ }
+ /*
+ * @see java.sql.ResultSet#getType()
+ */
+ public int getType() throws SQLException {
+ return this.cursorType;
+ }
+
+ public boolean absolute( int row) throws SQLException {
+ checkClosed();
+ checkNotForwardOnly();
+ return batchResults.absolute(row, getOffset());
+ }
+
+ protected PlanNode getUpdatedPlanDescription() {
+ return updatedPlanDescription;
+ }
+
+ public Batch requestBatch(int beginRow) throws SQLException{
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("requestBatch requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ checkClosed();
+ try {
+ ResultsFuture<ResultsMessage> results = statement.getDQP().processCursorRequest(requestID, beginRow, fetchSize);
+ int timeoutSeconds = statement.getQueryTimeout();
+ if (timeoutSeconds == 0) {
+ timeoutSeconds = Integer.MAX_VALUE;
+ }
+ ResultsMessage currentResultMsg = results.get(timeoutSeconds, TimeUnit.SECONDS);
+
+ if (currentResultMsg.getException() != null) {
+ throw TeiidSQLException.create(currentResultMsg.getException());
+ }
+
+ this.accumulateWarnings(currentResultMsg);
+ return getCurrentBatch(currentResultMsg);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (InterruptedException e) {
+ throw TeiidSQLException.create(e);
+ } catch (ExecutionException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TimeoutException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ private Batch getCurrentBatch(ResultsMessage currentResultMsg) {
+ this.updatedPlanDescription = currentResultMsg.getPlanDescription();
+ boolean isLast = currentResultMsg.getResults().length == 0 || currentResultMsg.getFinalRow() == currentResultMsg.getLastRow();
+ Batch result = new Batch(currentResultMsg.getResults(), currentResultMsg.getFirstRow(), currentResultMsg.getLastRow(), isLast);
+ result.setLastRow(currentResultMsg.getFinalRow());
+ return result;
+ }
+
+ protected int getFinalRowNumber() {
+ return Math.max(-1, batchResults.getFinalRowNumber() - getOffset());
+ }
+
+ protected boolean hasNext() throws SQLException {
+ return batchResults.hasNext(getOffset() + 1);
+ }
+
+ protected int getOffset() {
+ return parameters > 0 ? 1 : 0;
+ }
+
+ protected int getAbsoluteRowNumber() {
+ return batchResults.getCurrentRowNumber();
+ }
+
+ public void cancelRowUpdates() throws SQLException {
+ // do nothing.
+ checkClosed(); // check to see if the ResultSet is closed
+ }
+
+ @Override
+ public void clearWarnings() throws SQLException {
+ // do nothing
+ checkClosed(); // check to see if the ResultSet is closed
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getBigDecimal(getObject(columnIndex));
+ }
+
+ public BigDecimal getBigDecimal(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getBigDecimal(findColumn(columnName));
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
+
+ // do the necessary transformation depending on the datatype of the
+ // object at the given index.
+ BigDecimal bigDecimalObject = DataTypeTransformer
+ .getBigDecimal(getObject(columnIndex));
+
+ if (bigDecimalObject == null) {
+ return null;
+ }
+
+ // set the scale on the bigDecimal
+ return bigDecimalObject.setScale(scale);
+ }
+
+ public BigDecimal getBigDecimal(String columnName, int scale)
+ throws SQLException {
+ // find the columnIndex for the given column name.
+ return getBigDecimal(findColumn(columnName), scale);
+ }
+
+ public java.io.InputStream getBinaryStream(int columnIndex)
+ throws SQLException {
+ Object value = getObject(columnIndex);
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof Blob) {
+ return ((Blob) value).getBinaryStream();
+ }
+
+ if (value instanceof SQLXML) {
+ return ((SQLXML)value).getBinaryStream();
+ }
+
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$NON-NLS-1$
+ }
+
+ public java.io.InputStream getBinaryStream(String columnName)
+ throws SQLException {
+ return getBinaryStream(findColumn(columnName));
+ }
+
+ public Blob getBlob(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getBlob(getObject(columnIndex));
+ }
+
+ public Blob getBlob(String columnName) throws SQLException {
+ return getBlob(findColumn(columnName));
+ }
+
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getBoolean(getObject(columnIndex));
+ }
+
+ public boolean getBoolean(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getBoolean(findColumn(columnName));
+ }
+
+ public byte getByte(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getByte(getObject(columnIndex));
+ }
+
+ public byte getByte(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getByte(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as an array of byte
+ * values
+ *
+ * @param columnIndex
+ * The column position in the current row whose value is to be read.
+ * @return The value of the column at columnIndex as an array of bytes.
+ * @throws SQLException
+ * if there is an error accessing or converting the result value
+ */
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getBytes(getObject(columnIndex));
+ }
+
+ /**
+ * This method will return the value in the current row as an array of byte
+ * values
+ *
+ * @param columnName
+ * The column name in the current row whose value is to be updated.
+ * @return byte[]. The value of the column at columnIndex as an array of
+ * bytes.
+ * @throws SQLException
+ * if there is an error accessing or converting the result value
+ */
+ public byte[] getBytes(String columnName) throws SQLException {
+ return getBytes(findColumn(columnName));
+ }
+
+ /**
+ * Get the concurrency type for this ResultSet object. The concurrency was
+ * set by the Statement object. The possible concurrency types are
+ * CONCUR_READ_ONLY and CONCUR_UPDATABLE.
+ *
+ * @return The resultSets are not updatable, this method returns
+ * CONCUR_READ_ONLY.
+ * @throws SQLException
+ * if the there is an error accesing results
+ */
+ public int getConcurrency() throws SQLException {
+
+ checkClosed(); // check to see if the ResultSet is closed
+ return ResultSet.CONCUR_READ_ONLY;
+ }
+
+ /**
+ * This method will attempt to return the value contained at the index as a
+ * java.io.Reader object.
+ *
+ * @param columnIndex
+ * The column position in the current row whose value is to be read.
+ * @return The value of the column as a java.io.Reader object.
+ */
+ public java.io.Reader getCharacterStream(int columnIndex)
+ throws SQLException {
+ Object value = getObject(columnIndex);
+ return DataTypeTransformer.getCharacterStream(value);
+ }
+
+ /**
+ * This method will attempt to return the value at the designated column
+ * determined by the columName as a java.io.Reader object.
+ *
+ * @param columnName
+ * The column name in the current row whose value is to be updated.
+ * @return The value of the column as a java.io.Reader object.
+ */
+ public java.io.Reader getCharacterStream(String columnName)
+ throws SQLException {
+ return getCharacterStream(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a Date object.
+ * This will use the timeZone info of the calendar object.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @param Calender
+ * object used to get the date value.
+ * @return The value of the column as a Date object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ Date value = DataTypeTransformer.getDate(getObject(columnIndex));
+
+ if (value != null && cal != null) {
+ value = TimestampWithTimezone.createDate(value,
+ getDefaultCalendar().getTimeZone(), cal);
+ }
+
+ return value;
+ }
+
+ /**
+ * Get the Date value for the given column.
+ *
+ * @param columnName
+ * . The name of the column whose value needs to be fetched.
+ * @param Calender
+ * object used to get the date value.
+ * @return value of the column as an int.
+ * @throws SQLException
+ * unable to obtain date value for the given column.
+ */
+ public Date getDate(String columnName, Calendar cal) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getDate(findColumn(columnName), cal);
+ }
+
+ /**
+ * This method will return the value in the current row as a Date object.
+ * This will assume the default timeZone.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a Date object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Date getDate(int columnIndex) throws SQLException {
+ return getDate(columnIndex, null);
+ }
+
+ /**
+ * Get the column value as a Date object
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return value of the column as an int.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public Date getDate(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getDate(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a double value.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a double value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public double getDouble(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getDouble(getObject(columnIndex));
+ }
+
+ /**
+ * Get a double value based on the column name.
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return value of the column as a double.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public double getDouble(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getDouble(findColumn(columnName));
+ }
+
+ /**
+ * Gets the direction suggested to the driver as the direction in which to
+ * fetch rows.
+ *
+ * @return fetch direction for this ResultSet. This cannot be set and is
+ * alwayd FETCH_FORWARD.
+ * @throws SQLException
+ */
+ public int getFetchDirection() throws SQLException {
+ checkClosed(); // check to see if the ResultSet is closed
+ return ResultSet.FETCH_FORWARD;
+ }
+
+ /**
+ * This method will return the value in the current row as a float value.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a float value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public float getFloat(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getFloat(getObject(columnIndex));
+ }
+
+ /**
+ * Get a float value based on the column name.
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return value of the column as a float.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public float getFloat(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getFloat(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a int value.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a int value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public int getInt(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getInteger(getObject(columnIndex));
+ }
+
+ /**
+ * Get an integer based on the column index.
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return value of the column as an int.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public int getInt(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getInt(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a long value.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a long value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public long getLong(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getLong(getObject(columnIndex));
+ }
+
+ /**
+ * Get a long based on the column name.
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return value of the column as a long.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public long getLong(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getLong(findColumn(columnName));
+ }
+
+ /**
+ * Get a java object based on the column name.
+ *
+ * @param name
+ * of the column in the resultset whose value is to be fetched.
+ * @return object which gives the column value.
+ * @throw a SQLException if a resultSet access error occurs.
+ */
+ public Object getObject(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getObject(findColumn(columnName));
+ }
+
+ /**
+ * Get a primitive short based on the column index.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a short value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public short getShort(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getShort(getObject(columnIndex));
+ }
+
+ /**
+ * Get a short based on the column name.
+ *
+ * @param String
+ * representing name of the column.
+ * @return short value of the column.
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public short getShort(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getShort(findColumn(columnName));
+ }
+
+ /**
+ * Get a String based on the column index.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a string value.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public String getString(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getString(getObject(columnIndex));
+ }
+
+ /**
+ * Get a string based on the column name.
+ *
+ * @param String
+ * representing name of the column.
+ * @return String value of the column.
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public String getString(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getString(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a Time object.
+ * This will assume the default timeZone.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a Time object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Time getTime(int columnIndex) throws SQLException {
+ return getTime(columnIndex, null);
+ }
+
+ /**
+ * Get a java.sql.Time based on the column name.
+ *
+ * @param name
+ * of the column whose value is to be fetched as a timestamp
+ * @return value of the column as a Timestamp object
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public Time getTime(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getTime(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a Time object.
+ * This will use the timeZone info of the calendar object.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @param Calendar
+ * object to be used to construct the Time object.
+ * @return The value of the column as a Time object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ Time value = DataTypeTransformer.getTime(getObject(columnIndex));
+
+ if (value != null && cal != null) {
+ value = TimestampWithTimezone.createTime(value,
+ getDefaultCalendar().getTimeZone(), cal);
+ }
+
+ return value;
+ }
+
+ /**
+ * Get a java.sql.Time based on the column name.
+ *
+ * @param name
+ * of the column whose value is to be fetched as a timestamp
+ * @param calender
+ * object to include the timezone info in the object returned
+ * @return value of the column as a Timestamp object
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public Time getTime(String columnName, Calendar cal) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getTime((findColumn(columnName)), cal);
+ }
+
+ /**
+ * This method will return the value in the current row as a Timestamp
+ * object. This will assume the default timeZone.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @return The value of the column as a Timestamp object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ return getTimestamp(columnIndex, null);
+ }
+
+ /**
+ * Get a java.sql.Timestamp based on the column name.
+ *
+ * @param name
+ * of the column whose value is to be fetched as a timestamp
+ * @return value of the column as a Timestamp object
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public Timestamp getTimestamp(String columnName) throws SQLException {
+ // find the columnIndex for the given column name.
+ return getTimestamp(findColumn(columnName));
+ }
+
+ /**
+ * This method will return the value in the current row as a Timestamp
+ * object. This will use the timeZone info of the calendar object.
+ *
+ * @param The
+ * index of the column whose value needs to be fetched.
+ * @param Calendar
+ * object to be used to construct the Timestamp object.
+ * @return The value of the column as a Timestamp object.
+ * @throws SQLException
+ * if a results access error occurs or transform fails.
+ */
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
+ Timestamp value = DataTypeTransformer.getTimestamp(getObject(columnIndex));
+
+ if (value != null && cal != null) {
+ value = TimestampWithTimezone.createTimestamp(value,
+ getDefaultCalendar().getTimeZone(), cal);
+ }
+
+ return value;
+ }
+
+ /**
+ * Get a java.sql.Timestamp based on the column name.
+ *
+ * @param name
+ * of the column whose value is to be fetched as a timestamp
+ * @param calender
+ * object to include the timezone info in the object returned
+ * @return value of the column as a Timestamp object
+ * @throws SQLException
+ * if a results access error occurs.
+ */
+ public Timestamp getTimestamp(String columnName, Calendar cal)
+ throws SQLException {
+ // find the columnIndex for the given column name.
+ return getTimestamp(findColumn(columnName), cal);
+ }
+
+ /**
+ * Moves the cursor to the remembered cursor position, usually the current
+ * row. This method does not have any effect if the cursor is not on the
+ * insert row. ResultSet cannot currently be updated.
+ */
+ public void moveToCurrentRow() throws SQLException {
+ // do nothing
+ }
+
+ /**
+ * This will return a boolean value if the last column that was read had a
+ * value equal to null. If the last column read was null return true, else
+ * return false.
+ *
+ * @return A boolean value showing if the lastvalue read in was null or not.
+ * @throws SQLException
+ */
+ public boolean wasNull() throws SQLException {
+
+ checkClosed(); // check to see if the ResultSet is closed
+
+ return currentValue == null;
+ }
+
+ protected void accumulateWarnings(ResultsMessage resultsMsg) {
+ this.statement.accumulateWarnings(resultsMsg.getWarnings());
+ }
+
+ /**
+ * <p>
+ * This method returns the meta data of the result set, such as the number,
+ * types and properties of this resultSets columns.
+ * </p>
+ *
+ * @return ResultSerMetaData object for these results.
+ * @throws SQLException
+ * if results access error occurs
+ */
+ public ResultSetMetaData getMetaData() throws SQLException {
+ checkClosed();
+ return rmetadata;
+ }
+
+ /**
+ * Retrieves the RequestID for the query that created this ResultSet.
+ *
+ * @return The requestID for the query that created these results
+ * @throws SQLException
+ */
+ public String getCursorName() throws SQLException {
+ return null;
+ }
+
+ /**
+ * <p>
+ * Retrieves the Statement object that produced this ResultSet object.
+ *
+ * @return a Statement object.
+ * </p>
+ * @throws SQLException
+ * if the there is an error accesing results
+ */
+ public StatementImpl getStatement() throws SQLException {
+ checkClosed();
+ return statement;
+ }
+
+ public SQLWarning getWarnings() throws SQLException {
+ checkClosed();
+
+ return null;
+ }
+
+ /**
+ * True if current record is the first in the result set.
+ *
+ * @return True if current row is first
+ * @throws QueryResultsException
+ * if this result set has an exception
+ * @throws InvalidatedResultsException
+ * if the results were obtained during a transaction and the
+ * transaction has been rolled back
+ */
+ public boolean isFirst() throws SQLException {
+ return this.getAbsoluteRowNumber() == BEFORE_FIRST_ROW + 1 && hasNext();
+ }
+
+ /**
+ * True if current record is the last in the result set.
+ *
+ * @return True if current row is last
+ * @throws QueryResultsException
+ * if this result set has an exception
+ * @throws InvalidatedResultsException
+ * if the results were obtained during a transaction and the
+ * transaction has been rolled back
+ */
+ public boolean isLast() throws SQLException {
+ return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() == getFinalRowNumber();
+ }
+
+ /**
+ * <p>
+ * Determines whether the cursor is after the last row in this ResultSet
+ * object. This method should be called only if the result set is
+ * scrollable.
+ * </p>
+ *
+ * @return true if the cursor is after the last row in the resultSet.
+ * @throws SQLException
+ */
+ public boolean isAfterLast() throws SQLException {
+ if (getFinalRowNumber() == -1) {
+ return false;
+ }
+ // return true if the current row has a next row
+ // it is also not the last
+ return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() > getFinalRowNumber();
+ }
+
+ /**
+ * <p>
+ * Determines whether the cursor is before the first row in this ResultSet
+ * object. This method should be called only if the result set is
+ * scrollable.
+ * </p>
+ *
+ * @return true if the cursor is before the last row in the resultSet;false
+ * if the cursor is at any other position or the result set contains no
+ * rows.
+ * @throws SQLException
+ */
+ public boolean isBeforeFirst() throws SQLException {
+ // return true if there are rows and the current row is before first
+ return getAbsoluteRowNumber() == BEFORE_FIRST_ROW && hasNext();
+ }
+
+ /**
+ * <p>
+ * Moves the cursor a number of rows relative to the current row in this
+ * ResultSet object. The number of rows may be positive or negative.
+ * </p>
+ *
+ * @param number
+ * of rows to move relative to the present row.
+ * @return true if the cursor is on a valid row in the resultSet.
+ * @throws SQLException
+ * if the there is an error accessing results
+ */
+ public boolean relative(int rows) throws SQLException {
+ if (isBeforeFirst() || isAfterLast() || getFinalRowNumber() == 0) {
+ throw new TeiidSQLException(
+ JDBCPlugin.Util
+ .getString("ResultsImpl.The_cursor_is_not_on_a_valid_row._1")); //$NON-NLS-1$
+ }
+
+ checkNotForwardOnly();
+
+ return this.absolute(Math.max(0, getAbsoluteRowNumber() + rows));
+ }
+
+ /**
+ * <p>
+ * Moves the cursor to the last row in the in this ResultSet object. This
+ * method should be called only if the result set is scrollable.
+ * </p>
+ *
+ * @return true if the cursor is on a validRow, false otherwise or if no
+ * rows exist.
+ * @throws SQLException
+ * if the type of the ResultSet is TYPE_FORWARD_ONLY
+ */
+ public boolean last() throws SQLException {
+ checkNotForwardOnly();
+
+ return absolute(-1);
+ }
+
+ protected void checkNotForwardOnly() throws SQLException {
+ if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ String msg = JDBCPlugin.Util
+ .getString("ResultsImpl.Op_invalid_fwd_only"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ }
+
+ /**
+ * <p>
+ * Moves the cursor to the end of the result set, just after the last row.
+ * Has no effect if the result set contains no rows.
+ * </p>
+ *
+ * @throws SQLException
+ * if a results access error occurs or the result set type is
+ * TYPE_FORWARD_ONLY
+ */
+ public void afterLast() throws SQLException {
+ if (last()) {
+ next();
+ }
+ }
+
+ /**
+ * <p>
+ * Moves the cursor to the front of the result set, just before the first
+ * row. Has no effect if the result set contains no rows.
+ * </p>
+ *
+ * @exception SQLException
+ * if a results can not be accessed or the result set type is
+ * TYPE_FORWARD_ONLY
+ */
+ public void beforeFirst() throws SQLException {
+ if (first()) {
+ previous();
+ }
+ }
+
+ /**
+ * <p>
+ * Moves the cursor to the first row in this ResultSet object.
+ * </p>
+ *
+ * @return true if the cursor is on valid row, false if there are no rows in
+ * the resultset.
+ * @throws SQLException
+ * if the ResulSet is of TYPE_FORWARD_ONLY.
+ */
+ public boolean first() throws SQLException {
+ checkNotForwardOnly();
+ return absolute(1);
+ }
+
+ /**
+ * <p>
+ * This method returns the integer that represents which column represents
+ * the column name parameter.
+ * </p>
+ *
+ * @param Name
+ * of the column whose position is to be returned.
+ * @return Position of column amoung the columns in the ResultSet.
+ * @throws SQLException
+ * if a database access error occurs.
+ */
+ public int findColumn(String columnName) throws SQLException {
+ checkClosed();
+
+ // get the column index using ResultsMetadata object
+ return findColumnIndex(columnName);
+ }
+
+ protected int findColumnIndex(String columnName) throws SQLException {
+ int colCount = getMetaData().getColumnCount();
+ for (int i = 1; i <= colCount; i++) {
+ if (getMetaData().getColumnName(i).equalsIgnoreCase(columnName)) {
+ return i;
+ }
+ }
+
+ String msg = JDBCPlugin.Util.getString(
+ "MMResultsImpl.Col_doesnt_exist", columnName); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+
+ protected Calendar getDefaultCalendar() {
+ return statement.getDefaultCalendar();
+ }
+
+ public void deleteRow() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Array getArray(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Array getArray(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public InputStream getAsciiStream(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Clob getClob(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getClob(getObject(columnIndex));
+ }
+
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ return DataTypeTransformer.getSQLXML(getObject(columnIndex));
+ }
+
+ public Clob getClob(String columnLabel) throws SQLException {
+ return getClob(findColumn(columnLabel));
+ }
+
+
+ public int getHoldability() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public NClob getNClob(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public NClob getNClob(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public String getNString(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public String getNString(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Object getObject(String columnLabel, Map<String, Class<?>> map)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Ref getRef(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Ref getRef(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public RowId getRowId(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public RowId getRowId(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public URL getURL(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public URL getURL(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void insertRow() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void moveToInsertRow() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void refreshRow() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean rowDeleted() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean rowInserted() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean rowUpdated() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setFetchDirection(int direction) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setFetchSize(int rows) throws SQLException {
+ checkClosed();
+ if ( rows < 0 ) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size")); //$NON-NLS-1$
+ }
+ // sets the fetch size on this statement
+ if (rows == 0) {
+ this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
+ } else {
+ this.fetchSize = rows;
+ }
+ }
+
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateArray(String columnLabel, Array x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(int columnIndex, InputStream x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(String columnLabel, InputStream x, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateAsciiStream(String columnLabel, InputStream x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBigDecimal(String columnLabel, BigDecimal x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBinaryStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBinaryStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+
+ public void updateBinaryStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBinaryStream(int columnIndex, InputStream x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBinaryStream(String columnLabel, InputStream x,
+ long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBinaryStream(String columnLabel, InputStream x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(int columnIndex, Blob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(int columnIndex, InputStream inputStream, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(int columnIndex, InputStream inputStream)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(String columnLabel, InputStream inputStream,
+ long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBlob(String columnLabel, InputStream inputStream)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBoolean(String columnLabel, boolean x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateByte(int columnIndex, byte x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateByte(String columnLabel, byte x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+
+ public void updateCharacterStream(int columnIndex, Reader x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ int length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(int columnIndex, Clob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateClob(String columnLabel, Reader reader)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateDate(int columnIndex, Date x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateDate(String columnLabel, Date x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateDouble(int columnIndex, double x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateDouble(String columnLabel, double x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateFloat(int columnIndex, float x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateFloat(String columnLabel, float x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateInt(int columnIndex, int x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateInt(String columnLabel, int x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateLong(int columnIndex, long x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateLong(String columnLabel, long x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void updateNCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void updateNCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void updateNClob(int columnIndex, NClob clob) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNClob(int columnIndex, Reader reader) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNClob(String columnLabel, NClob clob) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNClob(String columnLabel, Reader reader)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNString(int columnIndex, String string)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNString(String columnLabel, String string)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNull(int columnIndex) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateNull(String columnLabel) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateObject(int columnIndex, Object x, int scaleOrLength)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateObject(int columnIndex, Object x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateObject(String columnLabel, Object x, int scaleOrLength)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateObject(String columnLabel, Object x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateRef(int columnIndex, Ref x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateRef(String columnLabel, Ref x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateRow() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateShort(int columnIndex, short x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateShort(String columnLabel, short x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateString(int columnIndex, String x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateString(String columnLabel, String x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateTime(int columnIndex, Time x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateTime(String columnLabel, Time x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void updateTimestamp(String columnLabel, Timestamp x)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,1133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import java.io.Serializable;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.RequestMessage.ResultsMode;
-import org.teiid.client.RequestMessage.ShowPlan;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.client.metadata.ResultsMetadataConstants;
-import org.teiid.client.metadata.ResultsMetadataDefaults;
-import org.teiid.client.plan.Annotation;
-import org.teiid.client.plan.PlanNode;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.JDBCSQLTypeInfo;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.util.SqlUtil;
-import org.teiid.core.util.StringUtil;
-
-
-public class StatementImpl extends WrapperImpl implements TeiidStatement {
- private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
-
- // State constants
- protected static final int TIMED_OUT = 4;
- protected static final int CANCELLED = 3;
- protected static final int NO_TIMEOUT = 0;
-
- // integer indicating no maximum limit - used in some metadata-ish methods.
- private static final int NO_LIMIT = 0;
-
- //######## Configuration state #############
- private ConnectionImpl driverConnection;
- private Properties execProps;
-
- // fetch size value. This is the default fetch size used by the server
- private int fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
-
- // the fetch direction
- private int fetchDirection = ResultSet.FETCH_FORWARD;
-
- // the result set type
- private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
- private int resultSetConcurrency = ResultSet.CONCUR_READ_ONLY;
-
- //######## Processing state #############
-
- // boolean to indicate if this statement object is closed
- private boolean isClosed = false;
-
- // Differentiate timeout from cancel in blocking asynch operation
- protected int commandStatus = -1;
-
- // number of seconds for the query to timeout.
- protected int queryTimeout = NO_TIMEOUT;
-
- //########## Per-execution state ########
-
- // ID for current request
- protected long currentRequestID = -1;
-
- // the last query plan description
- private PlanNode currentPlanDescription;
-
- // the last query debug log
- private String debugLog;
-
- // the last query annotations
- private Collection<Annotation> annotations;
-
- // resultSet object produced by execute methods on the statement.
- protected ResultSetImpl resultSet;
-
- private List<Exception> serverWarnings;
-
- // the per-execution security payload
- private Serializable payload;
-
- /** List of INSERT, UPDATE, DELETE AND SELECT INTO commands */
- private List batchedUpdates;
-
- /** Array of update counts as returned by executeBatch() */
- protected int[] updateCounts;
-
- /** default Calendar instance for converting date/time/timestamp values */
- private Calendar defaultCalendar;
- /** Max rows to be returned by executing the statement */
- private int maxRows = NO_LIMIT;
- private int maxFieldSize = NO_LIMIT;
-
- /** SPIN_TIMEOUT determines how responsive asynch operations will be to
- * statement cancellation, closure, or execution timeouts.
- * 1/2 second was chosen as default.
- */
- private static int SPIN_TIMEOUT = 500;
-
- //Map<out/inout/return param index --> index in results>
- protected Map outParamIndexMap = new HashMap();
-
- private static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s*transaction))\\s*;?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s*(\\w+)\\s*(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- private static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s*(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- /**
- * Factory Constructor
- * @param driverConnection
- * @param resultSetType
- * @param resultSetConcurrency
- */
- static StatementImpl newInstance(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
- return new StatementImpl(driverConnection, resultSetType, resultSetConcurrency);
- }
-
- /**
- * MMStatement Constructor.
- * @param driverConnection
- * @param resultSetType
- * @param resultSetConcurrency
- */
- StatementImpl(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
- this.driverConnection = driverConnection;
- this.resultSetType = resultSetType;
- this.resultSetConcurrency = resultSetConcurrency;
- this.execProps = new Properties(this.driverConnection.getExecutionProperties());
-
- // Set initial fetch size
- String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
- if(fetchSizeStr != null) {
- try {
- this.fetchSize = Integer.parseInt(fetchSizeStr);
- } catch(Exception e) {
- // silently failover to default
- }
- }
- }
-
- protected DQP getDQP() {
- return this.driverConnection.getDQP();
- }
-
- protected ConnectionImpl getMMConnection() {
- return this.driverConnection;
- }
-
- protected TimeZone getServerTimeZone() throws SQLException {
- return this.driverConnection.getServerConnection().getLogonResult().getTimeZone();
- }
-
- /**
- * Reset all per-execution state - this should be done before executing
- * a new command.
- */
- protected void resetExecutionState() throws SQLException {
- this.currentRequestID = -1;
-
- this.currentPlanDescription = null;
- this.debugLog = null;
- this.annotations = null;
-
- if ( this.resultSet != null ) {
- this.resultSet.close();
- this.resultSet = null;
- }
-
- this.serverWarnings = null;
-
- this.batchedUpdates = null;
- this.updateCounts = null;
- this.outParamIndexMap.clear();
- }
-
- /**
- * Adds sql to this statement object's current list of commands.
- * @param sql statement to be added to the batch
- */
- public void addBatch(String sql) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (batchedUpdates == null) {
- batchedUpdates = new ArrayList();
- }
- batchedUpdates.add(sql);
- }
-
- /**
- * This method can be used by one thread to cancel a statement that is being
- * executed by another thread.
- * @throws SQLException should never occur.
- */
- public void cancel() throws SQLException {
- /* Defect 19848 - Mark the statement cancelled before sending the CANCEL request.
- * Otherwise, it's possible get into a race where the server response is quicker
- * than the exception in the exception in the conditionalWait(), which results in
- * the statement.executeQuery() call throwing the server's exception instead of the
- * one generated by the conditionalWait() method.
- */
- commandStatus = CANCELLED;
- cancelRequest();
- }
-
- /**
- * Warning could be schema validation errors or partial results warnings.
- * @throws SQLException should never occur.
- */
- public void clearWarnings() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- // clear all the warnings on this statement, after this, getWarnings() should return null
- serverWarnings = null;
- }
-
- /**
- * Makes the set of commands in the current batch empty.
- *
- * @throws SQLException if a database access error occurs or the
- * driver does not support batch statements
- */
- public void clearBatch() throws SQLException {
- batchedUpdates.clear();
- }
-
- /**
- * In many cases, it is desirable to immediately release a Statements's database
- * and JDBC resources instead of waiting for this to happen when it is automatically
- * closed; the close method provides this immediate release.
- * @throws SQLException should never occur.
- */
- public void close() throws SQLException {
- if ( isClosed ) {
- return;
- }
-
- // close the the server's statement object (if necessary)
- if(resultSet != null) {
- resultSet.close();
- resultSet = null;
- }
-
- isClosed = true;
-
- // Remove link from connection to statement
- this.driverConnection.closeStatement(this);
-
- logger.fine(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success")); //$NON-NLS-1$
- }
-
- /**
- * <p> This utility method checks if the jdbc statement is closed and
- * throws an exception if it is closed. </p>
- * @throws SQLException if the statement object is closed.
- */
- protected void checkStatement() throws TeiidSQLException {
- //Check to see the connection is closed and proceed if it is not
- if ( isClosed ) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Stmt_closed")); //$NON-NLS-1$
- }
- }
-
- @Override
- public boolean execute(String sql) throws SQLException {
- executeSql(new String[] {sql}, false, ResultsMode.EITHER);
- return hasResultSet();
- }
-
- @Override
- public int[] executeBatch() throws SQLException {
- if (batchedUpdates == null || batchedUpdates.isEmpty()) {
- return new int[0];
- }
- String[] commands = (String[])batchedUpdates.toArray(new String[batchedUpdates.size()]);
- executeSql(commands, true, ResultsMode.UPDATECOUNT);
- return updateCounts;
- }
-
- @Override
- public ResultSet executeQuery(String sql) throws SQLException {
- executeSql(new String[] {sql}, false, ResultsMode.RESULTSET);
- return resultSet;
- }
-
- @Override
- public int executeUpdate(String sql) throws SQLException {
- String[] commands = new String[] {sql};
- executeSql(commands, false, ResultsMode.UPDATECOUNT);
- return this.updateCounts[0];
- }
-
- protected boolean hasResultSet() throws SQLException {
- return resultSet != null && resultSet.getMetaData().getColumnCount() > 0;
- }
-
- protected void createResultSet(ResultsMessage resultsMsg) throws SQLException {
- //create out/return parameter index map if there is any
- List listOfParameters = resultsMsg.getParameters();
- if(listOfParameters != null){
- //get the size of result set
- int resultSetSize = 0;
- Iterator iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() == ParameterInfo.RESULT_SET){
- resultSetSize = parameter.getNumColumns();
- //one ResultSet only
- break;
- }
- }
-
- //return needs to be the first
- int index = 0; //index in user call - {?=call sp(?)}
- int count = 0;
- iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() == ParameterInfo.RETURN_VALUE){
- count++;
- index++;
- outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
- break;
- }
- }
-
- iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() != ParameterInfo.RETURN_VALUE && parameter.getType() != ParameterInfo.RESULT_SET){
- index++;
- if(parameter.getType() == ParameterInfo.OUT || parameter.getType() == ParameterInfo.INOUT){
- count++;
- outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
- }
- }
- }
- }
-
- resultSet = new ResultSetImpl(resultsMsg, this, null, outParamIndexMap.size());
- resultSet.setMaxFieldSize(this.maxFieldSize);
- }
-
- protected void executeSql(String[] commands, boolean isBatchedCommand, ResultsMode resultsMode)
- throws SQLException {
- checkStatement();
- resetExecutionState();
-
- if (commands.length == 1) {
- Matcher match = SET_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- if (resultsMode == ResultsMode.RESULTSET) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
- }
- String key = match.group(1);
- String value = match.group(2);
- if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
- this.getMMConnection().getServerConnection().cleanUp();
- } else {
- JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
- }
- this.updateCounts = new int[] {0};
- return;
- }
- match = TRANSACTION_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- if (resultsMode == ResultsMode.RESULTSET) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
- }
- String command = match.group(1);
- if (StringUtil.startsWithIgnoreCase(command, "start")) { //$NON-NLS-1$
- this.getConnection().setAutoCommit(false);
- } else if (command.equalsIgnoreCase("commit")) { //$NON-NLS-1$
- this.getConnection().setAutoCommit(true);
- } else if (command.equalsIgnoreCase("rollback")) { //$NON-NLS-1$
- this.getConnection().rollback(false);
- }
- this.updateCounts = new int[] {0};
- return;
- }
- match = SHOW_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- if (resultsMode == ResultsMode.UPDATECOUNT) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
- }
- String show = match.group(1);
- if (show.equalsIgnoreCase("PLAN")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- PlanNode plan = driverConnection.getCurrentPlanDescription();
- if (plan != null) {
- ArrayList<Object> row = new ArrayList<Object>(3);
- row.add(DataTypeTransformer.getClob(plan.toString()));
- row.add(new SQLXMLImpl(plan.toXml()));
- row.add(DataTypeTransformer.getClob(driverConnection.getDebugLog()));
- records.add(row);
- }
- createResultSet(records, new String[] {"PLAN_TEXT", "PLAN_XML", "DEBUG_LOG"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] {JDBCSQLTypeInfo.CLOB, JDBCSQLTypeInfo.XML, JDBCSQLTypeInfo.CLOB});
- return;
- }
- if (show.equalsIgnoreCase("ANNOTATIONS")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- Collection<Annotation> annos = driverConnection.getAnnotations();
- for (Annotation annotation : annos) {
- ArrayList<Object> row = new ArrayList<Object>(4);
- row.add(annotation.getCategory());
- row.add(annotation.getPriority().name());
- row.add(annotation.getAnnotation());
- row.add(annotation.getResolution());
- records.add(row);
- }
- createResultSet(records, new String[] {"CATEGORY", "PRIORITY", "ANNOTATION", "RESOLUTION"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
- return;
- }
- if (show.equalsIgnoreCase("ALL")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- for (String key : driverConnection.getExecutionProperties().stringPropertyNames()) {
- ArrayList<Object> row = new ArrayList<Object>(4);
- row.add(key);
- row.add(driverConnection.getExecutionProperties().get(key));
- records.add(row);
- }
- createResultSet(records, new String[] {"NAME", "VALUE"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
- return;
- }
- List<List<String>> records = Collections.singletonList(Collections.singletonList(driverConnection.getExecutionProperties().getProperty(JDBCURL.getValidKey(show))));
- createResultSet(records, new String[] {show}, new String[] {JDBCSQLTypeInfo.STRING});
- return;
- }
- }
-
- RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, resultsMode);
- ResultsMessage resultsMsg = null;
- try {
- resultsMsg = sendRequestMessageAndWait(reqMessage);
- } catch ( Throwable ex ) {
- String msg = JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", reqMessage.getCommandString()); //$NON-NLS-1$
- logger.log(ex instanceof SQLException?Level.WARNING:Level.SEVERE, msg, ex);
- throw TeiidSQLException.create(ex, msg);
- }
-
- // warnings thrown
- List resultsWarning = resultsMsg.getWarnings();
-
- setAnalysisInfo(resultsMsg);
-
- if (resultsMsg.getException() != null) {
- throw TeiidSQLException.create(resultsMsg.getException());
- }
-
- // save warnings if have any
- if (resultsWarning != null) {
- accumulateWarnings(resultsWarning);
- }
-
- if (resultsMsg.isUpdateResult()) {
- List[] results = resultsMsg.getResults();
- this.updateCounts = new int[results.length];
- for (int i = 0; i < results.length; i++) {
- updateCounts[i] = (Integer)results[i].get(0);
- }
-
- // In update scenarios close the statement implicitly
- try {
- getDQP().closeRequest(getCurrentRequestID());
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidComponentException e) {
- throw TeiidSQLException.create(e);
- }
- } else {
- createResultSet(resultsMsg);
- }
-
- logger.fine(JDBCPlugin.Util.getString("MMStatement.Success_query", reqMessage.getCommandString())); //$NON-NLS-1$
- }
-
- protected RequestMessage createRequestMessage(String[] commands,
- boolean isBatchedCommand, ResultsMode resultsMode) {
- RequestMessage reqMessage = new RequestMessage();
- reqMessage.setCommands(commands);
- reqMessage.setBatchedUpdate(isBatchedCommand);
- reqMessage.setResultsMode(resultsMode);
- return reqMessage;
- }
-
- /**
- * Retreives the fetch direction this Statement object set as a performance hint
- * to the driver. The int returned will be one of the following constants from
- * the ResultSet interface: FETCH_FORWARD, FETCH_REVERSE, or FETCH_UNKNOWN.
- * @return int value indicating the direction in which results need to be fetched
- * @throws SQLException should never occur.
- */
- public int getFetchDirection() throws SQLException {
- return this.fetchDirection;
- }
-
- /**
- * Retreives the fetch size this Statement object set as a performance hint
- * to the driver. This is the number of rows the server fetches at a time when
- * the result set needs more rows.
- * @return int value indicating the number of rows the server fetches
- * @throws SQLException should never occur.
- */
- public int getFetchSize() throws SQLException {
- return fetchSize;
- }
-
- /**
- * Retreives the maximum number of bytes that a result set column may contain.
- * @return int value giving the maximum size of a field
- * @throws SQLException should never occur.
- */
- public int getMaxFieldSize() throws SQLException {
- return maxFieldSize;
- }
-
- /**
- * Retrives the maximum number of rows that a ResultSet object may contain.
- * If the limit is exceeded the excess rows are dropped.
- * @return Max limit on rows on ResultSet.
- * @throws SQLException should never iccure.
- */
- public int getMaxRows() throws SQLException {
- return maxRows;
- }
-
- /**
- * Moves to this Statement object's next result, returns true if
- * it is a ResultSet object, and implicitly closes any current
- * ResultSet object(s) obtained with the method #getResultSet.
- * @return true if the next result is a ResultSet object;
- * false if it is an update count or there are no more results
- * @throws SQLException if there is an error in database.
- */
- public boolean getMoreResults() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- // close any current ResultSet
- if ( resultSet != null ) {
- resultSet.close();
- resultSet = null;
- }
- // set the existing update count to -1
- // indicating that there are no more results
- this.updateCounts = null;
- return false;
- }
-
- /**
- * Moves to this Statement object's next result, deals with any current
- * ResultSet object(s) according to the instructions specified by the
- * given flag, and returns true if the next result is a ResultSet object.
- * @param current flag that gives instruction on what should happen
- * to current ResultSet objects obtained using the method getResultSet(
- * CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS).
- * @return true if the next result is a ResultSet object; false if it
- * is an update count or there are no more results
- * @throws SQLException if there is an error in database.
- */
- public boolean getMoreResults(int current) throws SQLException {
- checkStatement();
-
- /*if (current == CLOSE_ALL_RESULTS || current == CLOSE_CURRENT_RESULT) {
- // since MetaMatrix only supports one ResultSet per statement,
- // these two cases are handled the same way.
- if (resultSet != null) {
- resultSet.close();
- }
- } else if (current == KEEP_CURRENT_RESULT) {
- // do nothing
- }
-
- rowsAffected = -1;
- */
- return false;
- }
-
-
- /**
- * Return the number of seconds the driver will wait for a statement object
- * to execute
- * @return int value giving the query timeout in seconds
- * @throws SQLException should never occur
- */
- public int getQueryTimeout() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- return this.queryTimeout;
- }
-
- /**
- * Returns a ResultSet object that was produced by a call to the method execute.
- * We currently do not support execute method which could return multiple result
- * sets.
- * @return ResultSet object giving the next available ResultSet
- * @throws SQLException should never occur
- */
- public ResultSet getResultSet() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (!hasResultSet()) {
- return null;
- }
- return resultSet;
- }
-
- /**
- * Retrieves the concurrency mode for the ResultSet objects generated from
- * queries that this Statement object executes. All ResultSets are currently
- * read only.
- * @return intvalue giving the ResultSet concurrency
- * @throws SQLException should never occur
- */
- public int getResultSetConcurrency() throws SQLException {
- return this.resultSetConcurrency;
- }
-
- /**
- * Retrieves the type of the ResultSet objects generated from queries that this
- * statement executes.
- * @return int value indicating the type of the ResultSet
- * @throws SQLException should never occur
- */
- public int getResultSetType() {
- return this.resultSetType;
- }
-
- /**
- * This method returns the number of rows affected by a statement modifying a table.
- * @return Number of rows affected.
- * @throws SQLException should never occur
- */
- public int getUpdateCount() throws SQLException {
- checkStatement();
- if (this.updateCounts == null) {
- return -1;
- }
- return this.updateCounts[0];
- }
-
- protected void accumulateWarnings(List<Exception> serverWarnings) {
- if (serverWarnings == null || serverWarnings.isEmpty()) {
- return;
- }
- if (this.serverWarnings == null) {
- this.serverWarnings = new ArrayList<Exception>();
- }
- this.serverWarnings.addAll(serverWarnings);
- }
-
- /**
- * This method returns warnings returned by server.
- * @return null value as there are no warnings
- * @throws SQLException should never occur
- */
- public SQLWarning getWarnings() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- if (serverWarnings != null && serverWarnings.size() != 0) {
- return WarningUtil.convertWarnings(serverWarnings);
- }
- return null;
- }
-
- /**
- * This method enbles/disables escape processing. When escape processing is
- * enabled the driver will scan any escape syntax and do escape substitution
- * before sending the escaped sql statement to the server
- * @param enable boolean value indicating if the escape processing should be turned on
- * @throws SQLException should never occur
- */
- public void setEscapeProcessing(boolean enable) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- // do nothing, escape processing is always enabled.
- }
-
- public void setFetchDirection(int direction) throws SQLException {
- checkStatement();
- }
-
- public void setFetchSize(int rows) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if ( rows < 0 ) {
- String msg = JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- // sets the fetch size on this statement
- if (rows == 0) {
- this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
- } else {
- this.fetchSize = rows;
- }
- }
-
- /**
- * Sets the limit on the maximum number of rows in a ResultSet object. This
- * method is currently implemented to throw an exception as it is not possible
- * to limit the number of rows.
- * @param maxRows int value indicating maximum rows that can be returned in a ResultSet
- */
- public void setMaxRows(int maxRows) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- this.maxRows = maxRows;
- }
-
- /**
- * This sets to seconds the time limit for the number of seconds for a driver
- * to wait for a statement object to be executed.
- * @param seconds Maximum number of seconds for a statement object to execute.
- * throws SQLException, should never occur
- */
- public void setQueryTimeout(int seconds) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (seconds >= 0) {
- queryTimeout = seconds;
- }
- else {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Bad_timeout_value")); //$NON-NLS-1$
- }
- }
-
- /**
- * Helper method for copy the connection properties to request message.
- * @param res Request message that these properties to be copied to.
- * @throws TeiidSQLException
- */
- protected void copyPropertiesToRequest(RequestMessage res) throws TeiidSQLException {
- // Get partial mode
- String partial = getExecutionProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
- res.setPartialResults(Boolean.valueOf(partial).booleanValue());
-
- // Get xml validation mode
- String validate = getExecutionProperty(ExecutionProperties.PROP_XML_VALIDATION);
- if(validate == null) {
- res.setValidationMode(false);
- } else {
- res.setValidationMode(Boolean.valueOf(validate).booleanValue());
- }
-
- // Get xml format mode
- String format = getExecutionProperty(ExecutionProperties.PROP_XML_FORMAT);
- res.setXMLFormat(format);
-
- // Get transaction auto-wrap mode
- String txnAutoWrapMode = getExecutionProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
- try {
- res.setTxnAutoWrapMode(txnAutoWrapMode);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- }
-
- // Get result set cache mode
- String rsCache = getExecutionProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
- res.setUseResultSetCache(Boolean.valueOf(rsCache).booleanValue());
-
- res.setAnsiQuotedIdentifiers(Boolean.valueOf(
- getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS))
- .booleanValue());
- String showPlan = getExecutionProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN);
- if (showPlan != null) {
- try {
- res.setShowPlan(ShowPlan.valueOf(showPlan.toUpperCase()));
- } catch (IllegalArgumentException e) {
-
- }
- }
- String noExec = getExecutionProperty(ExecutionProperties.NOEXEC);
- if (noExec != null) {
- res.setNoExec(noExec.equalsIgnoreCase("ON")); //$NON-NLS-1$
- }
- }
-
- /**
- * Ends the command and sets the status to TIMED_OUT.
- */
- protected void timeoutOccurred() {
- logger.warning(JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement.")); //$NON-NLS-1$
- try {
- cancel();
- commandStatus = TIMED_OUT;
- queryTimeout = NO_TIMEOUT;
- currentRequestID = -1;
- if (this.resultSet != null) {
- this.resultSet.close();
- }
- } catch (SQLException se) {
- logger.log(Level.SEVERE, JDBCPlugin.Util.getString("MMStatement.Error_timing_out."), se); //$NON-NLS-1$
- }
- }
-
- protected void cancelRequest() throws SQLException {
- checkStatement();
-
- try {
- this.getDQP().cancelRequest(currentRequestID);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidComponentException e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- /**
- * Set the per-statement security payload. This optional payload will
- * accompany each request to the data source(s) so that the connector
- * will have access to it.
- * <br>Once the payload is set, it will be used for each statment
- * execution until it is set to <code>null</code>, a new payload is set on
- * the statement or the statement is closed.</br>
- *
- * <p>To remove an existing payload from a statement, call this method
- * with a <code>null</code> argument.</p>
- * @param payload The payload that is to accompany requests executed
- * from this statement.
- * @since 4.2
- */
- public void setPayload(Serializable payload) {
- this.payload = payload;
- }
-
- public void setExecutionProperty(String name, String value) {
- this.execProps.setProperty(name, value);
- }
-
- public String getExecutionProperty(String name) {
- return this.execProps.getProperty(name);
- }
-
- /**
- * Send out request message with necessary states.
- */
- protected ResultsMessage sendRequestMessageAndWait(RequestMessage reqMsg)
- throws SQLException, InterruptedException {
- this.currentRequestID = this.driverConnection.nextRequestID();
- // Create a request message
- reqMsg.setExecutionPayload(this.payload);
- reqMsg.setCursorType(this.resultSetType);
- reqMsg.setFetchSize(this.fetchSize);
- reqMsg.setRowLimit(this.maxRows);
- reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
-
- // Get connection properties and set them onto request message
- copyPropertiesToRequest(reqMsg);
-
- reqMsg.setExecutionId(this.currentRequestID);
-
- Future<ResultsMessage> pendingResult = null;
- try {
- pendingResult = this.getDQP().executeRequest(this.currentRequestID, reqMsg);
- } catch (TeiidException e) {
- throw TeiidSQLException.create(e);
- }
- long timeoutMillis = queryTimeout * 1000;
- long endTime = System.currentTimeMillis() + timeoutMillis;
- ResultsMessage result = null;
- while (result == null) {
-
- if (timeoutMillis > 0 && endTime <= System.currentTimeMillis() && commandStatus != TIMED_OUT && commandStatus != CANCELLED) {
- timeoutOccurred();
- }
-
- checkStatement();
- try {
- result = pendingResult.get(SPIN_TIMEOUT, TimeUnit.MILLISECONDS);
- } catch (ExecutionException e) {
- throw TeiidSQLException.create(e);
- } catch (TimeoutException e) {
- continue;
- }
- }
-
- if (commandStatus == CANCELLED) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Cancel_before_execute")); //$NON-NLS-1$
- }
-
- if (commandStatus == TIMED_OUT) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Timeout_before_complete")); //$NON-NLS-1$
- }
- return result;
- }
-
- long getCurrentRequestID() {
- return this.currentRequestID;
- }
-
- /**
- * Get Query plan description.
- * If the Statement has a resultSet, we get the plan description from the result set
- * If that plan description is null, though, we return the very first plan description
- * that was created from the resultsMessage in the method: setAnalysisInfo.
- * The plan description from the result set can be null if the resultsMsg stored in the
- * result set hasn't been created when getPlanDescription is called.
- * @return Query plan description, if it exists, otherwise null
- */
- public PlanNode getPlanDescription() {
- if(this.resultSet != null) {
- return this.resultSet.getUpdatedPlanDescription();
- }
- if(currentPlanDescription != null) {
- return this.currentPlanDescription;
- }
- return null;
- }
-
- /**
- * Get query planner debug log.
- * @return Query planner debug log, or null if it doesn't exist
- */
- public String getDebugLog() {
- return this.debugLog;
- }
-
- /**
- * Get annotations
- * @return Query planner annotations - Collection of Annotation
- */
- public Collection<Annotation> getAnnotations() {
- return this.annotations;
- }
-
- public String getRequestIdentifier() {
- if(this.currentRequestID >= 0) {
- return Long.toString(this.currentRequestID);
- }
- return null;
- }
-
- /**
- * Check is the statement is closed. Used primarily by the unit tests.
- * @return true if the statement is closed; false otherwise.
- */
- public boolean isClosed() {
- return this.isClosed;
- }
-
- protected void setAnalysisInfo(ResultsMessage resultsMsg) {
- this.debugLog = resultsMsg.getDebugLog();
- this.currentPlanDescription = resultsMsg.getPlanDescription();
- this.annotations = resultsMsg.getAnnotations();
- this.driverConnection.setDebugLog(debugLog);
- this.driverConnection.setCurrentPlanDescription(currentPlanDescription);
- this.driverConnection.setAnnotations(annotations);
- }
-
- Calendar getDefaultCalendar() {
- if (defaultCalendar == null) {
- defaultCalendar = Calendar.getInstance();
- }
- return defaultCalendar;
- }
-
- void setDefaultCalendar(Calendar cal) {
- this.defaultCalendar = cal;
- }
-
- public boolean isPoolable() throws SQLException {
- checkStatement();
- return false;
- }
-
- public void setPoolable(boolean arg0) throws SQLException {
- checkStatement();
- }
-
- public ConnectionImpl getConnection() throws SQLException {
- return this.driverConnection;
- }
-
- public boolean execute(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean execute(String sql, int[] columnIndexes) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean execute(String sql, String[] columnNames)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, int[] columnIndexes)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, String[] columnNames)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public ResultSet getGeneratedKeys() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int getResultSetHoldability() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setCursorName(String name) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setMaxFieldSize(int max) throws SQLException {
- checkStatement();
- if ( max < 0 ) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_field_size", max)); //$NON-NLS-1$
- }
- this.maxFieldSize = max;
- }
-
- ResultSetImpl createResultSet(List records, String[] columnNames, String[] dataTypes) throws SQLException {
- Map[] metadata = new Map[columnNames.length];
- for (int i = 0; i < columnNames.length; i++) {
- metadata[i] = getColumnMetadata(null, columnNames[i], dataTypes[i], ResultsMetadataConstants.NULL_TYPES.UNKNOWN, driverConnection);
- }
- return createResultSet(records, metadata);
- }
-
- ResultSetImpl createResultSet(List records, Map[] columnMetadata) throws SQLException {
- ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata));
-
- return createResultSet(records, rsmd);
- }
-
- ResultSetImpl createResultSet(List records, ResultSetMetaData rsmd) throws SQLException {
- rsmd.getScale(1); //force the load of the metadata
- ResultsMessage resultsMsg = createDummyResultsMessage(null, null, records);
- resultSet = new ResultSetImpl(resultsMsg, this, rsmd, 0);
- resultSet.setMaxFieldSize(this.maxFieldSize);
- return resultSet;
- }
-
- static ResultsMessage createDummyResultsMessage(String[] columnNames, String[] dataTypes, List records) {
- ResultsMessage resultsMsg = new ResultsMessage();
- resultsMsg.setColumnNames(columnNames);
- resultsMsg.setDataTypes(dataTypes);
- resultsMsg.setFirstRow(1);
- resultsMsg.setLastRow(records.size());
- resultsMsg.setFinalRow(records.size());
- resultsMsg.setResults((List[])records.toArray(new List[records.size()]));
- return resultsMsg;
- }
-
- static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, ConnectionImpl driverConnection) throws SQLException {
- return getColumnMetadata(tableName, columnName, dataType, nullable, ResultsMetadataConstants.SEARCH_TYPES.UNSEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, driverConnection);
- }
-
- static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, Integer searchable, Boolean writable, Boolean signed, Boolean caseSensitive, ConnectionImpl driverConnection) throws SQLException {
-
- // map that would contain metadata details
- Map<Integer, Object> metadataMap = new HashMap<Integer, Object>();
-
- /*******************************************************
- HardCoding Column metadata details for the given column
- ********************************************************/
-
- metadataMap.put(ResultsMetadataConstants.VIRTUAL_DATABASE_NAME, driverConnection.getVDBName());
- metadataMap.put(ResultsMetadataConstants.GROUP_NAME, tableName);
- metadataMap.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
- metadataMap.put(ResultsMetadataConstants.DATA_TYPE, dataType);
- metadataMap.put(ResultsMetadataConstants.PRECISION, ResultsMetadataDefaults.getDefaultPrecision(dataType));
- metadataMap.put(ResultsMetadataConstants.RADIX, new Integer(10));
- metadataMap.put(ResultsMetadataConstants.SCALE, new Integer(0));
- metadataMap.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
- metadataMap.put(ResultsMetadataConstants.CASE_SENSITIVE, caseSensitive);
- metadataMap.put(ResultsMetadataConstants.NULLABLE, nullable);
- metadataMap.put(ResultsMetadataConstants.SEARCHABLE, searchable);
- metadataMap.put(ResultsMetadataConstants.SIGNED, signed);
- metadataMap.put(ResultsMetadataConstants.WRITABLE, writable);
- metadataMap.put(ResultsMetadataConstants.CURRENCY, Boolean.FALSE);
- metadataMap.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.getMaxDisplaySize(dataType));
-
- return metadataMap;
- }
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java (from rev 2885, branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,1140 @@
+/*
+ * 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.jdbc;
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.RequestMessage.ResultsMode;
+import org.teiid.client.RequestMessage.ShowPlan;
+import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.metadata.ResultsMetadataConstants;
+import org.teiid.client.metadata.ResultsMetadataDefaults;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.JDBCSQLTypeInfo;
+import org.teiid.core.types.SQLXMLImpl;
+import org.teiid.core.util.SqlUtil;
+import org.teiid.core.util.StringUtil;
+
+
+public class StatementImpl extends WrapperImpl implements TeiidStatement {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
+
+ // State constants
+ protected static final int TIMED_OUT = 4;
+ protected static final int CANCELLED = 3;
+ protected static final int NO_TIMEOUT = 0;
+
+ // integer indicating no maximum limit - used in some metadata-ish methods.
+ private static final int NO_LIMIT = 0;
+
+ //######## Configuration state #############
+ private ConnectionImpl driverConnection;
+ private Properties execProps;
+
+ // fetch size value. This is the default fetch size used by the server
+ private int fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
+
+ // the fetch direction
+ private int fetchDirection = ResultSet.FETCH_FORWARD;
+
+ // the result set type
+ private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
+ private int resultSetConcurrency = ResultSet.CONCUR_READ_ONLY;
+
+ //######## Processing state #############
+
+ // boolean to indicate if this statement object is closed
+ private boolean isClosed = false;
+
+ // Differentiate timeout from cancel in blocking asynch operation
+ protected int commandStatus = -1;
+
+ // number of seconds for the query to timeout.
+ protected int queryTimeout = NO_TIMEOUT;
+
+ //########## Per-execution state ########
+
+ // ID for current request
+ protected long currentRequestID = -1;
+
+ // the last query plan description
+ private PlanNode currentPlanDescription;
+
+ // the last query debug log
+ private String debugLog;
+
+ // the last query annotations
+ private Collection<Annotation> annotations;
+
+ // resultSet object produced by execute methods on the statement.
+ protected ResultSetImpl resultSet;
+
+ private List<Exception> serverWarnings;
+
+ // the per-execution security payload
+ private Serializable payload;
+
+ /** List of INSERT, UPDATE, DELETE AND SELECT INTO commands */
+ private List batchedUpdates;
+
+ /** Array of update counts as returned by executeBatch() */
+ protected int[] updateCounts;
+
+ /** default Calendar instance for converting date/time/timestamp values */
+ private Calendar defaultCalendar;
+ /** Max rows to be returned by executing the statement */
+ private int maxRows = NO_LIMIT;
+ private int maxFieldSize = NO_LIMIT;
+
+ /** SPIN_TIMEOUT determines how responsive asynch operations will be to
+ * statement cancellation, closure, or execution timeouts.
+ * 1/2 second was chosen as default.
+ */
+ private static int SPIN_TIMEOUT = 500;
+
+ //Map<out/inout/return param index --> index in results>
+ protected Map outParamIndexMap = new HashMap();
+
+ private static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s*transaction))\\s*;?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s*(\\w+)\\s*(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ private static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s*(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ /**
+ * Factory Constructor
+ * @param driverConnection
+ * @param resultSetType
+ * @param resultSetConcurrency
+ */
+ static StatementImpl newInstance(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
+ return new StatementImpl(driverConnection, resultSetType, resultSetConcurrency);
+ }
+
+ /**
+ * MMStatement Constructor.
+ * @param driverConnection
+ * @param resultSetType
+ * @param resultSetConcurrency
+ */
+ StatementImpl(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
+ this.driverConnection = driverConnection;
+ this.resultSetType = resultSetType;
+ this.resultSetConcurrency = resultSetConcurrency;
+ this.execProps = new Properties(this.driverConnection.getExecutionProperties());
+
+ // Set initial fetch size
+ String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
+ if(fetchSizeStr != null) {
+ try {
+ this.fetchSize = Integer.parseInt(fetchSizeStr);
+ } catch(Exception e) {
+ // silently failover to default
+ }
+ }
+ }
+
+ protected DQP getDQP() {
+ return this.driverConnection.getDQP();
+ }
+
+ protected ConnectionImpl getMMConnection() {
+ return this.driverConnection;
+ }
+
+ protected TimeZone getServerTimeZone() throws SQLException {
+ return this.driverConnection.getServerConnection().getLogonResult().getTimeZone();
+ }
+
+ /**
+ * Reset all per-execution state - this should be done before executing
+ * a new command.
+ */
+ protected void resetExecutionState() throws SQLException {
+ this.currentRequestID = -1;
+
+ this.currentPlanDescription = null;
+ this.debugLog = null;
+ this.annotations = null;
+
+ if ( this.resultSet != null ) {
+ this.resultSet.close();
+ this.resultSet = null;
+ }
+
+ this.serverWarnings = null;
+
+ this.batchedUpdates = null;
+ this.updateCounts = null;
+ this.outParamIndexMap.clear();
+ }
+
+ /**
+ * Adds sql to this statement object's current list of commands.
+ * @param sql statement to be added to the batch
+ */
+ public void addBatch(String sql) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (batchedUpdates == null) {
+ batchedUpdates = new ArrayList();
+ }
+ batchedUpdates.add(sql);
+ }
+
+ /**
+ * This method can be used by one thread to cancel a statement that is being
+ * executed by another thread.
+ * @throws SQLException should never occur.
+ */
+ public void cancel() throws SQLException {
+ /* Defect 19848 - Mark the statement cancelled before sending the CANCEL request.
+ * Otherwise, it's possible get into a race where the server response is quicker
+ * than the exception in the exception in the conditionalWait(), which results in
+ * the statement.executeQuery() call throwing the server's exception instead of the
+ * one generated by the conditionalWait() method.
+ */
+ commandStatus = CANCELLED;
+ cancelRequest();
+ }
+
+ /**
+ * Warning could be schema validation errors or partial results warnings.
+ * @throws SQLException should never occur.
+ */
+ public void clearWarnings() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ // clear all the warnings on this statement, after this, getWarnings() should return null
+ serverWarnings = null;
+ }
+
+ /**
+ * Makes the set of commands in the current batch empty.
+ *
+ * @throws SQLException if a database access error occurs or the
+ * driver does not support batch statements
+ */
+ public void clearBatch() throws SQLException {
+ batchedUpdates.clear();
+ }
+
+ /**
+ * In many cases, it is desirable to immediately release a Statements's database
+ * and JDBC resources instead of waiting for this to happen when it is automatically
+ * closed; the close method provides this immediate release.
+ * @throws SQLException should never occur.
+ */
+ public void close() throws SQLException {
+ if ( isClosed ) {
+ return;
+ }
+
+ // close the the server's statement object (if necessary)
+ if(resultSet != null) {
+ resultSet.close();
+ resultSet = null;
+ }
+
+ isClosed = true;
+
+ // Remove link from connection to statement
+ this.driverConnection.closeStatement(this);
+
+ logger.fine(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p> This utility method checks if the jdbc statement is closed and
+ * throws an exception if it is closed. </p>
+ * @throws SQLException if the statement object is closed.
+ */
+ protected void checkStatement() throws TeiidSQLException {
+ //Check to see the connection is closed and proceed if it is not
+ if ( isClosed ) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Stmt_closed")); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public boolean execute(String sql) throws SQLException {
+ executeSql(new String[] {sql}, false, ResultsMode.EITHER);
+ return hasResultSet();
+ }
+
+ @Override
+ public int[] executeBatch() throws SQLException {
+ if (batchedUpdates == null || batchedUpdates.isEmpty()) {
+ return new int[0];
+ }
+ String[] commands = (String[])batchedUpdates.toArray(new String[batchedUpdates.size()]);
+ executeSql(commands, true, ResultsMode.UPDATECOUNT);
+ return updateCounts;
+ }
+
+ @Override
+ public ResultSet executeQuery(String sql) throws SQLException {
+ executeSql(new String[] {sql}, false, ResultsMode.RESULTSET);
+ return resultSet;
+ }
+
+ @Override
+ public int executeUpdate(String sql) throws SQLException {
+ String[] commands = new String[] {sql};
+ executeSql(commands, false, ResultsMode.UPDATECOUNT);
+ return this.updateCounts[0];
+ }
+
+ protected boolean hasResultSet() throws SQLException {
+ return resultSet != null && resultSet.getMetaData().getColumnCount() > 0;
+ }
+
+ protected void createResultSet(ResultsMessage resultsMsg) throws SQLException {
+ //create out/return parameter index map if there is any
+ List listOfParameters = resultsMsg.getParameters();
+ if(listOfParameters != null){
+ //get the size of result set
+ int resultSetSize = 0;
+ Iterator iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() == ParameterInfo.RESULT_SET){
+ resultSetSize = parameter.getNumColumns();
+ //one ResultSet only
+ break;
+ }
+ }
+
+ //return needs to be the first
+ int index = 0; //index in user call - {?=call sp(?)}
+ int count = 0;
+ iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() == ParameterInfo.RETURN_VALUE){
+ count++;
+ index++;
+ outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
+ break;
+ }
+ }
+
+ iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() != ParameterInfo.RETURN_VALUE && parameter.getType() != ParameterInfo.RESULT_SET){
+ index++;
+ if(parameter.getType() == ParameterInfo.OUT || parameter.getType() == ParameterInfo.INOUT){
+ count++;
+ outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
+ }
+ }
+ }
+ }
+
+ resultSet = new ResultSetImpl(resultsMsg, this, null, outParamIndexMap.size());
+ resultSet.setMaxFieldSize(this.maxFieldSize);
+ }
+
+ protected void executeSql(String[] commands, boolean isBatchedCommand, ResultsMode resultsMode)
+ throws SQLException {
+ checkStatement();
+ resetExecutionState();
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Executing: requestID " + getCurrentRequestID() + " commands: " + Arrays.toString(commands) + " expecting: " + resultsMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if (commands.length == 1) {
+ Matcher match = SET_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ if (resultsMode == ResultsMode.RESULTSET) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
+ }
+ String key = match.group(1);
+ String value = match.group(2);
+ if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
+ this.getMMConnection().getServerConnection().cleanUp();
+ } else {
+ JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
+ }
+ this.updateCounts = new int[] {0};
+ return;
+ }
+ match = TRANSACTION_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ logger.finer("Executing as transaction statement"); //$NON-NLS-1$
+ if (resultsMode == ResultsMode.RESULTSET) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
+ }
+ String command = match.group(1);
+ if (StringUtil.startsWithIgnoreCase(command, "start")) { //$NON-NLS-1$
+ this.getConnection().setAutoCommit(false);
+ } else if (command.equalsIgnoreCase("commit")) { //$NON-NLS-1$
+ this.getConnection().setAutoCommit(true);
+ } else if (command.equalsIgnoreCase("rollback")) { //$NON-NLS-1$
+ this.getConnection().rollback(false);
+ }
+ this.updateCounts = new int[] {0};
+ return;
+ }
+ match = SHOW_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ logger.finer("Executing as show statement"); //$NON-NLS-1$
+ if (resultsMode == ResultsMode.UPDATECOUNT) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
+ }
+ String show = match.group(1);
+ if (show.equalsIgnoreCase("PLAN")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ PlanNode plan = driverConnection.getCurrentPlanDescription();
+ if (plan != null) {
+ ArrayList<Object> row = new ArrayList<Object>(3);
+ row.add(DataTypeTransformer.getClob(plan.toString()));
+ row.add(new SQLXMLImpl(plan.toXml()));
+ row.add(DataTypeTransformer.getClob(driverConnection.getDebugLog()));
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"PLAN_TEXT", "PLAN_XML", "DEBUG_LOG"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] {JDBCSQLTypeInfo.CLOB, JDBCSQLTypeInfo.XML, JDBCSQLTypeInfo.CLOB});
+ return;
+ }
+ if (show.equalsIgnoreCase("ANNOTATIONS")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ Collection<Annotation> annos = driverConnection.getAnnotations();
+ for (Annotation annotation : annos) {
+ ArrayList<Object> row = new ArrayList<Object>(4);
+ row.add(annotation.getCategory());
+ row.add(annotation.getPriority().name());
+ row.add(annotation.getAnnotation());
+ row.add(annotation.getResolution());
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"CATEGORY", "PRIORITY", "ANNOTATION", "RESOLUTION"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
+ return;
+ }
+ if (show.equalsIgnoreCase("ALL")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ for (String key : driverConnection.getExecutionProperties().stringPropertyNames()) {
+ ArrayList<Object> row = new ArrayList<Object>(4);
+ row.add(key);
+ row.add(driverConnection.getExecutionProperties().get(key));
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"NAME", "VALUE"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
+ return;
+ }
+ List<List<String>> records = Collections.singletonList(Collections.singletonList(driverConnection.getExecutionProperties().getProperty(JDBCURL.getValidKey(show))));
+ createResultSet(records, new String[] {show}, new String[] {JDBCSQLTypeInfo.STRING});
+ return;
+ }
+ }
+
+ RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, resultsMode);
+ ResultsMessage resultsMsg = null;
+ try {
+ resultsMsg = sendRequestMessageAndWait(reqMessage);
+ } catch ( Throwable ex ) {
+ String msg = JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", reqMessage.getCommandString()); //$NON-NLS-1$
+ logger.log(ex instanceof SQLException?Level.WARNING:Level.SEVERE, msg, ex);
+ throw TeiidSQLException.create(ex, msg);
+ }
+
+ // warnings thrown
+ List resultsWarning = resultsMsg.getWarnings();
+
+ setAnalysisInfo(resultsMsg);
+
+ if (resultsMsg.getException() != null) {
+ throw TeiidSQLException.create(resultsMsg.getException());
+ }
+
+ // save warnings if have any
+ if (resultsWarning != null) {
+ accumulateWarnings(resultsWarning);
+ }
+
+ if (resultsMsg.isUpdateResult()) {
+ List[] results = resultsMsg.getResults();
+ this.updateCounts = new int[results.length];
+ for (int i = 0; i < results.length; i++) {
+ updateCounts[i] = (Integer)results[i].get(0);
+ }
+ if (logger.isLoggable(Level.FINER)) {
+ logger.fine(JDBCPlugin.Util.getString("Recieved update counts: " + Arrays.toString(updateCounts))); //$NON-NLS-1$
+ }
+ // In update scenarios close the statement implicitly
+ try {
+ getDQP().closeRequest(getCurrentRequestID());
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidComponentException e) {
+ throw TeiidSQLException.create(e);
+ }
+ } else {
+ createResultSet(resultsMsg);
+ }
+
+ logger.fine(JDBCPlugin.Util.getString("MMStatement.Success_query", reqMessage.getCommandString())); //$NON-NLS-1$
+ }
+
+ protected RequestMessage createRequestMessage(String[] commands,
+ boolean isBatchedCommand, ResultsMode resultsMode) {
+ RequestMessage reqMessage = new RequestMessage();
+ reqMessage.setCommands(commands);
+ reqMessage.setBatchedUpdate(isBatchedCommand);
+ reqMessage.setResultsMode(resultsMode);
+ return reqMessage;
+ }
+
+ /**
+ * Retreives the fetch direction this Statement object set as a performance hint
+ * to the driver. The int returned will be one of the following constants from
+ * the ResultSet interface: FETCH_FORWARD, FETCH_REVERSE, or FETCH_UNKNOWN.
+ * @return int value indicating the direction in which results need to be fetched
+ * @throws SQLException should never occur.
+ */
+ public int getFetchDirection() throws SQLException {
+ return this.fetchDirection;
+ }
+
+ /**
+ * Retreives the fetch size this Statement object set as a performance hint
+ * to the driver. This is the number of rows the server fetches at a time when
+ * the result set needs more rows.
+ * @return int value indicating the number of rows the server fetches
+ * @throws SQLException should never occur.
+ */
+ public int getFetchSize() throws SQLException {
+ return fetchSize;
+ }
+
+ /**
+ * Retreives the maximum number of bytes that a result set column may contain.
+ * @return int value giving the maximum size of a field
+ * @throws SQLException should never occur.
+ */
+ public int getMaxFieldSize() throws SQLException {
+ return maxFieldSize;
+ }
+
+ /**
+ * Retrives the maximum number of rows that a ResultSet object may contain.
+ * If the limit is exceeded the excess rows are dropped.
+ * @return Max limit on rows on ResultSet.
+ * @throws SQLException should never iccure.
+ */
+ public int getMaxRows() throws SQLException {
+ return maxRows;
+ }
+
+ /**
+ * Moves to this Statement object's next result, returns true if
+ * it is a ResultSet object, and implicitly closes any current
+ * ResultSet object(s) obtained with the method #getResultSet.
+ * @return true if the next result is a ResultSet object;
+ * false if it is an update count or there are no more results
+ * @throws SQLException if there is an error in database.
+ */
+ public boolean getMoreResults() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ // close any current ResultSet
+ if ( resultSet != null ) {
+ resultSet.close();
+ resultSet = null;
+ }
+ // set the existing update count to -1
+ // indicating that there are no more results
+ this.updateCounts = null;
+ return false;
+ }
+
+ /**
+ * Moves to this Statement object's next result, deals with any current
+ * ResultSet object(s) according to the instructions specified by the
+ * given flag, and returns true if the next result is a ResultSet object.
+ * @param current flag that gives instruction on what should happen
+ * to current ResultSet objects obtained using the method getResultSet(
+ * CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS).
+ * @return true if the next result is a ResultSet object; false if it
+ * is an update count or there are no more results
+ * @throws SQLException if there is an error in database.
+ */
+ public boolean getMoreResults(int current) throws SQLException {
+ checkStatement();
+
+ /*if (current == CLOSE_ALL_RESULTS || current == CLOSE_CURRENT_RESULT) {
+ // since MetaMatrix only supports one ResultSet per statement,
+ // these two cases are handled the same way.
+ if (resultSet != null) {
+ resultSet.close();
+ }
+ } else if (current == KEEP_CURRENT_RESULT) {
+ // do nothing
+ }
+
+ rowsAffected = -1;
+ */
+ return false;
+ }
+
+
+ /**
+ * Return the number of seconds the driver will wait for a statement object
+ * to execute
+ * @return int value giving the query timeout in seconds
+ * @throws SQLException should never occur
+ */
+ public int getQueryTimeout() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ return this.queryTimeout;
+ }
+
+ /**
+ * Returns a ResultSet object that was produced by a call to the method execute.
+ * We currently do not support execute method which could return multiple result
+ * sets.
+ * @return ResultSet object giving the next available ResultSet
+ * @throws SQLException should never occur
+ */
+ public ResultSet getResultSet() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (!hasResultSet()) {
+ return null;
+ }
+ return resultSet;
+ }
+
+ /**
+ * Retrieves the concurrency mode for the ResultSet objects generated from
+ * queries that this Statement object executes. All ResultSets are currently
+ * read only.
+ * @return intvalue giving the ResultSet concurrency
+ * @throws SQLException should never occur
+ */
+ public int getResultSetConcurrency() throws SQLException {
+ return this.resultSetConcurrency;
+ }
+
+ /**
+ * Retrieves the type of the ResultSet objects generated from queries that this
+ * statement executes.
+ * @return int value indicating the type of the ResultSet
+ * @throws SQLException should never occur
+ */
+ public int getResultSetType() {
+ return this.resultSetType;
+ }
+
+ /**
+ * This method returns the number of rows affected by a statement modifying a table.
+ * @return Number of rows affected.
+ * @throws SQLException should never occur
+ */
+ public int getUpdateCount() throws SQLException {
+ checkStatement();
+ if (this.updateCounts == null) {
+ return -1;
+ }
+ return this.updateCounts[0];
+ }
+
+ protected void accumulateWarnings(List<Exception> serverWarnings) {
+ if (serverWarnings == null || serverWarnings.isEmpty()) {
+ return;
+ }
+ if (this.serverWarnings == null) {
+ this.serverWarnings = new ArrayList<Exception>();
+ }
+ this.serverWarnings.addAll(serverWarnings);
+ }
+
+ /**
+ * This method returns warnings returned by server.
+ * @return null value as there are no warnings
+ * @throws SQLException should never occur
+ */
+ public SQLWarning getWarnings() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ if (serverWarnings != null && serverWarnings.size() != 0) {
+ return WarningUtil.convertWarnings(serverWarnings);
+ }
+ return null;
+ }
+
+ /**
+ * This method enbles/disables escape processing. When escape processing is
+ * enabled the driver will scan any escape syntax and do escape substitution
+ * before sending the escaped sql statement to the server
+ * @param enable boolean value indicating if the escape processing should be turned on
+ * @throws SQLException should never occur
+ */
+ public void setEscapeProcessing(boolean enable) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ // do nothing, escape processing is always enabled.
+ }
+
+ public void setFetchDirection(int direction) throws SQLException {
+ checkStatement();
+ }
+
+ public void setFetchSize(int rows) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if ( rows < 0 ) {
+ String msg = JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ // sets the fetch size on this statement
+ if (rows == 0) {
+ this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
+ } else {
+ this.fetchSize = rows;
+ }
+ }
+
+ /**
+ * Sets the limit on the maximum number of rows in a ResultSet object. This
+ * method is currently implemented to throw an exception as it is not possible
+ * to limit the number of rows.
+ * @param maxRows int value indicating maximum rows that can be returned in a ResultSet
+ */
+ public void setMaxRows(int maxRows) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ this.maxRows = maxRows;
+ }
+
+ /**
+ * This sets to seconds the time limit for the number of seconds for a driver
+ * to wait for a statement object to be executed.
+ * @param seconds Maximum number of seconds for a statement object to execute.
+ * throws SQLException, should never occur
+ */
+ public void setQueryTimeout(int seconds) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (seconds >= 0) {
+ queryTimeout = seconds;
+ }
+ else {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Bad_timeout_value")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Helper method for copy the connection properties to request message.
+ * @param res Request message that these properties to be copied to.
+ * @throws TeiidSQLException
+ */
+ protected void copyPropertiesToRequest(RequestMessage res) throws TeiidSQLException {
+ // Get partial mode
+ String partial = getExecutionProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
+ res.setPartialResults(Boolean.valueOf(partial).booleanValue());
+
+ // Get xml validation mode
+ String validate = getExecutionProperty(ExecutionProperties.PROP_XML_VALIDATION);
+ if(validate == null) {
+ res.setValidationMode(false);
+ } else {
+ res.setValidationMode(Boolean.valueOf(validate).booleanValue());
+ }
+
+ // Get xml format mode
+ String format = getExecutionProperty(ExecutionProperties.PROP_XML_FORMAT);
+ res.setXMLFormat(format);
+
+ // Get transaction auto-wrap mode
+ String txnAutoWrapMode = getExecutionProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
+ try {
+ res.setTxnAutoWrapMode(txnAutoWrapMode);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ }
+
+ // Get result set cache mode
+ String rsCache = getExecutionProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
+ res.setUseResultSetCache(Boolean.valueOf(rsCache).booleanValue());
+
+ res.setAnsiQuotedIdentifiers(Boolean.valueOf(
+ getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS))
+ .booleanValue());
+ String showPlan = getExecutionProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN);
+ if (showPlan != null) {
+ try {
+ res.setShowPlan(ShowPlan.valueOf(showPlan.toUpperCase()));
+ } catch (IllegalArgumentException e) {
+
+ }
+ }
+ String noExec = getExecutionProperty(ExecutionProperties.NOEXEC);
+ if (noExec != null) {
+ res.setNoExec(noExec.equalsIgnoreCase("ON")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Ends the command and sets the status to TIMED_OUT.
+ */
+ protected void timeoutOccurred() {
+ logger.warning(JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement.")); //$NON-NLS-1$
+ try {
+ cancel();
+ commandStatus = TIMED_OUT;
+ queryTimeout = NO_TIMEOUT;
+ currentRequestID = -1;
+ if (this.resultSet != null) {
+ this.resultSet.close();
+ }
+ } catch (SQLException se) {
+ logger.log(Level.SEVERE, JDBCPlugin.Util.getString("MMStatement.Error_timing_out."), se); //$NON-NLS-1$
+ }
+ }
+
+ protected void cancelRequest() throws SQLException {
+ checkStatement();
+
+ try {
+ this.getDQP().cancelRequest(currentRequestID);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidComponentException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ /**
+ * Set the per-statement security payload. This optional payload will
+ * accompany each request to the data source(s) so that the connector
+ * will have access to it.
+ * <br>Once the payload is set, it will be used for each statment
+ * execution until it is set to <code>null</code>, a new payload is set on
+ * the statement or the statement is closed.</br>
+ *
+ * <p>To remove an existing payload from a statement, call this method
+ * with a <code>null</code> argument.</p>
+ * @param payload The payload that is to accompany requests executed
+ * from this statement.
+ * @since 4.2
+ */
+ public void setPayload(Serializable payload) {
+ this.payload = payload;
+ }
+
+ public void setExecutionProperty(String name, String value) {
+ this.execProps.setProperty(name, value);
+ }
+
+ public String getExecutionProperty(String name) {
+ return this.execProps.getProperty(name);
+ }
+
+ /**
+ * Send out request message with necessary states.
+ */
+ protected ResultsMessage sendRequestMessageAndWait(RequestMessage reqMsg)
+ throws SQLException, InterruptedException {
+ this.currentRequestID = this.driverConnection.nextRequestID();
+ // Create a request message
+ reqMsg.setExecutionPayload(this.payload);
+ reqMsg.setCursorType(this.resultSetType);
+ reqMsg.setFetchSize(this.fetchSize);
+ reqMsg.setRowLimit(this.maxRows);
+ reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
+
+ // Get connection properties and set them onto request message
+ copyPropertiesToRequest(reqMsg);
+
+ reqMsg.setExecutionId(this.currentRequestID);
+
+ Future<ResultsMessage> pendingResult = null;
+ try {
+ pendingResult = this.getDQP().executeRequest(this.currentRequestID, reqMsg);
+ } catch (TeiidException e) {
+ throw TeiidSQLException.create(e);
+ }
+ long timeoutMillis = queryTimeout * 1000;
+ long endTime = System.currentTimeMillis() + timeoutMillis;
+ ResultsMessage result = null;
+ while (result == null) {
+
+ if (timeoutMillis > 0 && endTime <= System.currentTimeMillis() && commandStatus != TIMED_OUT && commandStatus != CANCELLED) {
+ timeoutOccurred();
+ }
+
+ checkStatement();
+ try {
+ result = pendingResult.get(SPIN_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TimeoutException e) {
+ continue;
+ }
+ }
+
+ if (commandStatus == CANCELLED) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Cancel_before_execute")); //$NON-NLS-1$
+ }
+
+ if (commandStatus == TIMED_OUT) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Timeout_before_complete")); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ long getCurrentRequestID() {
+ return this.currentRequestID;
+ }
+
+ /**
+ * Get Query plan description.
+ * If the Statement has a resultSet, we get the plan description from the result set
+ * If that plan description is null, though, we return the very first plan description
+ * that was created from the resultsMessage in the method: setAnalysisInfo.
+ * The plan description from the result set can be null if the resultsMsg stored in the
+ * result set hasn't been created when getPlanDescription is called.
+ * @return Query plan description, if it exists, otherwise null
+ */
+ public PlanNode getPlanDescription() {
+ if(this.resultSet != null) {
+ return this.resultSet.getUpdatedPlanDescription();
+ }
+ if(currentPlanDescription != null) {
+ return this.currentPlanDescription;
+ }
+ return null;
+ }
+
+ /**
+ * Get query planner debug log.
+ * @return Query planner debug log, or null if it doesn't exist
+ */
+ public String getDebugLog() {
+ return this.debugLog;
+ }
+
+ /**
+ * Get annotations
+ * @return Query planner annotations - Collection of Annotation
+ */
+ public Collection<Annotation> getAnnotations() {
+ return this.annotations;
+ }
+
+ public String getRequestIdentifier() {
+ if(this.currentRequestID >= 0) {
+ return Long.toString(this.currentRequestID);
+ }
+ return null;
+ }
+
+ /**
+ * Check is the statement is closed. Used primarily by the unit tests.
+ * @return true if the statement is closed; false otherwise.
+ */
+ public boolean isClosed() {
+ return this.isClosed;
+ }
+
+ protected void setAnalysisInfo(ResultsMessage resultsMsg) {
+ this.debugLog = resultsMsg.getDebugLog();
+ this.currentPlanDescription = resultsMsg.getPlanDescription();
+ this.annotations = resultsMsg.getAnnotations();
+ this.driverConnection.setDebugLog(debugLog);
+ this.driverConnection.setCurrentPlanDescription(currentPlanDescription);
+ this.driverConnection.setAnnotations(annotations);
+ }
+
+ Calendar getDefaultCalendar() {
+ if (defaultCalendar == null) {
+ defaultCalendar = Calendar.getInstance();
+ }
+ return defaultCalendar;
+ }
+
+ void setDefaultCalendar(Calendar cal) {
+ this.defaultCalendar = cal;
+ }
+
+ public boolean isPoolable() throws SQLException {
+ checkStatement();
+ return false;
+ }
+
+ public void setPoolable(boolean arg0) throws SQLException {
+ checkStatement();
+ }
+
+ public ConnectionImpl getConnection() throws SQLException {
+ return this.driverConnection;
+ }
+
+ public boolean execute(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean execute(String sql, int[] columnIndexes) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean execute(String sql, String[] columnNames)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, int[] columnIndexes)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, String[] columnNames)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public ResultSet getGeneratedKeys() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int getResultSetHoldability() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setCursorName(String name) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setMaxFieldSize(int max) throws SQLException {
+ checkStatement();
+ if ( max < 0 ) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_field_size", max)); //$NON-NLS-1$
+ }
+ this.maxFieldSize = max;
+ }
+
+ ResultSetImpl createResultSet(List records, String[] columnNames, String[] dataTypes) throws SQLException {
+ Map[] metadata = new Map[columnNames.length];
+ for (int i = 0; i < columnNames.length; i++) {
+ metadata[i] = getColumnMetadata(null, columnNames[i], dataTypes[i], ResultsMetadataConstants.NULL_TYPES.UNKNOWN, driverConnection);
+ }
+ return createResultSet(records, metadata);
+ }
+
+ ResultSetImpl createResultSet(List records, Map[] columnMetadata) throws SQLException {
+ ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata));
+
+ return createResultSet(records, rsmd);
+ }
+
+ ResultSetImpl createResultSet(List records, ResultSetMetaData rsmd) throws SQLException {
+ rsmd.getScale(1); //force the load of the metadata
+ ResultsMessage resultsMsg = createDummyResultsMessage(null, null, records);
+ resultSet = new ResultSetImpl(resultsMsg, this, rsmd, 0);
+ resultSet.setMaxFieldSize(this.maxFieldSize);
+ return resultSet;
+ }
+
+ static ResultsMessage createDummyResultsMessage(String[] columnNames, String[] dataTypes, List records) {
+ ResultsMessage resultsMsg = new ResultsMessage();
+ resultsMsg.setColumnNames(columnNames);
+ resultsMsg.setDataTypes(dataTypes);
+ resultsMsg.setFirstRow(1);
+ resultsMsg.setLastRow(records.size());
+ resultsMsg.setFinalRow(records.size());
+ resultsMsg.setResults((List[])records.toArray(new List[records.size()]));
+ return resultsMsg;
+ }
+
+ static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, ConnectionImpl driverConnection) throws SQLException {
+ return getColumnMetadata(tableName, columnName, dataType, nullable, ResultsMetadataConstants.SEARCH_TYPES.UNSEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, driverConnection);
+ }
+
+ static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, Integer searchable, Boolean writable, Boolean signed, Boolean caseSensitive, ConnectionImpl driverConnection) throws SQLException {
+
+ // map that would contain metadata details
+ Map<Integer, Object> metadataMap = new HashMap<Integer, Object>();
+
+ /*******************************************************
+ HardCoding Column metadata details for the given column
+ ********************************************************/
+
+ metadataMap.put(ResultsMetadataConstants.VIRTUAL_DATABASE_NAME, driverConnection.getVDBName());
+ metadataMap.put(ResultsMetadataConstants.GROUP_NAME, tableName);
+ metadataMap.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
+ metadataMap.put(ResultsMetadataConstants.DATA_TYPE, dataType);
+ metadataMap.put(ResultsMetadataConstants.PRECISION, ResultsMetadataDefaults.getDefaultPrecision(dataType));
+ metadataMap.put(ResultsMetadataConstants.RADIX, new Integer(10));
+ metadataMap.put(ResultsMetadataConstants.SCALE, new Integer(0));
+ metadataMap.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
+ metadataMap.put(ResultsMetadataConstants.CASE_SENSITIVE, caseSensitive);
+ metadataMap.put(ResultsMetadataConstants.NULLABLE, nullable);
+ metadataMap.put(ResultsMetadataConstants.SEARCHABLE, searchable);
+ metadataMap.put(ResultsMetadataConstants.SIGNED, signed);
+ metadataMap.put(ResultsMetadataConstants.WRITABLE, writable);
+ metadataMap.put(ResultsMetadataConstants.CURRENCY, Boolean.FALSE);
+ metadataMap.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.getMaxDisplaySize(dataType));
+
+ return metadataMap;
+ }
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,355 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/**
- *
- */
-package org.teiid.net.socket;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.teiid.client.security.ILogon;
-import org.teiid.client.security.InvalidSessionException;
-import org.teiid.client.security.LogonException;
-import org.teiid.client.security.LogonResult;
-import org.teiid.client.util.ExceptionUtil;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
-import org.teiid.jdbc.JDBCPlugin;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.HostInfo;
-import org.teiid.net.ServerConnection;
-import org.teiid.net.TeiidURL;
-
-
-/**
- * Represents a client connection that maintains session state and allows for service fail over.
- * Implements a sticky random selection policy.
- */
-public class SocketServerConnection implements ServerConnection {
-
- private static final int FAILOVER_PING_INTERVAL = 1000;
- private SocketServerInstanceFactory connectionFactory;
- private ServerDiscovery serverDiscovery;
- private static Logger log = Logger.getLogger("org.teiid.client.sockets"); //$NON-NLS-1$
-
- private boolean secure;
- private Properties connProps;
-
- private SocketServerInstance serverInstance;
- private LogonResult logonResult;
- private Map<HostInfo, LogonResult> logonResults = new ConcurrentHashMap<HostInfo, LogonResult>();
- private ILogon logon;
- private boolean closed;
- private boolean failOver;
- private long lastPing = System.currentTimeMillis();
- private int pingFailOverInterval = FAILOVER_PING_INTERVAL;
-
- public SocketServerConnection(
- SocketServerInstanceFactory connectionFactory, boolean secure,
- ServerDiscovery serverDiscovery, Properties connProps) throws CommunicationException, ConnectionException {
- this.connectionFactory = connectionFactory;
- this.serverDiscovery = serverDiscovery;
- this.connProps = connProps;
- this.secure = secure;
- //ILogon that is allowed to failover
- this.logon = this.getService(ILogon.class);
- this.failOver = Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.AUTO_FAILOVER)).booleanValue();
- this.failOver |= Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.ADMIN)).booleanValue();
- selectServerInstance(false);
- }
-
- /**
- * Implements a sticky random selection policy
- * TODO: make this customizable
- * TODO: put more information on hostinfo as to process response time, last successful connect, etc.
- * @throws ConnectionException
- */
- public synchronized SocketServerInstance selectServerInstance(boolean logoff)
- throws CommunicationException, ConnectionException {
- if (closed) {
- throw new CommunicationException(JDBCPlugin.Util.getString("SocketServerConnection.closed")); //$NON-NLS-1$
- }
- if (this.serverInstance != null && (!failOver || this.serverInstance.isOpen())) {
- return this.serverInstance;
- }
- List<HostInfo> hostKeys = new ArrayList<HostInfo>(this.serverDiscovery.getKnownHosts(logonResult, null));
- boolean discoverHosts = true;
- closeServerInstance();
- List<HostInfo> hostCopy = new ArrayList<HostInfo>(hostKeys);
- int knownHosts = hostKeys.size();
- while (hostKeys.size() > 0) {
- HostInfo hostInfo = this.serverDiscovery.selectNextInstance(hostKeys);
-
- Exception ex = null;
- try {
- if (!hostInfo.isResolved()) {
- hostInfo = new HostInfo(hostInfo.getHostName(), new InetSocketAddress(hostInfo.getInetAddress(), hostInfo.getPortNumber()));
- }
- ILogon newLogon = connect(hostInfo);
- if (this.logonResult == null) {
- try {
- logon(newLogon, logoff);
- this.serverDiscovery.connectionSuccessful(hostInfo);
- if (discoverHosts) {
- List<HostInfo> updatedHosts = this.serverDiscovery.getKnownHosts(logonResult, this.serverInstance);
- if (updatedHosts.size() > 1 && new HashSet<HostInfo>(updatedHosts).size() > new HashSet<HostInfo>(hostCopy).size()) {
- hostKeys = updatedHosts;
- closeServerInstance();
- discoverHosts = false;
- continue;
- }
- }
- } catch (LogonException e) {
- // Propagate the original message as it contains the message we want
- // to give to the user
- throw new ConnectionException(e, e.getMessage());
- } catch (TeiidComponentException e) {
- if (e.getCause() instanceof CommunicationException) {
- throw (CommunicationException)e.getCause();
- }
- throw new CommunicationException(e, JDBCPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to")); //$NON-NLS-1$
- }
- }
- return this.serverInstance;
- } catch (IOException e) {
- ex = e;
- } catch (SingleInstanceCommunicationException e) {
- ex = e;
- }
- this.serverDiscovery.markInstanceAsBad(hostInfo);
- if (knownHosts == 1) { //just a single host, use the exception
- if (ex instanceof UnknownHostException) {
- throw new SingleInstanceCommunicationException(ex, JDBCPlugin.Util.getString("SocketServerInstance.Connection_Error.Unknown_Host", hostInfo.getHostName())); //$NON-NLS-1$
- }
- throw new SingleInstanceCommunicationException(ex,JDBCPlugin.Util.getString("SocketServerInstance.Connection_Error.Connect_Failed", hostInfo.getHostName(), String.valueOf(hostInfo.getPortNumber()), ex.getMessage())); //$NON-NLS-1$
- }
- log.log(Level.FINE, "Unable to connect to host", ex); //$NON-NLS-1$
- }
- throw new CommunicationException(JDBCPlugin.Util.getString("SocketServerInstancePool.No_valid_host_available", hostCopy.toString())); //$NON-NLS-1$
- }
-
- private void logon(ILogon newLogon, boolean logoff) throws LogonException,
- TeiidComponentException, CommunicationException {
- LogonResult newResult = newLogon.logon(connProps);
- SocketServerInstance instance = this.serverInstance;
- if (logoff) {
- if ("7.3".compareTo(this.serverInstance.getServerVersion()) <= 0) { //$NON-NLS-1$
- //just remove the current instance - the server has already logged off the current user
- LogonResult old = this.logonResults.remove(this.serverInstance.getHostInfo());
- this.connectionFactory.disconnected(this.serverInstance, old.getSessionToken());
- }
- logoffAll();
- }
- this.logonResult = newResult;
- this.logonResults.put(instance.getHostInfo(), this.logonResult);
- this.connectionFactory.connected(instance, this.logonResult.getSessionToken());
- }
-
- private ILogon connect(HostInfo hostInfo) throws CommunicationException,
- IOException {
- hostInfo.setSsl(secure);
- this.serverInstance = connectionFactory.getServerInstance(hostInfo);
- this.logonResult = logonResults.get(hostInfo);
- ILogon newLogon = this.serverInstance.getService(ILogon.class);
- if (this.logonResult != null) {
- try {
- newLogon.assertIdentity(logonResult.getSessionToken());
- } catch (TeiidException e) {
- // session is no longer valid
- disconnect();
- }
- }
- return newLogon;
- }
-
- public <T> T getService(Class<T> iface) {
- return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new SocketServerInstanceImpl.RemoteInvocationHandler(iface) {
- @Override
- protected SocketServerInstance getInstance() throws CommunicationException {
- if (failOver && System.currentTimeMillis() - lastPing > pingFailOverInterval) {
- try {
- ResultsFuture<?> future = selectServerInstance(false).getService(ILogon.class).ping();
- future.get();
- } catch (SingleInstanceCommunicationException e) {
- closeServerInstance();
- } catch (CommunicationException e) {
- throw e;
- } catch (InvalidSessionException e) {
- disconnect();
- closeServerInstance();
- } catch (Exception e) {
- closeServerInstance();
- }
- }
- lastPing = System.currentTimeMillis();
- try {
- return selectServerInstance(false);
- } catch (ConnectionException e) {
- throw new CommunicationException(e);
- }
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- try {
- return super.invoke(proxy, method, args);
- } catch (Exception e) {
- if (ExceptionUtil.getExceptionOfType(e, InvalidSessionException.class) != null) {
- disconnect();
- }
- throw e;
- }
- }
-
- }));
- }
-
- public synchronized void close() {
- if (this.closed) {
- return;
- }
-
- if (this.serverInstance != null) {
- logoff();
- }
-
- logoffAll();
-
- this.closed = true;
- this.serverDiscovery.shutdown();
- }
-
- private void logoffAll() {
- for (Map.Entry<HostInfo, LogonResult> logonEntry : logonResults.entrySet()) {
- try {
- connect(logonEntry.getKey());
- logoff();
- } catch (Exception e) {
-
- }
- }
- }
-
- private void logoff() {
- disconnect();
- try {
- //make a best effort to send the logoff
- Future<?> writeFuture = this.serverInstance.getService(ILogon.class).logoff();
- writeFuture.get(5000, TimeUnit.MILLISECONDS);
- } catch (Exception e) {
- //ignore
- }
- closeServerInstance();
- }
-
- private void disconnect() {
- this.logonResults.remove(this.serverInstance.getHostInfo());
- if (this.logonResult != null) {
- this.connectionFactory.disconnected(this.serverInstance, this.logonResult.getSessionToken());
- }
- }
-
- private synchronized ResultsFuture<?> isOpen() throws CommunicationException, InvalidSessionException, TeiidComponentException {
- if (this.closed) {
- throw new CommunicationException();
- }
- return logon.ping();
- }
-
- public boolean isOpen(long msToTest) {
- try {
- ResultsFuture<?> future = isOpen();
- future.get(msToTest, TimeUnit.MILLISECONDS);
- return true;
- } catch (Throwable th) {
- return false;
- }
- }
-
- public LogonResult getLogonResult() {
- return logonResult;
- }
-
- synchronized void closeServerInstance() {
- if (this.serverInstance != null) {
- this.serverInstance.shutdown();
- this.serverInstance = null;
- }
- }
-
- public boolean isSameInstance(ServerConnection otherService) throws CommunicationException {
- if (!(otherService instanceof SocketServerConnection)) {
- return false;
- }
- try {
- return selectServerInstance(false).getHostInfo().equals(((SocketServerConnection)otherService).selectServerInstance(false).getHostInfo());
- } catch (ConnectionException e) {
- throw new CommunicationException(e);
- }
- }
-
- public void cleanUp() {
- closeServerInstance();
- }
-
- public void setFailOver(boolean failOver) {
- this.failOver = failOver;
- }
-
- public void setFailOverPingInterval(int pingFailOverInterval) {
- this.pingFailOverInterval = pingFailOverInterval;
- }
-
- @Override
- public void authenticate() throws ConnectionException,
- CommunicationException {
- if (this.serverInstance == null) {
- selectServerInstance(true); //this will trigger a logon with the new credentials
- } else {
- ILogon logonInstance = this.serverInstance.getService(ILogon.class);
- try {
- this.logon(logonInstance, true);
- } catch (LogonException e) {
- throw new ConnectionException(e);
- } catch (TeiidComponentException e) {
- throw new CommunicationException(e);
- }
- }
- }
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java (from rev 2879, branches/7.3.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,356 @@
+/*
+ * 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.net.socket;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.LogonException;
+import org.teiid.client.security.LogonResult;
+import org.teiid.client.util.ExceptionUtil;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.jdbc.JDBCPlugin;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.HostInfo;
+import org.teiid.net.ServerConnection;
+import org.teiid.net.TeiidURL;
+
+
+/**
+ * Represents a client connection that maintains session state and allows for service fail over.
+ * Implements a sticky random selection policy.
+ */
+public class SocketServerConnection implements ServerConnection {
+
+ private static final int FAILOVER_PING_INTERVAL = 1000;
+ private SocketServerInstanceFactory connectionFactory;
+ private ServerDiscovery serverDiscovery;
+ private static Logger log = Logger.getLogger("org.teiid.client.sockets"); //$NON-NLS-1$
+
+ private boolean secure;
+ private Properties connProps;
+
+ private SocketServerInstance serverInstance;
+ private LogonResult logonResult;
+ private Map<HostInfo, LogonResult> logonResults = new ConcurrentHashMap<HostInfo, LogonResult>();
+ private ILogon logon;
+ private boolean closed;
+ private boolean failOver;
+ private long lastPing = System.currentTimeMillis();
+ private int pingFailOverInterval = FAILOVER_PING_INTERVAL;
+
+ public SocketServerConnection(
+ SocketServerInstanceFactory connectionFactory, boolean secure,
+ ServerDiscovery serverDiscovery, Properties connProps) throws CommunicationException, ConnectionException {
+ this.connectionFactory = connectionFactory;
+ this.serverDiscovery = serverDiscovery;
+ this.connProps = connProps;
+ this.secure = secure;
+ //ILogon that is allowed to failover
+ this.logon = this.getService(ILogon.class);
+ this.failOver = Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.AUTO_FAILOVER)).booleanValue();
+ this.failOver |= Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.ADMIN)).booleanValue();
+ selectServerInstance(false);
+ }
+
+ /**
+ * Implements a sticky random selection policy
+ * TODO: make this customizable
+ * TODO: put more information on hostinfo as to process response time, last successful connect, etc.
+ * @throws ConnectionException
+ */
+ public synchronized SocketServerInstance selectServerInstance(boolean logoff)
+ throws CommunicationException, ConnectionException {
+ if (closed) {
+ throw new CommunicationException(JDBCPlugin.Util.getString("SocketServerConnection.closed")); //$NON-NLS-1$
+ }
+ if (this.serverInstance != null && (!failOver || this.serverInstance.isOpen())) {
+ return this.serverInstance;
+ }
+ List<HostInfo> hostKeys = new ArrayList<HostInfo>(this.serverDiscovery.getKnownHosts(logonResult, null));
+ boolean discoverHosts = true;
+ closeServerInstance();
+ List<HostInfo> hostCopy = new ArrayList<HostInfo>(hostKeys);
+ int knownHosts = hostKeys.size();
+ while (hostKeys.size() > 0) {
+ HostInfo hostInfo = this.serverDiscovery.selectNextInstance(hostKeys);
+
+ Exception ex = null;
+ try {
+ if (!hostInfo.isResolved()) {
+ hostInfo = new HostInfo(hostInfo.getHostName(), new InetSocketAddress(hostInfo.getInetAddress(), hostInfo.getPortNumber()));
+ }
+ ILogon newLogon = connect(hostInfo);
+ if (this.logonResult == null) {
+ try {
+ logon(newLogon, logoff);
+ this.serverDiscovery.connectionSuccessful(hostInfo);
+ if (discoverHosts) {
+ List<HostInfo> updatedHosts = this.serverDiscovery.getKnownHosts(logonResult, this.serverInstance);
+ if (updatedHosts.size() > 1 && new HashSet<HostInfo>(updatedHosts).size() > new HashSet<HostInfo>(hostCopy).size()) {
+ hostKeys = updatedHosts;
+ closeServerInstance();
+ discoverHosts = false;
+ continue;
+ }
+ }
+ } catch (LogonException e) {
+ // Propagate the original message as it contains the message we want
+ // to give to the user
+ throw new ConnectionException(e, e.getMessage());
+ } catch (TeiidComponentException e) {
+ if (e.getCause() instanceof CommunicationException) {
+ throw (CommunicationException)e.getCause();
+ }
+ throw new CommunicationException(e, JDBCPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to")); //$NON-NLS-1$
+ }
+ }
+ return this.serverInstance;
+ } catch (IOException e) {
+ ex = e;
+ } catch (SingleInstanceCommunicationException e) {
+ ex = e;
+ }
+ this.serverDiscovery.markInstanceAsBad(hostInfo);
+ if (knownHosts == 1) { //just a single host, use the exception
+ if (ex instanceof UnknownHostException) {
+ throw new SingleInstanceCommunicationException(ex, JDBCPlugin.Util.getString("SocketServerInstance.Connection_Error.Unknown_Host", hostInfo.getHostName())); //$NON-NLS-1$
+ }
+ throw new SingleInstanceCommunicationException(ex,JDBCPlugin.Util.getString("SocketServerInstance.Connection_Error.Connect_Failed", hostInfo.getHostName(), String.valueOf(hostInfo.getPortNumber()), ex.getMessage())); //$NON-NLS-1$
+ }
+ log.log(Level.FINE, "Unable to connect to host", ex); //$NON-NLS-1$
+ }
+ throw new CommunicationException(JDBCPlugin.Util.getString("SocketServerInstancePool.No_valid_host_available", hostCopy.toString())); //$NON-NLS-1$
+ }
+
+ private void logon(ILogon newLogon, boolean logoff) throws LogonException,
+ TeiidComponentException, CommunicationException {
+ LogonResult newResult = newLogon.logon(connProps);
+ SocketServerInstance instance = this.serverInstance;
+ if (logoff) {
+ if ("7.3".compareTo(this.serverInstance.getServerVersion()) <= 0) { //$NON-NLS-1$
+ //just remove the current instance - the server has already logged off the current user
+ LogonResult old = this.logonResults.remove(this.serverInstance.getHostInfo());
+ this.connectionFactory.disconnected(this.serverInstance, old.getSessionToken());
+ }
+ logoffAll();
+ }
+ this.logonResult = newResult;
+ this.logonResults.put(instance.getHostInfo(), this.logonResult);
+ this.connectionFactory.connected(instance, this.logonResult.getSessionToken());
+ }
+
+ private ILogon connect(HostInfo hostInfo) throws CommunicationException,
+ IOException {
+ hostInfo.setSsl(secure);
+ this.serverInstance = connectionFactory.getServerInstance(hostInfo);
+ this.logonResult = logonResults.get(hostInfo);
+ ILogon newLogon = this.serverInstance.getService(ILogon.class);
+ if (this.logonResult != null) {
+ try {
+ newLogon.assertIdentity(logonResult.getSessionToken());
+ } catch (TeiidException e) {
+ // session is no longer valid
+ disconnect();
+ }
+ }
+ return newLogon;
+ }
+
+ public <T> T getService(Class<T> iface) {
+ return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new SocketServerInstanceImpl.RemoteInvocationHandler(iface) {
+ @Override
+ protected SocketServerInstance getInstance() throws CommunicationException {
+ if (failOver && System.currentTimeMillis() - lastPing > pingFailOverInterval) {
+ try {
+ ResultsFuture<?> future = selectServerInstance(false).getService(ILogon.class).ping();
+ future.get();
+ } catch (SingleInstanceCommunicationException e) {
+ closeServerInstance();
+ } catch (CommunicationException e) {
+ throw e;
+ } catch (InvalidSessionException e) {
+ disconnect();
+ closeServerInstance();
+ } catch (Exception e) {
+ closeServerInstance();
+ }
+ }
+ lastPing = System.currentTimeMillis();
+ try {
+ return selectServerInstance(false);
+ } catch (ConnectionException e) {
+ throw new CommunicationException(e);
+ }
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ try {
+ return super.invoke(proxy, method, args);
+ } catch (Exception e) {
+ if (ExceptionUtil.getExceptionOfType(e, InvalidSessionException.class) != null) {
+ disconnect();
+ }
+ throw e;
+ }
+ }
+
+ }));
+ }
+
+ public synchronized void close() {
+ if (this.closed) {
+ return;
+ }
+
+ if (this.serverInstance != null) {
+ logoff();
+ }
+
+ logoffAll();
+
+ this.closed = true;
+ this.serverDiscovery.shutdown();
+ }
+
+ private void logoffAll() {
+ for (Map.Entry<HostInfo, LogonResult> logonEntry : logonResults.entrySet()) {
+ try {
+ connect(logonEntry.getKey());
+ logoff();
+ } catch (Exception e) {
+
+ }
+ }
+ }
+
+ private void logoff() {
+ disconnect();
+ try {
+ //make a best effort to send the logoff
+ Future<?> writeFuture = this.serverInstance.getService(ILogon.class).logoff();
+ writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ } catch (Exception e) {
+ //ignore
+ }
+ closeServerInstance();
+ }
+
+ private void disconnect() {
+ this.logonResults.remove(this.serverInstance.getHostInfo());
+ if (this.logonResult != null) {
+ this.connectionFactory.disconnected(this.serverInstance, this.logonResult.getSessionToken());
+ this.logonResult = null;
+ }
+ }
+
+ private synchronized ResultsFuture<?> isOpen() throws CommunicationException, InvalidSessionException, TeiidComponentException {
+ if (this.closed) {
+ throw new CommunicationException();
+ }
+ return logon.ping();
+ }
+
+ public boolean isOpen(long msToTest) {
+ try {
+ ResultsFuture<?> future = isOpen();
+ future.get(msToTest, TimeUnit.MILLISECONDS);
+ return true;
+ } catch (Throwable th) {
+ return false;
+ }
+ }
+
+ public LogonResult getLogonResult() {
+ return logonResult;
+ }
+
+ synchronized void closeServerInstance() {
+ if (this.serverInstance != null) {
+ this.serverInstance.shutdown();
+ this.serverInstance = null;
+ }
+ }
+
+ public boolean isSameInstance(ServerConnection otherService) throws CommunicationException {
+ if (!(otherService instanceof SocketServerConnection)) {
+ return false;
+ }
+ try {
+ return selectServerInstance(false).getHostInfo().equals(((SocketServerConnection)otherService).selectServerInstance(false).getHostInfo());
+ } catch (ConnectionException e) {
+ throw new CommunicationException(e);
+ }
+ }
+
+ public void cleanUp() {
+ closeServerInstance();
+ }
+
+ public void setFailOver(boolean failOver) {
+ this.failOver = failOver;
+ }
+
+ public void setFailOverPingInterval(int pingFailOverInterval) {
+ this.pingFailOverInterval = pingFailOverInterval;
+ }
+
+ @Override
+ public void authenticate() throws ConnectionException,
+ CommunicationException {
+ if (this.serverInstance == null) {
+ selectServerInstance(true); //this will trigger a logon with the new credentials
+ } else {
+ ILogon logonInstance = this.serverInstance.getService(ILogon.class);
+ try {
+ this.logon(logonInstance, true);
+ } catch (LogonException e) {
+ throw new ConnectionException(e);
+ } catch (TeiidComponentException e) {
+ throw new CommunicationException(e);
+ }
+ }
+ }
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
===================================================================
--- branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,927 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Matchers;
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.JDBCSQLTypeInfo;
-import org.teiid.core.util.TimestampWithTimezone;
-import org.teiid.jdbc.ResultSetImpl;
-import org.teiid.jdbc.StatementImpl;
-import org.teiid.query.unittest.TimestampUtil;
-
-
-public class TestAllResultsImpl {
-
- private static final long REQUEST_ID = 0;
- private static final int TYPE_FORWARD_ONLY = ResultSet.TYPE_FORWARD_ONLY;
- private static final int TYPE_SCROLL_SENSITIVE = ResultSet.TYPE_SCROLL_SENSITIVE;
-
- private StatementImpl statement;
-
- @Before public void setUp() throws Exception {
- statement = TestResultSet.createMockStatement(TYPE_SCROLL_SENSITIVE);
- }
-
- /** test hasNext(), actual result set should return FALSE. */
- @Test public void testHasNext1() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
- while (rs.next()) {
- // just walk through
- }
-
- boolean actual = rs.hasNext();
- boolean expected = false;
- assertEquals(expected, actual);
-
- rs.close();
- }
-
- /** test hasNext(), actual result set should return TRUE. */
- @Test public void testHasNext2() throws Exception {
- List[] results = exampleResults1(5);
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
-
- for (int i = 1; i < results.length; i++) {
- rs.next();
- }
-
- boolean actual = rs.hasNext();
- boolean expected = true;
- assertEquals(expected, actual);
-
- rs.close();
- }
-
- /**
- * test next(), whether the result set's cursor is positioned on next row or
- * not
- */
- @Test public void testNext1() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
-
- // point to first row
- boolean actual = rs.next();
- boolean expected = true;
- assertEquals(" Actual doesn't match with expected. ", expected, actual); //$NON-NLS-1$
-
- rs.close();
- }
-
- /** test next(), walk through all rows of a result set and compare each row. */
- @Test public void testNext2() throws Exception {
- List[] results = exampleResults1(5);
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
-
- int i = 0;
- while (rs.next()) {
- // walk through and compare
- List actual = rs.getCurrentRecord();
- List expected = results[i];
- assertEquals(expected, actual);
- i++;
- }
-
- rs.close();
- }
-
- /** test next(), get result set and close without walking through */
- @Test public void testNext3() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
- assertEquals(new Integer(0), new Integer(rs.getRow()));
-
- rs.close();
- }
-
- /** test next(), walk through partial rows of a result set */
- @Test public void testNext4() throws Exception {
- List[] results = exampleResults1(5);
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
-
- for (int i = 0; i < results.length - 1; i++) {
- rs.next();
- List actual = rs.getCurrentRecord();
- List expected = results[i];
- assertEquals(expected, actual);
- }
-
- rs.close();
- }
-
- /** test next(), when hasNext() == false */
- @Test public void testNext5() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
- while (rs.next()) {
- // just walk through until hasNext() == false;
- }
-
- boolean actual = rs.hasNext();
- boolean expected = false;
- assertEquals(expected, actual);
-
- rs.close();
- }
-
- /** test getObject() at columnIndex = 2 of 5th row */
- @Test public void testGetObject1() throws Exception {
- List[] results = exampleResults2();
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
- statement);
-
- String actual = null;
- String expected = "a3"; //$NON-NLS-1$
-
- // move cursor to the 4th row
- for (int i = 0; i < results.length - 2; i++) {
- rs.next();
- }
-
- // only compare the 4th row's 2nd column
- if (rs.next()) {
- actual = (String) rs.getObject(2);
- }
-
- assertEquals(expected, actual);
-
- rs.close();
- }
-
- /** Should fail, test getObject() at wrong columnIndex */
- @Test public void testGetObject2() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
- statement);
-
- if (rs.next()) {
- // ERROR -- there are totally only 2 columns inside result set, 6 is
- // an invalid one
- try {
- rs.getObject(6);
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- // OK
- }
- }
- }
-
- rs.close();
- }
-
- @Test public void testGetRow() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
- statement);
-
- int expected = 0;
- assertEquals(expected, rs.getRow());
-
- if (rs.next()) {
- expected = 1;
- assertEquals(expected, rs.getRow());
- }
- rs.close();
-
- }
-
- @Test public void testPrevious() throws Exception {
- List[] results = exampleResults1(5);
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
- statement);
-
- while (rs.next()) {
- // just walk to the end;
- }
-
- // walk reversely;
- int i = results.length - 1;
- while (rs.previous()) {
- List expected = new ArrayList();
- expected.add(new Integer(i + 1));
- assertEquals(expected, rs.getCurrentRecord());
- i--;
- }
-
- rs.close();
- }
-
- @Test public void testGetCurrentRecord() throws Exception {
- List[] results = exampleResults2();
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
- statement);
-
- rs.next();
- List actual = rs.getCurrentRecord();
- assertEquals(results[0], actual);
- rs.close();
- }
-
- @Test public void testGetMetaData() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
- statement);
- ResultSetMetaData rmetadata = rs.getMetaData();
- assertEquals(2, rmetadata.getColumnCount());
-
- String[] columnNames = columnNames();
- String[] dataTypes = dataTypes();
- for (int i = 0; i < 2; i++) {
- assertEquals(columnNames[i], rmetadata.getColumnName(i + 1));
- assertEquals(dataTypes[i], rmetadata.getColumnTypeName(i + 1));
- }
- rs.close();
- }
-
- @Test public void testResultsWarnings() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
- statement);
- rs.close();
- }
-
- @Test public void testClose() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
- statement);
- rs.close();
- verify(statement, times(0)).close();
- }
-
- @Test public void testGetFetchSize() throws Exception {
- StatementImpl s = mock(StatementImpl.class);
- stub(s.getFetchSize()).toReturn(500);
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(), s);
- assertEquals(500, rs.getFetchSize());
- rs.setFetchSize(100);
- assertEquals(100, rs.getFetchSize());
- }
-
- // //////////////////////Functions refer to ResultSet's TYPE_FORWARD_ONLY///
- // /////////////////
- @Test(expected=SQLException.class) public void testIsAfterLast1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
- rs.last();
- }
-
- @Test(expected=SQLException.class) public void testAfterLast1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
- rs.afterLast();
- }
-
- @Test public void testIsBeforeFirst1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- // right before the first row
- boolean actual = rs.isBeforeFirst();
- assertEquals(true, actual);
- rs.close();
- }
-
- @Test public void testIsBeforeFirst2() throws Exception {
- ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
-
- // right before the first row
- boolean actual = rs.isBeforeFirst();
- assertEquals(false, actual);
- rs.close();
- }
-
- @Test(expected=SQLException.class) public void testBeforeFirst1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- // move cursor to the first row
- rs.next();
-
- // move back to before first row
- rs.beforeFirst();
- }
-
- @Test public void testIsFirst1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- // move cursor to the first row
- rs.next();
- boolean actual = rs.isFirst();
- assertEquals(true, actual);
- rs.close();
- }
-
- @Test public void testIsFirst2() throws Exception {
- ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
-
- // move cursor to the first row
- rs.next();
- boolean actual = rs.isFirst();
- assertEquals(false, actual);
- rs.close();
- }
-
- @Test(expected=SQLException.class) public void testFirst1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- // move cursor to the first row
- rs.next();
- rs.first();
- }
-
- @Test(expected=SQLException.class) public void testFirst2() throws Exception {
- ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
-
- // move cursor to the first row
- rs.next();
- rs.first();
- }
-
- @Test public void testFindColumn() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
- statement);
-
- assertEquals(1, rs.findColumn("IntNum")); //$NON-NLS-1$
- rs.close();
- }
-
- @Test public void testIsLast1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- // move cursor to the last row
- boolean actual = rs.isLast();
- assertEquals(false, actual);
- }
-
- @Test public void testIsLast2() throws Exception {
- ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
-
- // move cursor to the last row
- boolean actual = rs.isLast();
- assertEquals(false, actual);
- }
-
- @Test(expected=SQLException.class) public void testLast1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- rs.last();
- }
-
- @Test public void testRelative1() throws Exception {
- ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
- statement);
-
- // move to 1st row
- rs.next();
- // move to 2nd row
- boolean actual = rs.relative(1);
- assertEquals(true, actual);
- assertEquals(2, rs.getRow());
-
- actual = rs.relative(-1);
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
- rs.close();
- }
-
- @Test(expected=SQLException.class) public void testAbsolute1() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
-
- rs.absolute(1);
- }
-
- // //////////Functions refer to other types other than ResultSet's
- // TYPE_FORWARD_ONLY//////
-
- @Test public void testAfterLast1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move cursor right past the last row
- rs.afterLast();
-
- // the expected row == 0 because it pasts the last row
- assertEquals(0, rs.getRow());
- rs.close();
- }
-
- @Test public void testIsAfterLast1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // the last row
- rs.last();
- boolean actual = rs.isAfterLast();
- assertEquals(false, actual);
-
- // move after the last row
- rs.next();
- actual = rs.isAfterLast();
- assertEquals(true, actual);
- rs.close();
- }
-
- @Test public void testIsBeforeFirst1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // right before the first row
- boolean actual = rs.isBeforeFirst();
- assertEquals(true, actual);
- rs.close();
- }
-
- @Test public void testBeforeFirst1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move cursor to the first row
- rs.next();
- rs.next();
-
- // move back to before first row
- rs.beforeFirst();
-
- assertEquals(0, rs.getRow());
- rs.close();
- }
-
- @Test public void testIsFirst1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move cursor to the first row
- rs.next();
- boolean actual = rs.isFirst();
- assertEquals(true, actual);
-
- // check row number
- assertEquals(1, rs.getRow());
- rs.close();
- }
-
- @Test public void testFirst1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move cursor to the first row
- boolean actual = rs.first();
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
-
- // move cursor to the first row starting from the last row
- rs.afterLast();
- actual = rs.first();
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
-
- // move cursor to the first row from random number;
- rs.absolute(3);
- actual = rs.first();
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
- rs.close();
- }
-
- @Test public void testIsLast1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // check whether the movement of cursor is successful
- rs.last();
- boolean actual = rs.isLast();
- assertEquals(true, actual);
-
- // check row number
- assertEquals(5, rs.getRow());
- rs.close();
- }
-
- @Test public void testLast1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // check whether the movement of cursor is successful
- boolean actual = rs.last();
- assertEquals(true, actual);
-
- // check weather the current row is the last row
- assertEquals(5, rs.getRow());
- rs.close();
- }
-
- /** normal relative move, only including moving from valid row to valid one */
- @Test public void testRelative1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move to 1st row
- rs.next();
- // move to 2nd row
- boolean actual = rs.relative(1);
-
- assertEquals(true, actual);
- assertEquals(2, rs.getRow());
-
- actual = rs.relative(-1);
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
- rs.close();
- }
-
- /** normal relative move, including moving from valid row to invalid one */
- @Test public void testRelative1b() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // move to 1st row
- rs.next();
- // move to 2nd row
- boolean actual = rs.relative(1);
- actual = rs.relative(-1);
-
- // test if move before first
- actual = rs.relative(-3);
- // relative should return false when not on a row
- assertEquals(false, actual);
- assertEquals(0, rs.getRow());
-
- // test if move after last
- // this line is very important because it positions the cursor in a
- // valid row!!!
- rs.beforeFirst();
- rs.next();
- actual = rs.relative(7);
- // should return false because it's not on a valid row
- assertEquals(false, actual);
- assertEquals(0, rs.getRow());
- rs.close();
- }
-
- /** check only moving from an invalid row */
- @Test public void testRelative1c() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // test if move before first will work or not
- // default to before first
- try {
- rs.relative(-2);
- fail("relative move from an invalid row should fail"); //$NON-NLS-1$
- } catch (SQLException e) {
-
- }
- assertEquals(
- " Should still be before the first row ", true, rs.isBeforeFirst()); //$NON-NLS-1$
- assertEquals(0, rs.getRow());
-
- try {
- rs.relative(2);
- fail("relative move from an invalid row should fail"); //$NON-NLS-1$
- } catch (SQLException e) {
-
- }
- assertEquals(
- " Should still be before the first row ", true, rs.isBeforeFirst()); //$NON-NLS-1$
- assertEquals(0, rs.getRow());
- // test if move after last will work or not
-
- rs.afterLast();
-
- try {
- rs.relative(2);
- fail("relative move from an invalid row should fail"); //$NON-NLS-1$
- } catch (SQLException e) {
-
- }
- assertEquals(
- " Should still be after the last row. ", true, rs.isAfterLast()); //$NON-NLS-1$
- assertEquals(0, rs.getRow());
- try {
- rs.relative(-2);
- fail("relative move from an invalid row should fail"); //$NON-NLS-1$
- } catch (SQLException e) {
-
- }
- assertEquals(
- " Should still be after the last row. ", true, rs.isAfterLast()); //$NON-NLS-1$
- assertEquals(0, rs.getRow());
- rs.close();
- }
-
- /** test only valid row in result set */
- @Test public void testAbsolute1a() throws Exception {
- ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
-
- // start from beginning
- boolean actual = rs.absolute(1);
- assertEquals(true, actual);
- assertEquals(1, rs.getRow());
-
- actual = rs.absolute(12);
- assertEquals(false, actual);
- assertEquals(0, rs.getRow());
-
- // start from right after last
- rs.afterLast();
- actual = rs.absolute(-1);
- assertEquals(true, actual);
- assertEquals(5, rs.getRow());
-
- actual = rs.absolute(-2);
- assertEquals(true, actual);
- assertEquals(4, rs.getRow());
- rs.close();
- }
-
- /** test only valid row in result set */
- @Test public void testAbsolute2a() throws Exception {
- ResultSetImpl rs = helpGetNoResults(TYPE_SCROLL_SENSITIVE);
-
- // start from beginning
- assertEquals(false, rs.absolute(1));
- assertEquals(0, rs.getRow());
-
- // start from right after last
- rs.afterLast();
- assertEquals(false, rs.absolute(-1));
- assertEquals(0, rs.getRow());
-
- rs.close();
- }
-
- /**
- * 3 batches
- */
- @Test public void testMoreResults() throws Exception {
- int fetchSize = 5;
- int batchLength = 4;
- int totalLength = 10;
-
- ResultSetImpl rs = helpTestBatching(statement, fetchSize, batchLength,
- totalLength);
-
- assertTrue(rs.absolute(6));
- assertTrue(rs.absolute(-1));
- assertFalse(rs.next());
-
- for (int i = 0; i < totalLength; i++) {
- assertTrue(rs.previous());
- }
- }
-
- static ResultSetImpl helpTestBatching(StatementImpl statement, int fetchSize, int batchLength,
- int totalLength) throws InterruptedException, ExecutionException,
- TeiidProcessingException, SQLException, TimeoutException {
- DQP dqp = mock(DQP.class);
- stub(statement.getDQP()).toReturn(dqp);
- stub(statement.getFetchSize()).toReturn(fetchSize);
- for (int i = batchLength; i < totalLength; i += batchLength) {
- //forward requests
- ResultsFuture<ResultsMessage> nextBatch = mock(ResultsFuture.class);
- stub(nextBatch.get(Matchers.anyLong(), (TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i + 1, Math.min(batchLength, totalLength - i), fetchSize, i + batchLength >= totalLength));
- stub(dqp.processCursorRequest(REQUEST_ID, i + 1, fetchSize)).toReturn(nextBatch);
-
- if (i + batchLength < totalLength) {
- //backward requests
- ResultsFuture<ResultsMessage> previousBatch = mock(ResultsFuture.class);
- stub(previousBatch.get(Matchers.anyLong(), (TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i - batchLength + 1, i, fetchSize, false));
- stub(dqp.processCursorRequest(REQUEST_ID, i, fetchSize)).toReturn(previousBatch);
- }
- }
-
- ResultsMessage msg = exampleResultsMsg4(1, batchLength, fetchSize, batchLength == totalLength);
- return new ResultSetImpl(msg, statement);
- }
-
- // /////////////////////Helper Method///////////////////
- static List<Object>[] exampleResults1(int length) {
- return exampleResults1(length, 1);
- }
-
- static List<Object>[] exampleResults1(int length, int begin) {
- List<Object>[] results = new List[length];
-
- for (int i = 0; i < results.length; i++) {
- results[i] = new ArrayList<Object>();
- results[i].add(new Integer(begin + i));
- }
-
- return results;
- }
-
- private List[] exampleResults2() {
- List[] results = new List[5];
-
- for (int i = 0; i < results.length; i++) {
- results[i] = new ArrayList();
- results[i].add(new Integer(i));
- results[i].add(new String("a" + i)); //$NON-NLS-1$
- }
-
- return results;
- }
-
- private String[] columnNames() {
- String[] names = new String[2];
- names[0] = new String("IntNum"); //$NON-NLS-1$
- names[1] = new String("StringNum"); //$NON-NLS-1$
- return names;
- }
-
- private String[] dataTypes() {
- String[] types = new String[2];
- types[0] = JDBCSQLTypeInfo.INTEGER;
- types[1] = JDBCSQLTypeInfo.STRING;
- return types;
- }
-
- private ResultSetImpl helpGetResultSetImpl(int type)
- throws SQLException {
- ResultsMessage rsMsg = exampleResultsMsg2();
- statement = TestResultSet.createMockStatement(type);
- ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
- return rs;
- }
-
- private ResultSetImpl helpGetNoResults(int type) throws SQLException {
- ResultsMessage rsMsg = exampleResultsMsg3();
- statement = TestResultSet.createMockStatement(type);
- ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
- return rs;
- }
-
- /** without metadata info. */
- private ResultsMessage exampleResultsMsg1() {
- return exampleMessage(exampleResults1(5), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
- }
-
- private ResultsMessage exampleMessage(List<Object>[] results, String[] columnNames, String[] datatypes) {
- RequestMessage request = new RequestMessage();
- request.setExecutionId(REQUEST_ID);
- ResultsMessage resultsMsg = new ResultsMessage(request);
- resultsMsg.setResults(results);
- resultsMsg.setColumnNames(columnNames);
- resultsMsg.setDataTypes(datatypes);
- resultsMsg.setFinalRow(results.length);
- resultsMsg.setLastRow(results.length);
- resultsMsg.setFirstRow(1);
- return resultsMsg;
- }
-
- /** without metadata info. */
- private ResultsMessage exampleResultsMsg2() {
- return exampleMessage(exampleResults2(), new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /** with limited metadata info. */
- private ResultsMessage exampleResultsMsg2a() {
- ResultsMessage resultsMsg = exampleResultsMsg2();
- List[] results = exampleResults2();
- resultsMsg.setDataTypes(dataTypes());
- resultsMsg.setColumnNames(columnNames());
-
- resultsMsg.setResults(results);
- resultsMsg.setFinalRow(results.length);
- resultsMsg.setLastRow(results.length);
- resultsMsg.setFirstRow(1);
- return resultsMsg;
- }
-
- /** no rows. */
- private ResultsMessage exampleResultsMsg3() {
- return exampleMessage(new List[0], new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private static ResultsMessage exampleResultsMsg4(int begin, int length, int fetchSize, boolean lastBatch) {
- RequestMessage request = new RequestMessage();
- request.setExecutionId(REQUEST_ID);
- ResultsMessage resultsMsg = new ResultsMessage(request);
- List[] results = exampleResults1(length, begin);
- resultsMsg.setResults(results);
- resultsMsg.setColumnNames(new String[] { "IntKey" }); //$NON-NLS-1$
- resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.INTEGER });
- resultsMsg.setFirstRow(begin);
- if (lastBatch) {
- resultsMsg.setFinalRow(begin + results.length - 1);
- }
- resultsMsg.setLastRow(begin + results.length - 1);
- return resultsMsg;
- }
-
- @Test public void testNotCallingNext() throws SQLException {
- ResultSetImpl cs = new ResultSetImpl(exampleResultsMsg2a(),
- statement);
-
- try {
- cs.getObject(1);
- fail("Exception expected"); //$NON-NLS-1$
- } catch (SQLException e) {
- assertEquals("The cursor is not on a valid row.", e.getMessage()); //$NON-NLS-1$
- }
- }
-
- @Test public void testDateType() throws SQLException {
- RequestMessage request = new RequestMessage();
- request.setExecutionId(REQUEST_ID);
- ResultsMessage resultsMsg = new ResultsMessage(request);
- resultsMsg.setResults(new List[] {Arrays.asList(new Timestamp(0))});
- resultsMsg.setColumnNames(new String[] { "TS" }); //$NON-NLS-1$
- resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.TIMESTAMP });
- resultsMsg.setFirstRow(1);
- resultsMsg.setFinalRow(1);
- resultsMsg.setLastRow(1);
- ResultSetImpl rs = new ResultSetImpl(resultsMsg, statement);
- assertTrue(rs.next());
- //assumes the mock statement is setup with GMT-5 server and GMT-6 client
-
- //will adjust ahead one hour
- assertEquals(new Timestamp(3600000), rs.getObject(1));
-
- //will be the same as the original
- assertEquals(new Timestamp(0), rs.getTimestamp(1, Calendar.getInstance(TimeZone.getTimeZone("GMT-05:00")))); //$NON-NLS-1$
- }
-
- @Test public void testWasNull() throws SQLException{
- ResultsMessage message = exampleMessage(new List[] { Arrays.asList((String)null), Arrays.asList("1") }, new String[] { "string" }, //$NON-NLS-1$
- new String[] { JDBCSQLTypeInfo.STRING });
- ResultSetImpl rs = new ResultSetImpl(message, statement);
- assertTrue(rs.next());
- assertEquals(Boolean.FALSE.booleanValue(), rs.getBoolean(1));
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getShort(1));
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getInt(1));
- assertTrue(rs.wasNull());
- assertEquals(0l, rs.getLong(1));
- assertTrue(rs.wasNull());
- assertEquals(0f, rs.getFloat(1), 0);
- assertTrue(rs.wasNull());
- assertEquals(0d, rs.getDouble(1), 0);
- assertTrue(rs.wasNull());
- assertNull(rs.getString(1));
- assertTrue(rs.wasNull());
- assertTrue(rs.next());
- assertEquals(1, rs.getShort(1));
- assertFalse(rs.wasNull());
- assertFalse(rs.next());
- }
-
- @Test public void testGetters() throws SQLException{
- TimeZone.setDefault(TimeZone.getTimeZone("GMT-05:00")); //$NON-NLS-1$
- ResultsMessage message = exampleMessage(new List[] { Arrays.asList(1, TimestampUtil.createTime(0, 0, 0), TimestampUtil.createDate(1, 1, 1), TimestampUtil.createTimestamp(1, 1, 1, 1, 1, 1, 1), "<root/>") }, //$NON-NLS-1$
- new String[] { "int", "time", "date", "timestamp", "sqlxml" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.TIME, JDBCSQLTypeInfo.DATE, JDBCSQLTypeInfo.TIMESTAMP, JDBCSQLTypeInfo.STRING });
- TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
- ResultSetImpl rs = new ResultSetImpl(message, statement);
- assertTrue(rs.next());
- assertEquals(Boolean.TRUE.booleanValue(), rs.getBoolean(1));
- assertEquals(1, rs.getShort(1));
- assertEquals(1, rs.getInt(1));
- assertEquals(1l, rs.getLong(1));
- assertEquals(1f, rs.getFloat(1), 0);
- assertEquals(1d, rs.getDouble(1), 0);
- assertEquals("1", rs.getString(1)); //$NON-NLS-1$
- assertEquals(Integer.valueOf(1), rs.getObject(1));
- //the mock statement is in GMT-6 the server results are from GMT-5, so we expect them to display the same
- assertEquals(TimestampUtil.createTime(0, 0, 0), rs.getTime(2));
- assertEquals(TimestampUtil.createDate(1, 1, 1), rs.getDate(3));
- assertEquals(TimestampUtil.createTimestamp(1, 1, 1, 1, 1, 1, 1), rs.getTimestamp(4));
- assertEquals("<root/>", rs.getSQLXML(5).getString()); //$NON-NLS-1$
- try {
- rs.getSQLXML(1);
- } catch (SQLException e) {
- assertEquals("Unable to transform the column value 1 to a SQLXML.", e.getMessage()); //$NON-NLS-1$
- }
- assertFalse(rs.next());
- TimestampWithTimezone.resetCalendar(null);
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java (from rev 2885, branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,941 @@
+/*
+ * 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.jdbc;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.List;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.JDBCSQLTypeInfo;
+import org.teiid.core.util.TimestampWithTimezone;
+import org.teiid.jdbc.ResultSetImpl;
+import org.teiid.jdbc.StatementImpl;
+import org.teiid.query.unittest.TimestampUtil;
+
+
+public class TestAllResultsImpl {
+
+ private static final long REQUEST_ID = 0;
+ private static final int TYPE_FORWARD_ONLY = ResultSet.TYPE_FORWARD_ONLY;
+ private static final int TYPE_SCROLL_SENSITIVE = ResultSet.TYPE_SCROLL_SENSITIVE;
+
+ private StatementImpl statement;
+
+ @Before public void setUp() throws Exception {
+ statement = TestResultSet.createMockStatement(TYPE_SCROLL_SENSITIVE);
+ }
+
+ /** test hasNext(), actual result set should return FALSE. */
+ @Test public void testHasNext1() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+ while (rs.next()) {
+ // just walk through
+ }
+
+ boolean actual = rs.hasNext();
+ boolean expected = false;
+ assertEquals(expected, actual);
+
+ rs.close();
+ }
+
+ /** test hasNext(), actual result set should return TRUE. */
+ @Test public void testHasNext2() throws Exception {
+ List[] results = exampleResults1(5);
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+
+ for (int i = 1; i < results.length; i++) {
+ rs.next();
+ }
+
+ boolean actual = rs.hasNext();
+ boolean expected = true;
+ assertEquals(expected, actual);
+
+ rs.close();
+ }
+
+ /**
+ * test next(), whether the result set's cursor is positioned on next row or
+ * not
+ */
+ @Test public void testNext1() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+
+ // point to first row
+ boolean actual = rs.next();
+ boolean expected = true;
+ assertEquals(" Actual doesn't match with expected. ", expected, actual); //$NON-NLS-1$
+
+ rs.close();
+ }
+
+ /** test next(), walk through all rows of a result set and compare each row. */
+ @Test public void testNext2() throws Exception {
+ List[] results = exampleResults1(5);
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+
+ int i = 0;
+ while (rs.next()) {
+ // walk through and compare
+ List actual = rs.getCurrentRecord();
+ List expected = results[i];
+ assertEquals(expected, actual);
+ i++;
+ }
+
+ rs.close();
+ }
+
+ /** test next(), get result set and close without walking through */
+ @Test public void testNext3() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+ assertEquals(new Integer(0), new Integer(rs.getRow()));
+
+ rs.close();
+ }
+
+ /** test next(), walk through partial rows of a result set */
+ @Test public void testNext4() throws Exception {
+ List[] results = exampleResults1(5);
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+
+ for (int i = 0; i < results.length - 1; i++) {
+ rs.next();
+ List actual = rs.getCurrentRecord();
+ List expected = results[i];
+ assertEquals(expected, actual);
+ }
+
+ rs.close();
+ }
+
+ /** test next(), when hasNext() == false */
+ @Test public void testNext5() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+ while (rs.next()) {
+ // just walk through until hasNext() == false;
+ }
+
+ boolean actual = rs.hasNext();
+ boolean expected = false;
+ assertEquals(expected, actual);
+
+ rs.close();
+ }
+
+ /** test getObject() at columnIndex = 2 of 5th row */
+ @Test public void testGetObject1() throws Exception {
+ List[] results = exampleResults2();
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
+ statement);
+
+ String actual = null;
+ String expected = "a3"; //$NON-NLS-1$
+
+ // move cursor to the 4th row
+ for (int i = 0; i < results.length - 2; i++) {
+ rs.next();
+ }
+
+ // only compare the 4th row's 2nd column
+ if (rs.next()) {
+ actual = (String) rs.getObject(2);
+ }
+
+ assertEquals(expected, actual);
+
+ rs.close();
+ }
+
+ /** Should fail, test getObject() at wrong columnIndex */
+ @Test public void testGetObject2() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
+ statement);
+
+ if (rs.next()) {
+ // ERROR -- there are totally only 2 columns inside result set, 6 is
+ // an invalid one
+ try {
+ rs.getObject(6);
+ } catch (Exception e) {
+ if (e instanceof IllegalArgumentException) {
+ // OK
+ }
+ }
+ }
+
+ rs.close();
+ }
+
+ @Test public void testGetRow() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
+ statement);
+
+ int expected = 0;
+ assertEquals(expected, rs.getRow());
+
+ if (rs.next()) {
+ expected = 1;
+ assertEquals(expected, rs.getRow());
+ }
+ rs.close();
+
+ }
+
+ @Test public void testPrevious() throws Exception {
+ List[] results = exampleResults1(5);
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(),
+ statement);
+
+ while (rs.next()) {
+ // just walk to the end;
+ }
+
+ // walk reversely;
+ int i = results.length - 1;
+ while (rs.previous()) {
+ List expected = new ArrayList();
+ expected.add(new Integer(i + 1));
+ assertEquals(expected, rs.getCurrentRecord());
+ i--;
+ }
+
+ rs.close();
+ }
+
+ @Test public void testGetCurrentRecord() throws Exception {
+ List[] results = exampleResults2();
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
+ statement);
+
+ rs.next();
+ List actual = rs.getCurrentRecord();
+ assertEquals(results[0], actual);
+ rs.close();
+ }
+
+ @Test public void testGetMetaData() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
+ statement);
+ ResultSetMetaData rmetadata = rs.getMetaData();
+ assertEquals(2, rmetadata.getColumnCount());
+
+ String[] columnNames = columnNames();
+ String[] dataTypes = dataTypes();
+ for (int i = 0; i < 2; i++) {
+ assertEquals(columnNames[i], rmetadata.getColumnName(i + 1));
+ assertEquals(dataTypes[i], rmetadata.getColumnTypeName(i + 1));
+ }
+ rs.close();
+ }
+
+ @Test public void testResultsWarnings() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
+ statement);
+ rs.close();
+ }
+
+ @Test public void testClose() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
+ statement);
+ rs.close();
+ verify(statement, times(0)).close();
+ }
+
+ @Test public void testGetFetchSize() throws Exception {
+ StatementImpl s = mock(StatementImpl.class);
+ stub(s.getFetchSize()).toReturn(500);
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(), s);
+ assertEquals(500, rs.getFetchSize());
+ rs.setFetchSize(100);
+ assertEquals(100, rs.getFetchSize());
+ }
+
+ // //////////////////////Functions refer to ResultSet's TYPE_FORWARD_ONLY///
+ // /////////////////
+ @Test(expected=SQLException.class) public void testIsAfterLast1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+ rs.last();
+ }
+
+ @Test(expected=SQLException.class) public void testAfterLast1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+ rs.afterLast();
+ }
+
+ @Test public void testIsBeforeFirst1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ // right before the first row
+ boolean actual = rs.isBeforeFirst();
+ assertEquals(true, actual);
+ rs.close();
+ }
+
+ @Test public void testIsBeforeFirst2() throws Exception {
+ ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
+
+ // right before the first row
+ boolean actual = rs.isBeforeFirst();
+ assertEquals(false, actual);
+ rs.close();
+ }
+
+ @Test(expected=SQLException.class) public void testBeforeFirst1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ // move cursor to the first row
+ rs.next();
+
+ // move back to before first row
+ rs.beforeFirst();
+ }
+
+ @Test public void testIsFirst1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ // move cursor to the first row
+ rs.next();
+ boolean actual = rs.isFirst();
+ assertEquals(true, actual);
+ rs.close();
+ }
+
+ @Test public void testIsFirst2() throws Exception {
+ ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
+
+ // move cursor to the first row
+ rs.next();
+ boolean actual = rs.isFirst();
+ assertEquals(false, actual);
+ rs.close();
+ }
+
+ @Test(expected=SQLException.class) public void testFirst1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ // move cursor to the first row
+ rs.next();
+ rs.first();
+ }
+
+ @Test(expected=SQLException.class) public void testFirst2() throws Exception {
+ ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
+
+ // move cursor to the first row
+ rs.next();
+ rs.first();
+ }
+
+ @Test public void testFindColumn() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2a(),
+ statement);
+
+ assertEquals(1, rs.findColumn("IntNum")); //$NON-NLS-1$
+ rs.close();
+ }
+
+ @Test public void testIsLast1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ // move cursor to the last row
+ boolean actual = rs.isLast();
+ assertEquals(false, actual);
+ }
+
+ @Test public void testIsLast2() throws Exception {
+ ResultSetImpl rs = helpGetNoResults(TYPE_FORWARD_ONLY);
+
+ // move cursor to the last row
+ boolean actual = rs.isLast();
+ assertEquals(false, actual);
+ }
+
+ @Test(expected=SQLException.class) public void testLast1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ rs.last();
+ }
+
+ @Test public void testRelative1() throws Exception {
+ ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg2(),
+ statement);
+
+ // move to 1st row
+ rs.next();
+ // move to 2nd row
+ boolean actual = rs.relative(1);
+ assertEquals(true, actual);
+ assertEquals(2, rs.getRow());
+
+ actual = rs.relative(-1);
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+ rs.close();
+ }
+
+ @Test(expected=SQLException.class) public void testAbsolute1() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_FORWARD_ONLY);
+
+ rs.absolute(1);
+ }
+
+ // //////////Functions refer to other types other than ResultSet's
+ // TYPE_FORWARD_ONLY//////
+
+ @Test public void testAfterLast1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move cursor right past the last row
+ rs.afterLast();
+
+ // the expected row == 0 because it pasts the last row
+ assertEquals(0, rs.getRow());
+ rs.close();
+ }
+
+ @Test public void testIsAfterLast1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // the last row
+ rs.last();
+ boolean actual = rs.isAfterLast();
+ assertEquals(false, actual);
+
+ // move after the last row
+ rs.next();
+ actual = rs.isAfterLast();
+ assertEquals(true, actual);
+ rs.close();
+ }
+
+ @Test public void testIsBeforeFirst1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // right before the first row
+ boolean actual = rs.isBeforeFirst();
+ assertEquals(true, actual);
+ rs.close();
+ }
+
+ @Test public void testBeforeFirst1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move cursor to the first row
+ rs.next();
+ rs.next();
+
+ // move back to before first row
+ rs.beforeFirst();
+
+ assertEquals(0, rs.getRow());
+ rs.close();
+ }
+
+ @Test public void testIsFirst1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move cursor to the first row
+ rs.next();
+ boolean actual = rs.isFirst();
+ assertEquals(true, actual);
+
+ // check row number
+ assertEquals(1, rs.getRow());
+ rs.close();
+ }
+
+ @Test public void testFirst1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move cursor to the first row
+ boolean actual = rs.first();
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+
+ // move cursor to the first row starting from the last row
+ rs.afterLast();
+ actual = rs.first();
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+
+ // move cursor to the first row from random number;
+ rs.absolute(3);
+ actual = rs.first();
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+ rs.close();
+ }
+
+ @Test public void testIsLast1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // check whether the movement of cursor is successful
+ rs.last();
+ boolean actual = rs.isLast();
+ assertEquals(true, actual);
+
+ // check row number
+ assertEquals(5, rs.getRow());
+ rs.close();
+ }
+
+ @Test public void testLast1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // check whether the movement of cursor is successful
+ boolean actual = rs.last();
+ assertEquals(true, actual);
+
+ // check weather the current row is the last row
+ assertEquals(5, rs.getRow());
+ rs.close();
+ }
+
+ /** normal relative move, only including moving from valid row to valid one */
+ @Test public void testRelative1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move to 1st row
+ rs.next();
+ // move to 2nd row
+ boolean actual = rs.relative(1);
+
+ assertEquals(true, actual);
+ assertEquals(2, rs.getRow());
+
+ actual = rs.relative(-1);
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+ rs.close();
+ }
+
+ /** normal relative move, including moving from valid row to invalid one */
+ @Test public void testRelative1b() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // move to 1st row
+ rs.next();
+ // move to 2nd row
+ boolean actual = rs.relative(1);
+ actual = rs.relative(-1);
+
+ // test if move before first
+ actual = rs.relative(-3);
+ // relative should return false when not on a row
+ assertEquals(false, actual);
+ assertEquals(0, rs.getRow());
+
+ // test if move after last
+ // this line is very important because it positions the cursor in a
+ // valid row!!!
+ rs.beforeFirst();
+ rs.next();
+ actual = rs.relative(7);
+ // should return false because it's not on a valid row
+ assertEquals(false, actual);
+ assertEquals(0, rs.getRow());
+ rs.close();
+ }
+
+ /** check only moving from an invalid row */
+ @Test public void testRelative1c() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // test if move before first will work or not
+ // default to before first
+ try {
+ rs.relative(-2);
+ fail("relative move from an invalid row should fail"); //$NON-NLS-1$
+ } catch (SQLException e) {
+
+ }
+ assertEquals(
+ " Should still be before the first row ", true, rs.isBeforeFirst()); //$NON-NLS-1$
+ assertEquals(0, rs.getRow());
+
+ try {
+ rs.relative(2);
+ fail("relative move from an invalid row should fail"); //$NON-NLS-1$
+ } catch (SQLException e) {
+
+ }
+ assertEquals(
+ " Should still be before the first row ", true, rs.isBeforeFirst()); //$NON-NLS-1$
+ assertEquals(0, rs.getRow());
+ // test if move after last will work or not
+
+ rs.afterLast();
+
+ try {
+ rs.relative(2);
+ fail("relative move from an invalid row should fail"); //$NON-NLS-1$
+ } catch (SQLException e) {
+
+ }
+ assertEquals(
+ " Should still be after the last row. ", true, rs.isAfterLast()); //$NON-NLS-1$
+ assertEquals(0, rs.getRow());
+ try {
+ rs.relative(-2);
+ fail("relative move from an invalid row should fail"); //$NON-NLS-1$
+ } catch (SQLException e) {
+
+ }
+ assertEquals(
+ " Should still be after the last row. ", true, rs.isAfterLast()); //$NON-NLS-1$
+ assertEquals(0, rs.getRow());
+ rs.close();
+ }
+
+ /** test only valid row in result set */
+ @Test public void testAbsolute1a() throws Exception {
+ ResultSetImpl rs = helpGetResultSetImpl(TYPE_SCROLL_SENSITIVE);
+
+ // start from beginning
+ boolean actual = rs.absolute(1);
+ assertEquals(true, actual);
+ assertEquals(1, rs.getRow());
+
+ actual = rs.absolute(12);
+ assertEquals(false, actual);
+ assertEquals(0, rs.getRow());
+
+ // start from right after last
+ rs.afterLast();
+ actual = rs.absolute(-1);
+ assertEquals(true, actual);
+ assertEquals(5, rs.getRow());
+
+ actual = rs.absolute(-2);
+ assertEquals(true, actual);
+ assertEquals(4, rs.getRow());
+ rs.close();
+ }
+
+ /** test only valid row in result set */
+ @Test public void testAbsolute2a() throws Exception {
+ ResultSetImpl rs = helpGetNoResults(TYPE_SCROLL_SENSITIVE);
+
+ // start from beginning
+ assertEquals(false, rs.absolute(1));
+ assertEquals(0, rs.getRow());
+
+ // start from right after last
+ rs.afterLast();
+ assertEquals(false, rs.absolute(-1));
+ assertEquals(0, rs.getRow());
+
+ rs.close();
+ }
+
+ /**
+ * 3 batches
+ */
+ @Test public void testMoreResults() throws Exception {
+ int fetchSize = 5;
+ int batchLength = 4;
+ int totalLength = 10;
+
+ ResultSetImpl rs = helpTestBatching(statement, fetchSize, batchLength,
+ totalLength);
+
+ assertTrue(rs.absolute(6));
+ assertTrue(rs.absolute(-1));
+ assertFalse(rs.next());
+
+ for (int i = 0; i < totalLength; i++) {
+ assertTrue(rs.previous());
+ }
+ }
+
+ @Test(expected=TeiidSQLException.class) public void testResultsMessageException() throws Exception {
+ ResultsMessage resultsMsg = exampleMessage(exampleResults1(1), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
+ resultsMsg.setFinalRow(-1);
+ ResultsMessage next = new ResultsMessage();
+ next.setException(new Throwable());
+ ResultsFuture<ResultsMessage> rf = new ResultsFuture<ResultsMessage>();
+ rf.getResultsReceiver().receiveResults(next);
+ Mockito.stub(statement.getDQP().processCursorRequest(0, 2, 0)).toReturn(rf);
+ ResultSetImpl cs = new ResultSetImpl(resultsMsg, statement, null, 2);
+ cs.next();
+ cs.next();
+ }
+
+ static ResultSetImpl helpTestBatching(StatementImpl statement, int fetchSize, int batchLength,
+ int totalLength) throws InterruptedException, ExecutionException,
+ TeiidProcessingException, SQLException, TimeoutException {
+ DQP dqp = mock(DQP.class);
+ stub(statement.getDQP()).toReturn(dqp);
+ stub(statement.getFetchSize()).toReturn(fetchSize);
+ for (int i = batchLength; i < totalLength; i += batchLength) {
+ //forward requests
+ ResultsFuture<ResultsMessage> nextBatch = mock(ResultsFuture.class);
+ stub(nextBatch.get(Matchers.anyLong(), (TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i + 1, Math.min(batchLength, totalLength - i), fetchSize, i + batchLength >= totalLength));
+ stub(dqp.processCursorRequest(REQUEST_ID, i + 1, fetchSize)).toReturn(nextBatch);
+
+ if (i + batchLength < totalLength) {
+ //backward requests
+ ResultsFuture<ResultsMessage> previousBatch = mock(ResultsFuture.class);
+ stub(previousBatch.get(Matchers.anyLong(), (TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i - batchLength + 1, i, fetchSize, false));
+ stub(dqp.processCursorRequest(REQUEST_ID, i, fetchSize)).toReturn(previousBatch);
+ }
+ }
+
+ ResultsMessage msg = exampleResultsMsg4(1, batchLength, fetchSize, batchLength == totalLength);
+ return new ResultSetImpl(msg, statement);
+ }
+
+ // /////////////////////Helper Method///////////////////
+ static List<Object>[] exampleResults1(int length) {
+ return exampleResults1(length, 1);
+ }
+
+ static List<Object>[] exampleResults1(int length, int begin) {
+ List<Object>[] results = new List[length];
+
+ for (int i = 0; i < results.length; i++) {
+ results[i] = new ArrayList<Object>();
+ results[i].add(new Integer(begin + i));
+ }
+
+ return results;
+ }
+
+ private List[] exampleResults2() {
+ List[] results = new List[5];
+
+ for (int i = 0; i < results.length; i++) {
+ results[i] = new ArrayList();
+ results[i].add(new Integer(i));
+ results[i].add(new String("a" + i)); //$NON-NLS-1$
+ }
+
+ return results;
+ }
+
+ private String[] columnNames() {
+ String[] names = new String[2];
+ names[0] = new String("IntNum"); //$NON-NLS-1$
+ names[1] = new String("StringNum"); //$NON-NLS-1$
+ return names;
+ }
+
+ private String[] dataTypes() {
+ String[] types = new String[2];
+ types[0] = JDBCSQLTypeInfo.INTEGER;
+ types[1] = JDBCSQLTypeInfo.STRING;
+ return types;
+ }
+
+ private ResultSetImpl helpGetResultSetImpl(int type)
+ throws SQLException {
+ ResultsMessage rsMsg = exampleResultsMsg2();
+ statement = TestResultSet.createMockStatement(type);
+ ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
+ return rs;
+ }
+
+ private ResultSetImpl helpGetNoResults(int type) throws SQLException {
+ ResultsMessage rsMsg = exampleResultsMsg3();
+ statement = TestResultSet.createMockStatement(type);
+ ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
+ return rs;
+ }
+
+ /** without metadata info. */
+ private ResultsMessage exampleResultsMsg1() {
+ return exampleMessage(exampleResults1(5), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
+ }
+
+ private ResultsMessage exampleMessage(List<Object>[] results, String[] columnNames, String[] datatypes) {
+ RequestMessage request = new RequestMessage();
+ request.setExecutionId(REQUEST_ID);
+ ResultsMessage resultsMsg = new ResultsMessage(request);
+ resultsMsg.setResults(results);
+ resultsMsg.setColumnNames(columnNames);
+ resultsMsg.setDataTypes(datatypes);
+ resultsMsg.setFinalRow(results.length);
+ resultsMsg.setLastRow(results.length);
+ resultsMsg.setFirstRow(1);
+ return resultsMsg;
+ }
+
+ /** without metadata info. */
+ private ResultsMessage exampleResultsMsg2() {
+ return exampleMessage(exampleResults2(), new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /** with limited metadata info. */
+ private ResultsMessage exampleResultsMsg2a() {
+ ResultsMessage resultsMsg = exampleResultsMsg2();
+ List[] results = exampleResults2();
+ resultsMsg.setDataTypes(dataTypes());
+ resultsMsg.setColumnNames(columnNames());
+
+ resultsMsg.setResults(results);
+ resultsMsg.setFinalRow(results.length);
+ resultsMsg.setLastRow(results.length);
+ resultsMsg.setFirstRow(1);
+ return resultsMsg;
+ }
+
+ /** no rows. */
+ private ResultsMessage exampleResultsMsg3() {
+ return exampleMessage(new List[0], new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private static ResultsMessage exampleResultsMsg4(int begin, int length, int fetchSize, boolean lastBatch) {
+ RequestMessage request = new RequestMessage();
+ request.setExecutionId(REQUEST_ID);
+ ResultsMessage resultsMsg = new ResultsMessage(request);
+ List[] results = exampleResults1(length, begin);
+ resultsMsg.setResults(results);
+ resultsMsg.setColumnNames(new String[] { "IntKey" }); //$NON-NLS-1$
+ resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.INTEGER });
+ resultsMsg.setFirstRow(begin);
+ if (lastBatch) {
+ resultsMsg.setFinalRow(begin + results.length - 1);
+ }
+ resultsMsg.setLastRow(begin + results.length - 1);
+ return resultsMsg;
+ }
+
+ @Test public void testNotCallingNext() throws SQLException {
+ ResultSetImpl cs = new ResultSetImpl(exampleResultsMsg2a(),
+ statement);
+
+ try {
+ cs.getObject(1);
+ fail("Exception expected"); //$NON-NLS-1$
+ } catch (SQLException e) {
+ assertEquals("The cursor is not on a valid row.", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ @Test public void testDateType() throws SQLException {
+ RequestMessage request = new RequestMessage();
+ request.setExecutionId(REQUEST_ID);
+ ResultsMessage resultsMsg = new ResultsMessage(request);
+ resultsMsg.setResults(new List[] {Arrays.asList(new Timestamp(0))});
+ resultsMsg.setColumnNames(new String[] { "TS" }); //$NON-NLS-1$
+ resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.TIMESTAMP });
+ resultsMsg.setFirstRow(1);
+ resultsMsg.setFinalRow(1);
+ resultsMsg.setLastRow(1);
+ ResultSetImpl rs = new ResultSetImpl(resultsMsg, statement);
+ assertTrue(rs.next());
+ //assumes the mock statement is setup with GMT-5 server and GMT-6 client
+
+ //will adjust ahead one hour
+ assertEquals(new Timestamp(3600000), rs.getObject(1));
+
+ //will be the same as the original
+ assertEquals(new Timestamp(0), rs.getTimestamp(1, Calendar.getInstance(TimeZone.getTimeZone("GMT-05:00")))); //$NON-NLS-1$
+ }
+
+ @Test public void testWasNull() throws SQLException{
+ ResultsMessage message = exampleMessage(new List[] { Arrays.asList((String)null), Arrays.asList("1") }, new String[] { "string" }, //$NON-NLS-1$
+ new String[] { JDBCSQLTypeInfo.STRING });
+ ResultSetImpl rs = new ResultSetImpl(message, statement);
+ assertTrue(rs.next());
+ assertEquals(Boolean.FALSE.booleanValue(), rs.getBoolean(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getShort(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getInt(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0l, rs.getLong(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0f, rs.getFloat(1), 0);
+ assertTrue(rs.wasNull());
+ assertEquals(0d, rs.getDouble(1), 0);
+ assertTrue(rs.wasNull());
+ assertNull(rs.getString(1));
+ assertTrue(rs.wasNull());
+ assertTrue(rs.next());
+ assertEquals(1, rs.getShort(1));
+ assertFalse(rs.wasNull());
+ assertFalse(rs.next());
+ }
+
+ @Test public void testGetters() throws SQLException{
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT-05:00")); //$NON-NLS-1$
+ ResultsMessage message = exampleMessage(new List[] { Arrays.asList(1, TimestampUtil.createTime(0, 0, 0), TimestampUtil.createDate(1, 1, 1), TimestampUtil.createTimestamp(1, 1, 1, 1, 1, 1, 1), "<root/>") }, //$NON-NLS-1$
+ new String[] { "int", "time", "date", "timestamp", "sqlxml" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.TIME, JDBCSQLTypeInfo.DATE, JDBCSQLTypeInfo.TIMESTAMP, JDBCSQLTypeInfo.STRING });
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
+ ResultSetImpl rs = new ResultSetImpl(message, statement);
+ assertTrue(rs.next());
+ assertEquals(Boolean.TRUE.booleanValue(), rs.getBoolean(1));
+ assertEquals(1, rs.getShort(1));
+ assertEquals(1, rs.getInt(1));
+ assertEquals(1l, rs.getLong(1));
+ assertEquals(1f, rs.getFloat(1), 0);
+ assertEquals(1d, rs.getDouble(1), 0);
+ assertEquals("1", rs.getString(1)); //$NON-NLS-1$
+ assertEquals(Integer.valueOf(1), rs.getObject(1));
+ //the mock statement is in GMT-6 the server results are from GMT-5, so we expect them to display the same
+ assertEquals(TimestampUtil.createTime(0, 0, 0), rs.getTime(2));
+ assertEquals(TimestampUtil.createDate(1, 1, 1), rs.getDate(3));
+ assertEquals(TimestampUtil.createTimestamp(1, 1, 1, 1, 1, 1, 1), rs.getTimestamp(4));
+ assertEquals("<root/>", rs.getSQLXML(5).getString()); //$NON-NLS-1$
+ try {
+ rs.getSQLXML(1);
+ } catch (SQLException e) {
+ assertEquals("Unable to transform the column value 1 to a SQLXML.", e.getMessage()); //$NON-NLS-1$
+ }
+ assertFalse(rs.next());
+ TimestampWithTimezone.resetCalendar(null);
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/common-core/pom.xml
===================================================================
--- branches/7.3.x/common-core/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/common-core/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-common-core</artifactId>
- <name>Common Core</name>
- <description>Core shared library</description>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-resources</phase>
- <configuration>
- <tasks>
- <tstamp />
- <replace dir="${project.build.outputDirectory}" token="@build-date@" value="${DSTAMP}">
- <include name="**/*.properties" />
- </replace>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/common-core/pom.xml (from rev 2888, branches/7.3.x/common-core/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/common-core/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/common-core/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-common-core</artifactId>
+ <name>Common Core</name>
+ <description>Core shared library</description>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <configuration>
+ <tasks>
+ <tstamp />
+ <replace dir="${project.build.outputDirectory}" token="@build-date@" value="${DSTAMP}">
+ <include name="**/*.properties" />
+ </replace>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-file/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-file</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>File Connector</name>
- <packaging>rar</packaging>
- <description>This connector reads data from files.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml (from rev 2888, branches/7.3.x/connectors/connector-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-file</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>File Connector</name>
+ <packaging>rar</packaging>
+ <description>This connector reads data from files.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ldap/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,57 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-ldap</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>LDAP Connector</name>
- <description>LDAP Connector</description>
- <packaging>rar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml (from rev 2888, branches/7.3.x/connectors/connector-ldap/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,57 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-ldap</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>LDAP Connector</name>
+ <description>LDAP Connector</description>
+ <packaging>rar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-salesforce/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-salesforce</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce Connector</name>
- <packaging>rar</packaging>
- <description>Integrates the query engine with Salesforce.com.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-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>salesforce-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>translator-salesforce</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml (from rev 2888, branches/7.3.x/connectors/connector-salesforce/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-salesforce</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce Connector</name>
+ <packaging>rar</packaging>
+ <description>Integrates the query engine with Salesforce.com.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-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>salesforce-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>translator-salesforce</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ws/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-ws</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Web Service Connector</name>
- <packaging>rar</packaging>
- <description>This connector reads data from Web Services</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxws</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-security</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-policy</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml (from rev 2888, branches/7.3.x/connectors/connector-ws/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/connector-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-ws</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Web Service Connector</name>
+ <packaging>rar</packaging>
+ <description>This connector reads data from Web Services</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/pom.xml
===================================================================
--- branches/7.3.x/connectors/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>connectors</artifactId>
- <packaging>pom</packaging>
- <name>Connectors</name>
- <description>This project is aggregator for all the supported connectors.</description>
- <dependencies>
-
- <!-- Internal Test Dependencies -->
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <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-client</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <!-- External dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <modules>
- <module>translator-jdbc</module>
- <module>translator-ldap</module>
- <module>translator-loopback</module>
- <module>translator-file</module>
- <module>translator-salesforce</module>
- <module>connector-file</module>
- <module>connector-salesforce</module>
- <module>connector-ldap</module>
- <module>salesforce-api</module>
- <module>connector-ws</module>
- <module>sandbox</module>
- <module>translator-ws</module>
- </modules>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/pom.xml (from rev 2888, branches/7.3.x/connectors/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>connectors</artifactId>
+ <packaging>pom</packaging>
+ <name>Connectors</name>
+ <description>This project is aggregator for all the supported connectors.</description>
+ <dependencies>
+
+ <!-- Internal Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <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-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <modules>
+ <module>translator-jdbc</module>
+ <module>translator-ldap</module>
+ <module>translator-loopback</module>
+ <module>translator-file</module>
+ <module>translator-salesforce</module>
+ <module>connector-file</module>
+ <module>connector-salesforce</module>
+ <module>connector-ldap</module>
+ <module>salesforce-api</module>
+ <module>connector-ws</module>
+ <module>sandbox</module>
+ <module>translator-ws</module>
+ </modules>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml
===================================================================
--- branches/7.3.x/connectors/salesforce-api/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,14 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>salesforce-api</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce API</name>
- <description>The java API for the Salesforce.com partner web service API</description>
- <dependencies>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml (from rev 2888, branches/7.3.x/connectors/salesforce-api/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/salesforce-api/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,14 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>salesforce-api</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce API</name>
+ <description>The java API for the Salesforce.com partner web service API</description>
+ <dependencies>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>sandbox</artifactId>
- <packaging>pom</packaging>
- <name>Sandbox</name>
- <description>Experimental connectors in progress</description>
- <modules>
- <module>translator-yahoo</module>
- </modules>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml (from rev 2888, branches/7.3.x/connectors/sandbox/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/sandbox/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>sandbox</artifactId>
+ <packaging>pom</packaging>
+ <name>Sandbox</name>
+ <description>Experimental connectors in progress</description>
+ <modules>
+ <module>translator-yahoo</module>
+ </modules>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>sandbox</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-yahoo</artifactId>
- <groupId>org.jboss.teiid.connectors.sandbox</groupId>
- <name>Yahoo Translator</name>
- <description>Test translator used to query ticker symbols from Yahoo website</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml (from rev 2888, branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>sandbox</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-yahoo</artifactId>
+ <groupId>org.jboss.teiid.connectors.sandbox</groupId>
+ <name>Yahoo Translator</name>
+ <description>Test translator used to query ticker symbols from Yahoo website</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-file/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-file</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>File Translator</name>
- <description>This translator provides access to the file system.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-file/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-file</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>File Translator</name>
+ <description>This translator provides access to the file system.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-jdbc/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-jdbc</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>JDBC Translator</name>
-
- <description>This project contains translators for a JDBC source. Currently this is an aggregator for all the JDBC translators relational databases.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-jdbc/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-jdbc/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-jdbc</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>JDBC Translator</name>
+
+ <description>This project contains translators for a JDBC source. Currently this is an aggregator for all the JDBC translators relational databases.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ldap/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,52 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-ldap</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>LDAP Translator</name>
- <description>LDAP Translator</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-ldap/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-ldap/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,52 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-ldap</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>LDAP Translator</name>
+ <description>LDAP Translator</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-loopback/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-loopback</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Loopback Translator</name>
- <description>Loopback Translator</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-loopback/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-loopback/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-loopback</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Loopback Translator</name>
+ <description>Loopback Translator</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-salesforce</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce Translator</name>
- <description>Integrates the query engine with Salesforce.com.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-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>salesforce-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-salesforce/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-salesforce</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce Translator</name>
+ <description>Integrates the query engine with Salesforce.com.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-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>salesforce-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.translator.salesforce.execution;
-
-import static org.junit.Assert.*;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.language.Call;
-import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.salesforce.SalesforceConnection;
-import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
-
-@SuppressWarnings("nls")
-public class TestProcedureExecution {
-
- private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
-
- @Test public void testProcedureName() throws Exception {
- Call command = (Call)translationUtility.parseCommand("exec getupdated('foo', {d '1970-01-01'}, {d '1990-01-01'})"); //$NON-NLS-1$
- SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
- UpdatedResult ur = new UpdatedResult();
- ur.setIDs(Arrays.asList("1", "2"));
- Mockito.stub(sfc.getUpdated(Mockito.eq("foo"), (XMLGregorianCalendar)Mockito.anyObject(), (XMLGregorianCalendar)Mockito.anyObject())).toReturn(ur);
- ProcedureExecutionParentImpl pepi = new ProcedureExecutionParentImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
- pepi.execute();
- assertNotNull(pepi.next());
- assertNotNull(pepi.next());
- assertNull(pepi.next());
- pepi.close();
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java (from rev 2886, branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.salesforce.execution;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Call;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
+
+@SuppressWarnings("nls")
+public class TestProcedureExecution {
+
+ private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
+
+ @Test public void testProcedureName() throws Exception {
+ Call command = (Call)translationUtility.parseCommand("exec getupdated('foo', {d '1970-01-01'}, {d '1990-01-01'})"); //$NON-NLS-1$
+ SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+ UpdatedResult ur = new UpdatedResult();
+ ur.setIDs(Arrays.asList("1", "2"));
+ Mockito.stub(sfc.getUpdated(Mockito.eq("foo"), (XMLGregorianCalendar)Mockito.anyObject(), (XMLGregorianCalendar)Mockito.anyObject())).toReturn(ur);
+ ProcedureExecutionParentImpl pepi = new ProcedureExecutionParentImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
+ pepi.execute();
+ assertNotNull(pepi.next());
+ assertNotNull(pepi.next());
+ assertNull(pepi.next());
+ pepi.close();
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,219 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.translator.salesforce.execution.visitors;
-
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.TimeZone;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.language.Select;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.ProcedureParameter;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
-import org.teiid.metadata.Column.SearchType;
-import org.teiid.query.metadata.CompositeMetadataStore;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.RealMetadataFactory;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.TypeFacility;
-import org.teiid.translator.salesforce.Constants;
-import org.teiid.translator.salesforce.SalesforceConnection;
-import org.teiid.translator.salesforce.execution.QueryExecutionImpl;
-
-@SuppressWarnings("nls")
-public class TestVisitors {
-
- public static QueryMetadataInterface exampleSalesforce() {
- MetadataStore store = new MetadataStore();
- // Create models
- Schema salesforceModel = RealMetadataFactory.createPhysicalModel("SalesforceModel", store); //$NON-NLS-1$
-
- // Create Account group
- Table accountTable = RealMetadataFactory.createPhysicalGroup("Account", salesforceModel); //$NON-NLS-1$
- accountTable.setNameInSource("Account"); //$NON-NLS-1$
- accountTable.setProperty("Supports Query", Boolean.TRUE.toString()); //$NON-NLS-1$
- accountTable.setProperty(Constants.SUPPORTS_RETRIEVE, Boolean.TRUE.toString());
- // Create Account Columns
- String[] acctNames = new String[] {
- "ID", "Name", "Stuff", "Industry" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- };
- String[] acctTypes = new String[] {
- DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING
- };
-
- List<Column> acctCols = RealMetadataFactory.createElements(accountTable, acctNames, acctTypes);
- acctCols.get(2).setNativeType("multipicklist"); //$NON-NLS-1$
- acctCols.get(2).setSearchType(SearchType.Like_Only);
- // Set name in source on each column
- String[] accountNameInSource = new String[] {
- "id", "AccountName", "Stuff", "Industry" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- };
- for(int i=0; i<2; i++) {
- Column obj = acctCols.get(i);
- obj.setNameInSource(accountNameInSource[i]);
- }
-
- // Create Contact group
- Table contactTable = RealMetadataFactory.createPhysicalGroup("Contacts", salesforceModel); //$NON-NLS-1$
- contactTable.setNameInSource("Contact"); //$NON-NLS-1$
- contactTable.setProperty("Supports Query", Boolean.TRUE.toString()); //$NON-NLS-1$
- // Create Contact Columns
- String[] elemNames = new String[] {
- "ContactID", "Name", "AccountId", "InitialContact" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- };
- String[] elemTypes = new String[] {
- DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.TIMESTAMP
- };
-
- List<Column> contactCols = RealMetadataFactory.createElements(contactTable, elemNames, elemTypes);
- // Set name in source on each column
- String[] contactNameInSource = new String[] {
- "id", "ContactName", "accountid", "InitialContact" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- };
- for(int i=0; i<2; i++) {
- Column obj = contactCols.get(i);
- obj.setNameInSource(contactNameInSource[i]);
- }
- List<ProcedureParameter> params = new LinkedList<ProcedureParameter>();
- params.add(RealMetadataFactory.createParameter("type", SPParameter.IN, TypeFacility.RUNTIME_NAMES.STRING));
- params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
- params.add(RealMetadataFactory.createParameter("end", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
-
- Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params, "GetUpdated");
- getUpdated.setResultSet(RealMetadataFactory.createResultSet("rs", new String[] {"updated"}, new String[] {TypeFacility.RUNTIME_NAMES.STRING}));
-
- return new TransformationMetadata(null, new CompositeMetadataStore(store), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
- }
-
- private static TranslationUtility translationUtility = new TranslationUtility(exampleSalesforce());
-
- @Test public void testOr() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select * from Account where Name = 'foo' or Stuff = 'bar'"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName = 'foo') OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testNot() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select * from Account where not (Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName != 'foo') OR (Account.Stuff != 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testCountStart() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select count(*) from Account"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT count() FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testNotLike() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select * from Account where Name not like '%foo' or Stuff = 'bar'"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (NOT (Account.AccountName LIKE '%foo')) OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
-
- @Test public void testIN() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select * from Account where Industry IN (1,2,3)"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertFalse(visitor.hasOnlyIDCriteria());
- assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE Industry IN('1','2','3')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
-
- }
-
- @Test public void testOnlyIDsIN() throws Exception {
- // this can resolve to a better performing retrieve call
- Select command = (Select)translationUtility.parseCommand("select * from Account where ID IN (1,2,3)"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertTrue(visitor.hasOnlyIdInCriteria());
- assertEquals("Account", visitor.getTableName());
- assertEquals("Account.id, Account.AccountName, Account.Stuff, Account.Industry", visitor.getRetrieveFieldList());
- assertEquals(Arrays.asList(new String[]{"1", "2", "3"}), visitor.getIdInCriteria());
- }
-
- @Test public void testJoin() throws Exception {
- Select command = (Select)translationUtility.parseCommand("SELECT Account.Name, Contacts.Name FROM Contacts LEFT OUTER JOIN Account ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
- SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Account.AccountName, Contact.ContactName FROM Contact", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testJoin2() throws Exception {
- Select command = (Select)translationUtility.parseCommand("SELECT Account.Name, Contacts.Name FROM Account LEFT OUTER JOIN Contacts ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
- SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Account.AccountName, (SELECT Contact.ContactName FROM Contacts) FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testJoin3() throws Exception {
- Select command = (Select)translationUtility.parseCommand("SELECT Contacts.Name FROM Account LEFT OUTER JOIN Contacts ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
- SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT (SELECT Contact.ContactName FROM Contacts) FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testInWithNameInSourceDifferent() throws Exception {
- Select command = (Select)translationUtility.parseCommand("SELECT Contacts.Name FROM Contacts WHERE Contacts.Name in ('x', 'y')"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Contact.ContactName FROM Contact WHERE ContactName IN('x','y')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- }
-
- @Test public void testIDCriteria() throws Exception {
- Select command = (Select)translationUtility.parseCommand("select id, name from Account where id = 'bar'"); //$NON-NLS-1$
- SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
- QueryExecutionImpl qei = new QueryExecutionImpl(command, sfc, translationUtility.createRuntimeMetadata(), Mockito.mock(ExecutionContext.class));
- qei.execute();
- Mockito.verify(sfc).retrieve("Account.id, Account.AccountName", "Account", Arrays.asList("bar"));
- }
-
- @Test public void testDateTimeFormating() throws Exception {
- TimeZone.setDefault(TimeZone.getTimeZone("GMT-06:00"));
- try {
- Select command = (Select)translationUtility.parseCommand("select name from contacts where initialcontact = {ts'2003-03-11 11:42:10.5'}"); //$NON-NLS-1$
- SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
- visitor.visit(command);
- assertEquals("SELECT Contact.ContactName FROM Contact WHERE Contact.InitialContact = 2003-03-11T11:42:10.500-06:00", visitor.getQuery().toString().trim()); //$NON-NLS-1$
- } finally {
- TimeZone.setDefault(null);
- }
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java (from rev 2886, branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.translator.salesforce.execution.visitors;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.Select;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.Column.SearchType;
+import org.teiid.query.metadata.CompositeMetadataStore;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.sql.lang.SPParameter;
+import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.salesforce.Constants;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.QueryExecutionImpl;
+
+@SuppressWarnings("nls")
+public class TestVisitors {
+
+ public static QueryMetadataInterface exampleSalesforce() {
+ MetadataStore store = new MetadataStore();
+ // Create models
+ Schema salesforceModel = RealMetadataFactory.createPhysicalModel("SalesforceModel", store); //$NON-NLS-1$
+
+ // Create Account group
+ Table accountTable = RealMetadataFactory.createPhysicalGroup("Account", salesforceModel); //$NON-NLS-1$
+ accountTable.setNameInSource("Account"); //$NON-NLS-1$
+ accountTable.setProperty("Supports Query", Boolean.TRUE.toString()); //$NON-NLS-1$
+ accountTable.setProperty(Constants.SUPPORTS_RETRIEVE, Boolean.TRUE.toString());
+ // Create Account Columns
+ String[] acctNames = new String[] {
+ "ID", "Name", "Stuff", "Industry" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ };
+ String[] acctTypes = new String[] {
+ DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING
+ };
+
+ List<Column> acctCols = RealMetadataFactory.createElements(accountTable, acctNames, acctTypes);
+ acctCols.get(2).setNativeType("multipicklist"); //$NON-NLS-1$
+ acctCols.get(2).setSearchType(SearchType.Like_Only);
+ // Set name in source on each column
+ String[] accountNameInSource = new String[] {
+ "id", "AccountName", "Stuff", "Industry" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ };
+ for(int i=0; i<2; i++) {
+ Column obj = acctCols.get(i);
+ obj.setNameInSource(accountNameInSource[i]);
+ }
+
+ // Create Contact group
+ Table contactTable = RealMetadataFactory.createPhysicalGroup("Contacts", salesforceModel); //$NON-NLS-1$
+ contactTable.setNameInSource("Contact"); //$NON-NLS-1$
+ contactTable.setProperty("Supports Query", Boolean.TRUE.toString()); //$NON-NLS-1$
+ // Create Contact Columns
+ String[] elemNames = new String[] {
+ "ContactID", "Name", "AccountId", "InitialContact" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ };
+ String[] elemTypes = new String[] {
+ DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.TIMESTAMP
+ };
+
+ List<Column> contactCols = RealMetadataFactory.createElements(contactTable, elemNames, elemTypes);
+ // Set name in source on each column
+ String[] contactNameInSource = new String[] {
+ "id", "ContactName", "accountid", "InitialContact" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ };
+ for(int i=0; i<2; i++) {
+ Column obj = contactCols.get(i);
+ obj.setNameInSource(contactNameInSource[i]);
+ }
+
+ List<ProcedureParameter> params = new LinkedList<ProcedureParameter>();
+ params.add(RealMetadataFactory.createParameter("type", SPParameter.IN, TypeFacility.RUNTIME_NAMES.STRING));
+ params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
+ params.add(RealMetadataFactory.createParameter("end", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
+
+ Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params, "GetUpdated");
+ getUpdated.setResultSet(RealMetadataFactory.createResultSet("rs", new String[] {"updated"}, new String[] {TypeFacility.RUNTIME_NAMES.STRING}));
+
+ return new TransformationMetadata(null, new CompositeMetadataStore(store), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ }
+
+ private static TranslationUtility translationUtility = new TranslationUtility(exampleSalesforce());
+
+ @Test public void testOr() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select * from Account where Name = 'foo' or Stuff = 'bar'"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName = 'foo') OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testNot() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select * from Account where not (Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName != 'foo') OR (Account.Stuff != 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testCountStart() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select count(*) from Account"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT count() FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testNotLike() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select * from Account where Name not like '%foo' or Stuff = 'bar'"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (NOT (Account.AccountName LIKE '%foo')) OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+
+ @Test public void testIN() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select * from Account where Industry IN (1,2,3)"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertFalse(visitor.hasOnlyIDCriteria());
+ assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE Industry IN('1','2','3')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+
+ }
+
+ @Test public void testOnlyIDsIN() throws Exception {
+ // this can resolve to a better performing retrieve call
+ Select command = (Select)translationUtility.parseCommand("select * from Account where ID IN (1,2,3)"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertTrue(visitor.hasOnlyIdInCriteria());
+ assertEquals("Account", visitor.getTableName());
+ assertEquals("Account.id, Account.AccountName, Account.Stuff, Account.Industry", visitor.getRetrieveFieldList());
+ assertEquals(Arrays.asList(new String[]{"1", "2", "3"}), visitor.getIdInCriteria());
+ }
+
+ @Test public void testJoin() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("SELECT Account.Name, Contacts.Name FROM Contacts LEFT OUTER JOIN Account ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
+ SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Account.AccountName, Contact.ContactName FROM Contact", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testJoin2() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("SELECT Account.Name, Contacts.Name FROM Account LEFT OUTER JOIN Contacts ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
+ SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Account.AccountName, (SELECT Contact.ContactName FROM Contacts) FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testJoin3() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("SELECT Contacts.Name FROM Account LEFT OUTER JOIN Contacts ON Account.Id = Contacts.AccountId"); //$NON-NLS-1$
+ SelectVisitor visitor = new JoinQueryVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT (SELECT Contact.ContactName FROM Contacts) FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testInWithNameInSourceDifferent() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("SELECT Contacts.Name FROM Contacts WHERE Contacts.Name in ('x', 'y')"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Contact.ContactName FROM Contact WHERE ContactName IN('x','y')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ }
+
+ @Test public void testIDCriteria() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select id, name from Account where id = 'bar'"); //$NON-NLS-1$
+ SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+ QueryExecutionImpl qei = new QueryExecutionImpl(command, sfc, translationUtility.createRuntimeMetadata(), Mockito.mock(ExecutionContext.class));
+ qei.execute();
+ Mockito.verify(sfc).retrieve("Account.id, Account.AccountName", "Account", Arrays.asList("bar"));
+ }
+
+ @Test public void testDateTimeFormating() throws Exception {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT-06:00"));
+ try {
+ Select command = (Select)translationUtility.parseCommand("select name from contacts where initialcontact = {ts'2003-03-11 11:42:10.5'}"); //$NON-NLS-1$
+ SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
+ visitor.visit(command);
+ assertEquals("SELECT Contact.ContactName FROM Contact WHERE Contact.InitialContact = 2003-03-11T11:42:10.500-06:00", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ } finally {
+ TimeZone.setDefault(null);
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ws/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-ws</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Web service Translator</name>
- <description>This translator provides access to Web Services.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-
-</project>
Copied: tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml (from rev 2888, branches/7.3.x/connectors/translator-ws/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/connectors/translator-ws/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-ws</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Web service Translator</name>
+ <description>This translator provides access to Web Services.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/console/pom.xml
===================================================================
--- branches/7.3.x/console/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/console/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,175 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-console</artifactId>
- <name>Console</name>
- <description>This project is for the RHQ plugin that supports the TEIID Console </description>
-
- <properties>
- <!--
- <org.jboss.jopr.as4.version>1.2.0.GA</org.jboss.jopr.as4.version>
- -->
- <org.jboss.jopr.as5.version>1.2.0.GA</org.jboss.jopr.as5.version>
- <jopr.jboss.as5.plugin.version>1.4.0.B01</jopr.jboss.as5.plugin.version>
- <org.rhq.version>1.3.0.GA</org.rhq.version>
- <apache.ant.version>1.7.0</apache.ant.version>
- <teiid.version>${project.version}</teiid.version>
-
-
- </properties>
-
- <dependencies>
- <!--
- Below are the core modules that are required dependencies of all
- plugins
- -->
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope>
- <!--
- provided by the agent/plugin-container
- -->
- </dependency>
-
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-plugin-api</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-native-system</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-jmx-plugin</artifactId>
- <version>${org.rhq.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-util</artifactId>
- <version>${org.rhq.version}</version>
- </dependency>
-
- <dependency>
- <groupId>mc4j</groupId>
- <artifactId>org-mc4j-ems</artifactId>
- <version>1.2.6</version>
- </dependency>
-
- <!--
- TODO: This is a fix for the Javac bug requiring annotations to be
- available when compiling dependent classes. It is fixed in JDK 6.
- -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
-
- <!--
- TODO: This is a fix for the Javac bug requiring annotations to be
- available when compiling dependent classes; it is fixed in JDK 6.
- -->
- <dependency>
- <groupId>jboss.jboss-embeddable-ejb3</groupId>
- <artifactId>hibernate-all</artifactId>
- <version>1.0.0.Alpha9</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.jopr</groupId>
- <artifactId>jopr-embedded-jbas5</artifactId>
- <type>war</type>
- <version>${org.jboss.jopr.as5.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-profileservice-spi</artifactId>
- <version>5.1.0.CR2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.on</groupId>
- <artifactId>jopr-jboss-as-5-plugin</artifactId>
- <version>${jopr.jboss.as5.plugin.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.2</version>
- </dependency>
-
-
- </dependencies>
-
-
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- </resources>
- </build>
-
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/console/pom.xml (from rev 2888, branches/7.3.x/console/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/console/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/console/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,175 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-console</artifactId>
+ <name>Console</name>
+ <description>This project is for the RHQ plugin that supports the TEIID Console </description>
+
+ <properties>
+ <!--
+ <org.jboss.jopr.as4.version>1.2.0.GA</org.jboss.jopr.as4.version>
+ -->
+ <org.jboss.jopr.as5.version>1.2.0.GA</org.jboss.jopr.as5.version>
+ <jopr.jboss.as5.plugin.version>1.4.0.B01</jopr.jboss.as5.plugin.version>
+ <org.rhq.version>1.3.0.GA</org.rhq.version>
+ <apache.ant.version>1.7.0</apache.ant.version>
+ <teiid.version>${project.version}</teiid.version>
+
+
+ </properties>
+
+ <dependencies>
+ <!--
+ Below are the core modules that are required dependencies of all
+ plugins
+ -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope>
+ <!--
+ provided by the agent/plugin-container
+ -->
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-jmx-plugin</artifactId>
+ <version>${org.rhq.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-util</artifactId>
+ <version>${org.rhq.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>mc4j</groupId>
+ <artifactId>org-mc4j-ems</artifactId>
+ <version>1.2.6</version>
+ </dependency>
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be
+ available when compiling dependent classes. It is fixed in JDK 6.
+ -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be
+ available when compiling dependent classes; it is fixed in JDK 6.
+ -->
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jopr</groupId>
+ <artifactId>jopr-embedded-jbas5</artifactId>
+ <type>war</type>
+ <version>${org.jboss.jopr.as5.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>5.1.0.CR2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-as-5-plugin</artifactId>
+ <version>${jopr.jboss.as5.plugin.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+
+
+ </dependencies>
+
+
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/admin-guide/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>admin-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Admin Guide</name>
- <description>The Teiid Admin manual</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>admin_guide.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_admin_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml (from rev 2888, branches/7.3.x/documentation/admin-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/admin-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>admin-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Admin Guide</name>
+ <description>The Teiid Admin manual</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>admin_guide.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_admin_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/caching-guide/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>caching-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Caching Guide</name>
- <description>The Teiid Caching Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>main.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_caching_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml (from rev 2888, branches/7.3.x/documentation/caching-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/caching-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>caching-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Caching Guide</name>
+ <description>The Teiid Caching Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>main.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_caching_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/client-developers-guide/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>client-developers-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Client Developers Guide</name>
- <description>The Client Developers Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>main.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_client_developers_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml (from rev 2888, branches/7.3.x/documentation/client-developers-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/client-developers-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>client-developers-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Client Developers Guide</name>
+ <description>The Client Developers Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>main.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_client_developers_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/developer-guide/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>developer-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Developer's Guide</name>
- <description>The Teiid Developer's Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>Developer_Guide.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_developer_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml (from rev 2888, branches/7.3.x/documentation/developer-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/developer-guide/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>developer-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Developer's Guide</name>
+ <description>The Teiid Developer's Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>Developer_Guide.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_developer_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/documentation/pom.xml
===================================================================
--- branches/7.3.x/documentation/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,21 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <packaging>pom</packaging>
- <name>Documents</name>
- <description>Teiid Documentation Aggregator</description>
- <modules>
- <module>admin-guide</module>
- <module>reference</module>
- <module>developer-guide</module>
- <module>quick-start-example</module>
- <module>client-developers-guide</module>
- <module>caching-guide</module>
- </modules>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/documentation/pom.xml (from rev 2888, branches/7.3.x/documentation/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,21 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <packaging>pom</packaging>
+ <name>Documents</name>
+ <description>Teiid Documentation Aggregator</description>
+ <modules>
+ <module>admin-guide</module>
+ <module>reference</module>
+ <module>developer-guide</module>
+ <module>quick-start-example</module>
+ <module>client-developers-guide</module>
+ <module>caching-guide</module>
+ </modules>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml
===================================================================
--- branches/7.3.x/documentation/quick-start-example/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>quick-start-example</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Quick Start Guide</name>
- <description>The Teiid Quick Start guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>quick_start_example.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_quick_start_example.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml (from rev 2888, branches/7.3.x/documentation/quick-start-example/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/quick-start-example/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>quick-start-example</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Quick Start Guide</name>
+ <description>The Teiid Quick Start guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>quick_start_example.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_quick_start_example.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml
===================================================================
--- branches/7.3.x/documentation/reference/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,77 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>reference</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Reference</name>
- <description>The Teiid reference manual</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>Reference.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_reference.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <xincludeSupported>true</xincludeSupported>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml (from rev 2888, branches/7.3.x/documentation/reference/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/documentation/reference/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>reference</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Reference</name>
+ <description>The Teiid reference manual</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>Reference.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_reference.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <xincludeSupported>true</xincludeSupported>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/engine/pom.xml
===================================================================
--- branches/7.3.x/engine/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-engine</artifactId>
- <name>Engine</name>
- <description>Relational, procedural, and xml core engine.</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>javacc</id>
- <goals>
- <goal>javacc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <artifactId>saxon</artifactId>
- </dependency>
-
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <classifier>dom</classifier>
- <artifactId>saxon</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/engine/pom.xml (from rev 2888, branches/7.3.x/engine/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-engine</artifactId>
+ <name>Engine</name>
+ <description>Relational, procedural, and xml core engine.</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>javacc</id>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <classifier>dom</classifier>
+ <artifactId>saxon</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache;
-
-import java.util.Set;
-
-/**
- * Abstraction over cache providers
- */
-public interface Cache<K, V> {
-
- public enum Type {
- MATTABLES("MatTables"), //$NON-NLS-1$
- MATTABLEUPDATES("MatTableUpdates"), //$NON-NLS-1$
- RESULTSET("ResultSet"), //$NON-NLS-1$
- RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
- PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
-
- private String location;
-
- Type(String location){
- this.location = location;
- }
-
- Type(Type base, String location){
- this.location = base.location+"/"+location; //$NON-NLS-1$
- }
-
- public String location() {
- return this.location;
- }
- }
-
- /**
- * Retrieves the value for the given Key
- *
- * @param key key under which value is to be retrieved.
- * @return returns data held under specified key in cache
- */
- V get(K key);
-
- /**
- * Associates the specified value with the specified key this cache.
- * If the cache previously contained a mapping for this key, the old value is replaced by the specified value.
- *
- * @param key key with which the specified value is to be associated.
- * @param value value to be associated with the specified key.
- * @param ttl the time for this entry to live
- * @return previous value associated with specified key, or <code>null</code> if there was no mapping for key.
- * A <code>null</code> return can also indicate that the key previously associated <code>null</code> with the specified key,
- * if the implementation supports null values.
- */
- V put(K key, V value, Long ttl);
-
- /**
- * Removes the value for this key from a Cache.
- * Returns the value to which the Key previously associated , or
- * <code>null</code> if the Key contained no mapping.
- *
- * @param key key whose mapping is to be removed
- * @return previous value associated with specified Node's key
- */
- V remove(K key);
-
- /**
- * Size of the cache
- * @return number of items in this cache
- */
- int size();
-
- /**
- * Removes all the keys and their values from the Cache
- */
- void clear();
-
- /**
- * Name of the cache node
- * @return
- */
- String getName();
-
- /**
- * Return all the keys
- * @return
- */
- Set<K> keys();
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,85 @@
+/*
+ * 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.cache;
+
+import java.util.Set;
+
+/**
+ * Abstraction over cache providers
+ */
+public interface Cache<K, V> {
+
+ /**
+ * Retrieves the value for the given Key
+ *
+ * @param key key under which value is to be retrieved.
+ * @return returns data held under specified key in cache
+ */
+ V get(K key);
+
+ /**
+ * Associates the specified value with the specified key this cache.
+ * If the cache previously contained a mapping for this key, the old value is replaced by the specified value.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @param ttl the time for this entry to live
+ * @return previous value associated with specified key, or <code>null</code> if there was no mapping for key.
+ * A <code>null</code> return can also indicate that the key previously associated <code>null</code> with the specified key,
+ * if the implementation supports null values.
+ */
+ V put(K key, V value, Long ttl);
+
+ /**
+ * Removes the value for this key from a Cache.
+ * Returns the value to which the Key previously associated , or
+ * <code>null</code> if the Key contained no mapping.
+ *
+ * @param key key whose mapping is to be removed
+ * @return previous value associated with specified Node's key
+ */
+ V remove(K key);
+
+ /**
+ * Size of the cache
+ * @return number of items in this cache
+ */
+ int size();
+
+ /**
+ * Removes all the keys and their values from the Cache
+ */
+ void clear();
+
+ /**
+ * Name of the cache node
+ * @return
+ */
+ String getName();
+
+ /**
+ * Return all the keys
+ * @return
+ */
+ Set<K> keys();
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
-public class CacheConfiguration {
-
- public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
-
- public enum Policy {
- LRU, // Least Recently Used
- EXPIRATION
- }
-
- private Policy policy;
- private int maxage;
- private int maxEntries;
- private boolean enabled = true;
- private String name;
-
- public CacheConfiguration() {
- }
-
- public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
- this.policy = policy;
- this.maxage = maxAgeInSeconds;
- this.maxEntries = maxNodes;
- }
-
- public Policy getPolicy() {
- return this.policy;
- }
-
- @ManagementProperty(description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)")
- public int getMaxAgeInSeconds(){
- return maxage;
- }
-
- public void setMaxAgeInSeconds(int maxage){
- this.maxage = maxage;
- }
-
- @ManagementProperty(description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)")
- public int getMaxEntries() {
- return this.maxEntries;
- }
-
- public void setMaxEntries(int entries) {
- this.maxEntries = entries;
- }
-
- public void setType (String type) {
- this.policy = Policy.valueOf(type);
- }
-
- @ManagementProperty(description="Name of the configuration", readOnly=true)
- @ManagementObjectID(type="cache")
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + maxage;
- result = prime * result + maxEntries;
- result = prime * result + ((policy == null) ? 0 : policy.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- CacheConfiguration other = (CacheConfiguration) obj;
- if (maxage != other.maxage)
- return false;
- if (maxEntries != other.maxEntries)
- return false;
- if (policy == null) {
- if (other.policy != null)
- return false;
- } else if (!policy.equals(other.policy))
- return false;
- return true;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,139 @@
+/*
+ * 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.cache;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
+public class CacheConfiguration {
+
+ public enum Policy {
+ LRU, // Least Recently Used
+ EXPIRATION
+ }
+
+ private Policy policy;
+ private int maxage;
+ private int maxEntries;
+ private boolean enabled = true;
+ private String name;
+ private String location;
+
+ public CacheConfiguration() {
+ }
+
+ public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes, String location) {
+ this.policy = policy;
+ this.maxage = maxAgeInSeconds;
+ this.maxEntries = maxNodes;
+ this.location = location;
+ }
+
+ public Policy getPolicy() {
+ return this.policy;
+ }
+
+ @ManagementProperty(description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)")
+ public int getMaxAgeInSeconds(){
+ return maxage;
+ }
+
+ public void setMaxAgeInSeconds(int maxage){
+ this.maxage = maxage;
+ }
+
+ @ManagementProperty(description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)")
+ public int getMaxEntries() {
+ return this.maxEntries;
+ }
+
+ public void setMaxEntries(int entries) {
+ this.maxEntries = entries;
+ }
+
+ public void setType (String type) {
+ this.policy = Policy.valueOf(type);
+ }
+
+ @ManagementProperty(description="Name of the configuration", readOnly=true)
+ @ManagementObjectID(type="cache")
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManagementProperty(description="location prefix in cache", readOnly=true)
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + maxage;
+ result = prime * result + maxEntries;
+ result = prime * result + ((policy == null) ? 0 : policy.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CacheConfiguration other = (CacheConfiguration) obj;
+ if (maxage != other.maxage)
+ return false;
+ if (maxEntries != other.maxEntries)
+ return false;
+ if (policy == null) {
+ if (other.policy != null)
+ return false;
+ } else if (!policy.equals(other.policy))
+ return false;
+ return true;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache;
-
-public interface CacheFactory {
-
- /**
- * Create / Get the cache for the give type use
- * @param type cache type
- * @param config configuration setup for the cache
- * @return
- */
- <K,V> Cache<K, V> get(Cache.Type type, CacheConfiguration config);
-
- /**
- * Destroy the cache factory and any caches underneath.
- */
- void destroy();
-
- /**
- * Return true if replicated caches are created by this factory
- * @return
- */
- boolean isReplicated();
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,45 @@
+/*
+ * 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.cache;
+
+public interface CacheFactory {
+
+ /**
+ * Create / Get the cache for the give type use
+ * @param type cache type
+ * @param config configuration setup for the cache
+ * @return
+ */
+ <K,V> Cache<K, V> get(String location, CacheConfiguration config);
+
+ /**
+ * Destroy the cache factory and any caches underneath.
+ */
+ void destroy();
+
+ /**
+ * Return true if replicated caches are created by this factory
+ * @return
+ */
+ boolean isReplicated();
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache;
-
-import java.io.Serializable;
-
-import org.teiid.cache.Cache.Type;
-import org.teiid.core.TeiidRuntimeException;
-
-
-public class DefaultCacheFactory implements CacheFactory, Serializable {
- private static final long serialVersionUID = -5541424157695857527L;
-
- DefaultCache cacheRoot;
- private volatile boolean destroyed = false;
-
- public DefaultCacheFactory() {
- this(CacheConfiguration.DEFAULT);
- }
-
- public DefaultCacheFactory(CacheConfiguration config) {
- this.cacheRoot = new DefaultCache("Teiid", config.getMaxEntries(), config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
- }
-
- @Override
- public void destroy() {
- this.destroyed = true;
- }
-
- @Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
- if (!destroyed) {
- return cacheRoot.addChild(type.location());
- }
- throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isReplicated() {
- return false;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,62 @@
+/*
+ * 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.cache;
+
+import java.io.Serializable;
+
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.core.TeiidRuntimeException;
+
+
+public class DefaultCacheFactory implements CacheFactory, Serializable {
+ private static final long serialVersionUID = -5541424157695857527L;
+ private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
+
+ DefaultCache cacheRoot;
+ private volatile boolean destroyed = false;
+
+ public DefaultCacheFactory() {
+ this(DEFAULT);
+ }
+
+ public DefaultCacheFactory(CacheConfiguration config) {
+ this.cacheRoot = new DefaultCache("Teiid", config.getMaxEntries(), config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
+ }
+
+ @Override
+ public void destroy() {
+ this.destroyed = true;
+ }
+
+ @Override
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
+ if (!destroyed) {
+ return cacheRoot.addChild(location);
+ }
+ throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean isReplicated() {
+ return false;
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,857 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-import javax.resource.spi.work.Work;
-import javax.resource.spi.work.WorkEvent;
-import javax.resource.spi.work.WorkListener;
-import javax.transaction.xa.Xid;
-
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.Request.ProcessingState;
-import org.teiid.adminapi.Request.ThreadState;
-import org.teiid.adminapi.impl.CacheStatisticsMetadata;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.lob.LobChunk;
-import org.teiid.client.metadata.MetadataResult;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.client.util.ResultsReceiver;
-import org.teiid.client.xa.XATransactionException;
-import org.teiid.client.xa.XidImpl;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.Streamable;
-import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
-import org.teiid.dqp.message.AtomicRequestMessage;
-import org.teiid.dqp.message.RequestID;
-import org.teiid.dqp.service.BufferService;
-import org.teiid.dqp.service.TransactionContext;
-import org.teiid.dqp.service.TransactionService;
-import org.teiid.dqp.service.TransactionContext.Scope;
-import org.teiid.logging.CommandLogMessage;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.tempdata.TempTableDataManager;
-import org.teiid.query.tempdata.TempTableStore;
-
-
-/**
- * Implements the core DQP processing.
- */
-public class DQPCore implements DQP {
-
- //TODO: replace with FutureTask
- public final static class FutureWork<T> implements Work, WorkListener, PrioritizedRunnable {
- private final Callable<T> toCall;
- private ResultsFuture<T> result = new ResultsFuture<T>();
- private ResultsReceiver<T> receiver = result.getResultsReceiver();
- private int priority;
- private long creationTime = System.currentTimeMillis();
- private DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-
- public FutureWork(Callable<T> processor, int priority) {
- this.toCall = processor;
- this.priority = priority;
- }
-
- public ResultsFuture<T> getResult() {
- return result;
- }
-
- @Override
- public void run() {
- try {
- receiver.receiveResults(toCall.call());
- } catch (Throwable t) {
- receiver.exceptionOccurred(t);
- }
- }
-
- @Override
- public void release() {
-
- }
-
- @Override
- public void workAccepted(WorkEvent arg0) {
-
- }
-
- @Override
- public void workCompleted(WorkEvent arg0) {
-
- }
-
- @Override
- public void workRejected(WorkEvent arg0) {
- receiver.exceptionOccurred(arg0.getException());
- }
-
- @Override
- public void workStarted(WorkEvent arg0) {
-
- }
-
- @Override
- public int getPriority() {
- return priority;
- }
-
- @Override
- public long getCreationTime() {
- return creationTime;
- }
-
- @Override
- public DQPWorkContext getDqpWorkContext() {
- return workContext;
- }
- }
-
- static class ClientState {
- List<RequestID> requests;
- TempTableStore sessionTables;
-
- public ClientState(TempTableStore tableStoreImpl) {
- this.sessionTables = tableStoreImpl;
- }
-
- public synchronized void addRequest(RequestID requestID) {
- if (requests == null) {
- requests = new LinkedList<RequestID>();
- }
- requests.add(requestID);
- }
-
- public synchronized List<RequestID> getRequests() {
- if (requests == null) {
- return Collections.emptyList();
- }
- return new ArrayList<RequestID>(requests);
- }
-
- public synchronized void removeRequest(RequestID requestID) {
- if (requests != null) {
- requests.remove(requestID);
- }
- }
-
- }
-
- private ThreadReuseExecutor processWorkerPool;
-
- // Resources
- private BufferManager bufferManager;
- private ProcessorDataManager dataTierMgr;
- private SessionAwareCache<PreparedPlan> prepPlanCache;
- private SessionAwareCache<CachedResults> rsCache;
- private TransactionService transactionService;
- private BufferService bufferService;
-
- private DQPConfiguration config = new DQPConfiguration();
-
- private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
-
- private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();
- private Map<String, ClientState> clientState = new ConcurrentHashMap<String, ClientState>();
-
- private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS;
- private int currentlyActivePlans;
- private LinkedList<RequestWorkItem> waitingPlans = new LinkedList<RequestWorkItem>();
- private CacheFactory cacheFactory;
-
- private SessionAwareCache<CachedResults> matTables;
-
- /**
- * perform a full shutdown and wait for 10 seconds for all threads to finish
- */
- public void stop() {
- processWorkerPool.shutdownNow();
- try {
- processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- }
- // TODO: Should we be doing more cleanup here??
- LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
- }
-
- /**
- * Return a list of {@link RequestMetadata} for the given session
- */
- public List<RequestMetadata> getRequestsForSession(String sessionId) {
- ClientState state = getClientState(sessionId, false);
- if (state == null) {
- return Collections.emptyList();
- }
- return buildRequestInfos(state.getRequests(), -1);
- }
-
- public ClientState getClientState(String key, boolean create) {
- if (key == null) {
- return null;
- }
- ClientState state = clientState.get(key);
- if (state == null && create) {
- state = new ClientState(new TempTableStore(key));
- clientState.put(key, state);
- }
- return state;
- }
-
- /**
- * Return a list of all {@link RequestMetadata}
- */
- public List<RequestMetadata> getRequests() {
- return buildRequestInfos(requests.keySet(), -1);
- }
-
- public List<RequestMetadata> getLongRunningRequests(){
- return buildRequestInfos(requests.keySet(), this.config.getQueryThresholdInSecs());
- }
-
- private List<RequestMetadata> buildRequestInfos(Collection<RequestID> ids, int longRunningQueryThreshold) {
- List<RequestMetadata> results = new ArrayList<RequestMetadata>();
-
- for (RequestID requestID : ids) {
- RequestWorkItem holder = requests.get(requestID);
-
- if(holder != null && !holder.isCanceled()) {
- RequestMetadata req = new RequestMetadata();
-
- req.setExecutionId(holder.requestID.getExecutionID());
- req.setSessionId(holder.requestID.getConnectionID());
- req.setCommand(holder.requestMsg.getCommandString());
- req.setStartTime(holder.getProcessingTimestamp());
- req.setState(holder.isCanceled()?ProcessingState.CANCELED:holder.isDoneProcessing()?ProcessingState.DONE:ProcessingState.PROCESSING);
- switch (holder.getThreadState()) {
- case DONE:
- case IDLE:
- req.setThreadState(ThreadState.IDLE);
- break;
- default:
- if (holder.isProcessing()) {
- req.setThreadState(ThreadState.RUNNING);
- } else {
- req.setThreadState(ThreadState.QUEUED);
- }
- }
- if (holder.getTransactionContext() != null && holder.getTransactionContext().getTransactionType() != Scope.NONE) {
- req.setTransactionId(holder.getTransactionContext().getTransactionId());
- }
-
- for (DataTierTupleSource conInfo : holder.getConnectorRequests()) {
- String connectorName = conInfo.getConnectorName();
-
- if (connectorName == null) {
- continue;
- }
- // If the request has not yet completed processing, then
- // add all the subrequest messages
- AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
- RequestMetadata info = new RequestMetadata();
- if (conInfo.isQueued()) {
- info.setThreadState(ThreadState.QUEUED);
- } else if (conInfo.isRunning()) {
- info.setThreadState(ThreadState.RUNNING);
- } else {
- info.setThreadState(ThreadState.IDLE);
- }
- info.setExecutionId(arm.getRequestID().getExecutionID());
- info.setSessionId(holder.requestID.getConnectionID());
- info.setCommand(arm.getCommand().toString());
- info.setStartTime(arm.getProcessingTimestamp());
- info.setSourceRequest(true);
- info.setNodeId(arm.getAtomicRequestID().getNodeID());
- info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
- results.add(info);
- }
-
- // check if only need long running queries.
- long elapsedTime = System.currentTimeMillis() - req.getStartTime();
- if (longRunningQueryThreshold == -1 || elapsedTime > longRunningQueryThreshold) {
- results.add(req);
- }
- }
- }
- return results;
- }
-
- public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestID requestID = workContext.getRequestID(reqID);
- requestMsg.setFetchSize(Math.min(requestMsg.getFetchSize(), this.config.getMaxRowsFetchSize()));
- Request request = null;
- if ( requestMsg.isPreparedStatement() || requestMsg.isCallableStatement()) {
- request = new PreparedStatementRequest(prepPlanCache);
- } else {
- request = new Request();
- }
- ClientState state = this.getClientState(workContext.getSessionId(), true);
- request.initialize(requestMsg, bufferManager,
- dataTierMgr, transactionService, state.sessionTables,
- workContext, this.config.getUseDataRoles(), this.prepPlanCache);
- request.setResultSetCacheEnabled(this.rsCache != null);
- request.setAllowCreateTemporaryTablesByDefault(this.config.isAllowCreateTemporaryTablesByDefault());
- ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
- RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
- logMMCommand(workItem, Event.NEW, null);
- addRequest(requestID, workItem, state);
- synchronized (waitingPlans) {
- if (currentlyActivePlans < maxActivePlans) {
- startActivePlan(workItem);
- } else {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Queuing plan, since max plans has been reached."); //$NON-NLS-1$
- }
- waitingPlans.add(workItem);
- }
- }
- return resultsFuture;
- }
-
- public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
- int batchFirst, int fetchSize) throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request from " + batchFirst); //$NON-NLS-1$
- }
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
- RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
- workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, this.config.getMaxRowsFetchSize()) - 1, resultsFuture.getResultsReceiver());
- return resultsFuture;
- }
-
- void addRequest(RequestID requestID, RequestWorkItem workItem, ClientState state) {
- this.requests.put(requestID, workItem);
- state.addRequest(requestID);
- }
-
- private void startActivePlan(RequestWorkItem workItem) {
- workItem.active = true;
- this.addWork(workItem);
- this.currentlyActivePlans++;
- }
-
- void finishProcessing(final RequestWorkItem workItem) {
- synchronized (waitingPlans) {
- if (!workItem.active) {
- return;
- }
- workItem.active = false;
- currentlyActivePlans--;
- if (!waitingPlans.isEmpty()) {
- startActivePlan(waitingPlans.remove());
- }
- }
- }
-
- void removeRequest(final RequestWorkItem workItem) {
- finishProcessing(workItem);
- this.requests.remove(workItem.requestID);
- ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false);
- if (state != null) {
- state.removeRequest(workItem.requestID);
- }
- }
-
- void addWork(Runnable work) {
- this.processWorkerPool.execute(work);
- }
-
- void scheduleWork(final Runnable r, int priority, long delay) {
- this.processWorkerPool.schedule(new FutureWork<Void>(new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- r.run();
- return null;
- }
- }, priority), delay, TimeUnit.MILLISECONDS);
- }
-
- public ResultsFuture<?> closeLobChunkStream(int lobRequestId,
- long requestId, String streamId)
- throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request to close the Lob stream with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
- }
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestWorkItem workItem = safeGetWorkItem(workContext.getRequestID(requestId));
- if (workItem != null) {
- workItem.removeLobStream(lobRequestId);
- }
- return ResultsFuture.NULL_FUTURE;
- }
-
- public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
- long requestId, String streamId)
- throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
- }
- RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
- ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
- workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
- return resultsFuture;
- }
-
-// /**
-// * Cancels a node in the request. (This request is called by the
-// * client directly using the admin API), so if this does not support
-// * partial results then remove the original request.
-// * @throws MetaMatrixComponentException
-// */
-// public void cancelAtomicRequest(AtomicRequestID requestID) throws MetaMatrixComponentException {
-// RequestWorkItem workItem = safeGetWorkItem(requestID.getRequestID());
-// if (workItem == null) {
-// LogManager.logDetail(LogConstants.CTX_DQP, "Could not cancel", requestID, "parent request does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
-// return;
-// }
-// workItem.requestAtomicRequestCancel(requestID);
-// }
-
- RequestWorkItem getRequestWorkItem(RequestID reqID) throws TeiidProcessingException {
- RequestWorkItem result = this.requests.get(reqID);
- if (result == null) {
- throw new TeiidProcessingException(QueryPlugin.Util.getString("DQPCore.The_request_has_been_closed.", reqID));//$NON-NLS-1$
- }
- return result;
- }
-
- RequestWorkItem safeGetWorkItem(Object processorID) {
- return this.requests.get(processorID);
- }
-
- public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
- return this.processWorkerPool.getStats();
- }
-
- public void terminateSession(String sessionId) {
- // sometimes there will not be any atomic requests pending, in that
- // situation we still need to clear the master request from our map
- ClientState state = this.clientState.remove(sessionId);
- if (state != null) {
- for (RequestID reqId : state.getRequests()) {
- try {
- cancelRequest(reqId);
- } catch (TeiidComponentException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel " + reqId); //$NON-NLS-1$
- }
- }
- }
-
- try {
- transactionService.cancelTransactions(sessionId, false);
- } catch (XATransactionException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
- }
- }
-
- public boolean cancelRequest(String sessionId, long executionId) throws TeiidComponentException {
- RequestID requestID = new RequestID(sessionId, executionId);
- return cancelRequest(requestID);
- }
-
- private boolean cancelRequest(RequestID requestID) throws TeiidComponentException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "cancelQuery for requestID=" + requestID); //$NON-NLS-1$
- }
-
- boolean markCancelled = false;
-
- RequestWorkItem workItem = safeGetWorkItem(requestID);
- if (workItem != null) {
- markCancelled = workItem.requestCancel();
- }
- if (markCancelled) {
- logMMCommand(workItem, Event.CANCEL, null);
- } else {
- LogManager.logDetail(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.failed_to_cancel")); //$NON-NLS-1$
- }
- return markCancelled;
- }
-
- public ResultsFuture<?> closeRequest(long requestId) throws TeiidProcessingException, TeiidComponentException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- closeRequest(workContext.getRequestID(requestId));
- return ResultsFuture.NULL_FUTURE;
- }
-
- /**
- * Close the request with given ID
- * @param requestID
- * @throws TeiidComponentException
- */
- void closeRequest(RequestID requestID) throws TeiidComponentException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "closeQuery for requestID=" + requestID); //$NON-NLS-1$
- }
-
- RequestWorkItem workItem = safeGetWorkItem(requestID);
- if (workItem != null) {
- workItem.requestClose();
- } else {
- LogManager.logDetail(LogConstants.CTX_DQP, requestID + " close call ignored as the request has already been removed."); //$NON-NLS-1$
- }
- }
-
- private void clearPlanCache(){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
- this.prepPlanCache.clearAll();
- }
-
- private void clearResultSetCache() {
- //clear cache in server
- if(rsCache != null){
- rsCache.clearAll();
- }
- }
-
- private void clearPlanCache(String vdbName, int version){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
- this.prepPlanCache.clearForVDB(vdbName, version);
- }
-
- private void clearResultSetCache(String vdbName, int version) {
- //clear cache in server
- if(rsCache != null){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.clearing_resultset_cache", vdbName, version)); //$NON-NLS-1$
- rsCache.clearForVDB(vdbName, version);
- }
- }
-
- public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
- if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
- return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
- }
- else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
- return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
- }
- return null;
- }
-
- private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
- CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
- stats.setName(name);
- stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
- stats.setTotalEntries(cache.getTotalCacheEntries());
- stats.setRequestCount(cache.getRequestCount());
- return stats;
- }
-
- public Collection<String> getCacheTypes(){
- ArrayList<String> caches = new ArrayList<String>();
- caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
- caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
- return caches;
- }
-
- public void clearCache(String cacheType) {
- Admin.Cache cache = Admin.Cache.valueOf(cacheType);
- switch (cache) {
- case PREPARED_PLAN_CACHE:
- clearPlanCache();
- break;
- case QUERY_SERVICE_RESULT_SET_CACHE:
- clearResultSetCache();
- break;
- }
- }
-
- public void clearCache(String cacheType, String vdbName, int version) {
- Admin.Cache cache = Admin.Cache.valueOf(cacheType);
- switch (cache) {
- case PREPARED_PLAN_CACHE:
- clearPlanCache(vdbName, version);
- break;
- case QUERY_SERVICE_RESULT_SET_CACHE:
- clearResultSetCache(vdbName, version);
- break;
- }
- if (this.matTables != null) {
- this.matTables.clearForVDB(vdbName, version);
- }
- }
-
- public Collection<org.teiid.adminapi.Transaction> getTransactions() {
- return this.transactionService.getTransactions();
- }
-
- public void terminateTransaction(String xid) throws AdminException {
- this.transactionService.terminateTransaction(xid);
- }
-
- void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
- if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
- return;
- }
-
- RequestMessage msg = workItem.requestMsg;
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestID rID = new RequestID(workContext.getSessionId(), msg.getExecutionId());
- String txnID = null;
- TransactionContext tc = workItem.getTransactionContext();
- if (tc != null && tc.getTransactionType() != Scope.NONE) {
- txnID = tc.getTransactionId();
- }
- String appName = workContext.getAppName();
- // Log to request log
- CommandLogMessage message = null;
- if (status == Event.NEW) {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
- } else {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
- }
- LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
- }
-
- ProcessorDataManager getDataTierManager() {
- return this.dataTierMgr;
- }
-
- public BufferManager getBufferManager() {
- return bufferManager;
- }
-
- public TransactionService getTransactionService() {
- return transactionService;
- }
-
- SessionAwareCache<CachedResults> getRsCache() {
- return rsCache;
- }
-
- int getProcessorTimeSlice() {
- return this.config.getTimeSliceInMilli();
- }
-
- int getChunkSize() {
- return chunkSize;
- }
-
- public void start(DQPConfiguration config) {
- this.config = config;
-
- this.chunkSize = config.getLobChunkSizeInKB() * 1024;
-
- //get buffer manager
- this.bufferManager = bufferService.getBufferManager();
-
- //result set cache
- CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
- if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
- this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
- this.rsCache.setBufferManager(this.bufferManager);
- }
-
- //prepared plan cache
- prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
- prepPlanCache.setBufferManager(this.bufferManager);
-
-
- this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
-
- if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1));
- matTables.setBufferManager(this.bufferManager);
- }
-
- dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
- this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
- }
-
- public void setBufferService(BufferService service) {
- this.bufferService = service;
- }
-
- public void setTransactionService(TransactionService service) {
- this.transactionService = service;
- }
-
- @Override
- public boolean cancelRequest(long requestID)
- throws TeiidProcessingException, TeiidComponentException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- return this.cancelRequest(workContext.getRequestID(requestID));
- }
-
- // local txn
- public ResultsFuture<?> begin() throws XATransactionException {
- String threadId = DQPWorkContext.getWorkContext().getSessionId();
- this.getTransactionService().begin(threadId);
- return ResultsFuture.NULL_FUTURE;
- }
-
- // local txn
- public ResultsFuture<?> commit() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getSessionId();
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- getTransactionService().commit(threadId);
- return null;
- }
- };
- return addWork(processor, 0);
- }
-
- // local txn
- public ResultsFuture<?> rollback() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getSessionId();
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- getTransactionService().rollback(threadId);
- return null;
- }
- };
- return addWork(processor, 0);
- }
-
- // global txn
- public ResultsFuture<?> commit(final XidImpl xid, final boolean onePhase) throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().commit(workContext.getSessionId(), xid, onePhase, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 0);
- }
- // global txn
- public ResultsFuture<?> end(XidImpl xid, int flags) throws XATransactionException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().end(workContext.getSessionId(), xid, flags, workContext.getSession().isEmbedded());
- return ResultsFuture.NULL_FUTURE;
- }
- // global txn
- public ResultsFuture<?> forget(XidImpl xid) throws XATransactionException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().forget(workContext.getSessionId(), xid, workContext.getSession().isEmbedded());
- return ResultsFuture.NULL_FUTURE;
- }
-
- // global txn
- public ResultsFuture<Integer> prepare(final XidImpl xid) throws XATransactionException {
- Callable<Integer> processor = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- return getTransactionService().prepare(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
- }
- };
- return addWork(processor, 10);
- }
-
- <T> ResultsFuture<T> addWork(Callable<T> processor, int priority) {
- FutureWork<T> work = new FutureWork<T>(processor, priority);
- this.addWork(work);
- return work.getResult();
- }
-
- // global txn
- public ResultsFuture<Xid[]> recover(int flag) throws XATransactionException {
- ResultsFuture<Xid[]> result = new ResultsFuture<Xid[]>();
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- result.getResultsReceiver().receiveResults(this.getTransactionService().recover(flag, workContext.getSession().isEmbedded()));
- return result;
- }
- // global txn
- public ResultsFuture<?> rollback(final XidImpl xid) throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().rollback(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 0);
- }
- // global txn
- public ResultsFuture<?> start(final XidImpl xid, final int flags, final int timeout)
- throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 100);
- }
-
- public MetadataResult getMetadata(long requestID)
- throws TeiidComponentException, TeiidProcessingException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
- return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
- }
-
- public MetadataResult getMetadata(long requestID, String preparedSql,
- boolean allowDoubleQuotedVariable)
- throws TeiidComponentException, TeiidProcessingException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
- return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
- }
-
- public boolean isExceptionOnMaxSourceRows() {
- return this.config.isExceptionOnMaxSourceRows();
- }
-
- public int getMaxSourceRows() {
- return this.config.getMaxSourceRows();
- }
-
- public void setCacheFactory(CacheFactory factory) {
- this.cacheFactory = factory;
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,855 @@
+/*
+ * 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.dqp.internal.process;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkEvent;
+import javax.resource.spi.work.WorkListener;
+import javax.transaction.xa.Xid;
+
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.lob.LobChunk;
+import org.teiid.client.metadata.MetadataResult;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.client.util.ResultsReceiver;
+import org.teiid.client.xa.XATransactionException;
+import org.teiid.client.xa.XidImpl;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.Streamable;
+import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
+import org.teiid.dqp.message.AtomicRequestMessage;
+import org.teiid.dqp.message.RequestID;
+import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.TransactionContext;
+import org.teiid.dqp.service.TransactionService;
+import org.teiid.dqp.service.TransactionContext.Scope;
+import org.teiid.logging.CommandLogMessage;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.logging.CommandLogMessage.Event;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.processor.ProcessorDataManager;
+import org.teiid.query.tempdata.TempTableDataManager;
+import org.teiid.query.tempdata.TempTableStore;
+
+
+/**
+ * Implements the core DQP processing.
+ */
+public class DQPCore implements DQP {
+
+ //TODO: replace with FutureTask
+ public final static class FutureWork<T> implements Work, WorkListener, PrioritizedRunnable {
+ private final Callable<T> toCall;
+ private ResultsFuture<T> result = new ResultsFuture<T>();
+ private ResultsReceiver<T> receiver = result.getResultsReceiver();
+ private int priority;
+ private long creationTime = System.currentTimeMillis();
+ private DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+
+ public FutureWork(Callable<T> processor, int priority) {
+ this.toCall = processor;
+ this.priority = priority;
+ }
+
+ public ResultsFuture<T> getResult() {
+ return result;
+ }
+
+ @Override
+ public void run() {
+ try {
+ receiver.receiveResults(toCall.call());
+ } catch (Throwable t) {
+ receiver.exceptionOccurred(t);
+ }
+ }
+
+ @Override
+ public void release() {
+
+ }
+
+ @Override
+ public void workAccepted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public void workCompleted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public void workRejected(WorkEvent arg0) {
+ receiver.exceptionOccurred(arg0.getException());
+ }
+
+ @Override
+ public void workStarted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+
+ @Override
+ public long getCreationTime() {
+ return creationTime;
+ }
+
+ @Override
+ public DQPWorkContext getDqpWorkContext() {
+ return workContext;
+ }
+ }
+
+ static class ClientState {
+ List<RequestID> requests;
+ TempTableStore sessionTables;
+
+ public ClientState(TempTableStore tableStoreImpl) {
+ this.sessionTables = tableStoreImpl;
+ }
+
+ public synchronized void addRequest(RequestID requestID) {
+ if (requests == null) {
+ requests = new LinkedList<RequestID>();
+ }
+ requests.add(requestID);
+ }
+
+ public synchronized List<RequestID> getRequests() {
+ if (requests == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<RequestID>(requests);
+ }
+
+ public synchronized void removeRequest(RequestID requestID) {
+ if (requests != null) {
+ requests.remove(requestID);
+ }
+ }
+
+ }
+
+ private ThreadReuseExecutor processWorkerPool;
+
+ // Resources
+ private BufferManager bufferManager;
+ private ProcessorDataManager dataTierMgr;
+ private SessionAwareCache<PreparedPlan> prepPlanCache;
+ private SessionAwareCache<CachedResults> rsCache;
+ private TransactionService transactionService;
+ private BufferService bufferService;
+
+ private DQPConfiguration config = new DQPConfiguration();
+
+ private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
+
+ private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();
+ private Map<String, ClientState> clientState = new ConcurrentHashMap<String, ClientState>();
+
+ private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS;
+ private int currentlyActivePlans;
+ private LinkedList<RequestWorkItem> waitingPlans = new LinkedList<RequestWorkItem>();
+ private CacheFactory cacheFactory;
+
+ private SessionAwareCache<CachedResults> matTables;
+
+ /**
+ * perform a full shutdown and wait for 10 seconds for all threads to finish
+ */
+ public void stop() {
+ processWorkerPool.shutdownNow();
+ try {
+ processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ }
+ // TODO: Should we be doing more cleanup here??
+ LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
+ }
+
+ /**
+ * Return a list of {@link RequestMetadata} for the given session
+ */
+ public List<RequestMetadata> getRequestsForSession(String sessionId) {
+ ClientState state = getClientState(sessionId, false);
+ if (state == null) {
+ return Collections.emptyList();
+ }
+ return buildRequestInfos(state.getRequests(), -1);
+ }
+
+ public ClientState getClientState(String key, boolean create) {
+ if (key == null) {
+ return null;
+ }
+ ClientState state = clientState.get(key);
+ if (state == null && create) {
+ state = new ClientState(new TempTableStore(key));
+ clientState.put(key, state);
+ }
+ return state;
+ }
+
+ /**
+ * Return a list of all {@link RequestMetadata}
+ */
+ public List<RequestMetadata> getRequests() {
+ return buildRequestInfos(requests.keySet(), -1);
+ }
+
+ public List<RequestMetadata> getLongRunningRequests(){
+ return buildRequestInfos(requests.keySet(), this.config.getQueryThresholdInSecs());
+ }
+
+ private List<RequestMetadata> buildRequestInfos(Collection<RequestID> ids, int longRunningQueryThreshold) {
+ List<RequestMetadata> results = new ArrayList<RequestMetadata>();
+
+ for (RequestID requestID : ids) {
+ RequestWorkItem holder = requests.get(requestID);
+
+ if(holder != null && !holder.isCanceled()) {
+ RequestMetadata req = new RequestMetadata();
+
+ req.setExecutionId(holder.requestID.getExecutionID());
+ req.setSessionId(holder.requestID.getConnectionID());
+ req.setCommand(holder.requestMsg.getCommandString());
+ req.setStartTime(holder.getProcessingTimestamp());
+ req.setState(holder.isCanceled()?ProcessingState.CANCELED:holder.isDoneProcessing()?ProcessingState.DONE:ProcessingState.PROCESSING);
+ switch (holder.getThreadState()) {
+ case DONE:
+ case IDLE:
+ req.setThreadState(ThreadState.IDLE);
+ break;
+ default:
+ if (holder.isProcessing()) {
+ req.setThreadState(ThreadState.RUNNING);
+ } else {
+ req.setThreadState(ThreadState.QUEUED);
+ }
+ }
+ if (holder.getTransactionContext() != null && holder.getTransactionContext().getTransactionType() != Scope.NONE) {
+ req.setTransactionId(holder.getTransactionContext().getTransactionId());
+ }
+
+ for (DataTierTupleSource conInfo : holder.getConnectorRequests()) {
+ String connectorName = conInfo.getConnectorName();
+
+ if (connectorName == null) {
+ continue;
+ }
+ // If the request has not yet completed processing, then
+ // add all the subrequest messages
+ AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
+ RequestMetadata info = new RequestMetadata();
+ if (conInfo.isQueued()) {
+ info.setThreadState(ThreadState.QUEUED);
+ } else if (conInfo.isRunning()) {
+ info.setThreadState(ThreadState.RUNNING);
+ } else {
+ info.setThreadState(ThreadState.IDLE);
+ }
+ info.setExecutionId(arm.getRequestID().getExecutionID());
+ info.setSessionId(holder.requestID.getConnectionID());
+ info.setCommand(arm.getCommand().toString());
+ info.setStartTime(arm.getProcessingTimestamp());
+ info.setSourceRequest(true);
+ info.setNodeId(arm.getAtomicRequestID().getNodeID());
+ info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
+ results.add(info);
+ }
+
+ // check if only need long running queries.
+ long elapsedTime = System.currentTimeMillis() - req.getStartTime();
+ if (longRunningQueryThreshold == -1 || elapsedTime > longRunningQueryThreshold) {
+ results.add(req);
+ }
+ }
+ }
+ return results;
+ }
+
+ public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestID requestID = workContext.getRequestID(reqID);
+ requestMsg.setFetchSize(Math.min(requestMsg.getFetchSize(), this.config.getMaxRowsFetchSize()));
+ Request request = null;
+ if ( requestMsg.isPreparedStatement() || requestMsg.isCallableStatement()) {
+ request = new PreparedStatementRequest(prepPlanCache);
+ } else {
+ request = new Request();
+ }
+ ClientState state = this.getClientState(workContext.getSessionId(), true);
+ request.initialize(requestMsg, bufferManager,
+ dataTierMgr, transactionService, state.sessionTables,
+ workContext, this.config.getUseDataRoles(), this.prepPlanCache);
+ request.setResultSetCacheEnabled(this.rsCache != null);
+ request.setAllowCreateTemporaryTablesByDefault(this.config.isAllowCreateTemporaryTablesByDefault());
+ ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
+ RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
+ logMMCommand(workItem, Event.NEW, null);
+ addRequest(requestID, workItem, state);
+ synchronized (waitingPlans) {
+ if (currentlyActivePlans < maxActivePlans) {
+ startActivePlan(workItem);
+ } else {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Queuing plan, since max plans has been reached."); //$NON-NLS-1$
+ }
+ waitingPlans.add(workItem);
+ }
+ }
+ return resultsFuture;
+ }
+
+ public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
+ int batchFirst, int fetchSize) throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request from " + batchFirst); //$NON-NLS-1$
+ }
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
+ RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
+ workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, this.config.getMaxRowsFetchSize()) - 1, resultsFuture.getResultsReceiver());
+ return resultsFuture;
+ }
+
+ void addRequest(RequestID requestID, RequestWorkItem workItem, ClientState state) {
+ this.requests.put(requestID, workItem);
+ state.addRequest(requestID);
+ }
+
+ private void startActivePlan(RequestWorkItem workItem) {
+ workItem.active = true;
+ this.addWork(workItem);
+ this.currentlyActivePlans++;
+ }
+
+ void finishProcessing(final RequestWorkItem workItem) {
+ synchronized (waitingPlans) {
+ if (!workItem.active) {
+ return;
+ }
+ workItem.active = false;
+ currentlyActivePlans--;
+ if (!waitingPlans.isEmpty()) {
+ startActivePlan(waitingPlans.remove());
+ }
+ }
+ }
+
+ void removeRequest(final RequestWorkItem workItem) {
+ finishProcessing(workItem);
+ this.requests.remove(workItem.requestID);
+ ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false);
+ if (state != null) {
+ state.removeRequest(workItem.requestID);
+ }
+ }
+
+ void addWork(Runnable work) {
+ this.processWorkerPool.execute(work);
+ }
+
+ void scheduleWork(final Runnable r, int priority, long delay) {
+ this.processWorkerPool.schedule(new FutureWork<Void>(new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ r.run();
+ return null;
+ }
+ }, priority), delay, TimeUnit.MILLISECONDS);
+ }
+
+ public ResultsFuture<?> closeLobChunkStream(int lobRequestId,
+ long requestId, String streamId)
+ throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request to close the Lob stream with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestWorkItem workItem = safeGetWorkItem(workContext.getRequestID(requestId));
+ if (workItem != null) {
+ workItem.removeLobStream(lobRequestId);
+ }
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
+ long requestId, String streamId)
+ throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
+ ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
+ workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
+ return resultsFuture;
+ }
+
+// /**
+// * Cancels a node in the request. (This request is called by the
+// * client directly using the admin API), so if this does not support
+// * partial results then remove the original request.
+// * @throws MetaMatrixComponentException
+// */
+// public void cancelAtomicRequest(AtomicRequestID requestID) throws MetaMatrixComponentException {
+// RequestWorkItem workItem = safeGetWorkItem(requestID.getRequestID());
+// if (workItem == null) {
+// LogManager.logDetail(LogConstants.CTX_DQP, "Could not cancel", requestID, "parent request does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
+// return;
+// }
+// workItem.requestAtomicRequestCancel(requestID);
+// }
+
+ RequestWorkItem getRequestWorkItem(RequestID reqID) throws TeiidProcessingException {
+ RequestWorkItem result = this.requests.get(reqID);
+ if (result == null) {
+ throw new TeiidProcessingException(QueryPlugin.Util.getString("DQPCore.The_request_has_been_closed.", reqID));//$NON-NLS-1$
+ }
+ return result;
+ }
+
+ RequestWorkItem safeGetWorkItem(Object processorID) {
+ return this.requests.get(processorID);
+ }
+
+ public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
+ return this.processWorkerPool.getStats();
+ }
+
+ public void terminateSession(String sessionId) {
+ // sometimes there will not be any atomic requests pending, in that
+ // situation we still need to clear the master request from our map
+ ClientState state = this.clientState.remove(sessionId);
+ if (state != null) {
+ for (RequestID reqId : state.getRequests()) {
+ try {
+ cancelRequest(reqId);
+ } catch (TeiidComponentException err) {
+ LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel " + reqId); //$NON-NLS-1$
+ }
+ }
+ }
+
+ try {
+ transactionService.cancelTransactions(sessionId, false);
+ } catch (XATransactionException err) {
+ LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
+ }
+ }
+
+ public boolean cancelRequest(String sessionId, long executionId) throws TeiidComponentException {
+ RequestID requestID = new RequestID(sessionId, executionId);
+ return cancelRequest(requestID);
+ }
+
+ private boolean cancelRequest(RequestID requestID) throws TeiidComponentException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "cancelQuery for requestID=" + requestID); //$NON-NLS-1$
+ }
+
+ boolean markCancelled = false;
+
+ RequestWorkItem workItem = safeGetWorkItem(requestID);
+ if (workItem != null) {
+ markCancelled = workItem.requestCancel();
+ }
+ if (markCancelled) {
+ logMMCommand(workItem, Event.CANCEL, null);
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.failed_to_cancel")); //$NON-NLS-1$
+ }
+ return markCancelled;
+ }
+
+ public ResultsFuture<?> closeRequest(long requestId) throws TeiidProcessingException, TeiidComponentException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ closeRequest(workContext.getRequestID(requestId));
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ /**
+ * Close the request with given ID
+ * @param requestID
+ * @throws TeiidComponentException
+ */
+ void closeRequest(RequestID requestID) throws TeiidComponentException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "closeQuery for requestID=" + requestID); //$NON-NLS-1$
+ }
+
+ RequestWorkItem workItem = safeGetWorkItem(requestID);
+ if (workItem != null) {
+ workItem.requestClose();
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID + " close call ignored as the request has already been removed."); //$NON-NLS-1$
+ }
+ }
+
+ private void clearPlanCache(){
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ this.prepPlanCache.clearAll();
+ }
+
+ private void clearResultSetCache() {
+ //clear cache in server
+ if(rsCache != null){
+ rsCache.clearAll();
+ }
+ }
+
+ private void clearPlanCache(String vdbName, int version){
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ this.prepPlanCache.clearForVDB(vdbName, version);
+ }
+
+ private void clearResultSetCache(String vdbName, int version) {
+ //clear cache in server
+ if(rsCache != null){
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.clearing_resultset_cache", vdbName, version)); //$NON-NLS-1$
+ rsCache.clearForVDB(vdbName, version);
+ }
+ }
+
+ public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
+ if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
+ }
+ else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
+ }
+ return null;
+ }
+
+ private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
+ CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
+ stats.setName(name);
+ stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
+ stats.setTotalEntries(cache.getTotalCacheEntries());
+ stats.setRequestCount(cache.getRequestCount());
+ return stats;
+ }
+
+ public Collection<String> getCacheTypes(){
+ ArrayList<String> caches = new ArrayList<String>();
+ caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
+ caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
+ return caches;
+ }
+
+ public void clearCache(String cacheType) {
+ Admin.Cache cache = Admin.Cache.valueOf(cacheType);
+ switch (cache) {
+ case PREPARED_PLAN_CACHE:
+ clearPlanCache();
+ break;
+ case QUERY_SERVICE_RESULT_SET_CACHE:
+ clearResultSetCache();
+ break;
+ }
+ }
+
+ public void clearCache(String cacheType, String vdbName, int version) {
+ Admin.Cache cache = Admin.Cache.valueOf(cacheType);
+ switch (cache) {
+ case PREPARED_PLAN_CACHE:
+ clearPlanCache(vdbName, version);
+ break;
+ case QUERY_SERVICE_RESULT_SET_CACHE:
+ clearResultSetCache(vdbName, version);
+ break;
+ }
+ if (this.matTables != null) {
+ this.matTables.clearForVDB(vdbName, version);
+ }
+ }
+
+ public Collection<org.teiid.adminapi.Transaction> getTransactions() {
+ return this.transactionService.getTransactions();
+ }
+
+ public void terminateTransaction(String xid) throws AdminException {
+ this.transactionService.terminateTransaction(xid);
+ }
+
+ void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
+ return;
+ }
+
+ RequestMessage msg = workItem.requestMsg;
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestID rID = new RequestID(workContext.getSessionId(), msg.getExecutionId());
+ String txnID = null;
+ TransactionContext tc = workItem.getTransactionContext();
+ if (tc != null && tc.getTransactionType() != Scope.NONE) {
+ txnID = tc.getTransactionId();
+ }
+ String appName = workContext.getAppName();
+ // Log to request log
+ CommandLogMessage message = null;
+ if (status == Event.NEW) {
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
+ } else {
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
+ }
+ LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
+ }
+
+ ProcessorDataManager getDataTierManager() {
+ return this.dataTierMgr;
+ }
+
+ public BufferManager getBufferManager() {
+ return bufferManager;
+ }
+
+ public TransactionService getTransactionService() {
+ return transactionService;
+ }
+
+ SessionAwareCache<CachedResults> getRsCache() {
+ return rsCache;
+ }
+
+ int getProcessorTimeSlice() {
+ return this.config.getTimeSliceInMilli();
+ }
+
+ int getChunkSize() {
+ return chunkSize;
+ }
+
+ public void start(DQPConfiguration config) {
+ this.config = config;
+
+ this.chunkSize = config.getLobChunkSizeInKB() * 1024;
+
+ //get buffer manager
+ this.bufferManager = bufferService.getBufferManager();
+
+ //result set cache
+ CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
+ if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
+ this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
+ this.rsCache.setBufferManager(this.bufferManager);
+ }
+
+ //prepared plan cache
+ prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount(), "PreparedCache")); //$NON-NLS-1$
+ prepPlanCache.setBufferManager(this.bufferManager);
+
+
+ this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
+
+ if (cacheFactory.isReplicated()) {
+ matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1, "MaterilizationTables")); //$NON-NLS-1$
+ matTables.setBufferManager(this.bufferManager);
+ }
+
+ dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
+ }
+
+ public void setBufferService(BufferService service) {
+ this.bufferService = service;
+ }
+
+ public void setTransactionService(TransactionService service) {
+ this.transactionService = service;
+ }
+
+ @Override
+ public boolean cancelRequest(long requestID)
+ throws TeiidProcessingException, TeiidComponentException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ return this.cancelRequest(workContext.getRequestID(requestID));
+ }
+
+ // local txn
+ public ResultsFuture<?> begin() throws XATransactionException {
+ String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ this.getTransactionService().begin(threadId);
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ // local txn
+ public ResultsFuture<?> commit() throws XATransactionException {
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ getTransactionService().commit(threadId);
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+
+ // local txn
+ public ResultsFuture<?> rollback() throws XATransactionException {
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ getTransactionService().rollback(threadId);
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+
+ // global txn
+ public ResultsFuture<?> commit(final XidImpl xid, final boolean onePhase) throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().commit(workContext.getSessionId(), xid, onePhase, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+ // global txn
+ public ResultsFuture<?> end(XidImpl xid, int flags) throws XATransactionException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ this.getTransactionService().end(workContext.getSessionId(), xid, flags, workContext.getSession().isEmbedded());
+ return ResultsFuture.NULL_FUTURE;
+ }
+ // global txn
+ public ResultsFuture<?> forget(XidImpl xid) throws XATransactionException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ this.getTransactionService().forget(workContext.getSessionId(), xid, workContext.getSession().isEmbedded());
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ // global txn
+ public ResultsFuture<Integer> prepare(final XidImpl xid) throws XATransactionException {
+ Callable<Integer> processor = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ return getTransactionService().prepare(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
+ }
+ };
+ return addWork(processor, 10);
+ }
+
+ <T> ResultsFuture<T> addWork(Callable<T> processor, int priority) {
+ FutureWork<T> work = new FutureWork<T>(processor, priority);
+ this.addWork(work);
+ return work.getResult();
+ }
+
+ // global txn
+ public ResultsFuture<Xid[]> recover(int flag) throws XATransactionException {
+ ResultsFuture<Xid[]> result = new ResultsFuture<Xid[]>();
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ result.getResultsReceiver().receiveResults(this.getTransactionService().recover(flag, workContext.getSession().isEmbedded()));
+ return result;
+ }
+ // global txn
+ public ResultsFuture<?> rollback(final XidImpl xid) throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().rollback(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+ // global txn
+ public ResultsFuture<?> start(final XidImpl xid, final int flags, final int timeout)
+ throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 100);
+ }
+
+ public MetadataResult getMetadata(long requestID)
+ throws TeiidComponentException, TeiidProcessingException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
+ return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
+ }
+
+ public MetadataResult getMetadata(long requestID, String preparedSql,
+ boolean allowDoubleQuotedVariable)
+ throws TeiidComponentException, TeiidProcessingException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
+ return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
+ }
+
+ public boolean isExceptionOnMaxSourceRows() {
+ return this.config.isExceptionOnMaxSourceRows();
+ }
+
+ public int getMaxSourceRows() {
+ return this.config.getMaxSourceRows();
+ }
+
+ public void setCacheFactory(CacheFactory factory) {
+ this.cacheFactory = factory;
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,305 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.teiid.cache.Cachable;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCache;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.EquivalenceUtil;
-import org.teiid.core.util.HashCodeUtil;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.FunctionMethod.Determinism;
-import org.teiid.query.parser.ParseInfo;
-import org.teiid.vdb.runtime.VDBKey;
-
-
-/**
- * This class is used to cache session aware objects
- */
-public class SessionAwareCache<T> {
- public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
-
- private Cache<CacheID, T> localCache;
- private Cache<CacheID, T> distributedCache;
- private Cache tupleBatchCache;
-
- private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
-
- private AtomicInteger cacheHit = new AtomicInteger();
- private AtomicInteger totalRequests = new AtomicInteger();
-
- private BufferManager bufferManager;
-
- public SessionAwareCache(){
- this(DEFAULT_MAX_SIZE_TOTAL);
- }
-
- SessionAwareCache(int maxSize){
- this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
- }
-
- SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
- this.maxSize = config.getMaxEntries();
- if(this.maxSize < 0){
- this.maxSize = Integer.MAX_VALUE;
- }
- this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
-
- if (type == Cache.Type.PREPAREDPLAN) {
- this.distributedCache = localCache;
- }
- else {
- this.distributedCache = cacheFactory.get(type, config);
- if (type == Cache.Type.RESULTSET) {
- this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
- }
- else {
- this.tupleBatchCache = this.distributedCache;
- }
- }
- }
-
- public T get(CacheID id){
-
- this.totalRequests.getAndIncrement();
-
- id.setSessionId(id.originalSessionId);
- T result = localCache.get(id);
-
- if (result == null) {
- id.setSessionId(null);
-
- id.setUserName(id.originalUserName);
- result = distributedCache.get(id);
-
- if (result == null) {
- id.setUserName(null);
- result = distributedCache.get(id);
- }
-
- if (result != null && result instanceof Cachable) {
- Cachable c = (Cachable)result;
- if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
- result = null;
- }
- }
- }
-
- if (result != null) {
- LogManager.logTrace(LogConstants.CTX_DQP, "Cache hit for", id); //$NON-NLS-1$
- cacheHit.getAndIncrement();
- } else {
- LogManager.logTrace(LogConstants.CTX_DQP, "Cache miss for", id); //$NON-NLS-1$
- }
- return result;
- }
-
- public int getCacheHitCount() {
- return cacheHit.get();
- }
-
- public int getRequestCount() {
- return this.totalRequests.get();
- }
-
- public int getTotalCacheEntries() {
- if (this.localCache == this.distributedCache) {
- return this.localCache.size();
- }
- return localCache.size() + distributedCache.size();
- }
-
- public void put(CacheID id, Determinism determinismLevel, T t, Long ttl){
- if (determinismLevel.compareTo(Determinism.SESSION_DETERMINISTIC) <= 0) {
- id.setSessionId(id.originalSessionId);
- LogManager.logTrace(LogConstants.CTX_DQP, "Adding to session/local cache", id); //$NON-NLS-1$
- this.localCache.put(id, t, ttl);
- }
- else {
-
- boolean insert = true;
-
- id.setSessionId(null);
-
- if (determinismLevel == Determinism.USER_DETERMINISTIC) {
- id.setUserName(id.originalUserName);
- }
- else {
- id.setUserName(null);
- }
-
- if (t instanceof Cachable) {
- Cachable c = (Cachable)t;
- insert = c.prepare(this.tupleBatchCache, this.bufferManager);
- }
-
- if (insert) {
- LogManager.logTrace(LogConstants.CTX_DQP, "Adding to global/distributed cache", id); //$NON-NLS-1$
- this.distributedCache.put(id, t, ttl);
- }
- }
- }
-
- /**
- * Clear all the cached plans for all the clientConns
- * @param clientConn ClientConnection
- */
- public void clearAll(){
- this.localCache.clear();
- this.distributedCache.clear();
- this.totalRequests = new AtomicInteger();
- this.cacheHit = new AtomicInteger();
- }
-
- public void clearForVDB(String vdbName, int version) {
- clearCache(this.localCache, vdbName, version);
- clearCache(this.distributedCache, vdbName, version);
- }
-
- private void clearCache(Cache<CacheID, T> cache, String vdbName, int version) {
- Set<CacheID> keys = cache.keys();
- VDBKey vdbKey = new VDBKey(vdbName, version);
- for (CacheID key:keys) {
- if (key.vdbInfo.equals(vdbKey)) {
- cache.remove(key);
- }
- }
- }
-
- public static class CacheID implements Serializable {
- private static final long serialVersionUID = 8261905111156764744L;
- private String sql;
- private VDBKey vdbInfo;
- private ParseInfo pi;
- private String sessionId;
- private String originalSessionId;
- private List<Serializable> parameters;
- private String userName;
- private String originalUserName;
-
- public CacheID(DQPWorkContext context, ParseInfo pi, String sql){
- this(pi, sql, context.getVdbName(), context.getVdbVersion(), context.getSessionId(), context.getUserName());
- }
-
- public CacheID(ParseInfo pi, String sql, String vdbName, int vdbVersion, String sessionId, String userName){
- this.sql = sql;
- this.vdbInfo = new VDBKey(vdbName, vdbVersion);
- this.pi = pi;
- this.originalSessionId = sessionId;
- this.originalUserName = userName;
- }
-
-
- public String getSessionId() {
- return sessionId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- private void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
-
- /**
- * Set the raw (non-Constant) parameter values.
- * @param parameters
- * @return
- */
- public boolean setParameters(List<?> parameters) {
- if (parameters != null && !parameters.isEmpty()) {
- this.parameters = new ArrayList<Serializable>();
- for (Object obj:parameters) {
- if (obj == null) {
- this.parameters.add(null);
- continue;
- }
- if (!(obj instanceof Serializable)) {
- return false;
- }
-
- Class<?> type = DataTypeManager.determineDataTypeClass(obj);
- if (type == DataTypeManager.DefaultDataClasses.OBJECT) {
- return false;
- }
- this.parameters.add((Serializable)obj);
- }
- }
- return true;
- }
-
- public String getSql() {
- return sql;
- }
-
- void setUserName(String name) {
- this.userName = name;
- }
-
- public boolean equals(Object obj){
- if(obj == this) {
- return true;
- }
- if(! (obj instanceof CacheID)) {
- return false;
- }
- CacheID that = (CacheID)obj;
- return EquivalenceUtil.areEqual(this.pi, that.pi) && this.vdbInfo.equals(that.vdbInfo) && this.sql.equals(that.sql)
- && EquivalenceUtil.areEqual(this.userName, that.userName)
- && EquivalenceUtil.areEqual(this.sessionId, that.sessionId)
- && EquivalenceUtil.areEqual(this.parameters, that.parameters);
- }
-
- public int hashCode() {
- return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, this.userName, sessionId, parameters);
- }
-
- @Override
- public String toString() {
- return "Cache Entry<" + originalSessionId + "="+ originalUserName + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- }
-
- int getSpaceAllowed() {
- return maxSize;
- }
-
- public void setBufferManager(BufferManager bufferManager) {
- this.bufferManager = bufferManager;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,310 @@
+/*
+ * 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.dqp.internal.process;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.teiid.cache.Cachable;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCache;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.EquivalenceUtil;
+import org.teiid.core.util.HashCodeUtil;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.FunctionMethod.Determinism;
+import org.teiid.query.parser.ParseInfo;
+import org.teiid.vdb.runtime.VDBKey;
+
+
+/**
+ * This class is used to cache session aware objects
+ */
+public class SessionAwareCache<T> {
+ public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
+ public enum Type {
+ RESULTSET,
+ PREPAREDPLAN;
+ }
+
+ private Cache<CacheID, T> localCache;
+ private Cache<CacheID, T> distributedCache;
+ private Cache tupleBatchCache;
+
+ private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
+
+ private AtomicInteger cacheHit = new AtomicInteger();
+ private AtomicInteger totalRequests = new AtomicInteger();
+
+ private BufferManager bufferManager;
+
+ public SessionAwareCache(){
+ this(DEFAULT_MAX_SIZE_TOTAL);
+ }
+
+ SessionAwareCache(int maxSize){
+ this(new DefaultCacheFactory(), Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize, "default")); //$NON-NLS-1$
+ }
+
+ SessionAwareCache (final CacheFactory cacheFactory, final Type type, final CacheConfiguration config){
+ this.maxSize = config.getMaxEntries();
+ if(this.maxSize < 0){
+ this.maxSize = Integer.MAX_VALUE;
+ }
+ this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
+
+ if (type == Type.PREPAREDPLAN) {
+ this.distributedCache = localCache;
+ }
+ else {
+ String location = config.getLocation()+"/"+type.name(); //$NON-NLS-1$
+ this.distributedCache = cacheFactory.get(location, config);
+ if (type == Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(location+"/batches", config); //$NON-NLS-1$
+ }
+ else {
+ this.tupleBatchCache = this.distributedCache;
+ }
+ }
+ }
+
+ public T get(CacheID id){
+
+ this.totalRequests.getAndIncrement();
+
+ id.setSessionId(id.originalSessionId);
+ T result = localCache.get(id);
+
+ if (result == null) {
+ id.setSessionId(null);
+
+ id.setUserName(id.originalUserName);
+ result = distributedCache.get(id);
+
+ if (result == null) {
+ id.setUserName(null);
+ result = distributedCache.get(id);
+ }
+
+ if (result != null && result instanceof Cachable) {
+ Cachable c = (Cachable)result;
+ if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
+ result = null;
+ }
+ }
+ }
+
+ if (result != null) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache hit for", id); //$NON-NLS-1$
+ cacheHit.getAndIncrement();
+ } else {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache miss for", id); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public int getCacheHitCount() {
+ return cacheHit.get();
+ }
+
+ public int getRequestCount() {
+ return this.totalRequests.get();
+ }
+
+ public int getTotalCacheEntries() {
+ if (this.localCache == this.distributedCache) {
+ return this.localCache.size();
+ }
+ return localCache.size() + distributedCache.size();
+ }
+
+ public void put(CacheID id, Determinism determinismLevel, T t, Long ttl){
+ if (determinismLevel.compareTo(Determinism.SESSION_DETERMINISTIC) <= 0) {
+ id.setSessionId(id.originalSessionId);
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to session/local cache", id); //$NON-NLS-1$
+ this.localCache.put(id, t, ttl);
+ }
+ else {
+
+ boolean insert = true;
+
+ id.setSessionId(null);
+
+ if (determinismLevel == Determinism.USER_DETERMINISTIC) {
+ id.setUserName(id.originalUserName);
+ }
+ else {
+ id.setUserName(null);
+ }
+
+ if (t instanceof Cachable) {
+ Cachable c = (Cachable)t;
+ insert = c.prepare(this.tupleBatchCache, this.bufferManager);
+ }
+
+ if (insert) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to global/distributed cache", id); //$NON-NLS-1$
+ this.distributedCache.put(id, t, ttl);
+ }
+ }
+ }
+
+ /**
+ * Clear all the cached plans for all the clientConns
+ * @param clientConn ClientConnection
+ */
+ public void clearAll(){
+ this.localCache.clear();
+ this.distributedCache.clear();
+ this.totalRequests = new AtomicInteger();
+ this.cacheHit = new AtomicInteger();
+ }
+
+ public void clearForVDB(String vdbName, int version) {
+ clearCache(this.localCache, vdbName, version);
+ clearCache(this.distributedCache, vdbName, version);
+ }
+
+ private void clearCache(Cache<CacheID, T> cache, String vdbName, int version) {
+ Set<CacheID> keys = cache.keys();
+ VDBKey vdbKey = new VDBKey(vdbName, version);
+ for (CacheID key:keys) {
+ if (key.vdbInfo.equals(vdbKey)) {
+ cache.remove(key);
+ }
+ }
+ }
+
+ public static class CacheID implements Serializable {
+ private static final long serialVersionUID = 8261905111156764744L;
+ private String sql;
+ private VDBKey vdbInfo;
+ private ParseInfo pi;
+ private String sessionId;
+ private String originalSessionId;
+ private List<Serializable> parameters;
+ private String userName;
+ private String originalUserName;
+
+ public CacheID(DQPWorkContext context, ParseInfo pi, String sql){
+ this(pi, sql, context.getVdbName(), context.getVdbVersion(), context.getSessionId(), context.getUserName());
+ }
+
+ public CacheID(ParseInfo pi, String sql, String vdbName, int vdbVersion, String sessionId, String userName){
+ this.sql = sql;
+ this.vdbInfo = new VDBKey(vdbName, vdbVersion);
+ this.pi = pi;
+ this.originalSessionId = sessionId;
+ this.originalUserName = userName;
+ }
+
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ private void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Set the raw (non-Constant) parameter values.
+ * @param parameters
+ * @return
+ */
+ public boolean setParameters(List<?> parameters) {
+ if (parameters != null && !parameters.isEmpty()) {
+ this.parameters = new ArrayList<Serializable>();
+ for (Object obj:parameters) {
+ if (obj == null) {
+ this.parameters.add(null);
+ continue;
+ }
+ if (!(obj instanceof Serializable)) {
+ return false;
+ }
+
+ Class<?> type = DataTypeManager.determineDataTypeClass(obj);
+ if (type == DataTypeManager.DefaultDataClasses.OBJECT) {
+ return false;
+ }
+ this.parameters.add((Serializable)obj);
+ }
+ }
+ return true;
+ }
+
+ public String getSql() {
+ return sql;
+ }
+
+ void setUserName(String name) {
+ this.userName = name;
+ }
+
+ public boolean equals(Object obj){
+ if(obj == this) {
+ return true;
+ }
+ if(! (obj instanceof CacheID)) {
+ return false;
+ }
+ CacheID that = (CacheID)obj;
+ return EquivalenceUtil.areEqual(this.pi, that.pi) && this.vdbInfo.equals(that.vdbInfo) && this.sql.equals(that.sql)
+ && EquivalenceUtil.areEqual(this.userName, that.userName)
+ && EquivalenceUtil.areEqual(this.sessionId, that.sessionId)
+ && EquivalenceUtil.areEqual(this.parameters, that.parameters);
+ }
+
+ public int hashCode() {
+ return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, this.userName, sessionId, parameters);
+ }
+
+ @Override
+ public String toString() {
+ return "Cache Entry<" + originalSessionId + "="+ originalUserName + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ }
+
+ int getSpaceAllowed() {
+ return maxSize;
+ }
+
+ public void setBufferManager(BufferManager bufferManager) {
+ this.bufferManager = bufferManager;
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,201 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.sql.symbol;
-
-import org.teiid.api.exception.query.QueryValidatorException;
-import org.teiid.core.util.Assertion;
-import org.teiid.query.metadata.TempMetadataID;
-import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.visitor.SQLStringVisitor;
-
-
-/**
- * This class represents a reference (positional from the user query, or
- * to an element from another scope). This reference may resolve to many different values
- * during evaluation. For any particular bound value, it is treated as a constant.
- */
-public class Reference implements Expression, ContextReference {
-
- public interface Constraint {
- public void validate(Object value) throws QueryValidatorException;
- }
-
- private boolean positional;
-
- private int refIndex;
- private Class<?> type;
-
- private ElementSymbol expression;
-
- private Constraint constraint;
-
- /**
- * Constructor for a positional Reference.
- */
- public Reference(int refIndex) {
- this.refIndex = refIndex;
- this.positional = true;
- }
-
- public Constraint getConstraint() {
- return constraint;
- }
-
- public void setConstraint(Constraint constraint) {
- this.constraint = constraint;
- }
-
- /**
- * Constructor for an element Reference.
- */
- public Reference(ElementSymbol expression) {
- this.expression = expression;
- this.positional = false;
- }
-
- private Reference(Reference ref) {
- this.refIndex = ref.refIndex;
- this.positional = ref.positional;
- this.type = ref.type;
- if (ref.expression != null) {
- this.expression = (ElementSymbol)ref.expression.clone();
- }
- this.constraint = ref.constraint;
- }
-
- public boolean isResolved() {
- return (expression != null || this.type != null);
- }
-
- public int getIndex() {
- return this.refIndex;
- }
-
- @Override
- public String getContextSymbol() {
- return "$param/pos" + this.refIndex; //$NON-NLS-1$
- }
-
- @Override
- public Expression getValueExpression() {
- return this.expression;
- }
-
- public ElementSymbol getExpression() {
- return this.expression;
- }
-
- public Class<?> getType() {
- if (this.isPositional() && this.expression == null) {
- return type;
- }
- return expression.getType();
- }
-
- public void acceptVisitor(LanguageVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- public Object clone() {
- return new Reference(this);
- }
-
- /**
- * Compare this constant to another constant for equality.
- * @param obj Other object
- * @return True if constants are equal
- */
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(!(obj instanceof Reference)) {
- return false;
- }
- Reference other = (Reference) obj;
-
- if (this.positional != other.positional) {
- return false;
- }
-
- if (this.positional) {
- return other.getIndex() == getIndex();
- }
-
- // Compare based on name
- return this.expression.equals(other.expression);
- }
-
- public void setType(Class<?> type) {
- Assertion.assertTrue(this.positional);
- this.type = type;
- }
-
- /**
- * Define hash code to be that of the underlying object to make it stable.
- * @return Hash code, based on value
- */
- public int hashCode() {
- if (this.isPositional()) {
- return getIndex();
- }
- return this.expression.hashCode();
- }
-
- /**
- * Return a String representation of this object using SQLStringVisitor.
- * @return String representation using SQLStringVisitor
- */
- public String toString() {
- return SQLStringVisitor.getSQLString(this);
- }
-
- public boolean isCorrelated() {
- if (this.isPositional()) {
- return false;
- }
- //metadata hack
- if (!(this.expression.getMetadataID() instanceof TempMetadataID)) {
- return true;
- }
- TempMetadataID tid = (TempMetadataID)this.expression.getMetadataID();
- return !tid.isScalarGroup();
- }
-
- public boolean isPositional() {
- return this.positional;
- }
-
- /**
- * Should never be called - used for an xml hack
- * @param expression
- */
- public void setExpression(ElementSymbol expression) {
- this.expression = expression;
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.sql.symbol;
+
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.core.util.Assertion;
+import org.teiid.query.metadata.TempMetadataID;
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.visitor.SQLStringVisitor;
+
+
+/**
+ * This class represents a reference (positional from the user query, or
+ * to an element from another scope). This reference may resolve to many different values
+ * during evaluation. For any particular bound value, it is treated as a constant.
+ */
+public class Reference implements Expression, ContextReference {
+
+ public interface Constraint {
+ public void validate(Object value) throws QueryValidatorException;
+ }
+
+ private boolean positional;
+
+ private int refIndex;
+ private Class<?> type;
+
+ private ElementSymbol expression;
+
+ private Constraint constraint;
+
+ /**
+ * Constructor for a positional Reference.
+ */
+ public Reference(int refIndex) {
+ this.refIndex = refIndex;
+ this.positional = true;
+ }
+
+ public Constraint getConstraint() {
+ return constraint;
+ }
+
+ public void setConstraint(Constraint constraint) {
+ this.constraint = constraint;
+ }
+
+ /**
+ * Constructor for an element Reference.
+ */
+ public Reference(ElementSymbol expression) {
+ this.expression = expression;
+ this.positional = false;
+ }
+
+ private Reference(Reference ref) {
+ this.refIndex = ref.refIndex;
+ this.positional = ref.positional;
+ this.type = ref.type;
+ if (ref.expression != null) {
+ this.expression = (ElementSymbol)ref.expression.clone();
+ }
+ this.constraint = ref.constraint;
+ }
+
+ public boolean isResolved() {
+ return (expression != null || this.type != null);
+ }
+
+ public int getIndex() {
+ return this.refIndex;
+ }
+
+ @Override
+ public String getContextSymbol() {
+ return "$param/pos" + this.refIndex; //$NON-NLS-1$
+ }
+
+ @Override
+ public Expression getValueExpression() {
+ return this.expression;
+ }
+
+ public ElementSymbol getExpression() {
+ return this.expression;
+ }
+
+ public Class<?> getType() {
+ if (this.isPositional() && this.expression == null) {
+ return type;
+ }
+ return expression.getType();
+ }
+
+ public void acceptVisitor(LanguageVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() {
+ return new Reference(this);
+ }
+
+ /**
+ * Compare this constant to another constant for equality.
+ * @param obj Other object
+ * @return True if constants are equal
+ */
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+
+ if(!(obj instanceof Reference)) {
+ return false;
+ }
+ Reference other = (Reference) obj;
+
+ if (this.positional != other.positional) {
+ return false;
+ }
+
+ if (this.positional) {
+ return other.getIndex() == getIndex();
+ }
+
+ // Compare based on name
+ return this.expression.equals(other.expression);
+ }
+
+ public void setType(Class<?> type) {
+ Assertion.assertTrue(this.positional);
+ this.type = type;
+ }
+
+ /**
+ * Define hash code to be that of the underlying object to make it stable.
+ * @return Hash code, based on value
+ */
+ public int hashCode() {
+ if (this.isPositional()) {
+ return getIndex();
+ }
+ return this.expression.hashCode();
+ }
+
+ /**
+ * Return a String representation of this object using SQLStringVisitor.
+ * @return String representation using SQLStringVisitor
+ */
+ public String toString() {
+ return SQLStringVisitor.getSQLString(this);
+ }
+
+ public boolean isCorrelated() {
+ if (this.isPositional()) {
+ return false;
+ }
+ //metadata hack
+ if (this.expression.getGroupSymbol() == null || !(this.expression.getGroupSymbol().getMetadataID() instanceof TempMetadataID)) {
+ return true;
+ }
+
+ TempMetadataID tid = (TempMetadataID)this.expression.getGroupSymbol().getMetadataID();
+ return !tid.isScalarGroup();
+ }
+
+ public boolean isPositional() {
+ return this.positional;
+ }
+
+ /**
+ * Should never be called - used for an xml hack
+ * @param expression
+ */
+ public void setExpression(ElementSymbol expression) {
+ this.expression = expression;
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,609 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.tempdata;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.FutureTask;
-
-import org.teiid.api.exception.query.ExpressionEvaluationException;
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.api.exception.query.QueryProcessingException;
-import org.teiid.api.exception.query.QueryResolverException;
-import org.teiid.api.exception.query.QueryValidatorException;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.TupleBuffer;
-import org.teiid.common.buffer.TupleSource;
-import org.teiid.core.CoreConstants;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.HashCodeUtil;
-import org.teiid.core.util.StringUtil;
-import org.teiid.dqp.internal.process.CachedResults;
-import org.teiid.dqp.internal.process.SessionAwareCache;
-import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
-import org.teiid.language.SQLConstants.Reserved;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.FunctionMethod.Determinism;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.eval.Evaluator;
-import org.teiid.query.mapping.relational.QueryNode;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TempMetadataID;
-import org.teiid.query.optimizer.relational.RelationalPlanner;
-import org.teiid.query.parser.ParseInfo;
-import org.teiid.query.processor.BatchCollector;
-import org.teiid.query.processor.CollectionTupleSource;
-import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.processor.QueryProcessor;
-import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.CacheHint;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.Create;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.Delete;
-import org.teiid.query.sql.lang.Drop;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.Option;
-import org.teiid.query.sql.lang.ProcedureContainer;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.Update;
-import org.teiid.query.sql.navigator.PostOrderNavigator;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
-import org.teiid.query.tempdata.TempTableStore.MatState;
-import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
-import org.teiid.query.util.CommandContext;
-import org.teiid.vdb.runtime.VDBKey;
-
-/**
- * This proxy ProcessorDataManager is used to handle temporary tables.
- *
- * This isn't handled as a connector because of the temporary metadata and
- * the create/drop handling (which doesn't have push down support)
- */
-public class TempTableDataManager implements ProcessorDataManager {
-
- private static final String REFRESHMATVIEWROW = ".refreshmatviewrow"; //$NON-NLS-1$
- private static final String REFRESHMATVIEW = ".refreshmatview"; //$NON-NLS-1$
- private static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
-
- private ProcessorDataManager processorDataManager;
- private BufferManager bufferManager;
- private SessionAwareCache<CachedResults> cache;
- private Executor executor;
-
- private static class MatTableKey implements Serializable {
- private static final long serialVersionUID = 5481692896572663992L;
- String name;
- VDBKey vdb;
-
- @Override
- public int hashCode() {
- return HashCodeUtil.hashCode(name.hashCode(), vdb);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof MatTableKey)) {
- return false;
- }
- MatTableKey other = (MatTableKey)obj;
- return this.name.equals(other.name) && this.vdb.equals(other.vdb);
- }
- }
-
- private static class MatTableEntry implements Serializable {
- private static final long serialVersionUID = 8559613701442751579L;
- long lastUpdate = System.currentTimeMillis();
- boolean valid;
- }
-
- private Cache<MatTableKey, MatTableEntry> tables;
- private SessionAwareCache<CachedResults> distributedCache;
-
- public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager,
- Executor executor, SessionAwareCache<CachedResults> cache, SessionAwareCache<CachedResults> distibutedCache, CacheFactory cacheFactory){
- this.processorDataManager = processorDataManager;
- this.bufferManager = bufferManager;
- this.executor = executor;
- this.cache = cache;
- this.distributedCache = distibutedCache;
- if (distibutedCache != null) {
- CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1);
- tables = cacheFactory.get(Cache.Type.MATTABLES, cc);
- }
- }
-
- public TupleSource registerRequest(
- CommandContext context,
- Command command,
- String modelName,
- String connectorBindingId, int nodeID)
- throws TeiidComponentException, TeiidProcessingException {
-
- TempTableStore tempTableStore = context.getTempTableStore();
- if(tempTableStore != null) {
- TupleSource result = registerRequest(context, modelName, command);
- if (result != null) {
- return result;
- }
- }
- return this.processorDataManager.registerRequest(context, command, modelName, connectorBindingId, nodeID);
- }
-
- TupleSource registerRequest(CommandContext context, String modelName, Command command) throws TeiidComponentException, TeiidProcessingException {
- TempTableStore contextStore = context.getTempTableStore();
- if (command instanceof Query) {
- Query query = (Query)command;
- return registerQuery(context, contextStore, query);
- }
- if (command instanceof ProcedureContainer) {
- if (command instanceof StoredProcedure) {
- StoredProcedure proc = (StoredProcedure)command;
- if (CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) {
- TupleSource result = handleSystemProcedures(context, proc);
- if (result != null) {
- return result;
- }
- } else if (proc.getGroup().isGlobalTable()) {
- return handleCachedProcedure(context, proc);
- }
- return null; //it's not a stored procedure we want to handle
- }
-
- GroupSymbol group = ((ProcedureContainer)command).getGroup();
- if (!group.isTempGroupSymbol()) {
- return null;
- }
- final String groupKey = group.getNonCorrelationName().toUpperCase();
- final TempTable table = contextStore.getOrCreateTempTable(groupKey, command, bufferManager, false);
- if (command instanceof Insert) {
- Insert insert = (Insert)command;
- TupleSource ts = insert.getTupleSource();
- if (ts == null) {
- List<Object> values = new ArrayList<Object>(insert.getValues().size());
- for (Expression expr : (List<Expression>)insert.getValues()) {
- values.add(Evaluator.evaluate(expr));
- }
- ts = new CollectionTupleSource(Arrays.asList(values).iterator());
- }
- return table.insert(ts, insert.getVariables());
- }
- if (command instanceof Update) {
- final Update update = (Update)command;
- final Criteria crit = update.getCriteria();
- return table.update(crit, update.getChangeList());
- }
- if (command instanceof Delete) {
- final Delete delete = (Delete)command;
- final Criteria crit = delete.getCriteria();
- if (crit == null) {
- //because we are non-transactional, just use a truncate
- int rows = table.truncate();
- return CollectionTupleSource.createUpdateCountTupleSource(rows);
- }
- return table.delete(crit);
- }
- }
- if (command instanceof Create) {
- Create create = (Create)command;
- String tempTableName = create.getTable().getCanonicalName();
- if (contextStore.hasTempTable(tempTableName)) {
- throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableStore.table_exist_error", tempTableName));//$NON-NLS-1$
- }
- contextStore.addTempTable(tempTableName, create, bufferManager, true);
- return CollectionTupleSource.createUpdateCountTupleSource(0);
- }
- if (command instanceof Drop) {
- String tempTableName = ((Drop)command).getTable().getCanonicalName();
- contextStore.removeTempTableByName(tempTableName);
- return CollectionTupleSource.createUpdateCountTupleSource(0);
- }
- return null;
- }
-
- private TupleSource handleCachedProcedure(CommandContext context,
- StoredProcedure proc) throws TeiidComponentException,
- QueryMetadataException, TeiidProcessingException {
- String fullName = context.getMetadata().getFullName(proc.getProcedureID());
- LogManager.logDetail(LogConstants.CTX_DQP, "processing cached procedure request for", fullName); //$NON-NLS-1$
- LinkedList<Object> vals = new LinkedList<Object>();
- for (SPParameter param : proc.getInputParameters()) {
- vals.add(((Constant)param.getExpression()).getValue());
- }
- //collapse the hash to single byte for the key to restrict the possible results to 256
- int hash = vals.hashCode();
- hash |= (hash >>> 16);
- hash |= (hash >>> 8);
- hash &= 0x000000ff;
- CacheID cid = new CacheID(new ParseInfo(), fullName + hash, context.getVdbName(),
- context.getVdbVersion(), context.getConnectionID(), context.getUserName());
- cid.setParameters(vals);
- CachedResults results = cache.get(cid);
- if (results != null) {
- TupleBuffer buffer = results.getResults();
- return buffer.createIndexedTupleSource();
- }
- //construct a query with a no cache hint
- //note that it's safe to use the stringified form of the parameters because
- //it's not possible to use xml/clob/blob/object
- CacheHint hint = proc.getCacheHint();
- proc.setCacheHint(null);
- Option option = new Option();
- option.setNoCache(true);
- option.addNoCacheGroup(fullName);
- proc.setOption(option);
- Determinism determinismLevel = context.resetDeterminismLevel();
- QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(proc.toString(), fullName.toUpperCase(), context);
- qp.setNonBlocking(true);
- BatchCollector bc = qp.createBatchCollector();
- TupleBuffer tb = bc.collectTuples();
- CachedResults cr = new CachedResults();
- cr.setResults(tb);
- cr.setHint(hint);
- if (hint != null && hint.getDeterminism() != null) {
- LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",determinismLevel, " to ", hint.getDeterminism() }); //$NON-NLS-1$ //$NON-NLS-2$
- determinismLevel = hint.getDeterminism();
- }
- cache.put(cid, determinismLevel, cr, hint != null?hint.getTtl():null);
- context.setDeterminismLevel(determinismLevel);
- return tb.createIndexedTupleSource();
- }
-
- private TupleSource handleSystemProcedures(CommandContext context, StoredProcedure proc)
- throws TeiidComponentException, QueryMetadataException,
- QueryProcessingException, QueryResolverException,
- QueryValidatorException, TeiidProcessingException,
- ExpressionEvaluationException {
- QueryMetadataInterface metadata = context.getMetadata();
- TempTableStore globalStore = context.getGlobalTableStore();
- if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) {
- Object groupID = validateMatView(metadata, proc);
- String matViewName = metadata.getFullName(groupID);
- String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
- LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
- MatTableInfo info = globalStore.getMatTableInfo(matTableName);
- boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(1).getExpression()).getValue());
- if (invalidate) {
- touchTable(context, matTableName, false);
- }
- MatState oldState = info.setState(MatState.NEEDS_LOADING, invalidate?Boolean.FALSE:null, null);
- if (oldState == MatState.LOADING) {
- return CollectionTupleSource.createUpdateCountTupleSource(-1);
- }
- GroupSymbol group = new GroupSymbol(matViewName);
- group.setMetadataID(groupID);
- Object matTableId = RelationalPlanner.getGlobalTempTableMetadataId(group, matTableName, context, metadata, AnalysisRecord.createNonRecordingRecord());
- GroupSymbol matTable = new GroupSymbol(matTableName);
- matTable.setMetadataID(matTableId);
- int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null);
- return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
- } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
- Object groupID = validateMatView(metadata, proc);
- Object pk = metadata.getPrimaryKey(groupID);
- String matViewName = metadata.getFullName(groupID);
- if (pk == null) {
- throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_pk", matViewName)); //$NON-NLS-1$
- }
- List<?> ids = metadata.getElementIDsInKey(pk);
- if (ids.size() > 1) {
- throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_composite", matViewName)); //$NON-NLS-1$
- }
- String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
- MatTableInfo info = globalStore.getMatTableInfo(matTableName);
- if (!info.isValid()) {
- return CollectionTupleSource.createUpdateCountTupleSource(-1);
- }
- TempTable tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
- if (!tempTable.isUpdatable()) {
- throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_updatable", matViewName)); //$NON-NLS-1$
- }
- Constant key = (Constant)proc.getParameter(2).getExpression();
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.row_refresh", matViewName, key)); //$NON-NLS-1$
- String queryString = Reserved.SELECT + " * " + Reserved.FROM + ' ' + matViewName + ' ' + Reserved.WHERE + ' ' + //$NON-NLS-1$
- metadata.getFullName(ids.iterator().next()) + " = ?" + ' ' + Reserved.OPTION + ' ' + Reserved.NOCACHE; //$NON-NLS-1$
- QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(queryString, matViewName.toUpperCase(), context, key.getValue());
- qp.setNonBlocking(true);
- TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
- tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
- List<?> tuple = ts.nextTuple();
- boolean delete = false;
- if (tuple == null) {
- delete = true;
- tuple = Arrays.asList(key.getValue());
- }
- List<?> result = tempTable.updateTuple(tuple, delete);
- //TODO: maintain a table log and distribute the events
- return CollectionTupleSource.createUpdateCountTupleSource(result != null ? 1 : 0);
- }
- return null;
- }
-
- private Object validateMatView(QueryMetadataInterface metadata,
- StoredProcedure proc) throws TeiidComponentException,
- TeiidProcessingException {
- String name = (String)((Constant)proc.getParameter(1).getExpression()).getValue();
- try {
- Object groupID = metadata.getGroupID(name);
- if (!metadata.hasMaterialization(groupID) || metadata.getMaterialization(groupID) != null) {
- throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.not_implicit_matview", name)); //$NON-NLS-1$
- }
- return groupID;
- } catch (QueryMetadataException e) {
- throw new TeiidProcessingException(e);
- }
- }
-
- private TupleSource registerQuery(final CommandContext context,
- TempTableStore contextStore, Query query)
- throws TeiidComponentException, QueryMetadataException,
- TeiidProcessingException, ExpressionEvaluationException,
- QueryProcessingException {
- final GroupSymbol group = query.getFrom().getGroups().get(0);
- if (!group.isTempGroupSymbol()) {
- return null;
- }
- final String tableName = group.getNonCorrelationName().toUpperCase();
- boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
- TempTable table = null;
- if (group.isGlobalTable()) {
- final TempTableStore globalStore = context.getGlobalTableStore();
- final MatTableInfo info = globalStore.getMatTableInfo(tableName);
- Long loadTime = null;
- if (this.distributedCache != null) {
- MatTableKey key = new MatTableKey();
- key.name = tableName;
- key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
-
- MatTableEntry entry = this.tables.get(key);
- if (entry != null && entry.lastUpdate > info.getUpdateTime()
- && info.getState() != MatState.LOADING) {
- //remote load
- info.setState(MatState.NEEDS_LOADING, entry.valid, null);
- loadTime = entry.lastUpdate;
- }
- }
- boolean load = info.shouldLoad();
- if (load) {
- if (!info.isValid()) {
- //blocking load
- loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
- } else {
- loadAsynch(context, group, tableName, globalStore, info, loadTime);
- }
- }
- table = globalStore.getOrCreateTempTable(tableName, query, bufferManager, false);
- } else {
- table = contextStore.getOrCreateTempTable(tableName, query, bufferManager, true);
- }
- if (remapColumns) {
- //convert to the actual table symbols (this is typically handled by the languagebridgefactory
- ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
- @Override
- public Expression replaceExpression(Expression element) {
- if (element instanceof ElementSymbol) {
- ElementSymbol es = (ElementSymbol)element;
- ((ElementSymbol) element).setName(tableName + ElementSymbol.SEPARATOR + es.getShortName());
- }
- return element;
- }
- };
- PostOrderNavigator.doVisit(query, emv);
- }
- return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
- }
-
- private void loadAsynch(final CommandContext context,
- final GroupSymbol group, final String tableName,
- final TempTableStore globalStore, final MatTableInfo info,
- final Long loadTime) {
- Callable<Integer> toCall = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- return loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
- }
- };
- FutureTask<Integer> task = new FutureTask<Integer>(toCall);
- executor.execute(task);
- }
-
- private int loadGlobalTable(CommandContext context,
- GroupSymbol group, final String tableName,
- TempTableStore globalStore, MatTableInfo info, Long loadTime)
- throws TeiidComponentException, TeiidProcessingException {
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
- QueryMetadataInterface metadata = context.getMetadata();
- Create create = new Create();
- create.setTable(group);
- List<ElementSymbol> allColumns = ResolverUtil.resolveElementsInGroup(group, metadata);
- create.setElementSymbolsAsColumns(allColumns);
- Object pk = metadata.getPrimaryKey(group.getMetadataID());
- if (pk != null) {
- List<ElementSymbol> pkColumns = resolveIndex(metadata, allColumns, pk);
- create.getPrimaryKey().addAll(pkColumns);
- }
- TempTable table = globalStore.addTempTable(tableName, create, bufferManager, false);
- table.setUpdatable(false);
- CacheHint hint = table.getCacheHint();
- boolean updatable = false;
- if (hint != null) {
- table.setPreferMemory(hint.getPrefersMemory());
- if (hint.getTtl() != null) {
- info.setTtl(table.getCacheHint().getTtl());
- }
- if (pk != null) {
- updatable = hint.isUpdatable();
- }
- }
- int rowCount = -1;
- try {
- String fullName = metadata.getFullName(group.getMetadataID());
- TupleSource ts = null;
- CacheID cid = null;
- if (distributedCache != null) {
- cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
- context.getVdbVersion(), context.getConnectionID(), context.getUserName());
- CachedResults cr = this.distributedCache.get(cid);
- if (cr != null) {
- ts = cr.getResults().createIndexedTupleSource();
- }
- }
-
- List<ElementSymbol> variables = table.getColumns();
-
- if (ts == null) {
- variables = allColumns;
- //TODO: coordinate a distributed load
- //TODO: order by primary key nulls first - then have an insert ordered optimization
- String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
- QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, fullName, context);
- qp.setNonBlocking(true);
-
- if (distributedCache != null) {
- CachedResults cr = new CachedResults();
- BatchCollector bc = qp.createBatchCollector();
- TupleBuffer tb = bc.collectTuples();
- cr.setResults(tb);
- touchTable(context, fullName, true);
- this.distributedCache.put(cid, Determinism.VDB_DETERMINISTIC, cr, info.getTtl());
- ts = tb.createIndexedTupleSource();
- } else {
- ts = new BatchCollector.BatchProducerTupleSource(qp);
- }
- }
-
- //TODO: if this insert fails, it's unnecessary to do the undo processing
- table.insert(ts, variables);
- rowCount = table.getRowCount();
- //TODO: could pre-process indexes to remove overlap
- for (Object index : metadata.getIndexesInGroup(group.getMetadataID())) {
- List<ElementSymbol> columns = resolveIndex(metadata, allColumns, index);
- table.addIndex(columns);
- }
- for (Object key : metadata.getUniqueKeysInGroup(group.getMetadataID())) {
- List<ElementSymbol> columns = resolveIndex(metadata, allColumns, key);
- table.addIndex(columns);
- }
- table.setUpdatable(updatable);
- } catch (TeiidComponentException e) {
- LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
- throw e;
- } catch (TeiidProcessingException e) {
- LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
- throw e;
- } finally {
- if (rowCount == -1) {
- info.setState(MatState.FAILED_LOAD, null, null);
- } else {
- globalStore.swapTempTable(tableName, table);
- info.setState(MatState.LOADED, true, loadTime);
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loaded", tableName, rowCount)); //$NON-NLS-1$
- }
- }
- return rowCount;
- }
-
- private void touchTable(CommandContext context, String fullName, boolean valid) {
- MatTableKey key = new MatTableKey();
- key.name = fullName;
- key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
- MatTableEntry matTableEntry = new MatTableEntry();
- matTableEntry.valid = valid;
- tables.put(key, matTableEntry, null);
- }
-
- /**
- * Return a list of ElementSymbols for the given index/key object
- */
- private List<ElementSymbol> resolveIndex(QueryMetadataInterface metadata,
- List<ElementSymbol> allColumns, Object pk)
- throws TeiidComponentException, QueryMetadataException {
- Collection<?> pkIds = metadata.getElementIDsInKey(pk);
- List<ElementSymbol> pkColumns = new ArrayList<ElementSymbol>(pkIds.size());
- for (Object col : pkIds) {
- pkColumns.add(allColumns.get(metadata.getPosition(col)-1));
- }
- return pkColumns;
- }
-
- public Object lookupCodeValue(CommandContext context, String codeTableName,
- String returnElementName, String keyElementName, Object keyValue)
- throws BlockedException, TeiidComponentException,
- TeiidProcessingException {
- String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase();
-
- ElementSymbol keyElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + keyElementName);
- ElementSymbol returnElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + returnElementName);
-
- QueryMetadataInterface metadata = context.getMetadata();
-
- keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
- returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
-
- TempMetadataID id = context.getGlobalTableStore().getMetadataStore().getTempGroupID(matTableName);
- if (id == null) {
- id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
- String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
- id.setQueryNode(new QueryNode(matTableName, queryString));
- id.setPrimaryKey(id.getElements().subList(0, 1));
- CacheHint hint = new CacheHint(true, null);
- id.setCacheHint(hint);
- }
- Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
- query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
-
- TupleSource ts = registerQuery(context, context.getTempTableStore(), query);
- List<?> row = ts.nextTuple();
- Object result = null;
- if (row != null) {
- result = row.get(0);
- }
- ts.closeSource();
- return result;
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java (from rev 2886, branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,609 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.tempdata;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+import org.teiid.api.exception.query.ExpressionEvaluationException;
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.api.exception.query.QueryProcessingException;
+import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.common.buffer.BlockedException;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.TupleSource;
+import org.teiid.core.CoreConstants;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.HashCodeUtil;
+import org.teiid.core.util.StringUtil;
+import org.teiid.dqp.internal.process.CachedResults;
+import org.teiid.dqp.internal.process.SessionAwareCache;
+import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.language.SQLConstants.Reserved;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.FunctionMethod.Determinism;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.eval.Evaluator;
+import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataID;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
+import org.teiid.query.parser.ParseInfo;
+import org.teiid.query.processor.BatchCollector;
+import org.teiid.query.processor.CollectionTupleSource;
+import org.teiid.query.processor.ProcessorDataManager;
+import org.teiid.query.processor.QueryProcessor;
+import org.teiid.query.resolver.util.ResolverUtil;
+import org.teiid.query.sql.lang.CacheHint;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.CompareCriteria;
+import org.teiid.query.sql.lang.Create;
+import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.lang.Delete;
+import org.teiid.query.sql.lang.Drop;
+import org.teiid.query.sql.lang.Insert;
+import org.teiid.query.sql.lang.Option;
+import org.teiid.query.sql.lang.ProcedureContainer;
+import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.SPParameter;
+import org.teiid.query.sql.lang.StoredProcedure;
+import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.navigator.PostOrderNavigator;
+import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
+import org.teiid.query.tempdata.TempTableStore.MatState;
+import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
+import org.teiid.query.util.CommandContext;
+import org.teiid.vdb.runtime.VDBKey;
+
+/**
+ * This proxy ProcessorDataManager is used to handle temporary tables.
+ *
+ * This isn't handled as a connector because of the temporary metadata and
+ * the create/drop handling (which doesn't have push down support)
+ */
+public class TempTableDataManager implements ProcessorDataManager {
+
+ private static final String REFRESHMATVIEWROW = ".refreshmatviewrow"; //$NON-NLS-1$
+ private static final String REFRESHMATVIEW = ".refreshmatview"; //$NON-NLS-1$
+ private static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
+
+ private ProcessorDataManager processorDataManager;
+ private BufferManager bufferManager;
+ private SessionAwareCache<CachedResults> cache;
+ private Executor executor;
+
+ private static class MatTableKey implements Serializable {
+ private static final long serialVersionUID = 5481692896572663992L;
+ String name;
+ VDBKey vdb;
+
+ @Override
+ public int hashCode() {
+ return HashCodeUtil.hashCode(name.hashCode(), vdb);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof MatTableKey)) {
+ return false;
+ }
+ MatTableKey other = (MatTableKey)obj;
+ return this.name.equals(other.name) && this.vdb.equals(other.vdb);
+ }
+ }
+
+ private static class MatTableEntry implements Serializable {
+ private static final long serialVersionUID = 8559613701442751579L;
+ long lastUpdate = System.currentTimeMillis();
+ boolean valid;
+ }
+
+ private Cache<MatTableKey, MatTableEntry> tables;
+ private SessionAwareCache<CachedResults> distributedCache;
+
+ public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager,
+ Executor executor, SessionAwareCache<CachedResults> cache, SessionAwareCache<CachedResults> distibutedCache, CacheFactory cacheFactory){
+ this.processorDataManager = processorDataManager;
+ this.bufferManager = bufferManager;
+ this.executor = executor;
+ this.cache = cache;
+ this.distributedCache = distibutedCache;
+ if (distibutedCache != null) {
+ CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1, "MaterializationUpdates"); //$NON-NLS-1$
+ tables = cacheFactory.get(cc.getLocation(), cc);
+ }
+ }
+
+ public TupleSource registerRequest(
+ CommandContext context,
+ Command command,
+ String modelName,
+ String connectorBindingId, int nodeID)
+ throws TeiidComponentException, TeiidProcessingException {
+
+ TempTableStore tempTableStore = context.getTempTableStore();
+ if(tempTableStore != null) {
+ TupleSource result = registerRequest(context, modelName, command);
+ if (result != null) {
+ return result;
+ }
+ }
+ return this.processorDataManager.registerRequest(context, command, modelName, connectorBindingId, nodeID);
+ }
+
+ TupleSource registerRequest(CommandContext context, String modelName, Command command) throws TeiidComponentException, TeiidProcessingException {
+ TempTableStore contextStore = context.getTempTableStore();
+ if (command instanceof Query) {
+ Query query = (Query)command;
+ return registerQuery(context, contextStore, query);
+ }
+ if (command instanceof ProcedureContainer) {
+ if (command instanceof StoredProcedure) {
+ StoredProcedure proc = (StoredProcedure)command;
+ if (CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) {
+ TupleSource result = handleSystemProcedures(context, proc);
+ if (result != null) {
+ return result;
+ }
+ } else if (proc.getGroup().isGlobalTable()) {
+ return handleCachedProcedure(context, proc);
+ }
+ return null; //it's not a stored procedure we want to handle
+ }
+
+ GroupSymbol group = ((ProcedureContainer)command).getGroup();
+ if (!group.isTempGroupSymbol()) {
+ return null;
+ }
+ final String groupKey = group.getNonCorrelationName().toUpperCase();
+ final TempTable table = contextStore.getOrCreateTempTable(groupKey, command, bufferManager, false);
+ if (command instanceof Insert) {
+ Insert insert = (Insert)command;
+ TupleSource ts = insert.getTupleSource();
+ if (ts == null) {
+ List<Object> values = new ArrayList<Object>(insert.getValues().size());
+ for (Expression expr : (List<Expression>)insert.getValues()) {
+ values.add(Evaluator.evaluate(expr));
+ }
+ ts = new CollectionTupleSource(Arrays.asList(values).iterator());
+ }
+ return table.insert(ts, insert.getVariables());
+ }
+ if (command instanceof Update) {
+ final Update update = (Update)command;
+ final Criteria crit = update.getCriteria();
+ return table.update(crit, update.getChangeList());
+ }
+ if (command instanceof Delete) {
+ final Delete delete = (Delete)command;
+ final Criteria crit = delete.getCriteria();
+ if (crit == null) {
+ //because we are non-transactional, just use a truncate
+ int rows = table.truncate();
+ return CollectionTupleSource.createUpdateCountTupleSource(rows);
+ }
+ return table.delete(crit);
+ }
+ }
+ if (command instanceof Create) {
+ Create create = (Create)command;
+ String tempTableName = create.getTable().getCanonicalName();
+ if (contextStore.hasTempTable(tempTableName)) {
+ throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableStore.table_exist_error", tempTableName));//$NON-NLS-1$
+ }
+ contextStore.addTempTable(tempTableName, create, bufferManager, true);
+ return CollectionTupleSource.createUpdateCountTupleSource(0);
+ }
+ if (command instanceof Drop) {
+ String tempTableName = ((Drop)command).getTable().getCanonicalName();
+ contextStore.removeTempTableByName(tempTableName);
+ return CollectionTupleSource.createUpdateCountTupleSource(0);
+ }
+ return null;
+ }
+
+ private TupleSource handleCachedProcedure(CommandContext context,
+ StoredProcedure proc) throws TeiidComponentException,
+ QueryMetadataException, TeiidProcessingException {
+ String fullName = context.getMetadata().getFullName(proc.getProcedureID());
+ LogManager.logDetail(LogConstants.CTX_DQP, "processing cached procedure request for", fullName); //$NON-NLS-1$
+ LinkedList<Object> vals = new LinkedList<Object>();
+ for (SPParameter param : proc.getInputParameters()) {
+ vals.add(((Constant)param.getExpression()).getValue());
+ }
+ //collapse the hash to single byte for the key to restrict the possible results to 256
+ int hash = vals.hashCode();
+ hash |= (hash >>> 16);
+ hash |= (hash >>> 8);
+ hash &= 0x000000ff;
+ CacheID cid = new CacheID(new ParseInfo(), fullName + hash, context.getVdbName(),
+ context.getVdbVersion(), context.getConnectionID(), context.getUserName());
+ cid.setParameters(vals);
+ CachedResults results = cache.get(cid);
+ if (results != null) {
+ TupleBuffer buffer = results.getResults();
+ return buffer.createIndexedTupleSource();
+ }
+ //construct a query with a no cache hint
+ //note that it's safe to use the stringified form of the parameters because
+ //it's not possible to use xml/clob/blob/object
+ CacheHint hint = proc.getCacheHint();
+ proc.setCacheHint(null);
+ Option option = new Option();
+ option.setNoCache(true);
+ option.addNoCacheGroup(fullName);
+ proc.setOption(option);
+ Determinism determinismLevel = context.resetDeterminismLevel();
+ QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(proc.toString(), fullName.toUpperCase(), context);
+ qp.setNonBlocking(true);
+ BatchCollector bc = qp.createBatchCollector();
+ TupleBuffer tb = bc.collectTuples();
+ CachedResults cr = new CachedResults();
+ cr.setResults(tb);
+ cr.setHint(hint);
+ if (hint != null && hint.getDeterminism() != null) {
+ LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",determinismLevel, " to ", hint.getDeterminism() }); //$NON-NLS-1$ //$NON-NLS-2$
+ determinismLevel = hint.getDeterminism();
+ }
+ cache.put(cid, determinismLevel, cr, hint != null?hint.getTtl():null);
+ context.setDeterminismLevel(determinismLevel);
+ return tb.createIndexedTupleSource();
+ }
+
+ private TupleSource handleSystemProcedures(CommandContext context, StoredProcedure proc)
+ throws TeiidComponentException, QueryMetadataException,
+ QueryProcessingException, QueryResolverException,
+ QueryValidatorException, TeiidProcessingException,
+ ExpressionEvaluationException {
+ QueryMetadataInterface metadata = context.getMetadata();
+ TempTableStore globalStore = context.getGlobalTableStore();
+ if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) {
+ Object groupID = validateMatView(metadata, proc);
+ String matViewName = metadata.getFullName(groupID);
+ String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
+ LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
+ MatTableInfo info = globalStore.getMatTableInfo(matTableName);
+ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(1).getExpression()).getValue());
+ if (invalidate) {
+ touchTable(context, matTableName, false);
+ }
+ MatState oldState = info.setState(MatState.NEEDS_LOADING, invalidate?Boolean.FALSE:null, null);
+ if (oldState == MatState.LOADING) {
+ return CollectionTupleSource.createUpdateCountTupleSource(-1);
+ }
+ GroupSymbol group = new GroupSymbol(matViewName);
+ group.setMetadataID(groupID);
+ Object matTableId = RelationalPlanner.getGlobalTempTableMetadataId(group, matTableName, context, metadata, AnalysisRecord.createNonRecordingRecord());
+ GroupSymbol matTable = new GroupSymbol(matTableName);
+ matTable.setMetadataID(matTableId);
+ int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null);
+ return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
+ } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
+ Object groupID = validateMatView(metadata, proc);
+ Object pk = metadata.getPrimaryKey(groupID);
+ String matViewName = metadata.getFullName(groupID);
+ if (pk == null) {
+ throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_pk", matViewName)); //$NON-NLS-1$
+ }
+ List<?> ids = metadata.getElementIDsInKey(pk);
+ if (ids.size() > 1) {
+ throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_composite", matViewName)); //$NON-NLS-1$
+ }
+ String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
+ MatTableInfo info = globalStore.getMatTableInfo(matTableName);
+ if (!info.isValid()) {
+ return CollectionTupleSource.createUpdateCountTupleSource(-1);
+ }
+ TempTable tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
+ if (!tempTable.isUpdatable()) {
+ throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_updatable", matViewName)); //$NON-NLS-1$
+ }
+ Constant key = (Constant)proc.getParameter(2).getExpression();
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.row_refresh", matViewName, key)); //$NON-NLS-1$
+ String queryString = Reserved.SELECT + " * " + Reserved.FROM + ' ' + matViewName + ' ' + Reserved.WHERE + ' ' + //$NON-NLS-1$
+ metadata.getFullName(ids.iterator().next()) + " = ?" + ' ' + Reserved.OPTION + ' ' + Reserved.NOCACHE; //$NON-NLS-1$
+ QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(queryString, matViewName.toUpperCase(), context, key.getValue());
+ qp.setNonBlocking(true);
+ TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
+ tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
+ List<?> tuple = ts.nextTuple();
+ boolean delete = false;
+ if (tuple == null) {
+ delete = true;
+ tuple = Arrays.asList(key.getValue());
+ }
+ List<?> result = tempTable.updateTuple(tuple, delete);
+ //TODO: maintain a table log and distribute the events
+ return CollectionTupleSource.createUpdateCountTupleSource(result != null ? 1 : 0);
+ }
+ return null;
+ }
+
+ private Object validateMatView(QueryMetadataInterface metadata,
+ StoredProcedure proc) throws TeiidComponentException,
+ TeiidProcessingException {
+ String name = (String)((Constant)proc.getParameter(1).getExpression()).getValue();
+ try {
+ Object groupID = metadata.getGroupID(name);
+ if (!metadata.hasMaterialization(groupID) || metadata.getMaterialization(groupID) != null) {
+ throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.not_implicit_matview", name)); //$NON-NLS-1$
+ }
+ return groupID;
+ } catch (QueryMetadataException e) {
+ throw new TeiidProcessingException(e);
+ }
+ }
+
+ private TupleSource registerQuery(final CommandContext context,
+ TempTableStore contextStore, Query query)
+ throws TeiidComponentException, QueryMetadataException,
+ TeiidProcessingException, ExpressionEvaluationException,
+ QueryProcessingException {
+ final GroupSymbol group = query.getFrom().getGroups().get(0);
+ if (!group.isTempGroupSymbol()) {
+ return null;
+ }
+ final String tableName = group.getNonCorrelationName().toUpperCase();
+ boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
+ TempTable table = null;
+ if (group.isGlobalTable()) {
+ final TempTableStore globalStore = context.getGlobalTableStore();
+ final MatTableInfo info = globalStore.getMatTableInfo(tableName);
+ Long loadTime = null;
+ if (this.distributedCache != null) {
+ MatTableKey key = new MatTableKey();
+ key.name = tableName;
+ key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
+
+ MatTableEntry entry = this.tables.get(key);
+ if (entry != null && entry.lastUpdate > info.getUpdateTime()
+ && info.getState() != MatState.LOADING) {
+ //remote load
+ info.setState(MatState.NEEDS_LOADING, entry.valid, null);
+ loadTime = entry.lastUpdate;
+ }
+ }
+ boolean load = info.shouldLoad();
+ if (load) {
+ if (!info.isValid()) {
+ //blocking load
+ loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ } else {
+ loadAsynch(context, group, tableName, globalStore, info, loadTime);
+ }
+ }
+ table = globalStore.getOrCreateTempTable(tableName, query, bufferManager, false);
+ } else {
+ table = contextStore.getOrCreateTempTable(tableName, query, bufferManager, true);
+ }
+ if (remapColumns) {
+ //convert to the actual table symbols (this is typically handled by the languagebridgefactory
+ ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
+ @Override
+ public Expression replaceExpression(Expression element) {
+ if (element instanceof ElementSymbol) {
+ ElementSymbol es = (ElementSymbol)element;
+ ((ElementSymbol) element).setName(tableName + ElementSymbol.SEPARATOR + es.getShortName());
+ }
+ return element;
+ }
+ };
+ PostOrderNavigator.doVisit(query, emv);
+ }
+ return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
+ }
+
+ private void loadAsynch(final CommandContext context,
+ final GroupSymbol group, final String tableName,
+ final TempTableStore globalStore, final MatTableInfo info,
+ final Long loadTime) {
+ Callable<Integer> toCall = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ return loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ }
+ };
+ FutureTask<Integer> task = new FutureTask<Integer>(toCall);
+ executor.execute(task);
+ }
+
+ private int loadGlobalTable(CommandContext context,
+ GroupSymbol group, final String tableName,
+ TempTableStore globalStore, MatTableInfo info, Long loadTime)
+ throws TeiidComponentException, TeiidProcessingException {
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
+ QueryMetadataInterface metadata = context.getMetadata();
+ Create create = new Create();
+ create.setTable(group);
+ List<ElementSymbol> allColumns = ResolverUtil.resolveElementsInGroup(group, metadata);
+ create.setElementSymbolsAsColumns(allColumns);
+ Object pk = metadata.getPrimaryKey(group.getMetadataID());
+ if (pk != null) {
+ List<ElementSymbol> pkColumns = resolveIndex(metadata, allColumns, pk);
+ create.getPrimaryKey().addAll(pkColumns);
+ }
+ TempTable table = globalStore.addTempTable(tableName, create, bufferManager, false);
+ table.setUpdatable(false);
+ CacheHint hint = table.getCacheHint();
+ boolean updatable = false;
+ if (hint != null) {
+ table.setPreferMemory(hint.getPrefersMemory());
+ if (hint.getTtl() != null) {
+ info.setTtl(table.getCacheHint().getTtl());
+ }
+ if (pk != null) {
+ updatable = hint.isUpdatable();
+ }
+ }
+ int rowCount = -1;
+ try {
+ String fullName = metadata.getFullName(group.getMetadataID());
+ TupleSource ts = null;
+ CacheID cid = null;
+ if (distributedCache != null) {
+ cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
+ context.getVdbVersion(), context.getConnectionID(), context.getUserName());
+ CachedResults cr = this.distributedCache.get(cid);
+ if (cr != null) {
+ ts = cr.getResults().createIndexedTupleSource();
+ }
+ }
+
+ List<ElementSymbol> variables = table.getColumns();
+
+ if (ts == null) {
+ variables = allColumns;
+ //TODO: coordinate a distributed load
+ //TODO: order by primary key nulls first - then have an insert ordered optimization
+ String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
+ QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, fullName, context);
+ qp.setNonBlocking(true);
+
+ if (distributedCache != null) {
+ CachedResults cr = new CachedResults();
+ BatchCollector bc = qp.createBatchCollector();
+ TupleBuffer tb = bc.collectTuples();
+ cr.setResults(tb);
+ touchTable(context, fullName, true);
+ this.distributedCache.put(cid, Determinism.VDB_DETERMINISTIC, cr, info.getTtl());
+ ts = tb.createIndexedTupleSource();
+ } else {
+ ts = new BatchCollector.BatchProducerTupleSource(qp);
+ }
+ }
+
+ //TODO: if this insert fails, it's unnecessary to do the undo processing
+ table.insert(ts, variables);
+ rowCount = table.getRowCount();
+ //TODO: could pre-process indexes to remove overlap
+ for (Object index : metadata.getIndexesInGroup(group.getMetadataID())) {
+ List<ElementSymbol> columns = resolveIndex(metadata, allColumns, index);
+ table.addIndex(columns);
+ }
+ for (Object key : metadata.getUniqueKeysInGroup(group.getMetadataID())) {
+ List<ElementSymbol> columns = resolveIndex(metadata, allColumns, key);
+ table.addIndex(columns);
+ }
+ table.setUpdatable(updatable);
+ } catch (TeiidComponentException e) {
+ LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
+ throw e;
+ } catch (TeiidProcessingException e) {
+ LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
+ throw e;
+ } finally {
+ if (rowCount == -1) {
+ info.setState(MatState.FAILED_LOAD, null, null);
+ } else {
+ globalStore.swapTempTable(tableName, table);
+ info.setState(MatState.LOADED, true, loadTime);
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loaded", tableName, rowCount)); //$NON-NLS-1$
+ }
+ }
+ return rowCount;
+ }
+
+ private void touchTable(CommandContext context, String fullName, boolean valid) {
+ MatTableKey key = new MatTableKey();
+ key.name = fullName;
+ key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
+ MatTableEntry matTableEntry = new MatTableEntry();
+ matTableEntry.valid = valid;
+ tables.put(key, matTableEntry, null);
+ }
+
+ /**
+ * Return a list of ElementSymbols for the given index/key object
+ */
+ private List<ElementSymbol> resolveIndex(QueryMetadataInterface metadata,
+ List<ElementSymbol> allColumns, Object pk)
+ throws TeiidComponentException, QueryMetadataException {
+ Collection<?> pkIds = metadata.getElementIDsInKey(pk);
+ List<ElementSymbol> pkColumns = new ArrayList<ElementSymbol>(pkIds.size());
+ for (Object col : pkIds) {
+ pkColumns.add(allColumns.get(metadata.getPosition(col)-1));
+ }
+ return pkColumns;
+ }
+
+ public Object lookupCodeValue(CommandContext context, String codeTableName,
+ String returnElementName, String keyElementName, Object keyValue)
+ throws BlockedException, TeiidComponentException,
+ TeiidProcessingException {
+ String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase();
+
+ ElementSymbol keyElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + keyElementName);
+ ElementSymbol returnElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + returnElementName);
+
+ QueryMetadataInterface metadata = context.getMetadata();
+
+ keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
+ returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
+
+ TempMetadataID id = context.getGlobalTableStore().getMetadataStore().getTempGroupID(matTableName);
+ if (id == null) {
+ id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
+ String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
+ id.setQueryNode(new QueryNode(matTableName, queryString));
+ id.setPrimaryKey(id.getElements().subList(0, 1));
+ CacheHint hint = new CacheHint(true, null);
+ id.setCacheHint(hint);
+ }
+ Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
+ query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
+
+ TupleSource ts = registerQuery(context, context.getTempTableStore(), query);
+ List<?> row = ts.nextTuple();
+ Object result = null;
+ if (row != null) {
+ result = row.get(0);
+ }
+ ts.closeSource();
+ return result;
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,2701 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.processor.proc;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.api.exception.query.QueryProcessingException;
-import org.teiid.api.exception.query.QueryValidatorException;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.mapping.relational.QueryNode;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TempMetadataAdapter;
-import org.teiid.query.metadata.TempMetadataStore;
-import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.optimizer.QueryOptimizer;
-import org.teiid.query.optimizer.TestOptimizer;
-import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
-import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
-import org.teiid.query.parser.QueryParser;
-import org.teiid.query.processor.FakeDataManager;
-import org.teiid.query.processor.FakeDataStore;
-import org.teiid.query.processor.HardcodedDataManager;
-import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.processor.TestProcessor;
-import org.teiid.query.processor.xml.TestXMLPlanningEnhancements;
-import org.teiid.query.processor.xml.TestXMLProcessor;
-import org.teiid.query.resolver.QueryResolver;
-import org.teiid.query.rewriter.QueryRewriter;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
-import org.teiid.query.unittest.RealMetadataFactory;
-import org.teiid.query.util.CommandContext;
-import org.teiid.query.validator.Validator;
-import org.teiid.query.validator.ValidatorFailure;
-import org.teiid.query.validator.ValidatorReport;
-
-@SuppressWarnings({"unchecked", "nls"})
-public class TestProcedureProcessor {
-
- public static ProcessorPlan getProcedurePlan(String userQuery, QueryMetadataInterface metadata) throws Exception {
- return getProcedurePlan(userQuery, metadata, /*capabilitiesFinder*/null);
- }
-
- public static ProcessorPlan getProcedurePlan(String userQuery, QueryMetadataInterface metadata, CapabilitiesFinder capabilitiesFinder) throws Exception {
- Command userCommand = QueryParser.getQueryParser().parseCommand(userQuery);
- QueryResolver.resolveCommand(userCommand, metadata);
- ValidatorReport report = Validator.validate(userCommand, metadata);
-
- if (report.hasItems()) {
- ValidatorFailure firstFailure = report.getItems().iterator().next();
- throw new QueryValidatorException(firstFailure.getMessage());
- }
- QueryRewriter.rewrite(userCommand, metadata, new CommandContext());
-
- AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
- try {
- if ( capabilitiesFinder == null ) capabilitiesFinder = new DefaultCapabilitiesFinder();
- ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null);
-
- return plan;
- } finally {
- if(DEBUG) {
- System.out.println(analysisRecord.getDebugLog());
- }
- }
- }
-
- public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
- CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
- if (!(metadata instanceof TempMetadataAdapter)) {
- metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
- }
- context.setMetadata(metadata);
-
- TestProcessor.helpProcess(procPlan, context, dataMgr, expectedResults);
- assertNotNull("Expected processing to fail", expectedResults);
- }
-
- private void helpTestProcessFailure(ProcessorPlan procPlan, FakeDataManager dataMgr,
- String failMessage, QueryMetadataInterface metadata) throws Exception {
- try {
- helpTestProcess(procPlan, null, dataMgr, metadata);
- } catch(TeiidException ex) {
- assertEquals(failMessage, ex.getMessage());
- }
- }
-
- private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
- helpTestProcess(procPlan, new List[] {Arrays.asList(expectedRows)}, dataMgr, metadata);
- }
-
- // Helper to create a list of elements - used in creating sample data
- private static List createElements(List elementIDs) {
- List elements = new ArrayList();
- for(int i=0; i<elementIDs.size(); i++) {
- FakeMetadataObject elementID = (FakeMetadataObject) elementIDs.get(i);
- ElementSymbol element = new ElementSymbol(elementID.getName());
- elements.add(element);
- }
-
- return elements;
- }
-
- private FakeDataManager exampleDataManager(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
- FakeDataManager dataMgr = new FakeDataManager();
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- return dataMgr;
- }
-
- private FakeDataManager exampleDataManager2(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
- FakeDataManager dataMgr = new FakeDataManager();
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- return dataMgr;
- }
-
- private FakeDataManager exampleDataManagerPm5(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
- FakeDataManager dataMgr = new FakeDataManager();
-
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm5.g3"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Short((short)5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Short((short)15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Short((short)51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- return dataMgr;
- }
-
- // procedure does nothing returns zero update count
- @Test public void testProcedureProcessor1() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1 = 0;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 0, dataMgr, metadata);
- }
-
- // testing if statement
- @Test public void testProcedureProcessor2() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- // testing if statement
- @Test public void testProcedureProcessor2WithBlockedException() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
- dataMgr.setBlockOnce();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- // testing rows updated incremented, Input and assignment statements
- @Test public void testProcedureProcessor3() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=40"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 45, dataMgr, metadata);
- }
-
- // if/else test
- @Test public void testProcedureProcessor4() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "ELSE\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- @Test public void testProcedureProcessor4WithBlockedException() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "ELSE\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
- dataMgr.setBlockOnce();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- // if/else test
- @Test public void testProcedureProcessor5() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=15;\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "ELSE\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 50, dataMgr, metadata);
- }
-
- // more rows than expected
- @Test public void testProcedureProcessor6() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1", metadata); //$NON-NLS-1$
- }
-
- // error statement
- @Test public void testProcedureProcessor7() throws Exception {
- String errorValue = "'MY ERROR'"; //$NON-NLS-1$
- helpTestErrorStatment(errorValue, "MY ERROR"); //$NON-NLS-1$
- }
-
- @Test public void testProcedureProcessor8() throws Exception {
- String errorValue = "var1"; //$NON-NLS-1$
- helpTestErrorStatment(errorValue, "5"); //$NON-NLS-1$
- }
-
- @Test public void testProcedureProcessor9() throws Exception {
- String errorValue = "var1||'MY ERROR'"; //$NON-NLS-1$
- helpTestErrorStatment(errorValue, "5MY ERROR"); //$NON-NLS-1$
- }
-
- @Test public void testProcedureProcessor10() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "loop on (Select pm1.g1.e2 from pm1.g1 where e2 = 5) as mycursor\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ERROR (mycursor.e2||'MY ERROR');\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR", metadata); //$NON-NLS-1$
- }
-
- private void helpTestErrorStatment(String errorValue, String expected) throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = 5;\n"; //$NON-NLS-1$
- procedure = procedure + "ERROR "+errorValue+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
- procedure = procedure + "ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected, metadata);
- }
-
- /** test if statement's if block with lookup in if condition */
- @Test public void testLookupFunction1() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
- procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 0))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "ELSE\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "var2 = 100;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +13;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
- FakeDataManager dataMgr = new FakeDataManager();
- FakeDataStore.sampleData2(dataMgr);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 1, dataMgr, metadata);
-
- }
-
- /** test if statement's else block with lookup in if condition */
- @Test public void testLookupFunction2() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
- procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "ELSE\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "var2 = 100;\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +12;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
- FakeDataManager dataMgr = new FakeDataManager();
- FakeDataStore.sampleData2(dataMgr);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 12, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureWithBlockedException() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
- dataMgr.setBlockOnce();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure2() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp3()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure3() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp4()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure4() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp5()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure5() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp6()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure6() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp7(5)"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure7() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp8(51)"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure8() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp9(51)"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure9() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp10(51)"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {};
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
-
- @Test public void testVirtualProcedure10() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp13()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure11() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp14()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure12() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp15()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- //Defect17447_testVirtualProcedure13
- @Test public void testVirtualProcedure13() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp16()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure14() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp17()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure15() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp19()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure16() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp20()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Fourth"})}; //$NON-NLS-1$
- CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
- context.setMetadata(metadata);
- context.setProcessorBatchSize(1); //ensure that the final temp result set will not be deleted prematurely
-
- TestProcessor.helpProcess(plan, context, dataMgr, expected);
- }
-
- @Test public void testVirtualProcedure17() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp21(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Fourth", new Integer(7)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure18() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp22(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure19() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure19WithBlockedException() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureNoDataInTempTable() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp25()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {};
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- //procedure with Has Criteria and Translate Criteria
- @Test public void testDefect13625() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "IF(HAS CRITERIA ON (vm1.g4.e2))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where TRANSLATE = CRITERIA ON (vm1.g4.e2);\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure30() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp30()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure31() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp31(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureDefect14282() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp24()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16193() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp35(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedure16602() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp37()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementSymbols = new ArrayList();
- ElementSymbol element = new ElementSymbol("Count"); //$NON-NLS-1$
- elementSymbols.add(element);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
- new List[] {
- Arrays.asList( new Object[] { new Integer(1) } )
- } );
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(1)})};
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16649_1() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp38()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16649_2() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp39()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16694() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp40()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16707() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp44(2)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect16707_1() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp43(2)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect17451() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp45()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- //Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- //Defect 17447
- @Test public void testVirtualProcedure46() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp46()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect17650() throws Exception {
- String procedure1 = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure1 = procedure1 + "BEGIN\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "IF(HAS CRITERIA ON (vm1.g1.e2))\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "BEGIN\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "ROWS_UPDATED = UPDATE vm1.g2 SET e1='x' where TRANSLATE = CRITERIA ON (vm1.g1.e2);\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "END\n"; //$NON-NLS-1$
- procedure1 = procedure1 + "END"; //$NON-NLS-1$
-
- String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure2 = procedure2 + "BEGIN\n"; //$NON-NLS-1$
- procedure2 = procedure2 + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure2 = procedure2 + "Select pm1.g2.e2 from pm1.g2 where TRANSLATE CRITERIA;\n";//$NON-NLS-1$
- procedure2 = procedure2 + "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
- procedure2 = procedure2 + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- @Test public void testDefect19982() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp55(5)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testCase3521() throws Exception {
- String userUpdateStr = "EXEC pm1.vsp1()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
-// Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
-// Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- //procedure with Has Criteria and Translate Criteria and changing
- @Test public void testDynamicCommandWithTranslate() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "IF(HAS CRITERIA ON (vm1.g4.e2))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "execute string 'Select pm1.g1.e2 x, changing.e1 y from pm1.g1 where TRANSLATE = CRITERIA ON (vm1.g4.e2)' as x integer, y boolean into #temp;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = select x from #temp;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithIntoExpression() throws Exception {
-
- //Test INTO clause with expression
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1 FROM pm1.g1 WHERE e1 = ''First''' as x string into #temp; declare string VARIABLES.RESULT = select x from #temp;select VARIABLES.RESULT; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- //Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithIntoAndLoop() throws Exception {
-
- //Test INTO clause with loop
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
- procedure.append("execute string 'SELECT e1, e2 FROM pm1.g1' as e1 string, e2 integer into #temp;\n"); //$NON-NLS-1$
- procedure.append("loop on (Select e2 from #temp where e2 > 2) as mycursor\n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("IF (mycursor.e2>5) \n"); //$NON-NLS-1$
- procedure.append("VARIABLES.e2_total=VARIABLES.e2_total+mycursor.e2;\n"); //$NON-NLS-1$
- procedure.append("END\n"); //$NON-NLS-1$
- procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- //Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(66)}),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithParameter() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithUsing() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=using.id' using id=pm1.sq2.in; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithVariable() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare string VARIABLES.x; VARIABLES.x = pm1.sq2.in; execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=VARIABLES.x'; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandValidationFails() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare object VARIABLES.x; execute string 'SELECT xmlelement(name elem, x)'; select 1; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- try {
- helpTestProcess(plan, null, dataMgr, metadata);
- fail("exception expected");
- } catch (QueryProcessingException e) {
- assertTrue(e.getCause() instanceof QueryValidatorException);
- }
- }
-
- @Test public void testDynamicCommandWithSingleSelect() throws Exception {
- //Test select of a single value in a DynamicCommand
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT 26'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "26" }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
-
- //converts e1 from integer to string, with a different name
- @Test public void testDynamicCommandTypeConversion() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare string VARIABLES.x; VARIABLES.x = 'a'; execute string 'SELECT e2 ' || ' FROM pm1.g1 ' || ' where e1=pm1.sq2.in'; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "5" }), //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandRecursion() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory
- .createResultSet("pm1.rs2", pm1, new String[] {"e1", "e2"}, new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory
- .createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory
- .createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'EXEC pm1.sq2(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory
- .createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] {rs2p1, rs2p2}), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan,
- dataMgr,
- "Couldn't execute the dynamic SQL command \"EXECUTE 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL.", metadata); //$NON-NLS-1$
- }
-
- @Test public void testDynamicCommandIncorrectProjectSymbolCount() throws Exception {
- //Tests dynamic query with incorrect number of elements
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "SELECT pm1.g1.e1 FROM pm1.g1; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- QueryNode sq2n2 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'EXEC pm1.sq1(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n2); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC pm1.sq2('test')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements.", metadata); //$NON-NLS-1$
- }
-
- @Test public void testDynamicCommandPositional() throws Exception {
- //Tests dynamic query with incorrect number of elements
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 as x, e2 from pm1.g1'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1('test')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {Arrays.asList("First", "5"), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList("Second", "15"), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList("Third", "51")}, dataMgr, metadata); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
- //Tests dynamic query with a different datatype definition for an element in the AS clause that
- //has no implicit conversion.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 from pm1.g1'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'.", metadata); //$NON-NLS-1$
- }
-
- @Test public void testDynamicCommandWithTwoDynamicStatements() throws Exception {
- //Tests dynamic query with two consecutive DynamicCommands. The first without an AS clause and returning different results.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 from pm1.g1'; execute string 'select e1, e2 from pm1.g1' as e1 string, e2 integer; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
-
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testAssignmentWithCase() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- String sql = new StringBuffer("declare integer caseValue = ") //$NON-NLS-1$
- .append("CASE") //$NON-NLS-1$
- .append(" WHEN pm1.sq1.param='a' THEN 0") //$NON-NLS-1$
- .append(" WHEN pm1.sq1.param='b' THEN 1") //$NON-NLS-1$
- .append(" WHEN pm1.sq1.param='c' THEN 2") //$NON-NLS-1$
- .append(" WHEN pm1.sq1.param='d' THEN 3") //$NON-NLS-1$
- .append(" ELSE 9999") //$NON-NLS-1$
- .append(" END").toString(); //$NON-NLS-1$
-
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + sql + "; SELECT caseValue; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1('d')"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(3) }),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandInsertIntoTempTableWithDifferentDatatypeFromSource() throws Exception {
- //Tests dynamic query with insert into a temp table using data returned from a physical table.
- //See defect 23394
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm5.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1,e2 from pm5.g3' as e1 string, e2 integer INTO #temp; select * from #temp; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1 ); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm5.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
-
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDynamicCommandWithVariableOnly() throws Exception {
- //Tests dynamic query with only a variable that represents thte entire dynamic query.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("param", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT, rs1); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("ret", 2, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm5.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "DECLARE string VARIABLES.CRIT = 'select e1, e2 from pm5.g3 where e2=using.id'; execute string VARIABLES.CRIT USING ID = pm5.sq1.param; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1 ); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm5.sq1(convert(5,short))"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] { Arrays.asList(new Object[] { "First", new Short((short)5)})}; //$NON-NLS-1$
-
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureWithCreate() throws Exception{
- String userUpdateStr = "EXEC pm1.vsp60()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureWithCreateAndDrop() throws Exception{
- String userUpdateStr = "EXEC pm1.vsp61()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testVirtualProcedureWithCreateAndSelectInto() throws Exception{
- String userUpdateStr = "EXEC pm1.vsp62()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDifferentlyScopedTempTables() throws Exception {
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
- procedure.append("if (e2_total = 0)"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("select e1 into #temp from pm1.g1;\n"); //$NON-NLS-1$
- procedure.append("VARIABLES.e2_total=select count(*) from #temp;\n"); //$NON-NLS-1$
- procedure.append("END\n"); //$NON-NLS-1$
- procedure.append("if (e2_total = 3)"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("select e1 into #temp from pm1.g1;\n"); //$NON-NLS-1$
- procedure.append("VARIABLES.e2_total=select count(*) from #temp;\n"); //$NON-NLS-1$
- procedure.append("END\n"); //$NON-NLS-1$
- procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- //Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(3)}),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testLoopsWithBreak() throws Exception {
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
- procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("e2_total=e2_total+mycursor.x;\n"); //$NON-NLS-1$
- procedure.append("break;\n"); //$NON-NLS-1$
- procedure.append("END\n"); //$NON-NLS-1$
- procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("e2_total=e2_total+mycursor.x;"); //$NON-NLS-1$
- procedure.append("END\n"); //$NON-NLS-1$
- procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- //Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(76)}),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testCreateWithoutDrop() throws Exception {
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
- procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
- procedure.append("SELECT e1 from t1;\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists.", metadata); //$NON-NLS-1$
- }
-
- /**
- * We allow drops to silently fail
- */
- @Test public void testDoubleDrop() throws Exception {
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("create local temporary table t1 (e1 string);\n"); //$NON-NLS-1$
- procedure.append("select e1 into t1 from pm1.g1;\n"); //$NON-NLS-1$
- procedure.append("drop table t1;\n"); //$NON-NLS-1$
- procedure.append("drop table t1;\n"); //$NON-NLS-1$
- procedure.append("SELECT 1;\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr, metadata);
- }
-
- /**
- * defect 23975
- */
- @Test public void testFunctionInput() throws Exception {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
-
- FakeMetadataObject p1 = FakeMetadataFactory.createParameter("v1.vp1.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.rs1", v1, new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
-
- QueryNode n1 = new QueryNode("v1.vp1", "CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x = '1'; exec v1.vp2(concat(x, v1.vp1.in)); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.vp1", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p1 }), n1); //$NON-NLS-1$
-
- FakeMetadataObject p2 = FakeMetadataFactory.createParameter("v1.vp2.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode n2 = new QueryNode("v1.vp2", "CREATE VIRTUAL PROCEDURE BEGIN select v1.vp2.in; end"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt2 = FakeMetadataFactory.createVirtualProcedure("v1.vp2", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p2 }), n2); //$NON-NLS-1$
-
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(v1);
- store.addObject(rs1);
- store.addObject(vt1);
- store.addObject(vt2);
- store.addObject(vt2);
-
- String sql = "exec v1.vp1('1')"; //$NON-NLS-1$
-
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "11" }), //$NON-NLS-1$
- };
-
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
-
- // Construct data manager with data
- // Plan query
- ProcessorPlan plan = getProcedurePlan(sql, metadata);
- // Run query
- helpTestProcess(plan, expected, new FakeDataManager(), metadata);
- }
-
- /**
- * defect 23976
- * Also, even after the bug for passing procedure inputs to non-execs was fixed, the special case of
- * if (below) and while statements popped up.
- */
- @Test public void testIfEvaluation() throws Exception {
- String procedure1 = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure1 += "BEGIN\n"; //$NON-NLS-1$
- procedure1 += "DECLARE string var1 = INPUT.e1;\n"; //$NON-NLS-1$
- procedure1 += "ROWS_UPDATED = UPDATE vm1.g2 SET e1=var1;\n"; //$NON-NLS-1$
- procedure1 += "END"; //$NON-NLS-1$
-
- String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure2 += "BEGIN\n"; //$NON-NLS-1$
- procedure2 += "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure2 += "IF (INPUT.e1 = 1)\n"; //$NON-NLS-1$
- procedure2 += "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
- procedure2 += "ELSE\n"; //$NON-NLS-1$
- procedure2 += "ROWS_UPDATED = 4;\n"; //$NON-NLS-1$
- procedure2 += "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 4, new FakeDataManager(), metadata);
- }
-
- /**
- * This is a slight variation of TestProcessor.testVariableInExecParam, where the proc wrapper can be
- * removed after rewrite
- */
- @Test public void testReferenceForwarding() throws Exception {
- // Create query
- String sql = "EXEC pm1.vsp49()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataStore store = metadata.getStore();
-
- FakeMetadataObject pm1 = store.findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN if (1 = 2) begin declare integer x = 1; end SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- store.addObject(sq2);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "b", new Integer(2) }), //$NON-NLS-1$
- };
-
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- TestProcessor.sampleData1(dataManager);
-
- // Plan query
- ProcessorPlan plan = getProcedurePlan(sql, metadata);
-
- // Run query
- helpTestProcess(plan, expected, dataManager, metadata);
- }
-
- @Test public void testInsertAfterCreate() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
- .append("BEGIN\n") //$NON-NLS-1$
- .append("\n create local temporary table #temp (e1 string, e2 string);") //$NON-NLS-1$
- .append("\n insert into #temp (e1) values ('a');") //$NON-NLS-1$
- .append("\n insert into #temp (e2) values ('b');") //$NON-NLS-1$
- .append("SELECT e2 as e1 from #temp;\n") //$NON-NLS-1$
- .append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {null}),
- Arrays.asList(new Object[] {"b"})}, dataMgr, metadata); //$NON-NLS-1$
-
- }
-
- /**
- * the update will not be executed, but the assignment value should still be 0
- */
- @Test public void testUpdateAssignmentNotExecuted() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1 = UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e2;"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = var1 + 1;\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 1, dataMgr, metadata);
-
- assertTrue(plan.requiresTransaction(false));
- }
-
- @Test public void testUpdateAssignmentNotExecutedVirtual() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1 = UPDATE vm1.g2 SET e1 = INPUT.e2;"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = var1 + 1;\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure2 += "BEGIN\n"; //$NON-NLS-1$
- procedure2 += "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure2 += "IF (INPUT.e1 = 1)\n"; //$NON-NLS-1$
- procedure2 += "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
- procedure2 += "ELSE\n"; //$NON-NLS-1$
- procedure2 += "ROWS_UPDATED = 4;\n"; //$NON-NLS-1$
- procedure2 += "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure, procedure2);
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, 1, dataMgr, metadata);
- }
-
- @Test public void testEvaluatableSelectWithOrderBy() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
- .append("BEGIN\n") //$NON-NLS-1$
- .append("SELECT param from pm1.g1 order by param limit 1;\n") //$NON-NLS-1$
- .append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {"1"})}, dataMgr, metadata); //$NON-NLS-1$
-
- }
-
- @Test public void testEvaluatableSelectWithOrderBy1() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
- .append("BEGIN\n") //$NON-NLS-1$
- .append("SELECT param from pm1.g1 union select e1 from pm1.g1 order by param limit 2;\n") //$NON-NLS-1$
- .append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {"1"}), //$NON-NLS-1$
- Arrays.asList(new Object[] {"First"}), //$NON-NLS-1$
- }, dataMgr, metadata);
-
- }
-
- /**
- * Tests non-deterministic evaluation of the rand function. There are two important things happening
- * 1. is that the evaluation of the rand function is delayed until processing time (which actually has predictable
- * values since the test initializes the command context with the same seed)
- * 2. The values are different, meaning that we got individual evaluations
- *
- * If this function were deterministic, it would be evaluated during rewrite to a single value.
- */
- @Test public void testNonDeterministicEvaluation() throws Exception {
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
- .append("BEGIN\n") //$NON-NLS-1$
- .append("DECLARE integer x = 0;\n") //$NON-NLS-1$
- .append("CREATE LOCAL TEMPORARY TABLE #TEMP (e1 integer);\n") //$NON-NLS-1$
- .append("while (x < 2)\n") //$NON-NLS-1$
- .append("BEGIN\n") //$NON-NLS-1$
- .append("insert into #temp (e1) values (convert(rand() * 1000, integer));\n") //$NON-NLS-1$
- .append("x = x + 1;\n") //$NON-NLS-1$
- .append("END\n") //$NON-NLS-1$
- .append("SELECT * FROM #TEMP;\n") //$NON-NLS-1$
- .append("END"); //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(procedure.toString());
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
-
- helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {new Integer(240)}),
- Arrays.asList(new Object[] {new Integer(637)})}, dataMgr, metadata);
- }
-
- private FakeMetadataFacade createProcedureMetadata(String procedure) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
-
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1}), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
- return metadata;
- }
-
- @Test public void testTempTableTypeConversion() throws Exception {
-
- String procedure = "CREATE VIRTUAL PROCEDURE\n"; //$NON-NLS-1$
- procedure += "BEGIN\n"; //$NON-NLS-1$
- procedure += "CREATE local temporary table temp (x string, y integer);\n"; //$NON-NLS-1$
- procedure += "Select pm1.g1.e2 as e1, pm1.g1.e2 into temp from pm1.g1 order by pm1.g1.e2 limit 1;\n"; //$NON-NLS-1$
- procedure += "Select x from temp;\n"; //$NON-NLS-1$
- procedure += "END\n"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(procedure);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {"5"}), //$NON-NLS-1$
- }, dataMgr, metadata);
- }
-
- /**
- * wraps {@link TestXMLPlanningEnhancements.testNested2WithContextCriteria5d1} in a procedure
- */
- @Test public void testXMLWithExternalCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
- FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
- String expectedDoc = TestXMLProcessor.readFile(resultFile);
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("xqttest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare integer VARIABLES.x = xqttest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { expectedDoc }),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testXMLWithExternalCriteria_InXMLVar() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
- FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
- String expectedDoc = TestXMLProcessor.readFile(resultFile);
- expectedDoc = expectedDoc.replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("xqttest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare integer VARIABLES.x = xqttest.proc.input; declare xml y = SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; select convert(y, string); END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { expectedDoc }),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- /**
- * wraps {@link TestXMLProcessor.testNested2WithCriteria2} in a procedure
- *
- * This one will successfully auto-stage
- */
- @Test public void testXMLWithExternalCriteria1() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
- FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- String expectedDoc =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
- "<Catalogs>\n" + //$NON-NLS-1$
- " <Catalog>\n" + //$NON-NLS-1$
- " <Items>\n" + //$NON-NLS-1$
- " <Item ItemID=\"001\">\n" + //$NON-NLS-1$
- " <Name>Lamp</Name>\n" + //$NON-NLS-1$
- " <Quantity>5</Quantity>\n" + //$NON-NLS-1$
- " <Suppliers>\n" + //$NON-NLS-1$
- " <Supplier SupplierID=\"52\">\n" + //$NON-NLS-1$
- " <Name>Biff's Stuff</Name>\n" + //$NON-NLS-1$
- " <Zip>22222</Zip>\n" + //$NON-NLS-1$
- " <Orders>\n" + //$NON-NLS-1$
- " <Order OrderID=\"2\">\n" + //$NON-NLS-1$
- " <OrderDate>12/31/01</OrderDate>\n" + //$NON-NLS-1$
- " <OrderQuantity>87</OrderQuantity>\n" + //$NON-NLS-1$
- " <OrderStatus>complete</OrderStatus>\n" + //$NON-NLS-1$
- " </Order>\n" + //$NON-NLS-1$
- " </Orders>\n" + //$NON-NLS-1$
- " </Supplier>\n" + //$NON-NLS-1$
- " </Suppliers>\n" + //$NON-NLS-1$
- " </Item>\n" + //$NON-NLS-1$
- " <Item ItemID=\"002\">\n" + //$NON-NLS-1$
- " <Name>Screwdriver</Name>\n" + //$NON-NLS-1$
- " <Quantity>100</Quantity>\n" + //$NON-NLS-1$
- " <Suppliers/>\n" + //$NON-NLS-1$
- " </Item>\n" + //$NON-NLS-1$
- " <Item ItemID=\"003\">\n" + //$NON-NLS-1$
- " <Name>Goat</Name>\n" + //$NON-NLS-1$
- " <Quantity>4</Quantity>\n" + //$NON-NLS-1$
- " <Suppliers/>\n" + //$NON-NLS-1$
- " </Item>\n" + //$NON-NLS-1$
- " </Items>\n" + //$NON-NLS-1$
- " </Catalog>\n" + //$NON-NLS-1$
- "</Catalogs>"; //$NON-NLS-1$
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("xmltest",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("xmltest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare integer VARIABLES.x = xmltest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, SupplierID)=x; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xmltest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
- String userUpdateStr = "EXEC xmltest.proc(52)"; //$NON-NLS-1$
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { expectedDoc }),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testCase174806() throws Exception{
- String userUpdateStr = "EXEC pm1.vsp63()"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "c"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testJoinProcAndPhysicalModel() throws Exception {
- String userUpdateStr = "select a.e1 from (EXEC pm1.vsp46()) as a, pm1.g1 where a.e1=pm1.g1.e1"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- // Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- /**
- * Test the procedure <code>DECLARE</code> statement using a query as the assignment value
- *
- * <p>The use of a query as the assignment value to a <code>DECLARE</code>
- * statement should execute without error as long as the query
- * is valid and fully resolvable.</p>
- *
- * <p>This test is related to JBEDSP-818 in which the query in the
- * <code>LOOP</code> statement would fail due to a query being used as the
- * assigned value in the <code>DECLARE</code> statement.</p>
- * @throws Exception
- */
- @Test public void testDeclareWithQueryAssignment() throws Exception {
- // procedure comes from test case IT236455 / JBEDSP-818
- String procedure = "CREATE VIRTUAL PROCEDURE \n"; //$NON-NLS-1$
- procedure += "BEGIN\n"; //$NON-NLS-1$
- procedure += " DECLARE integer VARIABLES.var1 = 0;\n"; //$NON-NLS-1$
- procedure += " /* the following DECLARE with ASSIGNMENT to a query should work "; //$NON-NLS-1$
- procedure += " but in IT236455 it results in the assignment inside the LOOP "; //$NON-NLS-1$
- procedure += " to fail */ "; //$NON-NLS-1$
- procedure += " DECLARE integer VARIABLES.NLEVELS = SELECT COUNT(*) FROM (\n"; //$NON-NLS-1$
- procedure += " SELECT 'Col1' AS ACol1, 'Col2' AS ACol2, convert(3, integer) AS ACol3\n"; //$NON-NLS-1$
- procedure += " ) AS Src;\n"; //$NON-NLS-1$
- procedure += " LOOP ON (\n"; //$NON-NLS-1$
- procedure += " SELECT StaticTable.BCol1, StaticTable.BCol2, StaticTable.BCol3 FROM (\n"; //$NON-NLS-1$
- procedure += " SELECT 'Col 1' AS BCol1, 'Col 2' AS BCol2, convert(3, integer) AS BCol3\n"; //$NON-NLS-1$
- procedure += " ) AS StaticTable\n"; //$NON-NLS-1$
- procedure += " ) AS L1\n"; //$NON-NLS-1$
- procedure += " BEGIN\n"; //$NON-NLS-1$
- procedure += " /* In IT236455 the following would fail as the results from "; //$NON-NLS-1$
- procedure += " the LOOP (L1) are not in scope when the assignment is being "; //$NON-NLS-1$
- procedure += " performed due to the query earlier being part of a DECLARE "; //$NON-NLS-1$
- procedure += " statement. */ "; //$NON-NLS-1$
- procedure += " VARIABLES.var1 = L1.BCol3;\n"; //$NON-NLS-1$
- procedure += " END\n"; //$NON-NLS-1$
- procedure += " SELECT VARIABLES.Var1 AS e1;\n"; //$NON-NLS-1$
- procedure += "END\n"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(procedure);
- String userQuery = "SELECT e1 FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
- FakeDataManager dataMgr = exampleDataManager(metadata);
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
-
- List[] expected = new List[] {Arrays.asList(new Object[] {new Integer(3)})};
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testDefect8693() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2 = 5;\n"; //$NON-NLS-1$
- procedure = procedure + "if (5 in (select 5 from pm1.g1))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
- FakeDataManager dataMgr = exampleDataManager(metadata);
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr, metadata);
- }
-
- @Test public void testWhileWithSubquery() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1 = 2;\n"; //$NON-NLS-1$
- procedure = procedure + "WHILE (5 in (select var1 from pm1.g1))\n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
- FakeDataManager dataMgr = exampleDataManager(metadata);
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 0, dataMgr, metadata);
- }
-
- @Test public void testDefect18404() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1 = 5 + (select count(e2) from pm1.g1);\n"; //$NON-NLS-1$
- procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
- procedure = procedure + "END"; //$NON-NLS-1$
-
- String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
- FakeDataManager dataMgr = exampleDataManager(metadata);
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 8, dataMgr, metadata);
- }
-
- /**
- * Test the use of a procedure variable in the criteria of a LEFT OUTER
- * JOIN which will be optimized out as non-JOIN criteria.
- * <p>
- * This test case verifies that the procedure variable will not be pushed
- * to the data manager when a federated source JOIN is performed.
- *
- * @throws Exception
- */
- @Test public void testRemovalOfNonJoinCritWithReference() throws Exception {
- String proc = ""; //$NON-NLS-1$
-
- String sql = ""; //$NON-NLS-1$
- sql += "SELECT " + //$NON-NLS-1$
- " pm1.g1.e1 AS pm1g1e1, " + //$NON-NLS-1$
- " pm2.g2.e1 AS pm2g2e1, " + //$NON-NLS-1$
- " pm1.g1.e2 AS pm1g1e2, " + //$NON-NLS-1$
- " pm2.g2.e2 AS pm2g2e2 " + //$NON-NLS-1$
- "FROM " + //$NON-NLS-1$
- " pm1.g1 " + //$NON-NLS-1$
- "LEFT OUTER JOIN pm2.g2 " + //$NON-NLS-1$
- " ON pm1.g1.e1 = pm2.g2.e1 " + //$NON-NLS-1$
- " AND pm2.g2.e2 = VARIABLES.myVar "; //$NON-NLS-1$
-
- proc += "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
- "BEGIN " + //$NON-NLS-1$
- " declare integer myVar = 5;" + //$NON-NLS-1$
- " " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
- "END"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
- String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
- FakeDataManager dataMgr = exampleDataManager2(metadata);
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
-
- List[] expected = new List[] {
- Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
-
- assertTrue(!plan.requiresTransaction(false));
- }
-
- /**
- * Test the use of a procedure variable in the criteria of a LEFT OUTER
- * JOIN which will be optimized out as non-JOIN criteria.
- * <p>
- * This test case verifies that the procedure variable will not be pushed
- * to the data manager when a federated source JOIN is performed and the
- * physical source supports all capabilities.
- *
- * @throws Exception
- */
- @Test public void testRemovalOfNonJoinCritWithReference2() throws Exception {
- String proc = ""; //$NON-NLS-1$
-
- String sql = ""; //$NON-NLS-1$
- sql += "SELECT " + //$NON-NLS-1$
- " pm1.g1.e1 AS pm1g1e1, " + //$NON-NLS-1$
- " pm2.g2.e1 AS pm2g2e1, " + //$NON-NLS-1$
- " pm1.g1.e2 AS pm1g1e2, " + //$NON-NLS-1$
- " pm2.g2.e2 AS pm2g2e2 " + //$NON-NLS-1$
- "FROM " + //$NON-NLS-1$
- " pm1.g1 " + //$NON-NLS-1$
- "LEFT OUTER JOIN pm2.g2 " + //$NON-NLS-1$
- " ON pm1.g1.e1 = pm2.g2.e1 " + //$NON-NLS-1$
- " AND pm2.g2.e2 = VARIABLES.myVar "; //$NON-NLS-1$
-
- proc += "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
- "BEGIN " + //$NON-NLS-1$
- " declare integer myVar = 5;" + //$NON-NLS-1$
- " " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
- "END"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
- String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
- FakeDataManager dataMgr = exampleDataManager2(metadata);
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
-
- List[] expected = new List[] {
- Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testUpdateDeleteTemp() throws Exception {
- String proc = "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
- "BEGIN " + //$NON-NLS-1$
- " select e1, e2, e3, e4 into #t1 from pm1.g1;\n" + //$NON-NLS-1$
- " update #t1 set e1 = 1 where e4 < 2;\n" + //$NON-NLS-1$
- " delete from #t1 where e4 > 2;\n" + //$NON-NLS-1$
- " select e1 from #t1;\n" + //$NON-NLS-1$
- "END"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
- String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
- FakeDataManager dataMgr = exampleDataManager2(metadata);
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
-
- List[] expected = new List[] {
- Arrays.asList( new Object[] { String.valueOf(1) } ),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testTempSubqueryInput() throws Exception {
- String proc = "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
- "BEGIN " + //$NON-NLS-1$
- " create local temporary table t1 (e1 string);\n" + //$NON-NLS-1$
- " select e1 into t1 from pm1.g1;\n" + //$NON-NLS-1$
- " select e2 from (exec pm1.sq2((select max(e1) from t1))) x;\n" + //$NON-NLS-1$
- "END"; //$NON-NLS-1$
-
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
- String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
- FakeDataManager dataMgr = exampleDataManager2(metadata);
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
-
- List[] expected = new List[] {
- Arrays.asList( 51 ),
- };
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testUnambiguousVirtualProc() throws Exception {
- String userQuery = "EXEC MMSP6('1')"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
-
- List[] expected = new List[] {
- Arrays.asList( "1" ),
- };
- helpTestProcess(plan, expected, new HardcodedDataManager(), metadata);
- }
-
- @Test public void testParameterAssignments() throws Exception {
- TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
- String userQuery = "EXEC TEIIDSP7(1)"; //$NON-NLS-1$
- HardcodedDataManager dataMgr = new HardcodedDataManager();
- ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
- dataMgr.addData("x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
- dataMgr.addData("EXEC spTest11(3, null)", new List[] {Arrays.asList("1", 1, null), Arrays.asList(null, null, 4)});
- List[] expected = new List[] {Arrays.asList("34")};
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- @Test public void testNonQueryPushdownValidation() throws Exception {
-
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject in = FakeMetadataFactory.createParameter("pm1.sq1.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
-
- StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
- procedure.append("BEGIN\n"); //$NON-NLS-1$
- procedure.append("create local temporary table x (y string);\n"); //$NON-NLS-1$
- procedure.append("update x set y = in1 || 'foo';\n"); //$NON-NLS-1$
- procedure.append("update pm1.g1 set e1 = lookup('pm1.g1', 'e1', 'e2', in1);\n"); //$NON-NLS-1$
- procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
- procedure.append("END"); //$NON-NLS-1$
-
- QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { in, rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
-
- FakeDataManager dataMgr = exampleDataManager(metadata);
-
- ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- //Create expected results
- List[] expected = new List[0];
- helpTestProcess(plan, expected, dataMgr, metadata);
- }
-
- private static final boolean DEBUG = false;
-}
Copied: tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java (from rev 2886, branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,2702 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.processor.proc;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.api.exception.query.QueryProcessingException;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.optimizer.QueryOptimizer;
+import org.teiid.query.optimizer.TestOptimizer;
+import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
+import org.teiid.query.parser.QueryParser;
+import org.teiid.query.processor.FakeDataManager;
+import org.teiid.query.processor.FakeDataStore;
+import org.teiid.query.processor.HardcodedDataManager;
+import org.teiid.query.processor.ProcessorDataManager;
+import org.teiid.query.processor.ProcessorPlan;
+import org.teiid.query.processor.TestProcessor;
+import org.teiid.query.processor.xml.TestXMLPlanningEnhancements;
+import org.teiid.query.processor.xml.TestXMLProcessor;
+import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.rewriter.QueryRewriter;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.SPParameter;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.unittest.FakeMetadataFacade;
+import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.query.util.CommandContext;
+import org.teiid.query.validator.Validator;
+import org.teiid.query.validator.ValidatorFailure;
+import org.teiid.query.validator.ValidatorReport;
+
+@SuppressWarnings({"unchecked", "nls"})
+public class TestProcedureProcessor {
+
+ public static ProcessorPlan getProcedurePlan(String userQuery, QueryMetadataInterface metadata) throws Exception {
+ return getProcedurePlan(userQuery, metadata, /*capabilitiesFinder*/null);
+ }
+
+ public static ProcessorPlan getProcedurePlan(String userQuery, QueryMetadataInterface metadata, CapabilitiesFinder capabilitiesFinder) throws Exception {
+ Command userCommand = QueryParser.getQueryParser().parseCommand(userQuery);
+ QueryResolver.resolveCommand(userCommand, metadata);
+ ValidatorReport report = Validator.validate(userCommand, metadata);
+
+ if (report.hasItems()) {
+ ValidatorFailure firstFailure = report.getItems().iterator().next();
+ throw new QueryValidatorException(firstFailure.getMessage());
+ }
+ QueryRewriter.rewrite(userCommand, metadata, new CommandContext());
+
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
+ try {
+ if ( capabilitiesFinder == null ) capabilitiesFinder = new DefaultCapabilitiesFinder();
+ ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null);
+
+ return plan;
+ } finally {
+ if(DEBUG) {
+ System.out.println(analysisRecord.getDebugLog());
+ }
+ }
+ }
+
+ public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+ CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
+ if (!(metadata instanceof TempMetadataAdapter)) {
+ metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+ }
+ context.setMetadata(metadata);
+
+ TestProcessor.helpProcess(procPlan, context, dataMgr, expectedResults);
+ assertNotNull("Expected processing to fail", expectedResults);
+ }
+
+ private void helpTestProcessFailure(ProcessorPlan procPlan, FakeDataManager dataMgr,
+ String failMessage, QueryMetadataInterface metadata) throws Exception {
+ try {
+ helpTestProcess(procPlan, null, dataMgr, metadata);
+ } catch(TeiidException ex) {
+ assertEquals(failMessage, ex.getMessage());
+ }
+ }
+
+ private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+ helpTestProcess(procPlan, new List[] {Arrays.asList(expectedRows)}, dataMgr, metadata);
+ }
+
+ // Helper to create a list of elements - used in creating sample data
+ private static List createElements(List elementIDs) {
+ List elements = new ArrayList();
+ for(int i=0; i<elementIDs.size(); i++) {
+ FakeMetadataObject elementID = (FakeMetadataObject) elementIDs.get(i);
+ ElementSymbol element = new ElementSymbol(elementID.getName());
+ elements.add(element);
+ }
+
+ return elements;
+ }
+
+ private FakeDataManager exampleDataManager(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ FakeDataManager dataMgr = new FakeDataManager();
+
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
+ elementIDs = metadata.getElementIDsInGroupID(groupID);
+ elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ return dataMgr;
+ }
+
+ private FakeDataManager exampleDataManager2(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ FakeDataManager dataMgr = new FakeDataManager();
+
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
+ elementIDs = metadata.getElementIDsInGroupID(groupID);
+ elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
+ elementIDs = metadata.getElementIDsInGroupID(groupID);
+ elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g2"); //$NON-NLS-1$
+ elementIDs = metadata.getElementIDsInGroupID(groupID);
+ elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ return dataMgr;
+ }
+
+ private FakeDataManager exampleDataManagerPm5(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ FakeDataManager dataMgr = new FakeDataManager();
+
+ // Group stock.items
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm5.g3"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Short((short)5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Short((short)15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Short((short)51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ return dataMgr;
+ }
+
+ // procedure does nothing returns zero update count
+ @Test public void testProcedureProcessor1() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1 = 0;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 0, dataMgr, metadata);
+ }
+
+ // testing if statement
+ @Test public void testProcedureProcessor2() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ // testing if statement
+ @Test public void testProcedureProcessor2WithBlockedException() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ dataMgr.setBlockOnce();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ // testing rows updated incremented, Input and assignment statements
+ @Test public void testProcedureProcessor3() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=40"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 45, dataMgr, metadata);
+ }
+
+ // if/else test
+ @Test public void testProcedureProcessor4() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "ELSE\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ @Test public void testProcedureProcessor4WithBlockedException() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "ELSE\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ dataMgr.setBlockOnce();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ // if/else test
+ @Test public void testProcedureProcessor5() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2=15;\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "ELSE\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where e2=5;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 50, dataMgr, metadata);
+ }
+
+ // more rows than expected
+ @Test public void testProcedureProcessor6() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1", metadata); //$NON-NLS-1$
+ }
+
+ // error statement
+ @Test public void testProcedureProcessor7() throws Exception {
+ String errorValue = "'MY ERROR'"; //$NON-NLS-1$
+ helpTestErrorStatment(errorValue, "MY ERROR"); //$NON-NLS-1$
+ }
+
+ @Test public void testProcedureProcessor8() throws Exception {
+ String errorValue = "var1"; //$NON-NLS-1$
+ helpTestErrorStatment(errorValue, "5"); //$NON-NLS-1$
+ }
+
+ @Test public void testProcedureProcessor9() throws Exception {
+ String errorValue = "var1||'MY ERROR'"; //$NON-NLS-1$
+ helpTestErrorStatment(errorValue, "5MY ERROR"); //$NON-NLS-1$
+ }
+
+ @Test public void testProcedureProcessor10() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "loop on (Select pm1.g1.e2 from pm1.g1 where e2 = 5) as mycursor\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ERROR (mycursor.e2||'MY ERROR');\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR", metadata); //$NON-NLS-1$
+ }
+
+ private void helpTestErrorStatment(String errorValue, String expected) throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = 5;\n"; //$NON-NLS-1$
+ procedure = procedure + "ERROR "+errorValue+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ procedure = procedure + "ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected, metadata);
+ }
+
+ /** test if statement's if block with lookup in if condition */
+ @Test public void testLookupFunction1() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
+ procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 0))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "ELSE\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "var2 = 100;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +13;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ FakeDataManager dataMgr = new FakeDataManager();
+ FakeDataStore.sampleData2(dataMgr);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ helpTestProcess(plan, 1, dataMgr, metadata);
+
+ }
+
+ /** test if statement's else block with lookup in if condition */
+ @Test public void testLookupFunction2() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
+ procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "ELSE\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "var2 = 100;\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +12;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ FakeDataManager dataMgr = new FakeDataManager();
+ FakeDataStore.sampleData2(dataMgr);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ helpTestProcess(plan, 12, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureWithBlockedException() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ dataMgr.setBlockOnce();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure2() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp3()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure3() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp4()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure4() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp5()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure5() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp6()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure6() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp7(5)"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure7() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp8(51)"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure8() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp9(51)"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure9() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp10(51)"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {};
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+
+ @Test public void testVirtualProcedure10() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp13()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure11() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp14()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure12() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp15()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ //Defect17447_testVirtualProcedure13
+ @Test public void testVirtualProcedure13() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp16()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure14() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp17()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure15() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp19()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure16() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp20()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Fourth"})}; //$NON-NLS-1$
+ CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
+ context.setMetadata(metadata);
+ context.setProcessorBatchSize(1); //ensure that the final temp result set will not be deleted prematurely
+
+ TestProcessor.helpProcess(plan, context, dataMgr, expected);
+ }
+
+ @Test public void testVirtualProcedure17() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp21(7)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", new Integer(51)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Fourth", new Integer(7)})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure18() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp22(7)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", new Integer(51)}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure19() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure19WithBlockedException() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureNoDataInTempTable() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp25()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {};
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ //procedure with Has Criteria and Translate Criteria
+ @Test public void testDefect13625() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "IF(HAS CRITERIA ON (vm1.g4.e2))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where TRANSLATE = CRITERIA ON (vm1.g4.e2);\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure30() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp30()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure31() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp31(51)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureDefect14282() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp24()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16193() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp35(51)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedure16602() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp37()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
+ List elementSymbols = new ArrayList();
+ ElementSymbol element = new ElementSymbol("Count"); //$NON-NLS-1$
+ elementSymbols.add(element);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+ new List[] {
+ Arrays.asList( new Object[] { new Integer(1) } )
+ } );
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { new Integer(1)})};
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16649_1() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp38()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16649_2() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp39()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16694() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp40()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16707() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp44(2)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect16707_1() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp43(2)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect17451() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp45()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ //Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
+ List elementIDs = metadata.getElementIDsInGroupID(groupID);
+ List elementSymbols = createElements(elementIDs);
+
+ dataMgr.registerTuples(
+ groupID,
+ elementSymbols,
+
+ new List[] {
+ Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ //Defect 17447
+ @Test public void testVirtualProcedure46() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp46()"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect17650() throws Exception {
+ String procedure1 = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure1 = procedure1 + "BEGIN\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "IF(HAS CRITERIA ON (vm1.g1.e2))\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "BEGIN\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "ROWS_UPDATED = UPDATE vm1.g2 SET e1='x' where TRANSLATE = CRITERIA ON (vm1.g1.e2);\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "END\n"; //$NON-NLS-1$
+ procedure1 = procedure1 + "END"; //$NON-NLS-1$
+
+ String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure2 = procedure2 + "BEGIN\n"; //$NON-NLS-1$
+ procedure2 = procedure2 + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure2 = procedure2 + "Select pm1.g2.e2 from pm1.g2 where TRANSLATE CRITERIA;\n";//$NON-NLS-1$
+ procedure2 = procedure2 + "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
+ procedure2 = procedure2 + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ @Test public void testDefect19982() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp55(5)"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", new Integer(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testCase3521() throws Exception {
+ String userUpdateStr = "EXEC pm1.vsp1()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+// Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+// Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ //procedure with Has Criteria and Translate Criteria and changing
+ @Test public void testDynamicCommandWithTranslate() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "IF(HAS CRITERIA ON (vm1.g4.e2))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "execute string 'Select pm1.g1.e2 x, changing.e1 y from pm1.g1 where TRANSLATE = CRITERIA ON (vm1.g4.e2)' as x integer, y boolean into #temp;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = select x from #temp;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "if(var1 = 5)\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithIntoExpression() throws Exception {
+
+ //Test INTO clause with expression
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1 FROM pm1.g1 WHERE e1 = ''First''' as x string into #temp; declare string VARIABLES.RESULT = select x from #temp;select VARIABLES.RESULT; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithIntoAndLoop() throws Exception {
+
+ //Test INTO clause with loop
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
+ procedure.append("execute string 'SELECT e1, e2 FROM pm1.g1' as e1 string, e2 integer into #temp;\n"); //$NON-NLS-1$
+ procedure.append("loop on (Select e2 from #temp where e2 > 2) as mycursor\n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("IF (mycursor.e2>5) \n"); //$NON-NLS-1$
+ procedure.append("VARIABLES.e2_total=VARIABLES.e2_total+mycursor.e2;\n"); //$NON-NLS-1$
+ procedure.append("END\n"); //$NON-NLS-1$
+ procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { new Integer(66)}),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithParameter() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithUsing() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=using.id' using id=pm1.sq2.in; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithVariable() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare string VARIABLES.x; VARIABLES.x = pm1.sq2.in; execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=VARIABLES.x'; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandValidationFails() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare object VARIABLES.x; execute string 'SELECT xmlelement(name elem, x)'; select 1; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ try {
+ helpTestProcess(plan, null, dataMgr, metadata);
+ fail("exception expected");
+ } catch (QueryProcessingException e) {
+ assertTrue(e.getCause() instanceof QueryValidatorException);
+ }
+ }
+
+ @Test public void testDynamicCommandWithSingleSelect() throws Exception {
+ //Test select of a single value in a DynamicCommand
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT 26'; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs1);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "26" }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+
+ //converts e1 from integer to string, with a different name
+ @Test public void testDynamicCommandTypeConversion() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare string VARIABLES.x; VARIABLES.x = 'a'; execute string 'SELECT e2 ' || ' FROM pm1.g1 ' || ' where e1=pm1.sq2.in'; END"); //$NON-NLS-1$ //
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "5" }), //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandRecursion() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory
+ .createResultSet("pm1.rs2", pm1, new String[] {"e1", "e2"}, new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory
+ .createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory
+ .createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'EXEC pm1.sq2(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
+ FakeMetadataObject sq2 = FakeMetadataFactory
+ .createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] {rs2p1, rs2p2}), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan,
+ dataMgr,
+ "Couldn't execute the dynamic SQL command \"EXECUTE 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL.", metadata); //$NON-NLS-1$
+ }
+
+ @Test public void testDynamicCommandIncorrectProjectSymbolCount() throws Exception {
+ //Tests dynamic query with incorrect number of elements
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "SELECT pm1.g1.e1 FROM pm1.g1; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ QueryNode sq2n2 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'EXEC pm1.sq1(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n2); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC pm1.sq2('test')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements.", metadata); //$NON-NLS-1$
+ }
+
+ @Test public void testDynamicCommandPositional() throws Exception {
+ //Tests dynamic query with incorrect number of elements
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 as x, e2 from pm1.g1'; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1('test')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {Arrays.asList("First", "5"), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList("Second", "15"), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList("Third", "51")}, dataMgr, metadata); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
+ //Tests dynamic query with a different datatype definition for an element in the AS clause that
+ //has no implicit conversion.
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 from pm1.g1'; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'.", metadata); //$NON-NLS-1$
+ }
+
+ @Test public void testDynamicCommandWithTwoDynamicStatements() throws Exception {
+ //Tests dynamic query with two consecutive DynamicCommands. The first without an AS clause and returning different results.
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 from pm1.g1'; execute string 'select e1, e2 from pm1.g1' as e1 string, e2 integer; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
+
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testAssignmentWithCase() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ String sql = new StringBuffer("declare integer caseValue = ") //$NON-NLS-1$
+ .append("CASE") //$NON-NLS-1$
+ .append(" WHEN pm1.sq1.param='a' THEN 0") //$NON-NLS-1$
+ .append(" WHEN pm1.sq1.param='b' THEN 1") //$NON-NLS-1$
+ .append(" WHEN pm1.sq1.param='c' THEN 2") //$NON-NLS-1$
+ .append(" WHEN pm1.sq1.param='d' THEN 3") //$NON-NLS-1$
+ .append(" ELSE 9999") //$NON-NLS-1$
+ .append(" END").toString(); //$NON-NLS-1$
+
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + sql + "; SELECT caseValue; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs1);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1('d')"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { new Integer(3) }),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandInsertIntoTempTableWithDifferentDatatypeFromSource() throws Exception {
+ //Tests dynamic query with insert into a temp table using data returned from a physical table.
+ //See defect 23394
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm5.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1,e2 from pm5.g3' as e1 string, e2 integer INTO #temp; select * from #temp; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1 ); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs1);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm5.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
+
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDynamicCommandWithVariableOnly() throws Exception {
+ //Tests dynamic query with only a variable that represents thte entire dynamic query.
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("param", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT, rs1); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("ret", 2, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm5.sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "DECLARE string VARIABLES.CRIT = 'select e1, e2 from pm5.g3 where e2=using.id'; execute string VARIABLES.CRIT USING ID = pm5.sq1.param; END"); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1 ); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs1);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm5.sq1(convert(5,short))"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] { Arrays.asList(new Object[] { "First", new Short((short)5)})}; //$NON-NLS-1$
+
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureWithCreate() throws Exception{
+ String userUpdateStr = "EXEC pm1.vsp60()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureWithCreateAndDrop() throws Exception{
+ String userUpdateStr = "EXEC pm1.vsp61()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testVirtualProcedureWithCreateAndSelectInto() throws Exception{
+ String userUpdateStr = "EXEC pm1.vsp62()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDifferentlyScopedTempTables() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
+ procedure.append("if (e2_total = 0)"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("select e1 into #temp from pm1.g1;\n"); //$NON-NLS-1$
+ procedure.append("VARIABLES.e2_total=select count(*) from #temp;\n"); //$NON-NLS-1$
+ procedure.append("END\n"); //$NON-NLS-1$
+ procedure.append("if (e2_total = 3)"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("select e1 into #temp from pm1.g1;\n"); //$NON-NLS-1$
+ procedure.append("VARIABLES.e2_total=select count(*) from #temp;\n"); //$NON-NLS-1$
+ procedure.append("END\n"); //$NON-NLS-1$
+ procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { new Integer(3)}),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testLoopsWithBreak() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
+ procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("e2_total=e2_total+mycursor.x;\n"); //$NON-NLS-1$
+ procedure.append("break;\n"); //$NON-NLS-1$
+ procedure.append("END\n"); //$NON-NLS-1$
+ procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("e2_total=e2_total+mycursor.x;"); //$NON-NLS-1$
+ procedure.append("END\n"); //$NON-NLS-1$
+ procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { new Integer(76)}),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testCreateWithoutDrop() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
+ procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
+ procedure.append("SELECT e1 from t1;\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists.", metadata); //$NON-NLS-1$
+ }
+
+ /**
+ * We allow drops to silently fail
+ */
+ @Test public void testDoubleDrop() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("create local temporary table t1 (e1 string);\n"); //$NON-NLS-1$
+ procedure.append("select e1 into t1 from pm1.g1;\n"); //$NON-NLS-1$
+ procedure.append("drop table t1;\n"); //$NON-NLS-1$
+ procedure.append("drop table t1;\n"); //$NON-NLS-1$
+ procedure.append("SELECT 1;\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr, metadata);
+ }
+
+ /**
+ * defect 23975
+ */
+ @Test public void testFunctionInput() throws Exception {
+ FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+
+ FakeMetadataObject p1 = FakeMetadataFactory.createParameter("v1.vp1.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.rs1", v1, new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+
+ QueryNode n1 = new QueryNode("v1.vp1", "CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x = '1'; exec v1.vp2(concat(x, v1.vp1.in)); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.vp1", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p1 }), n1); //$NON-NLS-1$
+
+ FakeMetadataObject p2 = FakeMetadataFactory.createParameter("v1.vp2.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode n2 = new QueryNode("v1.vp2", "CREATE VIRTUAL PROCEDURE BEGIN select v1.vp2.in; end"); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject vt2 = FakeMetadataFactory.createVirtualProcedure("v1.vp2", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p2 }), n2); //$NON-NLS-1$
+
+ FakeMetadataStore store = new FakeMetadataStore();
+ store.addObject(v1);
+ store.addObject(rs1);
+ store.addObject(vt1);
+ store.addObject(vt2);
+ store.addObject(vt2);
+
+ String sql = "exec v1.vp1('1')"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "11" }), //$NON-NLS-1$
+ };
+
+ FakeMetadataFacade metadata = new FakeMetadataFacade(store);
+
+ // Construct data manager with data
+ // Plan query
+ ProcessorPlan plan = getProcedurePlan(sql, metadata);
+ // Run query
+ helpTestProcess(plan, expected, new FakeDataManager(), metadata);
+ }
+
+ /**
+ * defect 23976
+ * Also, even after the bug for passing procedure inputs to non-execs was fixed, the special case of
+ * if (below) and while statements popped up.
+ */
+ @Test public void testIfEvaluation() throws Exception {
+ String procedure1 = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure1 += "BEGIN\n"; //$NON-NLS-1$
+ procedure1 += "DECLARE string var1 = INPUT.e1;\n"; //$NON-NLS-1$
+ procedure1 += "ROWS_UPDATED = UPDATE vm1.g2 SET e1=var1;\n"; //$NON-NLS-1$
+ procedure1 += "END"; //$NON-NLS-1$
+
+ String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure2 += "BEGIN\n"; //$NON-NLS-1$
+ procedure2 += "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure2 += "IF (INPUT.e1 = 1)\n"; //$NON-NLS-1$
+ procedure2 += "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
+ procedure2 += "ELSE\n"; //$NON-NLS-1$
+ procedure2 += "ROWS_UPDATED = 4;\n"; //$NON-NLS-1$
+ procedure2 += "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 4, new FakeDataManager(), metadata);
+ }
+
+ /**
+ * This is a slight variation of TestProcessor.testVariableInExecParam, where the proc wrapper can be
+ * removed after rewrite
+ */
+ @Test public void testReferenceForwarding() throws Exception {
+ // Create query
+ String sql = "EXEC pm1.vsp49()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataStore store = metadata.getStore();
+
+ FakeMetadataObject pm1 = store.findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("pm1.sq2", "CREATE VIRTUAL PROCEDURE BEGIN if (1 = 2) begin declare integer x = 1; end SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ store.addObject(sq2);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "b", new Integer(2) }), //$NON-NLS-1$
+ };
+
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ TestProcessor.sampleData1(dataManager);
+
+ // Plan query
+ ProcessorPlan plan = getProcedurePlan(sql, metadata);
+
+ // Run query
+ helpTestProcess(plan, expected, dataManager, metadata);
+ }
+
+ @Test public void testInsertAfterCreate() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("\n create local temporary table #temp (e1 string, e2 string);") //$NON-NLS-1$
+ .append("\n insert into #temp (e1) values ('a');") //$NON-NLS-1$
+ .append("\n insert into #temp (e2) values ('b');") //$NON-NLS-1$
+ .append("SELECT e2 as e1 from #temp;\n") //$NON-NLS-1$
+ .append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {
+ Arrays.asList(new Object[] {null}),
+ Arrays.asList(new Object[] {"b"})}, dataMgr, metadata); //$NON-NLS-1$
+
+ }
+
+ /**
+ * the update will not be executed, but the assignment value should still be 0
+ */
+ @Test public void testUpdateAssignmentNotExecuted() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1 = UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e2;"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = var1 + 1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 1, dataMgr, metadata);
+
+ assertTrue(plan.requiresTransaction(false));
+ }
+
+ @Test public void testUpdateAssignmentNotExecutedVirtual() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1 = UPDATE vm1.g2 SET e1 = INPUT.e2;"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = var1 + 1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String procedure2 = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure2 += "BEGIN\n"; //$NON-NLS-1$
+ procedure2 += "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure2 += "IF (INPUT.e1 = 1)\n"; //$NON-NLS-1$
+ procedure2 += "ROWS_UPDATED = 5;\n"; //$NON-NLS-1$
+ procedure2 += "ELSE\n"; //$NON-NLS-1$
+ procedure2 += "ROWS_UPDATED = 4;\n"; //$NON-NLS-1$
+ procedure2 += "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure, procedure2);
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, 1, dataMgr, metadata);
+ }
+
+ @Test public void testEvaluatableSelectWithOrderBy() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("SELECT param from pm1.g1 order by param limit 1;\n") //$NON-NLS-1$
+ .append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {
+ Arrays.asList(new Object[] {"1"})}, dataMgr, metadata); //$NON-NLS-1$
+
+ }
+
+ @Test public void testEvaluatableSelectWithOrderBy1() throws Exception {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("SELECT param from pm1.g1 union select e1 from pm1.g1 order by param limit 2;\n") //$NON-NLS-1$
+ .append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {
+ Arrays.asList(new Object[] {"1"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] {"First"}), //$NON-NLS-1$
+ }, dataMgr, metadata);
+
+ }
+
+ /**
+ * Tests non-deterministic evaluation of the rand function. There are two important things happening
+ * 1. is that the evaluation of the rand function is delayed until processing time (which actually has predictable
+ * values since the test initializes the command context with the same seed)
+ * 2. The values are different, meaning that we got individual evaluations
+ *
+ * If this function were deterministic, it would be evaluated during rewrite to a single value.
+ */
+ @Test public void testNonDeterministicEvaluation() throws Exception {
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("DECLARE integer x = 0;\n") //$NON-NLS-1$
+ .append("CREATE LOCAL TEMPORARY TABLE #TEMP (e1 integer);\n") //$NON-NLS-1$
+ .append("while (x < 2)\n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("insert into #temp (e1) values (convert(rand() * 1000, integer));\n") //$NON-NLS-1$
+ .append("x = x + 1;\n") //$NON-NLS-1$
+ .append("END\n") //$NON-NLS-1$
+ .append("SELECT * FROM #TEMP;\n") //$NON-NLS-1$
+ .append("END"); //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(procedure.toString());
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+
+ helpTestProcess(plan, new List[] {
+ Arrays.asList(new Object[] {new Integer(240)}),
+ Arrays.asList(new Object[] {new Integer(637)})}, dataMgr, metadata);
+ }
+
+ private FakeMetadataFacade createProcedureMetadata(String procedure) {
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1}), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+ return metadata;
+ }
+
+ @Test public void testTempTableTypeConversion() throws Exception {
+
+ String procedure = "CREATE VIRTUAL PROCEDURE\n"; //$NON-NLS-1$
+ procedure += "BEGIN\n"; //$NON-NLS-1$
+ procedure += "CREATE local temporary table temp (x string, y integer);\n"; //$NON-NLS-1$
+ procedure += "Select pm1.g1.e2 as e1, pm1.g1.e2 into temp from pm1.g1 order by pm1.g1.e2 limit 1;\n"; //$NON-NLS-1$
+ procedure += "Select x from temp;\n"; //$NON-NLS-1$
+ procedure += "END\n"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(procedure);
+
+ String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ helpTestProcess(plan, new List[] {
+ Arrays.asList(new Object[] {"5"}), //$NON-NLS-1$
+ }, dataMgr, metadata);
+ }
+
+ /**
+ * wraps {@link TestXMLPlanningEnhancements.testNested2WithContextCriteria5d1} in a procedure
+ */
+ @Test public void testXMLWithExternalCriteria() throws Exception {
+ FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
+ String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
+ String expectedDoc = TestXMLProcessor.readFile(resultFile);
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("xqttest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare integer VARIABLES.x = xqttest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { expectedDoc }),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testXMLWithExternalCriteria_InXMLVar() throws Exception {
+ FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
+ String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
+ String expectedDoc = TestXMLProcessor.readFile(resultFile);
+ expectedDoc = expectedDoc.replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("xqttest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare integer VARIABLES.x = xqttest.proc.input; declare xml y = SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; select convert(y, string); END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { expectedDoc }),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ /**
+ * wraps {@link TestXMLProcessor.testNested2WithCriteria2} in a procedure
+ *
+ * This one will successfully auto-stage
+ */
+ @Test public void testXMLWithExternalCriteria1() throws Exception {
+ FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
+ String expectedDoc =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
+ "<Catalogs>\n" + //$NON-NLS-1$
+ " <Catalog>\n" + //$NON-NLS-1$
+ " <Items>\n" + //$NON-NLS-1$
+ " <Item ItemID=\"001\">\n" + //$NON-NLS-1$
+ " <Name>Lamp</Name>\n" + //$NON-NLS-1$
+ " <Quantity>5</Quantity>\n" + //$NON-NLS-1$
+ " <Suppliers>\n" + //$NON-NLS-1$
+ " <Supplier SupplierID=\"52\">\n" + //$NON-NLS-1$
+ " <Name>Biff's Stuff</Name>\n" + //$NON-NLS-1$
+ " <Zip>22222</Zip>\n" + //$NON-NLS-1$
+ " <Orders>\n" + //$NON-NLS-1$
+ " <Order OrderID=\"2\">\n" + //$NON-NLS-1$
+ " <OrderDate>12/31/01</OrderDate>\n" + //$NON-NLS-1$
+ " <OrderQuantity>87</OrderQuantity>\n" + //$NON-NLS-1$
+ " <OrderStatus>complete</OrderStatus>\n" + //$NON-NLS-1$
+ " </Order>\n" + //$NON-NLS-1$
+ " </Orders>\n" + //$NON-NLS-1$
+ " </Supplier>\n" + //$NON-NLS-1$
+ " </Suppliers>\n" + //$NON-NLS-1$
+ " </Item>\n" + //$NON-NLS-1$
+ " <Item ItemID=\"002\">\n" + //$NON-NLS-1$
+ " <Name>Screwdriver</Name>\n" + //$NON-NLS-1$
+ " <Quantity>100</Quantity>\n" + //$NON-NLS-1$
+ " <Suppliers/>\n" + //$NON-NLS-1$
+ " </Item>\n" + //$NON-NLS-1$
+ " <Item ItemID=\"003\">\n" + //$NON-NLS-1$
+ " <Name>Goat</Name>\n" + //$NON-NLS-1$
+ " <Quantity>4</Quantity>\n" + //$NON-NLS-1$
+ " <Suppliers/>\n" + //$NON-NLS-1$
+ " </Item>\n" + //$NON-NLS-1$
+ " </Items>\n" + //$NON-NLS-1$
+ " </Catalog>\n" + //$NON-NLS-1$
+ "</Catalogs>"; //$NON-NLS-1$
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("xmltest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("xmltest.proc", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare integer VARIABLES.x = xmltest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, SupplierID)=x; END"); //$NON-NLS-1$
+ FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xmltest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq2);
+
+ String userUpdateStr = "EXEC xmltest.proc(52)"; //$NON-NLS-1$
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { expectedDoc }),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testCase174806() throws Exception{
+ String userUpdateStr = "EXEC pm1.vsp63()"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "c"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testJoinProcAndPhysicalModel() throws Exception {
+ String userUpdateStr = "select a.e1 from (EXEC pm1.vsp46()) as a, pm1.g1 where a.e1=pm1.g1.e1"; //$NON-NLS-1$
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ // Set up data
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ /**
+ * Test the procedure <code>DECLARE</code> statement using a query as the assignment value
+ *
+ * <p>The use of a query as the assignment value to a <code>DECLARE</code>
+ * statement should execute without error as long as the query
+ * is valid and fully resolvable.</p>
+ *
+ * <p>This test is related to JBEDSP-818 in which the query in the
+ * <code>LOOP</code> statement would fail due to a query being used as the
+ * assigned value in the <code>DECLARE</code> statement.</p>
+ * @throws Exception
+ */
+ @Test public void testDeclareWithQueryAssignment() throws Exception {
+ // procedure comes from test case IT236455 / JBEDSP-818
+ String procedure = "CREATE VIRTUAL PROCEDURE \n"; //$NON-NLS-1$
+ procedure += "BEGIN\n"; //$NON-NLS-1$
+ procedure += " DECLARE integer VARIABLES.var1 = 0;\n"; //$NON-NLS-1$
+ procedure += " /* the following DECLARE with ASSIGNMENT to a query should work "; //$NON-NLS-1$
+ procedure += " but in IT236455 it results in the assignment inside the LOOP "; //$NON-NLS-1$
+ procedure += " to fail */ "; //$NON-NLS-1$
+ procedure += " DECLARE integer VARIABLES.NLEVELS = SELECT COUNT(*) FROM (\n"; //$NON-NLS-1$
+ procedure += " SELECT 'Col1' AS ACol1, 'Col2' AS ACol2, convert(3, integer) AS ACol3\n"; //$NON-NLS-1$
+ procedure += " ) AS Src;\n"; //$NON-NLS-1$
+ procedure += " LOOP ON (\n"; //$NON-NLS-1$
+ procedure += " SELECT StaticTable.BCol1, StaticTable.BCol2, StaticTable.BCol3 FROM (\n"; //$NON-NLS-1$
+ procedure += " SELECT 'Col 1' AS BCol1, 'Col 2' AS BCol2, convert(3, integer) AS BCol3\n"; //$NON-NLS-1$
+ procedure += " ) AS StaticTable\n"; //$NON-NLS-1$
+ procedure += " ) AS L1\n"; //$NON-NLS-1$
+ procedure += " BEGIN\n"; //$NON-NLS-1$
+ procedure += " /* In IT236455 the following would fail as the results from "; //$NON-NLS-1$
+ procedure += " the LOOP (L1) are not in scope when the assignment is being "; //$NON-NLS-1$
+ procedure += " performed due to the query earlier being part of a DECLARE "; //$NON-NLS-1$
+ procedure += " statement. */ "; //$NON-NLS-1$
+ procedure += " VARIABLES.var1 = L1.BCol3;\n"; //$NON-NLS-1$
+ procedure += " END\n"; //$NON-NLS-1$
+ procedure += " SELECT VARIABLES.Var1 AS e1;\n"; //$NON-NLS-1$
+ procedure += "END\n"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(procedure);
+ String userQuery = "SELECT e1 FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
+
+ List[] expected = new List[] {Arrays.asList(new Object[] {new Integer(3)})};
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testDefect8693() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where e2 = 5;\n"; //$NON-NLS-1$
+ procedure = procedure + "if (5 in (select 5 from pm1.g1))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ helpTestProcess(plan, 5, dataMgr, metadata);
+ }
+
+ @Test public void testWhileWithSubquery() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1 = 2;\n"; //$NON-NLS-1$
+ procedure = procedure + "WHILE (5 in (select var1 from pm1.g1))\n"; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ helpTestProcess(plan, 0, dataMgr, metadata);
+ }
+
+ @Test public void testDefect18404() throws Exception {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1 = 5 + (select count(e2) from pm1.g1);\n"; //$NON-NLS-1$
+ procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED + var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "END"; //$NON-NLS-1$
+
+ String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+ helpTestProcess(plan, 8, dataMgr, metadata);
+ }
+
+ /**
+ * Test the use of a procedure variable in the criteria of a LEFT OUTER
+ * JOIN which will be optimized out as non-JOIN criteria.
+ * <p>
+ * This test case verifies that the procedure variable will not be pushed
+ * to the data manager when a federated source JOIN is performed.
+ *
+ * @throws Exception
+ */
+ @Test public void testRemovalOfNonJoinCritWithReference() throws Exception {
+ String proc = ""; //$NON-NLS-1$
+
+ String sql = ""; //$NON-NLS-1$
+ sql += "SELECT " + //$NON-NLS-1$
+ " pm1.g1.e1 AS pm1g1e1, " + //$NON-NLS-1$
+ " pm2.g2.e1 AS pm2g2e1, " + //$NON-NLS-1$
+ " pm1.g1.e2 AS pm1g1e2, " + //$NON-NLS-1$
+ " pm2.g2.e2 AS pm2g2e2 " + //$NON-NLS-1$
+ "FROM " + //$NON-NLS-1$
+ " pm1.g1 " + //$NON-NLS-1$
+ "LEFT OUTER JOIN pm2.g2 " + //$NON-NLS-1$
+ " ON pm1.g1.e1 = pm2.g2.e1 " + //$NON-NLS-1$
+ " AND pm2.g2.e2 = VARIABLES.myVar "; //$NON-NLS-1$
+
+ proc += "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
+ "BEGIN " + //$NON-NLS-1$
+ " declare integer myVar = 5;" + //$NON-NLS-1$
+ " " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
+ "END"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
+ FakeDataManager dataMgr = exampleDataManager2(metadata);
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
+
+ List[] expected = new List[] {
+ Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+
+ assertTrue(!plan.requiresTransaction(false));
+ }
+
+ /**
+ * Test the use of a procedure variable in the criteria of a LEFT OUTER
+ * JOIN which will be optimized out as non-JOIN criteria.
+ * <p>
+ * This test case verifies that the procedure variable will not be pushed
+ * to the data manager when a federated source JOIN is performed and the
+ * physical source supports all capabilities.
+ *
+ * @throws Exception
+ */
+ @Test public void testRemovalOfNonJoinCritWithReference2() throws Exception {
+ String proc = ""; //$NON-NLS-1$
+
+ String sql = ""; //$NON-NLS-1$
+ sql += "SELECT " + //$NON-NLS-1$
+ " pm1.g1.e1 AS pm1g1e1, " + //$NON-NLS-1$
+ " pm2.g2.e1 AS pm2g2e1, " + //$NON-NLS-1$
+ " pm1.g1.e2 AS pm1g1e2, " + //$NON-NLS-1$
+ " pm2.g2.e2 AS pm2g2e2 " + //$NON-NLS-1$
+ "FROM " + //$NON-NLS-1$
+ " pm1.g1 " + //$NON-NLS-1$
+ "LEFT OUTER JOIN pm2.g2 " + //$NON-NLS-1$
+ " ON pm1.g1.e1 = pm2.g2.e1 " + //$NON-NLS-1$
+ " AND pm2.g2.e2 = VARIABLES.myVar "; //$NON-NLS-1$
+
+ proc += "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
+ "BEGIN " + //$NON-NLS-1$
+ " declare integer myVar = 5;" + //$NON-NLS-1$
+ " " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
+ "END"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
+ FakeDataManager dataMgr = exampleDataManager2(metadata);
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
+
+ List[] expected = new List[] {
+ Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testUpdateDeleteTemp() throws Exception {
+ String proc = "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
+ "BEGIN " + //$NON-NLS-1$
+ " select e1, e2, e3, e4 into #t1 from pm1.g1;\n" + //$NON-NLS-1$
+ " update #t1 set e1 = 1 where e4 < 2;\n" + //$NON-NLS-1$
+ " delete from #t1 where e4 > 2;\n" + //$NON-NLS-1$
+ " select e1 from #t1;\n" + //$NON-NLS-1$
+ "END"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
+ FakeDataManager dataMgr = exampleDataManager2(metadata);
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
+
+ List[] expected = new List[] {
+ Arrays.asList( new Object[] { String.valueOf(1) } ),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testTempSubqueryInput() throws Exception {
+ String proc = "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
+ "BEGIN " + //$NON-NLS-1$
+ " create local temporary table t1 (e1 string);\n" + //$NON-NLS-1$
+ " select e1 into t1 from pm1.g1;\n" + //$NON-NLS-1$
+ " select e2 from (exec pm1.sq2((select max(e1) from t1))) x;\n" + //$NON-NLS-1$
+ "END"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
+ FakeDataManager dataMgr = exampleDataManager2(metadata);
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
+
+ List[] expected = new List[] {
+ Arrays.asList( 51 ),
+ };
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testUnambiguousVirtualProc() throws Exception {
+ String userQuery = "EXEC MMSP6('1')"; //$NON-NLS-1$
+ QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
+
+ List[] expected = new List[] {
+ Arrays.asList( "1" ),
+ };
+ helpTestProcess(plan, expected, new HardcodedDataManager(), metadata);
+ }
+
+ @Test public void testParameterAssignments() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
+ String userQuery = "EXEC TEIIDSP7(1)"; //$NON-NLS-1$
+ HardcodedDataManager dataMgr = new HardcodedDataManager();
+ ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
+ dataMgr.addData("x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
+ dataMgr.addData("EXEC spTest11(3, null)", new List[] {Arrays.asList("1", 1, null), Arrays.asList(null, null, 4)});
+ List[] expected = new List[] {Arrays.asList("34")};
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ @Test public void testNonQueryPushdownValidation() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject in = FakeMetadataFactory.createParameter("pm1.sq1.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("create local temporary table x (y string);\n"); //$NON-NLS-1$
+ procedure.append("declare string s = 'foo';\n"); //$NON-NLS-1$
+ procedure.append("update x set y = in1 || s;\n"); //$NON-NLS-1$
+ procedure.append("update pm1.g1 set e1 = lookup('pm1.g1', 'e1', 'e2', in1);\n"); //$NON-NLS-1$
+ procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { in, rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[0];
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
+ private static final boolean DEBUG = false;
+}
Deleted: tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml
===================================================================
--- branches/7.3.x/hibernate-dialect/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,18 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-hibernate-dialect</artifactId>
- <name>Hibernate Dialect</name>
- <description>Teiid Hibernate Dialect</description>
- <dependencies>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>3.5.2-Final</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml (from rev 2888, branches/7.3.x/hibernate-dialect/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/hibernate-dialect/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-hibernate-dialect</artifactId>
+ <name>Hibernate Dialect</name>
+ <description>Teiid Hibernate Dialect</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.5.2-Final</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml
===================================================================
--- branches/7.3.x/jboss-integration/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,146 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-jboss-integration</artifactId>
- <name>teiid-jboss-integration</name>
- <description>JBoss specific integration layer for teiid</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-runtime</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-profileservice-spi</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-connector</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- <version>2.0.6.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- <version>2.0.3.SP1</version>
- <scope>provided</scope>
- </dependency>
- <!-- these for just running profile service remotely -->
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.naming</groupId>
- <artifactId>jnp-client</artifactId>
- <version>5.0.3.GA</version>
- <scope>test</scope>
- </dependency>
-<!--
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <classifier>client</classifier>
- <version>2.1.1.GA</version>
- <scope>test</scope>
- </dependency>
--->
-
- <dependency>
- <groupId>org.jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>2.5.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-security-aspects</artifactId>
- <version>1.0.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-remoting-aspects</artifactId>
- <version>1.0.1.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>oswego-concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4-jboss-update1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>5.1.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-profileservice</artifactId>
- <version>5.1.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
Copied: tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml (from rev 2888, branches/7.3.x/jboss-integration/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/jboss-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,146 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-integration</artifactId>
+ <name>teiid-jboss-integration</name>
+ <description>JBoss specific integration layer for teiid</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-connector</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ <version>2.0.6.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>2.0.3.SP1</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- these for just running profile service remotely -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnp-client</artifactId>
+ <version>5.0.3.GA</version>
+ <scope>test</scope>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <classifier>client</classifier>
+ <version>2.1.1.GA</version>
+ <scope>test</scope>
+ </dependency>
+-->
+
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>2.5.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>1.0.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-remoting-aspects</artifactId>
+ <version>1.0.1.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.4-jboss-update1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-profileservice</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Deleted: tags/teiid-parent-7.3.0.Final/metadata/pom.xml
===================================================================
--- branches/7.3.x/metadata/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/metadata/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-metadata</artifactId>
- <name>Metadata</name>
- <description>Provides vdb metadata from index files.</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/metadata/pom.xml (from rev 2888, branches/7.3.x/metadata/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/metadata/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/metadata/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-metadata</artifactId>
+ <name>Metadata</name>
+ <description>Provides vdb metadata from index files.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/pom.xml
===================================================================
--- branches/7.3.x/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,493 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-parent</artifactId>
- <packaging>pom</packaging>
- <name>Teiid</name>
- <version>7.3.0.CR2-SNAPSHOT</version>
- <description>Federated SQL and XML query engine.</description>
- <properties>
- <ant.version>1.7.0</ant.version>
- <site.url>http://www.jboss.org/teiid</site.url>
- </properties>
- <scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
- </scm>
- <licenses>
- <license>
- <name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/lgpl.html</url>
- <distribution>repo</distribution>
- <comments>A business-friendly OSS license</comments>
- </license>
- </licenses>
- <url>${site.url}</url>
- <developers>
- <developer>
- <name>Steve Hawkins</name>
- <id>steve</id>
- <email>shawkins(a)redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Project Lead</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Ramesh Reddy</name>
- <id>ramesh</id>
- <email>rareddy(a)redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Project Lead</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Van Halbert</name>
- <id>van</id>
- <email>vhalbert(a)redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Ted Jones</name>
- <id>ted</id>
- <email>tejones(a)redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- </developers>
- <profiles>
- <profile>
- <!--
- This profile is activated manually, as in "mvn ... -P release ..."
- -->
- <id>release</id>
- <modules>
- <module>documentation</module>
- <module>build</module>
- </modules>
- </profile>
- <profile>
- <!--
- This is to enable faster build for development time.
- -->
- <id>dev</id>
- <modules>
- <module>build</module>
- </modules>
- </profile>
- </profiles>
- <build>
- <!-- This section defines the default plugin settings inherited by child projects. -->
- <pluginManagement>
- <plugins>
- <!-- Fixes how test resources of a project can be used in projects dependent on it -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-6-m1-jboss</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <!-- Specify the compiler options and settings -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <showDeprecation>false</showDeprecation>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*TestCase.java</include>
- <include>**/*Test.java</include>
- <include>**/Test*.java</include>
- </includes>
- <excludes>
- <exclude>**/Abstract*TestCase.java</exclude>
- <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
- <include>**/Test*$*.java</include>
- </excludes>
- <systemProperties>
- <property>
- <name>user.dir</name>
- <value>${basedir}/target</value>
- </property>
- <property>
- <name>java.io.tmpdir</name>
- <value>${basedir}/target</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- <!--
- Build a test-jar for each project, so that src/test/* resources and classes can be used
- in other projects. Also customize how the jar files are assembled.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries> true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries> true</addDefaultImplementationEntries>
- </manifest>
- <manifestEntries>
- <Implementation-URL>${pom.url}</Implementation-URL>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- <maxmemory>512m</maxmemory>
- <excludePackageNames>*.internal</excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- <repositories>
- <repository>
- <id>jboss-public-repository</id>
- <name>JBoss Public Maven Repository Group</name>
- <url>http://repository.jboss.org/nexus/content/groups/public/</url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <dependencyManagement>
- <dependencies>
- <!--
- Declare all dependency versions and default scopes here, but not optional.
- Each module should declare it's direct dependency and possibily overwrite scope/optional.
- -->
-
- <!-- Internal dependencies -->
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-console</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-console</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-txn-jbossts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-jboss-integration</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-runtime</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- External dependencies -->
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <version>1.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <groupId>logkit</groupId>
- <artifactId>logkit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- <version>2.6.10.GA</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>3.1.0.GA</version>
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <version>2.1.0.SP1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-metatype</artifactId>
- <version>2.1.0.SP1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-profileservice-spi</artifactId>
- <version>5.1.0.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>2.1.2.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <version>2.0.7.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <version>2.0.7.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-connector</artifactId>
- <version>5.1.0.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>2.0.2.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>2.5.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>9.1.0.8</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <artifactId>saxon</artifactId>
- <classifier>dom</classifier>
- <version>9.1.0.8</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.1.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <modules>
- <module>common-core</module>
- <module>api</module>
- <module>client</module>
- <module>engine</module>
- <module>connectors</module>
- <module>console</module>
- <module>metadata</module>
- <module>runtime</module>
- <module>adminshell</module>
- <module>cache-jbosscache</module>
- <module>hibernate-dialect</module>
- <module>jboss-integration</module>
- <module>test-integration</module>
- </modules>
- <distributionManagement>
- <repository>
- <id>jboss-releases-repository</id>
- <name>JBoss Releases Repository</name>
- <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
- </repository>
- <snapshotRepository>
- <id>jboss-snapshots-repository</id>
- <name>JBoss Snapshots Repository</name>
- <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/pom.xml (from rev 2888, branches/7.3.x/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,493 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Teiid</name>
+ <version>7.3.0.Final</version>
+ <description>Federated SQL and XML query engine.</description>
+ <properties>
+ <ant.version>1.7.0</ant.version>
+ <site.url>http://www.jboss.org/teiid</site.url>
+ </properties>
+ <scm>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</developerConnection>
+ </scm>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>A business-friendly OSS license</comments>
+ </license>
+ </licenses>
+ <url>${site.url}</url>
+ <developers>
+ <developer>
+ <name>Steve Hawkins</name>
+ <id>steve</id>
+ <email>shawkins(a)redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Ramesh Reddy</name>
+ <id>ramesh</id>
+ <email>rareddy(a)redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Van Halbert</name>
+ <id>van</id>
+ <email>vhalbert(a)redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Ted Jones</name>
+ <id>ted</id>
+ <email>tejones(a)redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ </developers>
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>release</id>
+ <modules>
+ <module>documentation</module>
+ <module>build</module>
+ </modules>
+ </profile>
+ <profile>
+ <!--
+ This is to enable faster build for development time.
+ -->
+ <id>dev</id>
+ <modules>
+ <module>build</module>
+ </modules>
+ </profile>
+ </profiles>
+ <build>
+ <!-- This section defines the default plugin settings inherited by child projects. -->
+ <pluginManagement>
+ <plugins>
+ <!-- Fixes how test resources of a project can be used in projects dependent on it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-6-m1-jboss</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ <include>**/*Test.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*TestCase.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+ <include>**/Test*$*.java</include>
+ </excludes>
+ <systemProperties>
+ <property>
+ <name>user.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ <property>
+ <name>java.io.tmpdir</name>
+ <value>${basedir}/target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--
+ Build a test-jar for each project, so that src/test/* resources and classes can be used
+ in other projects. Also customize how the jar files are assembled.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries> true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries> true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Implementation-URL>${pom.url}</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ <maxmemory>512m</maxmemory>
+ <excludePackageNames>*.internal</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <!--
+ Declare all dependency versions and default scopes here, but not optional.
+ Each module should declare it's direct dependency and possibily overwrite scope/optional.
+ -->
+
+ <!-- Internal dependencies -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-console</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-console</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-txn-jbossts</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-integration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <version>1.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>logkit</groupId>
+ <artifactId>logkit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.6.10.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>3.1.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>2.1.0.SP1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ <version>2.1.0.SP1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.1.2.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-connector</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>2.5.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>9.1.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <classifier>dom</classifier>
+ <version>9.1.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.2.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <modules>
+ <module>common-core</module>
+ <module>api</module>
+ <module>client</module>
+ <module>engine</module>
+ <module>connectors</module>
+ <module>console</module>
+ <module>metadata</module>
+ <module>runtime</module>
+ <module>adminshell</module>
+ <module>cache-jbosscache</module>
+ <module>hibernate-dialect</module>
+ <module>jboss-integration</module>
+ <module>test-integration</module>
+ </modules>
+ <distributionManagement>
+ <repository>
+ <id>jboss-releases-repository</id>
+ <name>JBoss Releases Repository</name>
+ <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
+ </repository>
+ <snapshotRepository>
+ <id>jboss-snapshots-repository</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/runtime/pom.xml
===================================================================
--- branches/7.3.x/runtime/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/runtime/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-runtime</artifactId>
- <name>Runtime Engine</name>
- <description>Teiid Runtime Engine</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-profileservice-spi</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/runtime/pom.xml (from rev 2888, branches/7.3.x/runtime/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/runtime/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/runtime/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ <name>Runtime Engine</name>
+ <description>Teiid Runtime Engine</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,383 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.util.threadpool.ThreadPool;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
-import org.teiid.dqp.internal.datamgr.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
-import org.teiid.runtime.RuntimePlugin;
-import org.teiid.translator.DelegatingExecutionFactory;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.TranslatorException;
-
-
-public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
- private VDBRepository vdbRepository;
- private TranslatorRepository translatorRepository;
- private ObjectSerializer serializer;
- private ContainerLifeCycleListener shutdownListener;
- private ThreadPool threadPool;
-
- public VDBDeployer() {
- super(VDBMetaData.class);
- setInput(VDBMetaData.class);
- setOutput(VDBMetaData.class);
- setRelativeOrder(3001); // after the data sources
- }
-
- @Override
- public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws DeploymentException {
- if (this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion())) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
- }
-
- TranslatorRepository repo = new TranslatorRepository();
- ConnectorManagerRepository cmr = new ConnectorManagerRepository();
-
- boolean preview = deployment.isPreview();
-
- if (!preview) {
- List<String> errors = deployment.getValidityErrors();
- if (errors != null && !errors.isEmpty()) {
- throw new DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
- }
- }
-
- // get the metadata store of the VDB (this is build in parse stage)
- MetadataStoreGroup store = unit.getAttachment(MetadataStoreGroup.class);
-
- // add required connector managers; if they are not already there
- for (Translator t: deployment.getOverrideTranslators()) {
- VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
-
- String type = data.getType();
- Translator parent = this.translatorRepository.getTranslatorMetaData(type);
- if ( parent == null) {
- throw new DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found", unit.getName())); //$NON-NLS-1$
- }
-
- Set<String> keys = parent.getProperties().stringPropertyNames();
- for (String key:keys) {
- if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
- data.addProperty(key, parent.getPropertyValue(key));
- }
- }
- repo.addTranslatorMetadata(data.getName(), data);
- }
- createConnectorManagers(cmr, repo, deployment);
-
- // if store is null and vdb dynamic vdb then try to get the metadata
- if (store == null && deployment.isDynamic()) {
- store = new MetadataStoreGroup();
- buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, store, cmr);
- }
-
- // allow empty vdbs for enabling the preview functionality
- if (preview && store == null) {
- store = new MetadataStoreGroup();
- }
-
- if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
- }
-
- // check if this is a VDB with index files, if there are then build the TransformationMetadata
- UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
-
- LinkedHashMap<String, Resource> visibilityMap = null;
- IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
- if (indexFactory != null) {
- visibilityMap = indexFactory.getEntriesPlusVisibilities();
- }
-
- // add the metadata objects as attachments
- deployment.removeAttachment(IndexMetadataFactory.class);
- deployment.removeAttachment(UDFMetaData.class);
- deployment.removeAttachment(MetadataStoreGroup.class);
-
- // add transformation metadata to the repository.
- this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
-
- try {
- saveMetadataStore((VFSDeploymentUnit)unit, deployment, store);
- } catch (IOException e1) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- boolean valid = true;
- if (!preview) {
- valid = validateSources(cmr, deployment);
-
- // Check if the VDB is fully configured.
- if (valid) {
- deployment.setStatus(VDB.Status.ACTIVE);
- } else {
- deployment.setStatus(VDB.Status.INACTIVE);
- }
- }
- else {
- deployment.setStatus(VDB.Status.ACTIVE);
- }
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws DeploymentException {
- IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
-
- for (Model model:deployment.getModels()) {
- for (String source:model.getSourceNames()) {
- if (cmr.getConnectorManager(source) != null) {
- continue;
- }
-
- String name = model.getSourceTranslatorName(source);
- ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
- ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
- cm.setExecutionFactory(ef);
- cm.setModelName(model.getName());
- cmr.addConnectorManager(source, cm);
- }
- }
- }
-
- private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws DeploymentException {
- if (!building.add(name)) {
- throw new DeploymentException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
- }
- Translator translator = repo.getTranslatorMetaData(name);
- if (translator == null) {
- translator = this.translatorRepository.getTranslatorMetaData(name);
- }
- if (translator == null) {
- throw new DeploymentException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
- }
- ExecutionFactory<Object, Object> ef = map.get(translator);
- if ( ef == null) {
- ef = TranslatorUtil.buildExecutionFactory(translator);
- if (ef instanceof DelegatingExecutionFactory) {
- DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
- String delegateName = delegator.getDelegateName();
- if (delegateName != null) {
- ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
- ((DelegatingExecutionFactory) ef).setDelegate(delegate);
- }
- }
- map.put(translator, ef);
- }
- return ef;
- }
-
- private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
- boolean valid = true;
- for(Model m:deployment.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- List<SourceMappingMetadata> mappings = model.getSourceMappings();
- for (SourceMappingMetadata mapping:mappings) {
- ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
- String msg = cm.getStausMessage();
- if (msg != null && msg.length() > 0) {
- valid = false;
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
- }
- }
-
- // in the dynamic case the metadata may be still loading.
- if (!model.getErrors().isEmpty()) {
- valid = false;
- }
- }
- return valid;
- }
-
- public void setVDBRepository(VDBRepository repo) {
- this.vdbRepository = repo;
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, VDBMetaData deployment) {
- super.undeploy(unit, deployment);
-
- if (this.vdbRepository != null) {
- this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
- }
-
- deployment.setRemoved(true);
-
- try {
- deleteMetadataStore((VFSDeploymentUnit)unit);
- } catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_delete_failed", e.getMessage())); //$NON-NLS-1$
- }
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
- }
-
- public void setObjectSerializer(ObjectSerializer serializer) {
- this.serializer = serializer;
- }
-
- private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
- File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
- if (!cacheFileName.exists()) {
- this.serializer.saveAttachment(cacheFileName,store);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void deleteMetadataStore(VFSDeploymentUnit unit) throws IOException {
- if (!unit.getRoot().exists() || !shutdownListener.isShutdownInProgress()) {
- this.serializer.removeAttachments(unit);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void buildDynamicMetadataStore(final VFSDeploymentUnit unit, final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws DeploymentException {
-
- // make sure we are configured correctly first
- for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getSourceNames().isEmpty()) {
- throw new DeploymentException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
- final File cacheFile = buildCachedModelFileName(unit, vdb, model.getName());
- boolean loaded = false;
- if (cache) {
- MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
- if (store != null) {
- vdbStore.addStore(store);
- loaded = true;
- }
- }
-
- if (!loaded) {
- String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName()+"-"+vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
- final ValidationError addedError = model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- threadPool.run(new Runnable() {
- @Override
- public void run() {
- loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr, addedError);
- }
- });
- }
- }
- }
-
- private void loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr, ValidationError addedError) {
- Exception exception = null;
-
- boolean loaded = false;
- for (String sourceName: model.getSourceNames()) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- if (cm == null) {
- continue;
- }
- try {
- MetadataStore store = cm.getMetadata(model.getName(), this.vdbRepository.getBuiltinDatatypes(), model.getProperties());
- if (cache) {
- this.serializer.saveAttachment(cacheFile, store);
- }
- vdbStore.addStore(store);
- model.removeError(addedError);
- loaded = true;
- break;
- } catch (TranslatorException e) {
- if (exception == null) {
- exception = e;
- }
- } catch (IOException e) {
- if (exception == null) {
- exception = e;
- }
- }
- }
-
- synchronized (this) {
- if (!loaded) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String msg = RuntimePlugin.Util.getString("failed_to_retrive_metadata", vdb.getName()+"-"+vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
- if (exception != null) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exception.getMessage());
- }
- LogManager.logWarning(LogConstants.CTX_RUNTIME, msg);
- }
- else {
- if (vdb.isValid()) {
- this.vdbRepository.updateVDB(vdb.getName(), vdb.getVersion());
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
- }
- }
- }
-
- private File buildCachedModelFileName(VFSDeploymentUnit unit, VDBMetaData vdb, String modelName) {
- return this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- static File buildCachedVDBFileName(ObjectSerializer serializer, VFSDeploymentUnit unit, VDBMetaData vdb) {
- return serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
- }
-
- public void setTranslatorRepository(TranslatorRepository repo) {
- this.translatorRepository = repo;
- }
-
- public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
- shutdownListener = listener;
- }
-
- public void setThreadPool(ThreadPool pool) {
- this.threadPool = pool;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java (from rev 2886, branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,385 @@
+/*
+ * 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.deployers;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.util.threadpool.ThreadPool;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.runtime.RuntimePlugin;
+import org.teiid.translator.DelegatingExecutionFactory;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+
+public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
+ private VDBRepository vdbRepository;
+ private TranslatorRepository translatorRepository;
+ private ObjectSerializer serializer;
+ private ContainerLifeCycleListener shutdownListener;
+ private ThreadPool threadPool;
+
+ public VDBDeployer() {
+ super(VDBMetaData.class);
+ setInput(VDBMetaData.class);
+ setOutput(VDBMetaData.class);
+ setRelativeOrder(3001); // after the data sources
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws DeploymentException {
+ if (this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion())) {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
+ }
+
+ TranslatorRepository repo = new TranslatorRepository();
+ ConnectorManagerRepository cmr = new ConnectorManagerRepository();
+
+ boolean preview = deployment.isPreview();
+
+ if (!preview) {
+ List<String> errors = deployment.getValidityErrors();
+ if (errors != null && !errors.isEmpty()) {
+ throw new DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+ }
+ }
+
+ // get the metadata store of the VDB (this is build in parse stage)
+ MetadataStoreGroup store = unit.getAttachment(MetadataStoreGroup.class);
+
+ // add required connector managers; if they are not already there
+ for (Translator t: deployment.getOverrideTranslators()) {
+ VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
+
+ String type = data.getType();
+ Translator parent = this.translatorRepository.getTranslatorMetaData(type);
+ if ( parent == null) {
+ throw new DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found", unit.getName())); //$NON-NLS-1$
+ }
+
+ Set<String> keys = parent.getProperties().stringPropertyNames();
+ for (String key:keys) {
+ if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
+ data.addProperty(key, parent.getPropertyValue(key));
+ }
+ }
+ repo.addTranslatorMetadata(data.getName(), data);
+ }
+ createConnectorManagers(cmr, repo, deployment);
+
+ // if store is null and vdb dynamic vdb then try to get the metadata
+ if (store == null && deployment.isDynamic()) {
+ store = new MetadataStoreGroup();
+ buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, store, cmr);
+ }
+
+ // allow empty vdbs for enabling the preview functionality
+ if (preview && store == null) {
+ store = new MetadataStoreGroup();
+ }
+
+ if (store == null) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
+ }
+
+ // check if this is a VDB with index files, if there are then build the TransformationMetadata
+ UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
+
+ LinkedHashMap<String, Resource> visibilityMap = null;
+ IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
+ if (indexFactory != null) {
+ visibilityMap = indexFactory.getEntriesPlusVisibilities();
+ }
+
+ // add the metadata objects as attachments
+ deployment.removeAttachment(IndexMetadataFactory.class);
+ deployment.removeAttachment(UDFMetaData.class);
+ deployment.removeAttachment(MetadataStoreGroup.class);
+
+ // add transformation metadata to the repository.
+ this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
+
+ try {
+ saveMetadataStore((VFSDeploymentUnit)unit, deployment, store);
+ } catch (IOException e1) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ boolean valid = true;
+ synchronized (deployment) {
+ if (!preview) {
+ valid = validateSources(cmr, deployment);
+
+ // Check if the VDB is fully configured.
+ if (valid) {
+ deployment.setStatus(VDB.Status.ACTIVE);
+ } else {
+ deployment.setStatus(VDB.Status.INACTIVE);
+ }
+ }
+ else {
+ deployment.setStatus(VDB.Status.ACTIVE);
+ }
+ }
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws DeploymentException {
+ IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
+
+ for (Model model:deployment.getModels()) {
+ for (String source:model.getSourceNames()) {
+ if (cmr.getConnectorManager(source) != null) {
+ continue;
+ }
+
+ String name = model.getSourceTranslatorName(source);
+ ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
+ ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
+ cm.setExecutionFactory(ef);
+ cm.setModelName(model.getName());
+ cmr.addConnectorManager(source, cm);
+ }
+ }
+ }
+
+ private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws DeploymentException {
+ if (!building.add(name)) {
+ throw new DeploymentException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
+ }
+ Translator translator = repo.getTranslatorMetaData(name);
+ if (translator == null) {
+ translator = this.translatorRepository.getTranslatorMetaData(name);
+ }
+ if (translator == null) {
+ throw new DeploymentException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
+ }
+ ExecutionFactory<Object, Object> ef = map.get(translator);
+ if ( ef == null) {
+ ef = TranslatorUtil.buildExecutionFactory(translator);
+ if (ef instanceof DelegatingExecutionFactory) {
+ DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
+ String delegateName = delegator.getDelegateName();
+ if (delegateName != null) {
+ ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
+ ((DelegatingExecutionFactory) ef).setDelegate(delegate);
+ }
+ }
+ map.put(translator, ef);
+ }
+ return ef;
+ }
+
+ private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
+ boolean valid = true;
+ for(Model m:deployment.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
+ String msg = cm.getStausMessage();
+ if (msg != null && msg.length() > 0) {
+ valid = false;
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
+ }
+ }
+
+ // in the dynamic case the metadata may be still loading.
+ if (!model.getErrors().isEmpty()) {
+ valid = false;
+ }
+ }
+ return valid;
+ }
+
+ public void setVDBRepository(VDBRepository repo) {
+ this.vdbRepository = repo;
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, VDBMetaData deployment) {
+ super.undeploy(unit, deployment);
+
+ if (this.vdbRepository != null) {
+ this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
+ }
+
+ deployment.setRemoved(true);
+
+ try {
+ deleteMetadataStore((VFSDeploymentUnit)unit);
+ } catch (IOException e) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_delete_failed", e.getMessage())); //$NON-NLS-1$
+ }
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
+ }
+
+ public void setObjectSerializer(ObjectSerializer serializer) {
+ this.serializer = serializer;
+ }
+
+ private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
+ File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
+ if (!cacheFileName.exists()) {
+ this.serializer.saveAttachment(cacheFileName,store);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ private void deleteMetadataStore(VFSDeploymentUnit unit) throws IOException {
+ if (!unit.getRoot().exists() || !shutdownListener.isShutdownInProgress()) {
+ this.serializer.removeAttachments(unit);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ private void buildDynamicMetadataStore(final VFSDeploymentUnit unit, final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws DeploymentException {
+
+ // make sure we are configured correctly first
+ for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
+ if (model.getSourceNames().isEmpty()) {
+ throw new DeploymentException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
+ final File cacheFile = buildCachedModelFileName(unit, vdb, model.getName());
+ boolean loaded = false;
+ if (cache) {
+ MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
+ if (store != null) {
+ vdbStore.addStore(store);
+ loaded = true;
+ }
+ }
+
+ if (!loaded) {
+ String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName()+"-"+vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+ final ValidationError addedError = model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ threadPool.run(new Runnable() {
+ @Override
+ public void run() {
+ loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr, addedError);
+ }
+ });
+ }
+ }
+ }
+
+ private void loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr, ValidationError addedError) {
+ Exception exception = null;
+
+ boolean loaded = false;
+ for (String sourceName: model.getSourceNames()) {
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ if (cm == null) {
+ continue;
+ }
+ try {
+ MetadataStore store = cm.getMetadata(model.getName(), this.vdbRepository.getBuiltinDatatypes(), model.getProperties());
+ if (cache) {
+ this.serializer.saveAttachment(cacheFile, store);
+ }
+ vdbStore.addStore(store);
+ model.removeError(addedError);
+ loaded = true;
+ break;
+ } catch (TranslatorException e) {
+ if (exception == null) {
+ exception = e;
+ }
+ } catch (IOException e) {
+ if (exception == null) {
+ exception = e;
+ }
+ }
+ }
+
+ synchronized (vdb) {
+ if (!loaded) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ String msg = RuntimePlugin.Util.getString("failed_to_retrive_metadata", vdb.getName()+"-"+vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ if (exception != null) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exception.getMessage());
+ }
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, msg);
+ }
+ else {
+ if (vdb.isValid()) {
+ this.vdbRepository.updateVDB(vdb.getName(), vdb.getVersion());
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private File buildCachedModelFileName(VFSDeploymentUnit unit, VDBMetaData vdb, String modelName) {
+ return this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ static File buildCachedVDBFileName(ObjectSerializer serializer, VFSDeploymentUnit unit, VDBMetaData vdb) {
+ return serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
+ }
+
+ public void setTranslatorRepository(TranslatorRepository repo) {
+ this.translatorRepository = repo;
+ }
+
+ public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
+ shutdownListener = listener;
+ }
+
+ public void setThreadPool(ThreadPool pool) {
+ this.threadPool = pool;
+ }
+}
Deleted: tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,151 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.dqp.internal.datamgr.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
-
-
-public class VDBStatusChecker {
- private static final String JAVA_CONTEXT = "java:"; //$NON-NLS-1$
- private VDBRepository vdbRepository;
-
- public void translatorAdded(String translatorName) {
- resourceAdded(translatorName, true);
- }
-
- public void translatorRemoved(String translatorName) {
- resourceremoved(translatorName, true);
- }
-
- public void dataSourceAdded(String dataSourceName) {
- if (dataSourceName.startsWith(JAVA_CONTEXT)) {
- dataSourceName = dataSourceName.substring(5);
- }
- resourceAdded(dataSourceName, false);
- }
-
- public void dataSourceRemoved(String dataSourceName) {
- if (dataSourceName.startsWith(JAVA_CONTEXT)) {
- dataSourceName = dataSourceName.substring(5);
- }
- resourceremoved(dataSourceName, false);
- }
-
- public void setVDBRepository(VDBRepository repo) {
- this.vdbRepository = repo;
- }
-
- public void resourceAdded(String resourceName, boolean translator) {
- for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
- if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
- continue;
- }
- ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (model.getErrors().isEmpty()) {
- continue;
- }
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- model.clearErrors();
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
- }
- }
- }
-
- boolean valid = true;
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (!model.getErrors().isEmpty()) {
- valid = false;
- break;
- }
- }
-
- if (valid) {
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
- }
- }
-
- public void resourceremoved(String resourceName, boolean translator) {
- for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
- if (vdb.isPreview()) {
- continue;
- }
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String msg = null;
- if (translator) {
- msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
- }
- else {
- msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
- }
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
- }
- }
- }
-
- private String getSourceName(String translatorName, ModelMetaData model, boolean translator) {
- for (String sourceName:model.getSourceNames()) {
- if (translator) {
- if (translatorName.equals(model.getSourceTranslatorName(sourceName))) {
- return sourceName;
- }
- } else {
- String jndiName = model.getSourceConnectionJndiName(sourceName);
- if (jndiName.startsWith(JAVA_CONTEXT)) {
- jndiName = jndiName.substring(5);
- }
- if (translatorName.equals(jndiName)) {
- return sourceName;
- }
- }
- }
- return null;
- }
-}
Copied: tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java (from rev 2886, branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,154 @@
+/*
+ * 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.deployers;
+
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class VDBStatusChecker {
+ private static final String JAVA_CONTEXT = "java:"; //$NON-NLS-1$
+ private VDBRepository vdbRepository;
+
+ public void translatorAdded(String translatorName) {
+ resourceAdded(translatorName, true);
+ }
+
+ public void translatorRemoved(String translatorName) {
+ resourceremoved(translatorName, true);
+ }
+
+ public void dataSourceAdded(String dataSourceName) {
+ if (dataSourceName.startsWith(JAVA_CONTEXT)) {
+ dataSourceName = dataSourceName.substring(5);
+ }
+ resourceAdded(dataSourceName, false);
+ }
+
+ public void dataSourceRemoved(String dataSourceName) {
+ if (dataSourceName.startsWith(JAVA_CONTEXT)) {
+ dataSourceName = dataSourceName.substring(5);
+ }
+ resourceremoved(dataSourceName, false);
+ }
+
+ public void setVDBRepository(VDBRepository repo) {
+ this.vdbRepository = repo;
+ }
+
+ public void resourceAdded(String resourceName, boolean translator) {
+ for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+ if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
+ continue;
+ }
+ synchronized (vdb) {
+ ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
+
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (model.getErrors().isEmpty()) {
+ continue;
+ }
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ model.clearErrors();
+ String status = cm.getStausMessage();
+ if (status != null && status.length() > 0) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
+ }
+ }
+ }
+
+ boolean valid = true;
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (!model.getErrors().isEmpty()) {
+ valid = false;
+ break;
+ }
+ }
+
+ if (valid) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ public void resourceremoved(String resourceName, boolean translator) {
+ for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+ if (vdb.isPreview()) {
+ continue;
+ }
+ synchronized (vdb) {
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ String msg = null;
+ if (translator) {
+ msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ else {
+ msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+
+ private String getSourceName(String translatorName, ModelMetaData model, boolean translator) {
+ for (String sourceName:model.getSourceNames()) {
+ if (translator) {
+ if (translatorName.equals(model.getSourceTranslatorName(sourceName))) {
+ return sourceName;
+ }
+ } else {
+ String jndiName = model.getSourceConnectionJndiName(sourceName);
+ if (jndiName.startsWith(JAVA_CONTEXT)) {
+ jndiName = jndiName.substring(5);
+ }
+ if (translatorName.equals(jndiName)) {
+ return sourceName;
+ }
+ }
+ }
+ return null;
+ }
+}
Copied: tags/teiid-parent-7.3.0.Final/runtime/src/test/java/org/teiid/transport/TestFailover.java (from rev 2886, branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/runtime/src/test/java/org/teiid/transport/TestFailover.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.transport;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.net.InetSocketAddress;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Test;
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.LogonException;
+import org.teiid.client.security.LogonResult;
+import org.teiid.client.security.SessionToken;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.ComponentNotFoundException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.dqp.service.SessionService;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.HostInfo;
+import org.teiid.net.TeiidURL;
+import org.teiid.net.socket.SocketServerConnection;
+import org.teiid.net.socket.SocketServerConnectionFactory;
+import org.teiid.net.socket.UrlServerDiscovery;
+import org.teiid.transport.TestSocketRemoting.FakeService;
+
+
+@SuppressWarnings("nls")
+public class TestFailover {
+
+ SocketListener listener;
+ SocketListener listener1;
+
+ private SocketServerConnectionFactory sscf;
+ private InetSocketAddress addr = new InetSocketAddress(0);
+ private int logonAttempts;
+
+ @After public void tearDown() {
+ if (this.listener != null) {
+ this.listener.stop();
+ }
+ if (this.listener1 != null) {
+ this.listener1.stop();
+ }
+ }
+
+ private SocketServerConnection helpEstablishConnection(boolean clientSecure, SSLConfiguration config, Properties socketConfig) throws CommunicationException,
+ ConnectionException {
+ listener = createListener(addr, config);
+ listener1 = createListener(addr, config);
+ listener1.stop();
+ Properties p = new Properties();
+ TeiidURL teiidUrl = new TeiidURL(addr.getHostName(), listener.getPort(), clientSecure);
+ teiidUrl.getHostInfo().add(new HostInfo(addr.getHostName(), listener1.getPort()));
+ String url = teiidUrl.getAppServerURL();
+ p.setProperty(TeiidURL.CONNECTION.SERVER_URL, url);
+ p.setProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
+ p.setProperty(TeiidURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
+ if (sscf == null) {
+ sscf = new SocketServerConnectionFactory();
+ sscf.initialize(socketConfig);
+ }
+ return sscf.getConnection(p);
+ }
+
+ private SocketListener createListener(InetSocketAddress address, SSLConfiguration config) {
+ ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
+ server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
+ @Override
+ public LogonResult logon(Properties connProps)
+ throws LogonException, ComponentNotFoundException {
+ logonAttempts++;
+ return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
+ }
+
+ @Override
+ public ResultsFuture<?> ping() throws InvalidSessionException,
+ TeiidComponentException {
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ @Override
+ public void assertIdentity(SessionToken checkSession)
+ throws InvalidSessionException, TeiidComponentException {
+ throw new InvalidSessionException();
+ }
+
+ }, null);
+ server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
+ return new SocketListener(address.getPort(), address.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
+ }
+
+ @Test public void testFailover() throws Exception {
+ SSLConfiguration config = new SSLConfiguration();
+ Properties p = new Properties();
+ SocketServerConnection conn = helpEstablishConnection(false, config, p);
+ assertTrue(conn.isOpen(1000));
+ //restart the second instance now that we know the connection was made to the first
+ listener1 = createListener(new InetSocketAddress(addr.getAddress(), listener1.getPort()), config);
+ listener.stop();
+ conn.isOpen(1000); //there is a chance this call can fail
+ assertTrue(conn.isOpen(1000));
+ listener1.stop();
+ //both instances are down
+ assertFalse(conn.isOpen(1000));
+ //bring the first back up
+ listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
+ assertTrue(conn.isOpen(1000));
+ assertEquals(3, logonAttempts);
+ conn.close();
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml
===================================================================
--- branches/7.3.x/test-integration/common/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-test-integration</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>test-integration-common</artifactId>
- <name>Common Integration Tests</name>
- <description>Common Integration tests that do not require external dependencies</description>
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml (from rev 2888, branches/7.3.x/test-integration/common/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/test-integration/common/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-test-integration</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-integration-common</artifactId>
+ <name>Common Integration Tests</name>
+ <description>Common Integration tests that do not require external dependencies</description>
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,166 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jdbc;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.mockito.Mockito;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.client.DQP;
-import org.teiid.client.security.ILogon;
-import org.teiid.deployers.MetadataStoreGroup;
-import org.teiid.deployers.VDBRepository;
-import org.teiid.dqp.internal.datamgr.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.FakeTransactionService;
-import org.teiid.dqp.internal.process.DQPConfiguration;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.service.FakeBufferService;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.metadata.index.VDBMetadataFactory;
-import org.teiid.query.function.SystemFunctionManager;
-import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
-import org.teiid.query.optimizer.capabilities.SourceCapabilities;
-import org.teiid.services.SessionServiceImpl;
-import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.ClientServiceRegistryImpl;
-import org.teiid.transport.LocalServerConnection;
-import org.teiid.transport.LogonImpl;
-
-@SuppressWarnings("nls")
-public class FakeServer extends ClientServiceRegistryImpl {
-
- SessionServiceImpl sessionService = new SessionServiceImpl();
- LogonImpl logon;
- DQPCore dqp = new DQPCore();
- VDBRepository repo = new VDBRepository();
- private ConnectorManagerRepository cmr;
-
- public FakeServer() {
- this.logon = new LogonImpl(sessionService, null);
-
- this.repo.setSystemStore(VDBMetadataFactory.getSystem());
- this.repo.setSystemFunctionManager(new SystemFunctionManager());
- this.repo.odbcEnabled();
- this.repo.start();
-
- this.sessionService.setVDBRepository(repo);
- this.dqp.setBufferService(new FakeBufferService());
- this.dqp.setCacheFactory(new DefaultCacheFactory());
- this.dqp.setTransactionService(new FakeTransactionService());
-
- cmr = Mockito.mock(ConnectorManagerRepository.class);
- Mockito.stub(cmr.getConnectorManager("source")).toReturn(new ConnectorManager("x", "x") {
- @Override
- public SourceCapabilities getCapabilities() {
- return new BasicSourceCapabilities();
- }
- });
-
- DQPConfiguration config = new DQPConfiguration();
- config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250));
- this.dqp.setCacheFactory(new DefaultCacheFactory());
- this.dqp.start(config);
- this.sessionService.setDqp(this.dqp);
-
- registerClientService(ILogon.class, logon, null);
- registerClientService(DQP.class, dqp, null);
- }
-
- public void deployVDB(String vdbName, String vdbPath) throws Exception {
-
- IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
- MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
-
- VDBMetaData vdbMetaData = new VDBMetaData();
- vdbMetaData.setName(vdbName);
- vdbMetaData.setStatus(VDB.Status.ACTIVE);
-
- for (Schema schema : repo.getSystemStore().getSchemas().values()) {
- addModel(vdbMetaData, schema);
- }
-
- for (Schema schema : repo.getODBCStore().getSchemas().values()) {
- addModel(vdbMetaData, schema);
- }
-
- for (Schema schema : metadata.getSchemas().values()) {
- addModel(vdbMetaData, schema);
- }
-
- try {
- MetadataStoreGroup stores = new MetadataStoreGroup();
- stores.addStore(metadata);
- this.repo.addVDB(vdbMetaData, stores, imf.getEntriesPlusVisibilities(), null, cmr);
- } catch (DeploymentException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void removeVDB(String vdbName) {
- this.repo.removeVDB(vdbName, 1);
- }
-
- private void addModel(VDBMetaData vdbMetaData, Schema schema) {
- ModelMetaData model = new ModelMetaData();
- model.setName(schema.getName());
- vdbMetaData.addModel(model);
- model.addSourceMapping("source", "translator", "jndi:source");
- }
-
- public VDBMetaData getVDB(String vdbName) {
- return this.repo.getVDB(vdbName, 1);
- }
-
- public void undeployVDB(String vdbName) {
- this.repo.removeVDB(vdbName, 1);
- }
-
- public void mergeVDBS(String sourceVDB, String targetVDB) throws AdminException {
- this.repo.mergeVDBs(sourceVDB, 1, targetVDB, 1);
- }
-
- public ConnectionImpl createConnection(String embeddedURL) throws Exception {
- final Properties p = new Properties();
- EmbeddedProfile.parseURL(embeddedURL, p);
-
- LocalServerConnection conn = new LocalServerConnection(p) {
- @Override
- protected ClientServiceRegistry getClientServiceRegistry() {
- return FakeServer.this;
- }
- };
- return new ConnectionImpl(conn, p, embeddedURL);
- }
-
-
-}
Copied: tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java (from rev 2886, branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,166 @@
+/*
+ * 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.jdbc;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.mockito.Mockito;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.client.DQP;
+import org.teiid.client.security.ILogon;
+import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.FakeTransactionService;
+import org.teiid.dqp.internal.process.DQPConfiguration;
+import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.dqp.service.FakeBufferService;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.VDBMetadataFactory;
+import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities;
+import org.teiid.services.SessionServiceImpl;
+import org.teiid.transport.ClientServiceRegistry;
+import org.teiid.transport.ClientServiceRegistryImpl;
+import org.teiid.transport.LocalServerConnection;
+import org.teiid.transport.LogonImpl;
+
+@SuppressWarnings("nls")
+public class FakeServer extends ClientServiceRegistryImpl {
+
+ SessionServiceImpl sessionService = new SessionServiceImpl();
+ LogonImpl logon;
+ DQPCore dqp = new DQPCore();
+ VDBRepository repo = new VDBRepository();
+ private ConnectorManagerRepository cmr;
+
+ public FakeServer() {
+ this.logon = new LogonImpl(sessionService, null);
+
+ this.repo.setSystemStore(VDBMetadataFactory.getSystem());
+ this.repo.setSystemFunctionManager(new SystemFunctionManager());
+ this.repo.odbcEnabled();
+ this.repo.start();
+
+ this.sessionService.setVDBRepository(repo);
+ this.dqp.setBufferService(new FakeBufferService());
+ this.dqp.setCacheFactory(new DefaultCacheFactory());
+ this.dqp.setTransactionService(new FakeTransactionService());
+
+ cmr = Mockito.mock(ConnectorManagerRepository.class);
+ Mockito.stub(cmr.getConnectorManager("source")).toReturn(new ConnectorManager("x", "x") {
+ @Override
+ public SourceCapabilities getCapabilities() {
+ return new BasicSourceCapabilities();
+ }
+ });
+
+ DQPConfiguration config = new DQPConfiguration();
+ config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
+ this.dqp.setCacheFactory(new DefaultCacheFactory());
+ this.dqp.start(config);
+ this.sessionService.setDqp(this.dqp);
+
+ registerClientService(ILogon.class, logon, null);
+ registerClientService(DQP.class, dqp, null);
+ }
+
+ public void deployVDB(String vdbName, String vdbPath) throws Exception {
+
+ IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
+ MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
+
+ VDBMetaData vdbMetaData = new VDBMetaData();
+ vdbMetaData.setName(vdbName);
+ vdbMetaData.setStatus(VDB.Status.ACTIVE);
+
+ for (Schema schema : repo.getSystemStore().getSchemas().values()) {
+ addModel(vdbMetaData, schema);
+ }
+
+ for (Schema schema : repo.getODBCStore().getSchemas().values()) {
+ addModel(vdbMetaData, schema);
+ }
+
+ for (Schema schema : metadata.getSchemas().values()) {
+ addModel(vdbMetaData, schema);
+ }
+
+ try {
+ MetadataStoreGroup stores = new MetadataStoreGroup();
+ stores.addStore(metadata);
+ this.repo.addVDB(vdbMetaData, stores, imf.getEntriesPlusVisibilities(), null, cmr);
+ } catch (DeploymentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void removeVDB(String vdbName) {
+ this.repo.removeVDB(vdbName, 1);
+ }
+
+ private void addModel(VDBMetaData vdbMetaData, Schema schema) {
+ ModelMetaData model = new ModelMetaData();
+ model.setName(schema.getName());
+ vdbMetaData.addModel(model);
+ model.addSourceMapping("source", "translator", "jndi:source");
+ }
+
+ public VDBMetaData getVDB(String vdbName) {
+ return this.repo.getVDB(vdbName, 1);
+ }
+
+ public void undeployVDB(String vdbName) {
+ this.repo.removeVDB(vdbName, 1);
+ }
+
+ public void mergeVDBS(String sourceVDB, String targetVDB) throws AdminException {
+ this.repo.mergeVDBs(sourceVDB, 1, targetVDB, 1);
+ }
+
+ public ConnectionImpl createConnection(String embeddedURL) throws Exception {
+ final Properties p = new Properties();
+ EmbeddedProfile.parseURL(embeddedURL, p);
+
+ LocalServerConnection conn = new LocalServerConnection(p) {
+ @Override
+ protected ClientServiceRegistry getClientServiceRegistry() {
+ return FakeServer.this;
+ }
+ };
+ return new ConnectionImpl(conn, p, embeddedURL);
+ }
+
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml
===================================================================
--- branches/7.3.x/test-integration/db/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,537 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-<!--
- The database dependent tests are meant to be run on their own, not as part of the continous or nightly
- build for Teiid.
--->
-
- <parent>
- <artifactId>teiid-test-integration</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>test-integration-db</artifactId>
-
- <name>DB Dependent Integration Tests</name>
- <groupId>org.jboss.teiid.teiid-test-integration</groupId>
- <description>Integration tests that require external database dependencies </description>
- <dependencies>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <scope>compile</scope>
- </dependency>
-
-
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>test-integration-common</artifactId>
- <type>test-jar</type>
- <scope>compile</scope>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.7.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-launcher</artifactId>
- <version>1.7.0</version>
- </dependency>
- <dependency>
- <groupId>ant-contrib</groupId>
- <artifactId>ant-contrib</artifactId>
- <version>1.0b3</version>
- <exclusions>
- <exclusion>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- </exclusions>
-
- </dependency>
-
- <dependency>
- <groupId>ant-contrib</groupId>
- <artifactId>cpptasks</artifactId>
- <version>1.0b3</version>
- <exclusions>
- <exclusion>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
-
- <!-- DBUnit dependencies -->
-
- <dependency>
- <groupId>org.dbunit</groupId>
- <artifactId>dbunit</artifactId>
- <version>2.2</version>
- </dependency>
-
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.6</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.poi</groupId>
- <artifactId>poi</artifactId>
- <version>3.2-FINAL</version>
- </dependency>
-
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>${postgresql.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
-
- <build>
- <plugins>
- <!-- Specify the compiler options and settings -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <showDeprecation>false</showDeprecation>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/binaries.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>
- </profile>
-
-
- <profile>
- <id>runalltests</id>
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <additionalClasspathElements>
- <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
-
- </additionalClasspathElements>
- <systemProperties>
- <property>
- <name>usedatasources</name>
- <value>${usedatasources}</value>
- </property>
- <property>
- <name>datasourceloc</name>
- <value>${datasourceloc}</value>
- </property>
- </systemProperties>
-
-<!--
-<forkMode>always</forkMode>
- <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
- -->
- <includes>
- <!-- <include>**/*TestCase.java</include> -->
- <include>**/*Test.java</include>
- <include>**/*Tests.java</include>
- <include>**/Test*.java</include>
- </includes>
- <excludes>
- <exclude>**/*Abstract*TestCase.java</exclude>
- <exclude>**/*Abstract*Test.java</exclude>
- <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
- <exclude>**/Test*$*.java</exclude>
- </excludes>
-
- </configuration>
- </plugin>
-
- </plugins>
-
- </build>
-
-<!-- <version>2.4.2</version> -->
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
-
- <configuration>
- <outputDirectory>${basedir}/target/newsite</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- </profile>
-
- <profile>
- <id>runsingletest</id>
- <activation>
- <property>
- <name>classname</name>
- </property>
- </activation>
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <additionalClasspathElements>
- <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
- </additionalClasspathElements>
- <systemProperties>
- <property>
- <name>usedatasources</name>
- <value>${usedatasources}</value>
- </property>
- <property>
- <name>datasourceloc</name>
- <value>${datasourceloc}</value>
- </property>
- </systemProperties>
-
-<!--
- <forkMode>always</forkMode>
-
- <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
- -->
- <includes>
- <include>**/${classname}.java</include>
- </includes>
-
- </configuration>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
-
- <profile>
- <id>setupdatasources</id>
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${apache.ant.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- </configuration>
- <executions>
- <execution>
- <id>setupalldatasources</id>
- <phase>pre-integration-test</phase>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="relative.resources.dir" value="src/main/resources" />
- <property name="datasourceloc" value="${datasourceloc}" />
- <ant antfile="src/main/resources/ddl/manage_schemas.xml" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
-
- </plugins>
- </build>
- </profile>
- <profile>
- <id>singledatasource</id>
- <activation>
- <property>
- <name>datasource</name>
- </property>
- </activation>
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${apache.ant.version}</version>
- </dependency>
- </dependencies>
- <configuration>
-
- </configuration>
- <executions>
- <execution>
- <id>setupsingledatasource</id>
- <phase>pre-integration-test</phase>
- <configuration>
- <tasks>
-
- <property name="single" value="${datasource}" />
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="datasourceloc" value="${datasourceloc}" />
-
- <property name="relative.resources.dir" value="src/main/resources" />
- <ant antfile="src/main/resources/ddl/manage_schemas.xml" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
-
- </plugins>
- </build>
- </profile>
-
-
- <profile>
- <id>runclienttests</id>
- <activation>
- <property>
- <name>scenario.dir</name>
- </property>
- </activation>
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${apache.ant.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>run-client-test</id>
- <phase>integration-test</phase>
- <configuration>
- <tasks>
-
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="scenario.dir" value="${scenario.dir}" />
- <property name="queryset.artifacts.dir" value="${queryset.artifacts.dir}" />
- <property name="vdb.artifacts.dir" value="${vdb.artifacts.dir}" />
- <!-- optional properties -->
- <property name="config.file" value="${config.file}" />
- <property name="query.scenario.classname" value="${query.scenario.classname}" />
- <property name="proj.dir" value="${project.basedir}/target/" />
- <property name="usedatasources" value="${usedatasources}" />
- <property name="datasourceloc" value="${datasourceloc}" />
-
- <ant antfile="src/main/resources/ctc_tests/ctc.xml" />
-
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
- </plugins>
- </build>
-
- </profile>
-
- <profile>
- <id>assemble</id>
-<!-- assemble will compile, but not run the tests prior to assemblying the kit -->
-
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/binaries.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/work/assembly</workDirectory>
-
- </configuration>
- <executions>
-
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- </profiles>
-
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml (from rev 2888, branches/7.3.x/test-integration/db/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/test-integration/db/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,537 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+<!--
+ The database dependent tests are meant to be run on their own, not as part of the continous or nightly
+ build for Teiid.
+-->
+
+ <parent>
+ <artifactId>teiid-test-integration</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-integration-db</artifactId>
+
+ <name>DB Dependent Integration Tests</name>
+ <groupId>org.jboss.teiid.teiid-test-integration</groupId>
+ <description>Integration tests that require external database dependencies </description>
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>compile</scope>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>test-integration-common</artifactId>
+ <type>test-jar</type>
+ <scope>compile</scope>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+
+ </dependency>
+
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>cpptasks</artifactId>
+ <version>1.0b3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <!-- DBUnit dependencies -->
+
+ <dependency>
+ <groupId>org.dbunit</groupId>
+ <artifactId>dbunit</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>3.2-FINAL</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${postgresql.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/binaries.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>
+ </profile>
+
+
+ <profile>
+ <id>runalltests</id>
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+
+ </additionalClasspathElements>
+ <systemProperties>
+ <property>
+ <name>usedatasources</name>
+ <value>${usedatasources}</value>
+ </property>
+ <property>
+ <name>datasourceloc</name>
+ <value>${datasourceloc}</value>
+ </property>
+ </systemProperties>
+
+<!--
+<forkMode>always</forkMode>
+ <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+ -->
+ <includes>
+ <!-- <include>**/*TestCase.java</include> -->
+ <include>**/*Test.java</include>
+ <include>**/*Tests.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*TestCase.java</exclude>
+ <exclude>**/*Abstract*Test.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+ <exclude>**/Test*$*.java</exclude>
+ </excludes>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+<!-- <version>2.4.2</version> -->
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+
+ <configuration>
+ <outputDirectory>${basedir}/target/newsite</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
+
+ <profile>
+ <id>runsingletest</id>
+ <activation>
+ <property>
+ <name>classname</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+ </additionalClasspathElements>
+ <systemProperties>
+ <property>
+ <name>usedatasources</name>
+ <value>${usedatasources}</value>
+ </property>
+ <property>
+ <name>datasourceloc</name>
+ <value>${datasourceloc}</value>
+ </property>
+ </systemProperties>
+
+<!--
+ <forkMode>always</forkMode>
+
+ <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+ -->
+ <includes>
+ <include>**/${classname}.java</include>
+ </includes>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
+ <id>setupdatasources</id>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>setupalldatasources</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="relative.resources.dir" value="src/main/resources" />
+ <property name="datasourceloc" value="${datasourceloc}" />
+ <ant antfile="src/main/resources/ddl/manage_schemas.xml" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>singledatasource</id>
+ <activation>
+ <property>
+ <name>datasource</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+
+ </configuration>
+ <executions>
+ <execution>
+ <id>setupsingledatasource</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <property name="single" value="${datasource}" />
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="datasourceloc" value="${datasourceloc}" />
+
+ <property name="relative.resources.dir" value="src/main/resources" />
+ <ant antfile="src/main/resources/ddl/manage_schemas.xml" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
+ <id>runclienttests</id>
+ <activation>
+ <property>
+ <name>scenario.dir</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>run-client-test</id>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="scenario.dir" value="${scenario.dir}" />
+ <property name="queryset.artifacts.dir" value="${queryset.artifacts.dir}" />
+ <property name="vdb.artifacts.dir" value="${vdb.artifacts.dir}" />
+ <!-- optional properties -->
+ <property name="config.file" value="${config.file}" />
+ <property name="query.scenario.classname" value="${query.scenario.classname}" />
+ <property name="proj.dir" value="${project.basedir}/target/" />
+ <property name="usedatasources" value="${usedatasources}" />
+ <property name="datasourceloc" value="${datasourceloc}" />
+
+ <ant antfile="src/main/resources/ctc_tests/ctc.xml" />
+
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+
+ <profile>
+ <id>assemble</id>
+<!-- assemble will compile, but not run the tests prior to assemblying the kit -->
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/binaries.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/work/assembly</workDirectory>
+
+ </configuration>
+ <executions>
+
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
===================================================================
--- branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,682 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.test.util;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-
-/**
- * TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
- * in order to call out.print instead of out.println
- * This is because the println adds a line terminator, and when the result file is in turn used for
- * comparison it fails because of the line terminator.
- *
- * @since
- */
-public class TestResultSetUtil {
-
-
- public static final int DEFAULT_MAX_COL_WIDTH = 29;
- private static final String SPACER = " "; //$NON-NLS-1$
- private static final String NULL = "<null>"; //$NON-NLS-1$
- private static final String MORE = "$ ";
-
-
- public static List compareThrowable(Throwable t, String query, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
- BufferedReader expectedResultsReader = null;
- if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
- expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
- }
-
- PrintStream out = TestResultSetUtil.getPrintStream(null,expectedResultsReader, printToConsole ? System.out : null);
-
- printThrowable(t, query, out);
- return TestResultSetUtil.getUnequalLines(out);
- }
-
-
- public static void printThrowable(Throwable t, String sql, PrintStream out) {
- out.println(sql);
-
- out.print(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
-
- }
-
-
-
- /**
- * Gets a PrintStream implementation that uses the input parameters as underlying streams
- * @param resultsOutput an output file for result data. If null, results will only be written to the defaul stream.
- * @param expectedResultsInput the reader for expected data. If null, actual data is never compared against expected results.
- * @param defaultPrintStream if not null, this utility will always write to this stream. Typically this is System.out
- * @return the single PrintStream that wraps all the input streams for writing and comparison.
- * @since 4.2
- */
- public static PrintStream getPrintStream(OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
- PrintStream out = null;
- if (defaultPrintStream == null) {
- defaultPrintStream = new PrintStream(new OutputStream () {
- public void write(int b) throws IOException {}
- });
- }
- if (resultsOutput == null && expectedResultsInput == null) {
- out = defaultPrintStream;
- } else if (resultsOutput == null && expectedResultsInput != null) {
- out = new ComparingPrintStream(defaultPrintStream, expectedResultsInput);
- } else if (resultsOutput!= null && expectedResultsInput == null) {
- PrintStream filePrintStream = new PrintStream(resultsOutput);
- out = new MuxingPrintStream(new PrintStream[] {defaultPrintStream, filePrintStream});
- } else {
- PrintStream filePrintStream = new PrintStream(resultsOutput);
- out = new ComparingPrintStream(new MuxingPrintStream(new PrintStream[] {defaultPrintStream, filePrintStream}), expectedResultsInput);
- }
- return out;
- }
-
- /**
- * Compares the actual results with the expected results.
- * @param updateCount the result of the execution
- * @param resultsFile output file to which the results will be written. Can be null.
- * @param expectedResultsFile expected results file with which to compare the results. Can be null.
- * @param printToConsole writes to System.out if true
- * @return The List of line numbers which differ between the actual and expected results.
- * @throws IOException
- * @since 4.3
- */
-// public static List writeAndCompareUpdateCount(int updateCount, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException {
-// FileOutputStream resultsOutputStream = null;
-// if (resultsFile != null) {
-// resultsOutputStream = new FileOutputStream(resultsFile);
-// }
-// BufferedReader expectedResultsReader = null;
-// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
-// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
-// }
-// return writeAndCompareUpdateCount(updateCount, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
-// }
-
- /**
- * Compares the actual results with the expected results.
- * @param updateCount the result of the execution
- * @param resultsOutput OutputStream to which the results will be written. Can be null.
- * @param expectedResultsInput reader with which the expected results are read. Can be null.
- * @param defaultPrintStream the default stream to which to write the results. Can be null.
- * @return The List of line numbers which differ between the actual and expected results.
- * @since 4.3
- */
-// public static List writeAndCompareUpdateCount(int updateCount, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
-// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
-// printUpdateCount(updateCount, out);
-// return getUnequalLines(out);
-// }
-
- /**
- * Compares the actual results with the expected results.
- * @param counts the result of the execution
- * @param resultsFile output file to which the results will be written. Can be null.
- * @param expectedResultsFile expected results file with which to compare the results. Can be null.
- * @param printToConsole writes to System.out if true
- * @return The List of line numbers which differ between the actual and expected results.
- * @throws IOException
- * @since 4.3
- */
-// public static List writeAndCompareBatchedUpdateCounts(int[] counts, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException {
-// FileOutputStream resultsOutputStream = null;
-// if (resultsFile != null) {
-// resultsOutputStream = new FileOutputStream(resultsFile);
-// }
-// BufferedReader expectedResultsReader = null;
-// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
-// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
-// }
-// return writeAndCompareBatchedUpdateCounts(counts, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
-// }
-
- /**
- * Compares the actual results with the expected results.
- * @param counts the result of the execution
- * @param resultsOutput OutputStream to which the results will be written. Can be null.
- * @param expectedResultsInput reader with which the expected results are read. Can be null.
- * @param defaultPrintStream the default stream to which to write the results. Can be null.
- * @return The List of line numbers which differ between the actual and expected results.
- * @since 4.3
- */
-// public static List writeAndCompareBatchedUpdateCounts(int[] counts, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
-// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
-// printBatchedUpdateCounts(counts, out);
-// return getUnequalLines(out);
-// }
-//
- /**
- * Compares the actual results with the expected results.
- * @param rs the result of the execution
- * @param maxColWidth the max width a column is allowed to have
- * @param printMetadata writes the metadata if true
- * @param resultsFile output file to which the results will be written. Can be null.
- * @param expectedResultsFile expected results file with which to compare the results. Can be null.
- * @param printToConsole writes to System.out if true
- * @return The List of line numbers which differ between the actual and expected results.
- * @throws IOException
- * @throws SQLException
- * @since 4.3
- */
- public static List writeAndCompareResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
- FileOutputStream resultsOutputStream = null;
- if (resultsFile != null) {
- resultsOutputStream = new FileOutputStream(resultsFile);
- }
- BufferedReader expectedResultsReader = null;
- if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
- expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
- }
- return writeAndCompareResultSet(rs, query, maxColWidth, printMetadata, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
- }
-
- /**
- * Compares the actual results with the expected results.
- * @param rs the result of the execution
- * @param maxColWidth the max width a column is allowed to have
- * @param printMetadata writes the metadata if true
- * @param resultsOutput OutputStream to which the results will be written. Can be null.
- * @param expectedResultsInput reader with which the expected results are read. Can be null.
- * @param defaultPrintStream the default stream to which to write the results. Can be null.
- * @return The List of line numbers which differ between the actual and expected results.
- * @throws SQLException
- * @since 4.3
- */
- public static List writeAndCompareResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) throws SQLException {
- PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
- printResultSet(rs, query, maxColWidth, printMetadata, out);
- return getUnequalLines(out);
- }
-
- public static List getUnequalLines(PrintStream out) {
- if (out instanceof ComparingPrintStream) {
- return ((ComparingPrintStream)out).getUnequalLines();
- }
- return Collections.EMPTY_LIST;
- }
-
-// public static List writeAndCompareThrowable(Throwable t, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
-// FileOutputStream resultsOutputStream = null;
-// if (resultsFile != null) {
-// resultsOutputStream = new FileOutputStream(resultsFile);
-// }
-// BufferedReader expectedResultsReader = null;
-// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
-// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
-// }
-// return writeAndCompareThrowable(t, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
-// }
-
-// public static List writeAndCompareThrowable(Throwable t, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) throws SQLException {
-// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
-// printThrowable(t, out);
-// return getUnequalLines(out);
-// }
-//
-// public static void printThrowable(Throwable t, PrintStream out) {
-// out.println(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
-// }
-
- public static void printUpdateCount(int updateCount, PrintStream out) {
- out.println("Update Count : " + updateCount); //$NON-NLS-1$
- }
-
- public static void printBatchedUpdateCounts(int[] counts, PrintStream out) {
- out.println("Batched Update Counts :"); //$NON-NLS-1$
- for (int i = 0; i < counts.length; i++) {
- out.println(counts[i]);
- }
- out.println("Total Batched Commands : " + counts.length); //$NON-NLS-1$
- }
-
- /**
- * Prints the ResultSet (and optionally the ResultSetMetaData) to a stream. If you're using the stream from getPrintStream(),
- * then you can also compare data with expected results.
- * @param rs
- * @param maxColWidth the max width a column is allowed to have. The column will be wider than this value only if the column name is longer.
- * @param printMetadata
- * @param out
- * @throws SQLException
- * @since 4.2
- */
- public static void printResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, PrintStream out) throws SQLException {
- if (maxColWidth < 0) {
- maxColWidth = DEFAULT_MAX_COL_WIDTH;
- }
-
- out.println(query);
-
- ResultSetMetaData rsmd = rs.getMetaData();
- int count = rsmd.getColumnCount();
- int[] sizes = new int[count];
- StringWriter types = new StringWriter();
- StringWriter columns = new StringWriter();
- for (int i = 1; i <= count; i++) {
- String columnName = rsmd.getColumnName(i);
- String typeName = rsmd.getColumnTypeName(i);
- if (maxColWidth == 0) {
- // Sets the width of the column to the wider of the column name and the column type name.
- sizes[i-1] = Math.max(columnName.length(), typeName.length());
- } else {
- // Sets the width of the column to the wider of the column name and the column display size (which cannot exceed maxColWidth).
- sizes[i-1] = Math.max(Math.max(columnName.length(), typeName.length()), // takes into account the type name width
- Math.min(rsmd.getColumnDisplaySize(i), maxColWidth));
- }
- types.write(resizeString(typeName, sizes[i-1]));
- columns.write(resizeString(columnName, sizes[i-1]));
- if (i != count) {
- types.write(SPACER);
- columns.write(SPACER);
- }
- }
- out.println(types.toString());
- out.println(columns.toString());
- int totalRows = 0;
- while (rs.next()) {
- for (int j = 1; j <= count; j++) {
- if (maxColWidth == 0) {
- Object obj = rs.getObject(j);
- out.print(obj == null ? NULL : obj); //$NON-NLS-1$
- if (j != count) out.print(SPACER);
- } else {
- String resizedString = resizeString(rs.getObject(j), sizes[j-1]);
- out.print(resizedString);
- if (j != count && resizedString.length() <= sizes[j-1]) {
- out.print(SPACER);
- }
- }
- }
- out.println();
- totalRows++;
- }
- out.println("Row Count : " + totalRows); //$NON-NLS-1$
- if (printMetadata) printResultSetMetadata(rsmd, out);
- }
-
- private static String[] METADATA_METHODS = {
- "getColumnName", //$NON-NLS-1$
- "getColumnType", //$NON-NLS-1$
- "getCatalogName", //$NON-NLS-1$
- "getColumnClassName", //$NON-NLS-1$
- "getColumnLabel", //$NON-NLS-1$
- "getColumnTypeName", //$NON-NLS-1$
- "getSchemaName", //$NON-NLS-1$
- "getTableName", //$NON-NLS-1$
- "getColumnDisplaySize", //$NON-NLS-1$
- "getPrecision", //$NON-NLS-1$
- "getScale", //$NON-NLS-1$
- "isAutoIncrement", //$NON-NLS-1$
- "isCaseSensitive", //$NON-NLS-1$
- "isCurrency", //$NON-NLS-1$
- "isDefinitelyWritable", //$NON-NLS-1$
- "isNullable", //$NON-NLS-1$
- "isReadOnly", //$NON-NLS-1$
- "isSearchable", //$NON-NLS-1$
- "isSigned", //$NON-NLS-1$
- "isWritable", //$NON-NLS-1$
- };
-
- /**
- * Prints the ResultSetMetaData values for each column
- * @param rsmd
- * @param out
- * @throws SQLException
- * @since 4.2
- */
- public static void printResultSetMetadata(ResultSetMetaData rsmd, PrintStream out) throws SQLException {
- int columns = rsmd.getColumnCount();
- Class RSMD = ResultSetMetaData.class;
- Class[] params = {int.class};
- int numMethods = METADATA_METHODS.length;
- String[][] metadataStrings = new String[columns][numMethods];
- // Init the widths of the columns
- int[] maxColWidths = new int[numMethods];
- for (int i = 0; i < numMethods; i++) {
- maxColWidths[i] = METADATA_METHODS[i].length();
- }
- // Buffer the metadata
- for (int col = 1; col <= columns; col++) {
- Object [] columnParam = {new Integer(col)};
- for (int i = 0; i < numMethods; i++) {
- try {
- Method m = RSMD.getMethod(METADATA_METHODS[i], params);
- Object obj = m.invoke(rsmd, columnParam);
- String stringVal = (obj == null) ? NULL : obj.toString(); //$NON-NLS-1$
- metadataStrings[col - 1][i] = stringVal;
- if (maxColWidths[i] < stringVal.length()) {
- maxColWidths[i] = stringVal.length();
- }
- } catch (Throwable t) {
-
- }
- }
- }
- // Print the header
- for (int i = 0; i < numMethods; i++) {
- out.print(resizeString(METADATA_METHODS[i], maxColWidths[i]));
- if (i != numMethods) {
- out.print(SPACER);
- }
- }
- out.println();
- // Print the metadata from the buffer
- for (int col = 0; col < columns; col++) {
- for (int i = 0; i < numMethods; i++) {
- out.print(resizeString(metadataStrings[col][i], maxColWidths[i]));
- if (i != numMethods) {
- out.print(SPACER);
- }
- }
- out.println();
- }
- }
-
- private static String resizeString(Object obj, int size) {
- if (obj == null) {
- return resizeString(NULL, size); //$NON-NLS-1$
- }
- String str = obj.toString();
- if (str.length() == size) {
- return str;
- } else if (str.length() < size) {
- return pad(str, size - str.length());
- } else {
- return str.substring(0, size) + MORE;
- }
- }
-
- private static String pad(String str, int padding) {
- StringBuffer buf = new StringBuffer(str);
- for (int i = 0; i < padding; i++) {
- buf.append(' ');
- }
- return buf.toString();
- }
-
- /**
- * Used to write the same data to more than one output stream.
- * @since 4.2
- */
- private static final class MuxingPrintStream extends PrintStream {
- private PrintStream[] streams;
- private MuxingPrintStream(PrintStream[] streams) {
- super(streams[0]);
- this.streams = new PrintStream[streams.length];
- System.arraycopy(streams, 0, this.streams, 0, streams.length);
- }
- public void close() {
- for (int i = 0; i < streams.length; i++) {
- streams[i].close();
- }
- }
- public void flush() {
- for (int i = 0; i < streams.length; i++) {
- streams[i].close();
- }
- }
- public void print(boolean b) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(b);
- }
- }
- public void print(char c) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(c);
- }
- }
- public void print(char[] s) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(s);
- }
- }
- public void print(double d) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(d);
- }
- }
- public void print(float f) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(f);
- }
- }
- public void print(int b) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(b);
- }
- }
- public void print(long l) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(l);
- }
- }
- public void print(Object obj) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(obj);
- }
- }
- public void print(String s) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].print(s);
- }
- }
- public void println() {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println();
- }
- }
- public void println(boolean x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(char x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(char[] x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(double x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(float x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(int x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(long x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(Object x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void println(String x) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].println(x);
- }
- }
- public void write(byte[] buf, int off, int len) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].write(buf, off, len);
- }
- }
- public void write(int b) {
- for (int i = 0; i < streams.length; i++) {
- streams[i].write(b);
- }
- }
- public void write(byte[] b) throws IOException {
- for (int i = 0; i < streams.length; i++) {
- streams[i].write(b);
- }
- }
- }
-
- /**
- * Used to compare (per line) the data being written to the output stream with
- * some expected data read from an input stream
- * @since 4.2
- */
- private static final class ComparingPrintStream extends PrintStream {
- private ByteArrayOutputStream byteStream = new ByteArrayOutputStream(2048);
- private PrintStream buf = new PrintStream(byteStream);
- private BufferedReader in;
- private int line = 0;
-
- private ArrayList unequalLines = new ArrayList();
-
- private ComparingPrintStream(OutputStream out, BufferedReader in) {
- super(out);
- this.in = in;
- }
-
- public void print(boolean b) {
- super.print(b);
- buf.print(b);
- }
- public void print(char c) {
- super.print(c);
- buf.print(c);
- }
- public void print(char[] s) {
- super.print(s);
- buf.print(s);
- }
- public void print(double d) {
- super.print(d);
- buf.print(d);
- }
- public void print(float f) {
- super.print(f);
- buf.print(f);
- }
- public void print(int i) {
- super.print(i);
- buf.print(i);
- }
- public void print(long l) {
- super.print(l);
- buf.print(l);
- }
- public void print(Object obj) {
- super.print(obj);
- buf.print(obj);
- }
- public void print(String s) {
- super.print(s);
- buf.print(s);
- }
- public void println() {
- super.println();
- compareLines();
- }
- public void println(boolean x) {
- super.println(x);
- compareLines();
- }
- public void println(char x) {
- super.println(x);
- compareLines();
- }
- public void println(char[] x) {
- super.println(x);
- compareLines();
- }
- public void println(double x) {
- super.println(x);
- compareLines();
- }
- public void println(float x) {
- super.println(x);
- compareLines();
- }
- public void println(int x) {
- super.println(x);
- compareLines();
- }
- public void println(long x) {
- super.println(x);
- compareLines();
- }
- public void println(Object x) {
- super.println(x);
- compareLines();
- }
- public void println(String x) {
- super.println(x);
- compareLines();
- }
-
- private void compareLines() {
- line++;
- buf.flush();
- String bufferedLine = byteStream.toString();
- byteStream.reset();
- try {
- String expectedLine = in.readLine();
- if (!bufferedLine.equals(expectedLine)) {
- unequalLines.add("\n" + new Integer(line) + ":" + bufferedLine );
- }
- } catch (IOException e) {
-
- }
- }
-
- public List getUnequalLines() {
- return unequalLines;
- }
- }
-
-}
Copied: tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java (from rev 2886, branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java)
===================================================================
--- tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java (rev 0)
+++ tags/teiid-parent-7.3.0.Final/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,698 @@
+/*
+ * 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.test.util;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.teiid.jdbc.TeiidSQLException;
+
+
+
+/**
+ * TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
+ * in order to call out.print instead of out.println
+ * This is because the println adds a line terminator, and when the result file is in turn used for
+ * comparison it fails because of the line terminator.
+ *
+ * @since
+ */
+public class TestResultSetUtil {
+
+
+ public static final int DEFAULT_MAX_COL_WIDTH = 29;
+ private static final String SPACER = " "; //$NON-NLS-1$
+ private static final String NULL = "<null>"; //$NON-NLS-1$
+ private static final String MORE = "$ ";
+
+
+ public static List compareThrowable(Throwable t, String query, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
+ BufferedReader expectedResultsReader = null;
+ if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
+ expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
+ }
+
+ PrintStream out = TestResultSetUtil.getPrintStream(null,expectedResultsReader, printToConsole ? System.out : null);
+
+ printThrowable(t, query, out);
+ return TestResultSetUtil.getUnequalLines(out);
+ }
+
+
+ public static void printThrowable(Throwable t, String sql, PrintStream out) {
+ out.println(sql);
+
+ Throwable answer = t;
+ if (t instanceof TeiidSQLException) {
+ TeiidSQLException sqle = (TeiidSQLException) t;
+ SQLException se = sqle.getNextException();
+ if (se != null) {
+ SQLException s = null;
+ while( (s = se.getNextException()) != null) {
+ se = s;
+ }
+
+ answer = se;
+ }
+ }
+
+ out.print(t.getClass().getName() + " : " + answer.getMessage()); //$NON-NLS-1$
+
+ }
+
+
+
+ /**
+ * Gets a PrintStream implementation that uses the input parameters as underlying streams
+ * @param resultsOutput an output file for result data. If null, results will only be written to the defaul stream.
+ * @param expectedResultsInput the reader for expected data. If null, actual data is never compared against expected results.
+ * @param defaultPrintStream if not null, this utility will always write to this stream. Typically this is System.out
+ * @return the single PrintStream that wraps all the input streams for writing and comparison.
+ * @since 4.2
+ */
+ public static PrintStream getPrintStream(OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
+ PrintStream out = null;
+ if (defaultPrintStream == null) {
+ defaultPrintStream = new PrintStream(new OutputStream () {
+ public void write(int b) throws IOException {}
+ });
+ }
+ if (resultsOutput == null && expectedResultsInput == null) {
+ out = defaultPrintStream;
+ } else if (resultsOutput == null && expectedResultsInput != null) {
+ out = new ComparingPrintStream(defaultPrintStream, expectedResultsInput);
+ } else if (resultsOutput!= null && expectedResultsInput == null) {
+ PrintStream filePrintStream = new PrintStream(resultsOutput);
+ out = new MuxingPrintStream(new PrintStream[] {defaultPrintStream, filePrintStream});
+ } else {
+ PrintStream filePrintStream = new PrintStream(resultsOutput);
+ out = new ComparingPrintStream(new MuxingPrintStream(new PrintStream[] {defaultPrintStream, filePrintStream}), expectedResultsInput);
+ }
+ return out;
+ }
+
+ /**
+ * Compares the actual results with the expected results.
+ * @param updateCount the result of the execution
+ * @param resultsFile output file to which the results will be written. Can be null.
+ * @param expectedResultsFile expected results file with which to compare the results. Can be null.
+ * @param printToConsole writes to System.out if true
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @throws IOException
+ * @since 4.3
+ */
+// public static List writeAndCompareUpdateCount(int updateCount, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException {
+// FileOutputStream resultsOutputStream = null;
+// if (resultsFile != null) {
+// resultsOutputStream = new FileOutputStream(resultsFile);
+// }
+// BufferedReader expectedResultsReader = null;
+// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
+// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
+// }
+// return writeAndCompareUpdateCount(updateCount, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
+// }
+
+ /**
+ * Compares the actual results with the expected results.
+ * @param updateCount the result of the execution
+ * @param resultsOutput OutputStream to which the results will be written. Can be null.
+ * @param expectedResultsInput reader with which the expected results are read. Can be null.
+ * @param defaultPrintStream the default stream to which to write the results. Can be null.
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @since 4.3
+ */
+// public static List writeAndCompareUpdateCount(int updateCount, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
+// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
+// printUpdateCount(updateCount, out);
+// return getUnequalLines(out);
+// }
+
+ /**
+ * Compares the actual results with the expected results.
+ * @param counts the result of the execution
+ * @param resultsFile output file to which the results will be written. Can be null.
+ * @param expectedResultsFile expected results file with which to compare the results. Can be null.
+ * @param printToConsole writes to System.out if true
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @throws IOException
+ * @since 4.3
+ */
+// public static List writeAndCompareBatchedUpdateCounts(int[] counts, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException {
+// FileOutputStream resultsOutputStream = null;
+// if (resultsFile != null) {
+// resultsOutputStream = new FileOutputStream(resultsFile);
+// }
+// BufferedReader expectedResultsReader = null;
+// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
+// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
+// }
+// return writeAndCompareBatchedUpdateCounts(counts, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
+// }
+
+ /**
+ * Compares the actual results with the expected results.
+ * @param counts the result of the execution
+ * @param resultsOutput OutputStream to which the results will be written. Can be null.
+ * @param expectedResultsInput reader with which the expected results are read. Can be null.
+ * @param defaultPrintStream the default stream to which to write the results. Can be null.
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @since 4.3
+ */
+// public static List writeAndCompareBatchedUpdateCounts(int[] counts, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) {
+// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
+// printBatchedUpdateCounts(counts, out);
+// return getUnequalLines(out);
+// }
+//
+ /**
+ * Compares the actual results with the expected results.
+ * @param rs the result of the execution
+ * @param maxColWidth the max width a column is allowed to have
+ * @param printMetadata writes the metadata if true
+ * @param resultsFile output file to which the results will be written. Can be null.
+ * @param expectedResultsFile expected results file with which to compare the results. Can be null.
+ * @param printToConsole writes to System.out if true
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @throws IOException
+ * @throws SQLException
+ * @since 4.3
+ */
+ public static List writeAndCompareResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
+ FileOutputStream resultsOutputStream = null;
+ if (resultsFile != null) {
+ resultsOutputStream = new FileOutputStream(resultsFile);
+ }
+ BufferedReader expectedResultsReader = null;
+ if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
+ expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
+ }
+ return writeAndCompareResultSet(rs, query, maxColWidth, printMetadata, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
+ }
+
+ /**
+ * Compares the actual results with the expected results.
+ * @param rs the result of the execution
+ * @param maxColWidth the max width a column is allowed to have
+ * @param printMetadata writes the metadata if true
+ * @param resultsOutput OutputStream to which the results will be written. Can be null.
+ * @param expectedResultsInput reader with which the expected results are read. Can be null.
+ * @param defaultPrintStream the default stream to which to write the results. Can be null.
+ * @return The List of line numbers which differ between the actual and expected results.
+ * @throws SQLException
+ * @since 4.3
+ */
+ public static List writeAndCompareResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) throws SQLException {
+ PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
+ printResultSet(rs, query, maxColWidth, printMetadata, out);
+ return getUnequalLines(out);
+ }
+
+ public static List getUnequalLines(PrintStream out) {
+ if (out instanceof ComparingPrintStream) {
+ return ((ComparingPrintStream)out).getUnequalLines();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+// public static List writeAndCompareThrowable(Throwable t, File resultsFile, File expectedResultsFile, boolean printToConsole) throws IOException, SQLException {
+// FileOutputStream resultsOutputStream = null;
+// if (resultsFile != null) {
+// resultsOutputStream = new FileOutputStream(resultsFile);
+// }
+// BufferedReader expectedResultsReader = null;
+// if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
+// expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
+// }
+// return writeAndCompareThrowable(t, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
+// }
+
+// public static List writeAndCompareThrowable(Throwable t, OutputStream resultsOutput, BufferedReader expectedResultsInput, PrintStream defaultPrintStream) throws SQLException {
+// PrintStream out = getPrintStream(resultsOutput, expectedResultsInput, defaultPrintStream);
+// printThrowable(t, out);
+// return getUnequalLines(out);
+// }
+//
+// public static void printThrowable(Throwable t, PrintStream out) {
+// out.println(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
+// }
+
+ public static void printUpdateCount(int updateCount, PrintStream out) {
+ out.println("Update Count : " + updateCount); //$NON-NLS-1$
+ }
+
+ public static void printBatchedUpdateCounts(int[] counts, PrintStream out) {
+ out.println("Batched Update Counts :"); //$NON-NLS-1$
+ for (int i = 0; i < counts.length; i++) {
+ out.println(counts[i]);
+ }
+ out.println("Total Batched Commands : " + counts.length); //$NON-NLS-1$
+ }
+
+ /**
+ * Prints the ResultSet (and optionally the ResultSetMetaData) to a stream. If you're using the stream from getPrintStream(),
+ * then you can also compare data with expected results.
+ * @param rs
+ * @param maxColWidth the max width a column is allowed to have. The column will be wider than this value only if the column name is longer.
+ * @param printMetadata
+ * @param out
+ * @throws SQLException
+ * @since 4.2
+ */
+ public static void printResultSet(ResultSet rs, String query, int maxColWidth, boolean printMetadata, PrintStream out) throws SQLException {
+ if (maxColWidth < 0) {
+ maxColWidth = DEFAULT_MAX_COL_WIDTH;
+ }
+
+ out.println(query);
+
+ ResultSetMetaData rsmd = rs.getMetaData();
+ int count = rsmd.getColumnCount();
+ int[] sizes = new int[count];
+ StringWriter types = new StringWriter();
+ StringWriter columns = new StringWriter();
+ for (int i = 1; i <= count; i++) {
+ String columnName = rsmd.getColumnName(i);
+ String typeName = rsmd.getColumnTypeName(i);
+ if (maxColWidth == 0) {
+ // Sets the width of the column to the wider of the column name and the column type name.
+ sizes[i-1] = Math.max(columnName.length(), typeName.length());
+ } else {
+ // Sets the width of the column to the wider of the column name and the column display size (which cannot exceed maxColWidth).
+ sizes[i-1] = Math.max(Math.max(columnName.length(), typeName.length()), // takes into account the type name width
+ Math.min(rsmd.getColumnDisplaySize(i), maxColWidth));
+ }
+ types.write(resizeString(typeName, sizes[i-1]));
+ columns.write(resizeString(columnName, sizes[i-1]));
+ if (i != count) {
+ types.write(SPACER);
+ columns.write(SPACER);
+ }
+ }
+ out.println(types.toString());
+ out.println(columns.toString());
+ int totalRows = 0;
+ while (rs.next()) {
+ for (int j = 1; j <= count; j++) {
+ if (maxColWidth == 0) {
+ Object obj = rs.getObject(j);
+ out.print(obj == null ? NULL : obj); //$NON-NLS-1$
+ if (j != count) out.print(SPACER);
+ } else {
+ String resizedString = resizeString(rs.getObject(j), sizes[j-1]);
+ out.print(resizedString);
+ if (j != count && resizedString.length() <= sizes[j-1]) {
+ out.print(SPACER);
+ }
+ }
+ }
+ out.println();
+ totalRows++;
+ }
+ out.println("Row Count : " + totalRows); //$NON-NLS-1$
+ if (printMetadata) printResultSetMetadata(rsmd, out);
+ }
+
+ private static String[] METADATA_METHODS = {
+ "getColumnName", //$NON-NLS-1$
+ "getColumnType", //$NON-NLS-1$
+ "getCatalogName", //$NON-NLS-1$
+ "getColumnClassName", //$NON-NLS-1$
+ "getColumnLabel", //$NON-NLS-1$
+ "getColumnTypeName", //$NON-NLS-1$
+ "getSchemaName", //$NON-NLS-1$
+ "getTableName", //$NON-NLS-1$
+ "getColumnDisplaySize", //$NON-NLS-1$
+ "getPrecision", //$NON-NLS-1$
+ "getScale", //$NON-NLS-1$
+ "isAutoIncrement", //$NON-NLS-1$
+ "isCaseSensitive", //$NON-NLS-1$
+ "isCurrency", //$NON-NLS-1$
+ "isDefinitelyWritable", //$NON-NLS-1$
+ "isNullable", //$NON-NLS-1$
+ "isReadOnly", //$NON-NLS-1$
+ "isSearchable", //$NON-NLS-1$
+ "isSigned", //$NON-NLS-1$
+ "isWritable", //$NON-NLS-1$
+ };
+
+ /**
+ * Prints the ResultSetMetaData values for each column
+ * @param rsmd
+ * @param out
+ * @throws SQLException
+ * @since 4.2
+ */
+ public static void printResultSetMetadata(ResultSetMetaData rsmd, PrintStream out) throws SQLException {
+ int columns = rsmd.getColumnCount();
+ Class RSMD = ResultSetMetaData.class;
+ Class[] params = {int.class};
+ int numMethods = METADATA_METHODS.length;
+ String[][] metadataStrings = new String[columns][numMethods];
+ // Init the widths of the columns
+ int[] maxColWidths = new int[numMethods];
+ for (int i = 0; i < numMethods; i++) {
+ maxColWidths[i] = METADATA_METHODS[i].length();
+ }
+ // Buffer the metadata
+ for (int col = 1; col <= columns; col++) {
+ Object [] columnParam = {new Integer(col)};
+ for (int i = 0; i < numMethods; i++) {
+ try {
+ Method m = RSMD.getMethod(METADATA_METHODS[i], params);
+ Object obj = m.invoke(rsmd, columnParam);
+ String stringVal = (obj == null) ? NULL : obj.toString(); //$NON-NLS-1$
+ metadataStrings[col - 1][i] = stringVal;
+ if (maxColWidths[i] < stringVal.length()) {
+ maxColWidths[i] = stringVal.length();
+ }
+ } catch (Throwable t) {
+
+ }
+ }
+ }
+ // Print the header
+ for (int i = 0; i < numMethods; i++) {
+ out.print(resizeString(METADATA_METHODS[i], maxColWidths[i]));
+ if (i != numMethods) {
+ out.print(SPACER);
+ }
+ }
+ out.println();
+ // Print the metadata from the buffer
+ for (int col = 0; col < columns; col++) {
+ for (int i = 0; i < numMethods; i++) {
+ out.print(resizeString(metadataStrings[col][i], maxColWidths[i]));
+ if (i != numMethods) {
+ out.print(SPACER);
+ }
+ }
+ out.println();
+ }
+ }
+
+ private static String resizeString(Object obj, int size) {
+ if (obj == null) {
+ return resizeString(NULL, size); //$NON-NLS-1$
+ }
+ String str = obj.toString();
+ if (str.length() == size) {
+ return str;
+ } else if (str.length() < size) {
+ return pad(str, size - str.length());
+ } else {
+ return str.substring(0, size) + MORE;
+ }
+ }
+
+ private static String pad(String str, int padding) {
+ StringBuffer buf = new StringBuffer(str);
+ for (int i = 0; i < padding; i++) {
+ buf.append(' ');
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Used to write the same data to more than one output stream.
+ * @since 4.2
+ */
+ private static final class MuxingPrintStream extends PrintStream {
+ private PrintStream[] streams;
+ private MuxingPrintStream(PrintStream[] streams) {
+ super(streams[0]);
+ this.streams = new PrintStream[streams.length];
+ System.arraycopy(streams, 0, this.streams, 0, streams.length);
+ }
+ public void close() {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].close();
+ }
+ }
+ public void flush() {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].close();
+ }
+ }
+ public void print(boolean b) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(b);
+ }
+ }
+ public void print(char c) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(c);
+ }
+ }
+ public void print(char[] s) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(s);
+ }
+ }
+ public void print(double d) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(d);
+ }
+ }
+ public void print(float f) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(f);
+ }
+ }
+ public void print(int b) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(b);
+ }
+ }
+ public void print(long l) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(l);
+ }
+ }
+ public void print(Object obj) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(obj);
+ }
+ }
+ public void print(String s) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].print(s);
+ }
+ }
+ public void println() {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println();
+ }
+ }
+ public void println(boolean x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(char x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(char[] x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(double x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(float x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(int x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(long x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(Object x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void println(String x) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].println(x);
+ }
+ }
+ public void write(byte[] buf, int off, int len) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].write(buf, off, len);
+ }
+ }
+ public void write(int b) {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].write(b);
+ }
+ }
+ public void write(byte[] b) throws IOException {
+ for (int i = 0; i < streams.length; i++) {
+ streams[i].write(b);
+ }
+ }
+ }
+
+ /**
+ * Used to compare (per line) the data being written to the output stream with
+ * some expected data read from an input stream
+ * @since 4.2
+ */
+ private static final class ComparingPrintStream extends PrintStream {
+ private ByteArrayOutputStream byteStream = new ByteArrayOutputStream(2048);
+ private PrintStream buf = new PrintStream(byteStream);
+ private BufferedReader in;
+ private int line = 0;
+
+ private ArrayList unequalLines = new ArrayList();
+
+ private ComparingPrintStream(OutputStream out, BufferedReader in) {
+ super(out);
+ this.in = in;
+ }
+
+ public void print(boolean b) {
+ super.print(b);
+ buf.print(b);
+ }
+ public void print(char c) {
+ super.print(c);
+ buf.print(c);
+ }
+ public void print(char[] s) {
+ super.print(s);
+ buf.print(s);
+ }
+ public void print(double d) {
+ super.print(d);
+ buf.print(d);
+ }
+ public void print(float f) {
+ super.print(f);
+ buf.print(f);
+ }
+ public void print(int i) {
+ super.print(i);
+ buf.print(i);
+ }
+ public void print(long l) {
+ super.print(l);
+ buf.print(l);
+ }
+ public void print(Object obj) {
+ super.print(obj);
+ buf.print(obj);
+ }
+ public void print(String s) {
+ super.print(s);
+ buf.print(s);
+ }
+ public void println() {
+ super.println();
+ compareLines();
+ }
+ public void println(boolean x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(char x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(char[] x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(double x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(float x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(int x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(long x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(Object x) {
+ super.println(x);
+ compareLines();
+ }
+ public void println(String x) {
+ super.println(x);
+ compareLines();
+ }
+
+ private void compareLines() {
+ line++;
+ buf.flush();
+ String bufferedLine = byteStream.toString();
+ byteStream.reset();
+ try {
+ String expectedLine = in.readLine();
+ if (!bufferedLine.equals(expectedLine)) {
+ unequalLines.add("\n" + new Integer(line) + ":" + bufferedLine );
+ }
+ } catch (IOException e) {
+
+ }
+ }
+
+ public List getUnequalLines() {
+ return unequalLines;
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.3.0.Final/test-integration/pom.xml
===================================================================
--- branches/7.3.x/test-integration/pom.xml 2011-01-27 03:26:46 UTC (rev 2878)
+++ tags/teiid-parent-7.3.0.Final/test-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-test-integration</artifactId>
- <packaging>pom</packaging>
- <name>Integration Tests</name>
- <description>Integration tests spanning server/embedded/connectors.</description>
-
- <properties>
- <derby.version>10.2.1.6</derby.version>
- <mysql.connector.version>5.1.5</mysql.connector.version>
- <postgresql.version>8.3-603.jdbc3</postgresql.version>
-
- <apache.ant.version>1.7.0</apache.ant.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>translator-jdbc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <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>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-adminshell</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-runtime</artifactId>
- </dependency>
-
- <!-- external dependencies -->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
-
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
- <modules>
- <module>common</module>
- <module>db</module>
- </modules>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.3.0.Final/test-integration/pom.xml (from rev 2888, branches/7.3.x/test-integration/pom.xml)
===================================================================
--- tags/teiid-parent-7.3.0.Final/test-integration/pom.xml (rev 0)
+++ tags/teiid-parent-7.3.0.Final/test-integration/pom.xml 2011-01-31 16:08:16 UTC (rev 2889)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.3.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-test-integration</artifactId>
+ <packaging>pom</packaging>
+ <name>Integration Tests</name>
+ <description>Integration tests spanning server/embedded/connectors.</description>
+
+ <properties>
+ <derby.version>10.2.1.6</derby.version>
+ <mysql.connector.version>5.1.5</mysql.connector.version>
+ <postgresql.version>8.3-603.jdbc3</postgresql.version>
+
+ <apache.ant.version>1.7.0</apache.ant.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>translator-jdbc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <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>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-adminshell</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ </dependency>
+
+ <!-- external dependencies -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <modules>
+ <module>common</module>
+ <module>db</module>
+ </modules>
+</project>
\ No newline at end of file
13 years, 10 months
teiid SVN: r2888 - in branches/7.3.x: adminshell and 35 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 11:05:08 -0500 (Mon, 31 Jan 2011)
New Revision: 2888
Modified:
branches/7.3.x/adminshell/pom.xml
branches/7.3.x/api/pom.xml
branches/7.3.x/build/pom.xml
branches/7.3.x/cache-jbosscache/pom.xml
branches/7.3.x/client/pom.xml
branches/7.3.x/common-core/pom.xml
branches/7.3.x/connectors/connector-file/pom.xml
branches/7.3.x/connectors/connector-ldap/pom.xml
branches/7.3.x/connectors/connector-salesforce/pom.xml
branches/7.3.x/connectors/connector-ws/pom.xml
branches/7.3.x/connectors/pom.xml
branches/7.3.x/connectors/salesforce-api/pom.xml
branches/7.3.x/connectors/sandbox/pom.xml
branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml
branches/7.3.x/connectors/translator-file/pom.xml
branches/7.3.x/connectors/translator-jdbc/pom.xml
branches/7.3.x/connectors/translator-ldap/pom.xml
branches/7.3.x/connectors/translator-loopback/pom.xml
branches/7.3.x/connectors/translator-salesforce/pom.xml
branches/7.3.x/connectors/translator-ws/pom.xml
branches/7.3.x/console/pom.xml
branches/7.3.x/documentation/admin-guide/pom.xml
branches/7.3.x/documentation/caching-guide/pom.xml
branches/7.3.x/documentation/client-developers-guide/pom.xml
branches/7.3.x/documentation/developer-guide/pom.xml
branches/7.3.x/documentation/pom.xml
branches/7.3.x/documentation/quick-start-example/pom.xml
branches/7.3.x/documentation/reference/pom.xml
branches/7.3.x/engine/pom.xml
branches/7.3.x/hibernate-dialect/pom.xml
branches/7.3.x/jboss-integration/pom.xml
branches/7.3.x/metadata/pom.xml
branches/7.3.x/pom.xml
branches/7.3.x/runtime/pom.xml
branches/7.3.x/test-integration/common/pom.xml
branches/7.3.x/test-integration/db/pom.xml
branches/7.3.x/test-integration/pom.xml
Log:
[maven-release-plugin] prepare release teiid-parent-7.3.0.Final
Modified: branches/7.3.x/adminshell/pom.xml
===================================================================
--- branches/7.3.x/adminshell/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/adminshell/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: branches/7.3.x/api/pom.xml
===================================================================
--- branches/7.3.x/api/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/api/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: branches/7.3.x/build/pom.xml
===================================================================
--- branches/7.3.x/build/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/build/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: branches/7.3.x/cache-jbosscache/pom.xml
===================================================================
--- branches/7.3.x/cache-jbosscache/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/cache-jbosscache/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: branches/7.3.x/client/pom.xml
===================================================================
--- branches/7.3.x/client/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/client/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: branches/7.3.x/common-core/pom.xml
===================================================================
--- branches/7.3.x/common-core/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/common-core/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: branches/7.3.x/connectors/connector-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-file/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/connector-file/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: branches/7.3.x/connectors/connector-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ldap/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/connector-ldap/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: branches/7.3.x/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-salesforce/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/connector-salesforce/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: branches/7.3.x/connectors/connector-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/connector-ws/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/connector-ws/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: branches/7.3.x/connectors/pom.xml
===================================================================
--- branches/7.3.x/connectors/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/connectors/salesforce-api/pom.xml
===================================================================
--- branches/7.3.x/connectors/salesforce-api/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/salesforce-api/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: branches/7.3.x/connectors/sandbox/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/sandbox/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/sandbox/translator-yahoo/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: branches/7.3.x/connectors/translator-file/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-file/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-file/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: branches/7.3.x/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-jdbc/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-jdbc/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: branches/7.3.x/connectors/translator-ldap/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ldap/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-ldap/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: branches/7.3.x/connectors/translator-loopback/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-loopback/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-loopback/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: branches/7.3.x/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-salesforce/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: branches/7.3.x/connectors/translator-ws/pom.xml
===================================================================
--- branches/7.3.x/connectors/translator-ws/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/connectors/translator-ws/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: branches/7.3.x/console/pom.xml
===================================================================
--- branches/7.3.x/console/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/console/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.3.x/documentation/admin-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/admin-guide/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/admin-guide/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: branches/7.3.x/documentation/caching-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/caching-guide/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/caching-guide/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: branches/7.3.x/documentation/client-developers-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/client-developers-guide/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/client-developers-guide/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: branches/7.3.x/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.3.x/documentation/developer-guide/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/developer-guide/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: branches/7.3.x/documentation/pom.xml
===================================================================
--- branches/7.3.x/documentation/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/documentation/quick-start-example/pom.xml
===================================================================
--- branches/7.3.x/documentation/quick-start-example/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/quick-start-example/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: branches/7.3.x/documentation/reference/pom.xml
===================================================================
--- branches/7.3.x/documentation/reference/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/documentation/reference/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: branches/7.3.x/engine/pom.xml
===================================================================
--- branches/7.3.x/engine/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/engine/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: branches/7.3.x/hibernate-dialect/pom.xml
===================================================================
--- branches/7.3.x/hibernate-dialect/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/hibernate-dialect/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: branches/7.3.x/jboss-integration/pom.xml
===================================================================
--- branches/7.3.x/jboss-integration/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/jboss-integration/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/metadata/pom.xml
===================================================================
--- branches/7.3.x/metadata/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/metadata/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: branches/7.3.x/pom.xml
===================================================================
--- branches/7.3.x/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -5,15 +5,15 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.3.0.Final</developerConnection>
</scm>
<licenses>
<license>
Modified: branches/7.3.x/runtime/pom.xml
===================================================================
--- branches/7.3.x/runtime/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/runtime/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.3.x/test-integration/common/pom.xml
===================================================================
--- branches/7.3.x/test-integration/common/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/test-integration/common/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: branches/7.3.x/test-integration/db/pom.xml
===================================================================
--- branches/7.3.x/test-integration/db/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/test-integration/db/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.3.x/test-integration/pom.xml
===================================================================
--- branches/7.3.x/test-integration/pom.xml 2011-01-31 15:41:27 UTC (rev 2887)
+++ branches/7.3.x/test-integration/pom.xml 2011-01-31 16:05:08 UTC (rev 2888)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.3.0.CR2-SNAPSHOT</version>
+ <version>7.3.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
13 years, 10 months
teiid SVN: r2887 - branches/7.3.x/build/kits/jboss-container.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 10:41:27 -0500 (Mon, 31 Jan 2011)
New Revision: 2887
Modified:
branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html
Log:
adding missing issue
Modified: branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 15:36:30 UTC (rev 2886)
+++ branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 15:41:27 UTC (rev 2887)
@@ -263,6 +263,8 @@
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-1451'>TEIID-1451</a>] - Teiid does not handle failover correctly
</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1456'>TEIID-1456</a>] - Processing errors after the first batch has been returned may not be reported
+</li>
</ul>
<h2> Feature Request
13 years, 10 months
teiid SVN: r2886 - in branches/7.3.x: build/kits/jboss-container/deploy/teiid and 13 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 10:36:30 -0500 (Mon, 31 Jan 2011)
New Revision: 2886
Added:
branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java
Removed:
branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java
Modified:
branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt
branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java
branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java
branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
Log:
forward merge from 7.1.1 and an update to the releasenotes
Modified: branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt
===================================================================
--- branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/build/kits/jboss-container/COPYRIGHT.txt 2011-01-31 15:36:30 UTC (rev 2886)
@@ -1,4 +1,4 @@
-Portions Copyright (C) 2008-2009 Red Hat, Inc.
+Portions Copyright (C) 2008-2011 Red Hat, Inc.
Portions Copyright (C) 2000-2007 MetaMatrix, Inc.
Portions Copyright (c) 2000, 2003, 2008 IBM Corporation and others.
Portions Copyright (c) 1997-2000 Sun Microsystems, Inc.
\ No newline at end of file
Modified: branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-31 15:36:30 UTC (rev 2886)
@@ -66,7 +66,8 @@
<!-- Allowed values are LRU, EXPIRATION.
Setting this value to LRU will cause cache hint TTL values
to be ignored. (default EXPIRATION) -->
- <property name="type">EXPIRATION</property>
+ <property name="type">EXPIRATION</property>
+ <property name="location">resultset</property>
</bean>
<bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
Modified: branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/build/kits/jboss-container/teiid-releasenotes.html 2011-01-31 15:36:30 UTC (rev 2886)
@@ -10,7 +10,7 @@
<P><A HREF="http://www.teiid.org/"><IMG SRC="https://www.jboss.org/dms/teiid/images/teiid-banner.png" NAME="graphics1" ALT="Teiid" ALIGN=BOTTOM WIDTH=800></A>
<H1>Teiid ${project.version} Release Notes</H1>
-<P>Teiid ${project.version} adds performance and integration features.
+<P>Teiid ${project.version} adds updatable view, performance, and integration features.
<H2>Overview</H2>
<UL>
@@ -175,7 +175,147 @@
<h2><a name="Details">Detailed Release Notes</a></h2>
Detailed Release Notes - Teiid - Version ${project.version}
-
+
+<h2> Bug
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-89'>TEIID-89</a>] - Data roles should account for the ability to create temp tables
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1350'>TEIID-1350</a>] - Teiid 7.2 in JBoss EAP cluster (with clustered cache on) will not deploy VDBs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1357'>TEIID-1357</a>] - Provide an example of an ODBC ds file to be used with a JDBC-ODBC bridge connection
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1360'>TEIID-1360</a>] - with clause not processed in views
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1361'>TEIID-1361</a>] - Salesforce IN predicate handling
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1362'>TEIID-1362</a>] - salesforce push down queries won't get resolved correctly
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1370'>TEIID-1370</a>] - Error Code:107 Message:'The column prefix 'custsale' does not match with a table name or alias name used in the query - But query is valid
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1372'>TEIID-1372</a>] - Change the default Teiid user from "admin" to something else
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1373'>TEIID-1373</a>] - Document that 'OID' column in the system tables is not durable across different versions of the same VDB.
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1381'>TEIID-1381</a>] - pushdown validation not accurate for all update
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1387'>TEIID-1387</a>] - Restrict access of default port 31000 to JDBC and 31443 to Admin connections
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1390'>TEIID-1390</a>] - Partial multi-byte char values misread in InputStreamReader
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1391'>TEIID-1391</a>] - Changes to the use of SSL when connecting with the Teiid Driver are ignored after a successful connection
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1395'>TEIID-1395</a>] - XMLPARSE error message references XMLSERIALIZE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1396'>TEIID-1396</a>] - XML_PLAN output to server log too verbose for DEBUG level logging
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1399'>TEIID-1399</a>] - Adding ORDER BY to SELECT COUNT(*) FROM ... returns org.teiid.core.TeiidProcessingException: null to client - Needs clearer message
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1401'>TEIID-1401</a>] - QueryRewriter issue with certain UDFs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1402'>TEIID-1402</a>] - SELECTing data from salesforce with a WHERE condition which includes ID results in a NPE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1404'>TEIID-1404</a>] - The teiid runtime jar overrides commons logging configuration
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1406'>TEIID-1406</a>] - Salesforce connector does not parse {ts'2003-03-11 11:42:10.5'} - gets mismatched character ' ' expecting ':'
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1407'>TEIID-1407</a>] - Client code fails while inserting "lobs" in few situations
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1408'>TEIID-1408</a>] - SalesForce.com - Unable to get managed connection - java.lang.NullPointerException
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1410'>TEIID-1410</a>] - MALFORMED Query when trying to execute a query with OUTER JOINs which only contains elements from JOINed source
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1411'>TEIID-1411</a>] - Incorrect IN behavior when using a SELECT clause as IN values
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1414'>TEIID-1414</a>] - Execution of a Prepared Statement may receive LanguageBridgeFactory AssertionError
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1416'>TEIID-1416</a>] - Admin console shows no information about sessions
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1418'>TEIID-1418</a>] - Metadata loaded incorrectly
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1420'>TEIID-1420</a>] - Adminshell getTransactions() fails - exception = org.teiid.adminapi.AdminComponentException:
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1422'>TEIID-1422</a>] - Limit pushing can result in inconsistent xml results
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1426'>TEIID-1426</a>] - NPE when SELECTing NULL columns from JOINed tables
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1427'>TEIID-1427</a>] - Class not found in Teiid JON agent
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1428'>TEIID-1428</a>] - ODBC connection fails if the TeiidDriver is not registered.
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1434'>TEIID-1434</a>] - Example dynamicvdb-portfolio customer-schema.sql INSERT INTO HOLDINGS has PRODUCT_ID references that don't exist in PRODUCT table causing sql to fail
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1435'>TEIID-1435</a>] - SQL type boolean imported as object for dynamic vdbs
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1439'>TEIID-1439</a>] - Adminshell/API - sequence of datasource creation/VDB deployment and queries results in deployment error
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1441'>TEIID-1441</a>] - java.lang.NullPointerException - on queries involving lookup (temp table cache does not have buffermanager set on it)
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1442'>TEIID-1442</a>] - clearCache("QUERY_SERVICE_RESULT_SET_CACHE") - in ER7 - totalEntries is not reset to zero
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1443'>TEIID-1443</a>] - SalesForce connector execution of procedure fails with NPE
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1444'>TEIID-1444</a>] - Jopr Plugin has description for refreshing Materialized Views that's awkward: "Refresh a given any Materialized View for this VDB"
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1445'>TEIID-1445</a>] - ConcurrentModificationException during the startup of the Server
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1446'>TEIID-1446</a>] - Error during startup when CXF is installed
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1451'>TEIID-1451</a>] - Teiid does not handle failover correctly
+</li>
+</ul>
+
+<h2> Feature Request
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-146'>TEIID-146</a>] - Translate Criteria enhancement
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-192'>TEIID-192</a>] - Add the ability to switch the identity on connections
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-211'>TEIID-211</a>] - subquery optimization
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-229'>TEIID-229</a>] - Support update of the view column using a column
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-231'>TEIID-231</a>] - Ability to support Connector Level UDF functions in the System
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1227'>TEIID-1227</a>] - Lob values should be cachable
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1253'>TEIID-1253</a>] - Allow for cache scope to be set in the cache hint
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1267'>TEIID-1267</a>] - Add support for non-pushdown subquery evaluation on update statements
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1330'>TEIID-1330</a>] - API request: Delegating Translator
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1338'>TEIID-1338</a>] - Add transitive join conditions across sources
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1349'>TEIID-1349</a>] - Better default update procedure handling
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1351'>TEIID-1351</a>] - Replace translate criteria
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1376'>TEIID-1376</a>] - Add support for pushing joins through a union
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1385'>TEIID-1385</a>] - Add a way to support escaped strings
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1389'>TEIID-1389</a>] - Add additional detection for conflicting criteria to help optimize query plan
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1412'>TEIID-1412</a>] - Teiid should take care of salesforce query limits by itself
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1421'>TEIID-1421</a>] - Support better scrolling of cached results
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1433'>TEIID-1433</a>] - Temp tables should support count(*)
+</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1440'>TEIID-1440</a>] - Add support for not null and auto increment for temp table columns
+</li>
+</ul>
+
+<h2> Quality Risk
+</h2>
+<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1368'>TEIID-1368</a>] - "Each" should be a parser keyword
+</li>
+</ul>
+
+
<h2><a name="Documentation">Documentation and Help</a></h2>
The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.
Modified: branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -31,7 +31,6 @@
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.core.TeiidRuntimeException;
public class ClusterableCacheFactory implements CacheFactory, Serializable {
@@ -42,7 +41,7 @@
private String cacheManagerName;
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (this.delegate == null) {
Object cacheManager = getClusteredCache();
if (cacheManager == null) {
@@ -56,7 +55,7 @@
}
}
}
- return delegate.get(type, config);
+ return delegate.get(location, config);
}
public void setResultsetCacheName(String name) {
Modified: branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -36,7 +36,6 @@
import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
@@ -55,7 +54,7 @@
/**
* {@inheritDoc}
*/
- public Cache get(Type type, CacheConfiguration config) {
+ public Cache get(String location, CacheConfiguration config) {
if (!destroyed) {
if (!this.cacheStore.getCacheStatus().allowInvocations()) {
@@ -63,7 +62,7 @@
}
Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
- Node node = cacheRoot.addChild(Fqn.fromString(type.location()));
+ Node node = cacheRoot.addChild(Fqn.fromString(location));
node.setResident(true);
Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
Modified: branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -214,7 +214,7 @@
this.errors = errors;
}
- public List<ValidationError> getValidationErrors(ValidationError.Severity severity){
+ public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
if (this.errors == null) {
return Collections.emptyList();
}
@@ -227,7 +227,7 @@
return list;
}
- public ValidationError addError(String severity, String message) {
+ public synchronized ValidationError addError(String severity, String message) {
if (this.errors == null) {
this.errors = new ArrayList<ValidationError>();
}
@@ -236,14 +236,14 @@
return ve;
}
- public boolean removeError(ValidationError remove) {
+ public synchronized boolean removeError(ValidationError remove) {
if (this.errors == null) {
return false;
}
return this.errors.remove(remove);
}
- public void clearErrors() {
+ public synchronized void clearErrors() {
this.errors.clear();
}
Deleted: branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.translator.salesforce.execution;
-
-import static org.junit.Assert.*;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.language.Call;
-import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.salesforce.SalesforceConnection;
-import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
-
-@SuppressWarnings("nls")
-public class TestProcedureExecution {
-
- private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
-
- @Test public void testProcedureName() throws Exception {
- Call command = (Call)translationUtility.parseCommand("exec getupdated('foo', {d '1970-01-01'}, {d '1990-01-01'})"); //$NON-NLS-1$
- SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
- UpdatedResult ur = new UpdatedResult();
- ur.setIDs(Arrays.asList("1", "2"));
- Mockito.stub(sfc.getUpdated(Mockito.eq("foo"), (XMLGregorianCalendar)Mockito.anyObject(), (XMLGregorianCalendar)Mockito.anyObject())).toReturn(ur);
- ProcedureExecutionParentImpl pepi = new ProcedureExecutionParentImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
- pepi.execute();
- assertNotNull(pepi.next());
- assertNotNull(pepi.next());
- assertNull(pepi.next());
- pepi.close();
- }
-
-}
Copied: branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java (from rev 2885, branches/7.1.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java)
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java (rev 0)
+++ branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.salesforce.execution;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Call;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
+
+@SuppressWarnings("nls")
+public class TestProcedureExecution {
+
+ private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
+
+ @Test public void testProcedureName() throws Exception {
+ Call command = (Call)translationUtility.parseCommand("exec getupdated('foo', {d '1970-01-01'}, {d '1990-01-01'})"); //$NON-NLS-1$
+ SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+ UpdatedResult ur = new UpdatedResult();
+ ur.setIDs(Arrays.asList("1", "2"));
+ Mockito.stub(sfc.getUpdated(Mockito.eq("foo"), (XMLGregorianCalendar)Mockito.anyObject(), (XMLGregorianCalendar)Mockito.anyObject())).toReturn(ur);
+ ProcedureExecutionParentImpl pepi = new ProcedureExecutionParentImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
+ pepi.execute();
+ assertNotNull(pepi.next());
+ assertNotNull(pepi.next());
+ assertNull(pepi.next());
+ pepi.close();
+ }
+
+}
Modified: branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -106,6 +106,7 @@
Column obj = contactCols.get(i);
obj.setNameInSource(contactNameInSource[i]);
}
+
List<ProcedureParameter> params = new LinkedList<ProcedureParameter>();
params.add(RealMetadataFactory.createParameter("type", SPParameter.IN, TypeFacility.RUNTIME_NAMES.STRING));
params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
Modified: branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -28,29 +28,7 @@
* Abstraction over cache providers
*/
public interface Cache<K, V> {
-
- public enum Type {
- MATTABLES("MatTables"), //$NON-NLS-1$
- MATTABLEUPDATES("MatTableUpdates"), //$NON-NLS-1$
- RESULTSET("ResultSet"), //$NON-NLS-1$
- RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
- PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
- private String location;
-
- Type(String location){
- this.location = location;
- }
-
- Type(Type base, String location){
- this.location = base.location+"/"+location; //$NON-NLS-1$
- }
-
- public String location() {
- return this.location;
- }
- }
-
/**
* Retrieves the value for the given Key
*
Modified: branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -30,9 +30,7 @@
@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
public class CacheConfiguration {
-
- public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
-
+
public enum Policy {
LRU, // Least Recently Used
EXPIRATION
@@ -43,14 +41,16 @@
private int maxEntries;
private boolean enabled = true;
private String name;
-
+ private String location;
+
public CacheConfiguration() {
}
- public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
+ public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes, String location) {
this.policy = policy;
this.maxage = maxAgeInSeconds;
this.maxEntries = maxNodes;
+ this.location = location;
}
public Policy getPolicy() {
@@ -89,6 +89,15 @@
this.name = name;
}
+ @ManagementProperty(description="location prefix in cache", readOnly=true)
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified: branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -30,7 +30,7 @@
* @param config configuration setup for the cache
* @return
*/
- <K,V> Cache<K, V> get(Cache.Type type, CacheConfiguration config);
+ <K,V> Cache<K, V> get(String location, CacheConfiguration config);
/**
* Destroy the cache factory and any caches underneath.
Modified: branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -23,18 +23,19 @@
import java.io.Serializable;
-import org.teiid.cache.Cache.Type;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
public class DefaultCacheFactory implements CacheFactory, Serializable {
private static final long serialVersionUID = -5541424157695857527L;
+ private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
DefaultCache cacheRoot;
private volatile boolean destroyed = false;
public DefaultCacheFactory() {
- this(CacheConfiguration.DEFAULT);
+ this(DEFAULT);
}
public DefaultCacheFactory(CacheConfiguration config) {
@@ -47,9 +48,9 @@
}
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (!destroyed) {
- return cacheRoot.addChild(type.location());
+ return cacheRoot.addChild(location);
}
throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
}
Modified: branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -44,7 +44,6 @@
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.CacheConfiguration.Policy;
@@ -683,24 +682,23 @@
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
- this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
+ this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
this.rsCache.setBufferManager(this.bufferManager);
}
//prepared plan cache
- prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
+ prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount(), "PreparedCache")); //$NON-NLS-1$
prepPlanCache.setBufferManager(this.bufferManager);
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1));
+ matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1, "MaterilizationTables")); //$NON-NLS-1$
matTables.setBufferManager(this.bufferManager);
}
- dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
- this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
+ dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
}
public void setBufferService(BufferService service) {
Modified: branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -51,6 +51,10 @@
*/
public class SessionAwareCache<T> {
public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
+ public enum Type {
+ RESULTSET,
+ PREPAREDPLAN;
+ }
private Cache<CacheID, T> localCache;
private Cache<CacheID, T> distributedCache;
@@ -68,23 +72,24 @@
}
SessionAwareCache(int maxSize){
- this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
+ this(new DefaultCacheFactory(), Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize, "default")); //$NON-NLS-1$
}
- SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
+ SessionAwareCache (final CacheFactory cacheFactory, final Type type, final CacheConfiguration config){
this.maxSize = config.getMaxEntries();
if(this.maxSize < 0){
this.maxSize = Integer.MAX_VALUE;
}
this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
- if (type == Cache.Type.PREPAREDPLAN) {
+ if (type == Type.PREPAREDPLAN) {
this.distributedCache = localCache;
}
else {
- this.distributedCache = cacheFactory.get(type, config);
- if (type == Cache.Type.RESULTSET) {
- this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+ String location = config.getLocation()+"/"+type.name(); //$NON-NLS-1$
+ this.distributedCache = cacheFactory.get(location, config);
+ if (type == Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(location+"/batches", config); //$NON-NLS-1$
}
else {
this.tupleBatchCache = this.distributedCache;
Modified: branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -179,10 +179,11 @@
return false;
}
//metadata hack
- if (!(this.expression.getMetadataID() instanceof TempMetadataID)) {
+ if (this.expression.getGroupSymbol() == null || !(this.expression.getGroupSymbol().getMetadataID() instanceof TempMetadataID)) {
return true;
}
- TempMetadataID tid = (TempMetadataID)this.expression.getMetadataID();
+
+ TempMetadataID tid = (TempMetadataID)this.expression.getGroupSymbol().getMetadataID();
return !tid.isScalarGroup();
}
Modified: branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -153,8 +153,8 @@
this.cache = cache;
this.distributedCache = distibutedCache;
if (distibutedCache != null) {
- CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1);
- tables = cacheFactory.get(Cache.Type.MATTABLES, cc);
+ CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1, "MaterializationUpdates"); //$NON-NLS-1$
+ tables = cacheFactory.get(cc.getLocation(), cc);
}
}
Modified: branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -2675,7 +2675,8 @@
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("create local temporary table x (y string);\n"); //$NON-NLS-1$
- procedure.append("update x set y = in1 || 'foo';\n"); //$NON-NLS-1$
+ procedure.append("declare string s = 'foo';\n"); //$NON-NLS-1$
+ procedure.append("update x set y = in1 || s;\n"); //$NON-NLS-1$
procedure.append("update pm1.g1 set e1 = lookup('pm1.g1', 'e1', 'e2', in1);\n"); //$NON-NLS-1$
procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
Modified: branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -150,21 +150,23 @@
} catch (IOException e1) {
LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ boolean valid = true;
+ synchronized (deployment) {
+ if (!preview) {
+ valid = validateSources(cmr, deployment);
- boolean valid = true;
- if (!preview) {
- valid = validateSources(cmr, deployment);
-
- // Check if the VDB is fully configured.
- if (valid) {
+ // Check if the VDB is fully configured.
+ if (valid) {
+ deployment.setStatus(VDB.Status.ACTIVE);
+ } else {
+ deployment.setStatus(VDB.Status.INACTIVE);
+ }
+ }
+ else {
deployment.setStatus(VDB.Status.ACTIVE);
- } else {
- deployment.setStatus(VDB.Status.INACTIVE);
- }
+ }
}
- else {
- deployment.setStatus(VDB.Status.ACTIVE);
- }
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -341,7 +343,7 @@
}
}
- synchronized (this) {
+ synchronized (vdb) {
if (!loaded) {
vdb.setStatus(VDB.Status.INACTIVE);
String msg = RuntimePlugin.Util.getString("failed_to_retrive_metadata", vdb.getName()+"-"+vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -67,39 +67,41 @@
if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
continue;
}
- ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (model.getErrors().isEmpty()) {
- continue;
+ synchronized (vdb) {
+ ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
+
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (model.getErrors().isEmpty()) {
+ continue;
+ }
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ model.clearErrors();
+ String status = cm.getStausMessage();
+ if (status != null && status.length() > 0) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
+ }
+ }
}
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- model.clearErrors();
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
- }
+
+ boolean valid = true;
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ if (!model.getErrors().isEmpty()) {
+ valid = false;
+ break;
+ }
}
- }
-
- boolean valid = true;
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- if (!model.getErrors().isEmpty()) {
- valid = false;
- break;
+
+ if (valid) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
}
-
- if (valid) {
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
}
}
@@ -108,25 +110,26 @@
if (vdb.isPreview()) {
continue;
}
-
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
-
- String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String msg = null;
- if (translator) {
- msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ synchronized (vdb) {
+ for (Model m:vdb.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+
+ String sourceName = getSourceName(resourceName, model, translator);
+ if (sourceName != null) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ String msg = null;
+ if (translator) {
+ msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ else {
+ msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ }
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
- else {
- msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
- }
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
- }
+ }
}
}
Deleted: branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java
===================================================================
--- branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (C) 2008 Red Hat, Inc.
- * Licensed to Red Hat, Inc. under one or more contributor
- * license agreements. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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.transport;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import java.net.InetSocketAddress;
-import java.util.Properties;
-
-import org.junit.After;
-import org.junit.Test;
-import org.teiid.client.security.ILogon;
-import org.teiid.client.security.InvalidSessionException;
-import org.teiid.client.security.LogonException;
-import org.teiid.client.security.LogonResult;
-import org.teiid.client.security.SessionToken;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.common.buffer.BufferManagerFactory;
-import org.teiid.core.ComponentNotFoundException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.dqp.service.SessionService;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.HostInfo;
-import org.teiid.net.TeiidURL;
-import org.teiid.net.socket.SocketServerConnection;
-import org.teiid.net.socket.SocketServerConnectionFactory;
-import org.teiid.net.socket.UrlServerDiscovery;
-import org.teiid.transport.TestSocketRemoting.FakeService;
-
-
-@SuppressWarnings("nls")
-public class TestFailover {
-
- SocketListener listener;
- SocketListener listener1;
-
- private SocketServerConnectionFactory sscf;
- private InetSocketAddress addr = new InetSocketAddress(0);
- private int logonAttempts;
-
- @After public void tearDown() {
- if (this.listener != null) {
- this.listener.stop();
- }
- if (this.listener1 != null) {
- this.listener1.stop();
- }
- }
-
- private SocketServerConnection helpEstablishConnection(boolean clientSecure, SSLConfiguration config, Properties socketConfig) throws CommunicationException,
- ConnectionException {
- listener = createListener(addr, config);
- listener1 = createListener(addr, config);
- listener1.stop();
- Properties p = new Properties();
- TeiidURL teiidUrl = new TeiidURL(addr.getHostName(), listener.getPort(), clientSecure);
- teiidUrl.getHostInfo().add(new HostInfo(addr.getHostName(), listener1.getPort()));
- String url = teiidUrl.getAppServerURL();
- p.setProperty(TeiidURL.CONNECTION.SERVER_URL, url);
- p.setProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
- p.setProperty(TeiidURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
- if (sscf == null) {
- sscf = new SocketServerConnectionFactory();
- sscf.initialize(socketConfig);
- }
- return sscf.getConnection(p);
- }
-
- private SocketListener createListener(InetSocketAddress address, SSLConfiguration config) {
- ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
- server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
- @Override
- public LogonResult logon(Properties connProps)
- throws LogonException, ComponentNotFoundException {
- logonAttempts++;
- return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
- }
-
- @Override
- public ResultsFuture<?> ping() throws InvalidSessionException,
- TeiidComponentException {
- return ResultsFuture.NULL_FUTURE;
- }
-
- @Override
- public void assertIdentity(SessionToken checkSession)
- throws InvalidSessionException, TeiidComponentException {
- throw new InvalidSessionException();
- }
-
- }, null);
- server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
- return new SocketListener(address.getPort(), address.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
- }
-
- @Test public void testFailover() throws Exception {
- SSLConfiguration config = new SSLConfiguration();
- Properties p = new Properties();
- SocketServerConnection conn = helpEstablishConnection(false, config, p);
- assertTrue(conn.isOpen(1000));
- //restart the second instance now that we know the connection was made to the first
- listener1 = createListener(new InetSocketAddress(addr.getAddress(), listener1.getPort()), config);
- listener.stop();
- conn.isOpen(1000); //there is a chance this call can fail
- assertTrue(conn.isOpen(1000));
- listener1.stop();
- //both instances are down
- assertFalse(conn.isOpen(1000));
- //bring the first back up
- listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
- assertTrue(conn.isOpen(1000));
- assertEquals(3, logonAttempts);
- conn.close();
- }
-
-}
Copied: branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java (from rev 2885, branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestFailover.java)
===================================================================
--- branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java (rev 0)
+++ branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.transport;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.net.InetSocketAddress;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Test;
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.LogonException;
+import org.teiid.client.security.LogonResult;
+import org.teiid.client.security.SessionToken;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.ComponentNotFoundException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.dqp.service.SessionService;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.HostInfo;
+import org.teiid.net.TeiidURL;
+import org.teiid.net.socket.SocketServerConnection;
+import org.teiid.net.socket.SocketServerConnectionFactory;
+import org.teiid.net.socket.UrlServerDiscovery;
+import org.teiid.transport.TestSocketRemoting.FakeService;
+
+
+@SuppressWarnings("nls")
+public class TestFailover {
+
+ SocketListener listener;
+ SocketListener listener1;
+
+ private SocketServerConnectionFactory sscf;
+ private InetSocketAddress addr = new InetSocketAddress(0);
+ private int logonAttempts;
+
+ @After public void tearDown() {
+ if (this.listener != null) {
+ this.listener.stop();
+ }
+ if (this.listener1 != null) {
+ this.listener1.stop();
+ }
+ }
+
+ private SocketServerConnection helpEstablishConnection(boolean clientSecure, SSLConfiguration config, Properties socketConfig) throws CommunicationException,
+ ConnectionException {
+ listener = createListener(addr, config);
+ listener1 = createListener(addr, config);
+ listener1.stop();
+ Properties p = new Properties();
+ TeiidURL teiidUrl = new TeiidURL(addr.getHostName(), listener.getPort(), clientSecure);
+ teiidUrl.getHostInfo().add(new HostInfo(addr.getHostName(), listener1.getPort()));
+ String url = teiidUrl.getAppServerURL();
+ p.setProperty(TeiidURL.CONNECTION.SERVER_URL, url);
+ p.setProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
+ p.setProperty(TeiidURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
+ if (sscf == null) {
+ sscf = new SocketServerConnectionFactory();
+ sscf.initialize(socketConfig);
+ }
+ return sscf.getConnection(p);
+ }
+
+ private SocketListener createListener(InetSocketAddress address, SSLConfiguration config) {
+ ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
+ server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
+ @Override
+ public LogonResult logon(Properties connProps)
+ throws LogonException, ComponentNotFoundException {
+ logonAttempts++;
+ return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
+ }
+
+ @Override
+ public ResultsFuture<?> ping() throws InvalidSessionException,
+ TeiidComponentException {
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ @Override
+ public void assertIdentity(SessionToken checkSession)
+ throws InvalidSessionException, TeiidComponentException {
+ throw new InvalidSessionException();
+ }
+
+ }, null);
+ server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
+ return new SocketListener(address.getPort(), address.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
+ }
+
+ @Test public void testFailover() throws Exception {
+ SSLConfiguration config = new SSLConfiguration();
+ Properties p = new Properties();
+ SocketServerConnection conn = helpEstablishConnection(false, config, p);
+ assertTrue(conn.isOpen(1000));
+ //restart the second instance now that we know the connection was made to the first
+ listener1 = createListener(new InetSocketAddress(addr.getAddress(), listener1.getPort()), config);
+ listener.stop();
+ conn.isOpen(1000); //there is a chance this call can fail
+ assertTrue(conn.isOpen(1000));
+ listener1.stop();
+ //both instances are down
+ assertFalse(conn.isOpen(1000));
+ //bring the first back up
+ listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
+ assertTrue(conn.isOpen(1000));
+ assertEquals(3, logonAttempts);
+ conn.close();
+ }
+
+}
Modified: branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -87,7 +87,7 @@
});
DQPConfiguration config = new DQPConfiguration();
- config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250));
+ config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.start(config);
this.sessionService.setDqp(this.dqp);
Modified: branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
===================================================================
--- branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 14:52:07 UTC (rev 2885)
+++ branches/7.3.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-31 15:36:30 UTC (rev 2886)
@@ -39,8 +39,10 @@
import java.util.Collections;
import java.util.List;
+import org.teiid.jdbc.TeiidSQLException;
+
/**
* TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
* in order to call out.print instead of out.println
@@ -73,8 +75,22 @@
public static void printThrowable(Throwable t, String sql, PrintStream out) {
out.println(sql);
+
+ Throwable answer = t;
+ if (t instanceof TeiidSQLException) {
+ TeiidSQLException sqle = (TeiidSQLException) t;
+ SQLException se = sqle.getNextException();
+ if (se != null) {
+ SQLException s = null;
+ while( (s = se.getNextException()) != null) {
+ se = s;
+ }
+
+ answer = se;
+ }
+ }
- out.print(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
+ out.print(t.getClass().getName() + " : " + answer.getMessage()); //$NON-NLS-1$
}
13 years, 10 months
teiid SVN: r2885 - in branches/7.3.x/client/src: test/java/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-31 09:52:07 -0500 (Mon, 31 Jan 2011)
New Revision: 2885
Modified:
branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
Log:
TEIID-1456 checking for execution exceptions on resultset results and adding some logging
Modified: branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-30 14:53:25 UTC (rev 2884)
+++ branches/7.3.x/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-01-31 14:52:07 UTC (rev 2885)
@@ -48,6 +48,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.teiid.client.ResultsMessage;
@@ -146,6 +147,9 @@
rmetadata = new FilteredResultsMetadata(rmetadata, resultColumns);
}
this.fetchSize = statement.getFetchSize();
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Creating ResultSet requestID: " + requestID + " beginRow: " + resultsMsg.getFirstRow() + " resultsColumns: " + resultColumns + " parameters: " + parameters); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
}
public void setMaxFieldSize(int maxFieldSize) {
@@ -356,7 +360,9 @@
}
public Batch requestBatch(int beginRow) throws SQLException{
- logger.fine("CursorResultsImpl.requestBatch] thread name: " + Thread.currentThread().getName() + " requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("requestBatch requestID: " + requestID + " beginRow: " + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
checkClosed();
try {
ResultsFuture<ResultsMessage> results = statement.getDQP().processCursorRequest(requestID, beginRow, fetchSize);
@@ -365,6 +371,11 @@
timeoutSeconds = Integer.MAX_VALUE;
}
ResultsMessage currentResultMsg = results.get(timeoutSeconds, TimeUnit.SECONDS);
+
+ if (currentResultMsg.getException() != null) {
+ throw TeiidSQLException.create(currentResultMsg.getException());
+ }
+
this.accumulateWarnings(currentResultMsg);
return getCurrentBatch(currentResultMsg);
} catch (TeiidProcessingException e) {
Modified: branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-30 14:53:25 UTC (rev 2884)
+++ branches/7.3.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-01-31 14:52:07 UTC (rev 2885)
@@ -28,6 +28,7 @@
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
@@ -387,7 +388,9 @@
throws SQLException {
checkStatement();
resetExecutionState();
-
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Executing: requestID " + getCurrentRequestID() + " commands: " + Arrays.toString(commands) + " expecting: " + resultsMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
if (commands.length == 1) {
Matcher match = SET_STATEMENT.matcher(commands[0]);
if (match.matches()) {
@@ -406,6 +409,7 @@
}
match = TRANSACTION_STATEMENT.matcher(commands[0]);
if (match.matches()) {
+ logger.finer("Executing as transaction statement"); //$NON-NLS-1$
if (resultsMode == ResultsMode.RESULTSET) {
throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
}
@@ -422,6 +426,7 @@
}
match = SHOW_STATEMENT.matcher(commands[0]);
if (match.matches()) {
+ logger.finer("Executing as show statement"); //$NON-NLS-1$
if (resultsMode == ResultsMode.UPDATECOUNT) {
throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
}
@@ -503,7 +508,9 @@
for (int i = 0; i < results.length; i++) {
updateCounts[i] = (Integer)results[i].get(0);
}
-
+ if (logger.isLoggable(Level.FINER)) {
+ logger.fine(JDBCPlugin.Util.getString("Recieved update counts: " + Arrays.toString(updateCounts))); //$NON-NLS-1$
+ }
// In update scenarios close the statement implicitly
try {
getDQP().closeRequest(getCurrentRequestID());
Modified: branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
===================================================================
--- branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-30 14:53:25 UTC (rev 2884)
+++ branches/7.3.x/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-01-31 14:52:07 UTC (rev 2885)
@@ -41,6 +41,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
+import org.mockito.Mockito;
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
@@ -696,6 +697,19 @@
assertTrue(rs.previous());
}
}
+
+ @Test(expected=TeiidSQLException.class) public void testResultsMessageException() throws Exception {
+ ResultsMessage resultsMsg = exampleMessage(exampleResults1(1), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
+ resultsMsg.setFinalRow(-1);
+ ResultsMessage next = new ResultsMessage();
+ next.setException(new Throwable());
+ ResultsFuture<ResultsMessage> rf = new ResultsFuture<ResultsMessage>();
+ rf.getResultsReceiver().receiveResults(next);
+ Mockito.stub(statement.getDQP().processCursorRequest(0, 2, 0)).toReturn(rf);
+ ResultSetImpl cs = new ResultSetImpl(resultsMsg, statement, null, 2);
+ cs.next();
+ cs.next();
+ }
static ResultSetImpl helpTestBatching(StatementImpl statement, int fetchSize, int batchLength,
int totalLength) throws InterruptedException, ExecutionException,
13 years, 10 months
teiid SVN: r2884 - branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2011-01-30 09:53:25 -0500 (Sun, 30 Jan 2011)
New Revision: 2884
Modified:
branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
Log:
SOA-2853 traversing to the inner most chained exception to use in reporting
Modified: branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
===================================================================
--- branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-29 04:41:29 UTC (rev 2883)
+++ branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java 2011-01-30 14:53:25 UTC (rev 2884)
@@ -39,8 +39,10 @@
import java.util.Collections;
import java.util.List;
+import org.teiid.jdbc.TeiidSQLException;
+
/**
* TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
* in order to call out.print instead of out.println
@@ -73,8 +75,22 @@
public static void printThrowable(Throwable t, String sql, PrintStream out) {
out.println(sql);
+
+ Throwable answer = t;
+ if (t instanceof TeiidSQLException) {
+ TeiidSQLException sqle = (TeiidSQLException) t;
+ SQLException se = sqle.getNextException();
+ if (se != null) {
+ SQLException s = null;
+ while( (s = se.getNextException()) != null) {
+ se = s;
+ }
+
+ answer = se;
+ }
+ }
- out.print(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
+ out.print(t.getClass().getName() + " : " + answer.getMessage()); //$NON-NLS-1$
}
13 years, 10 months
teiid SVN: r2883 - in branches/7.1.x: cache-jbosscache/src/main/java/org/teiid/cache/jboss and 4 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-01-28 23:41:29 -0500 (Fri, 28 Jan 2011)
New Revision: 2883
Modified:
branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.1.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-1439: decoupled the cache type from the cache location. Materialization Cache and ResultSet cache were using the same JBoss cache node, thus the data was getting mixed up.
Modified: branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-01-29 04:41:29 UTC (rev 2883)
@@ -66,7 +66,8 @@
<!-- Allowed values are LRU, EXPIRATION.
Setting this value to LRU will cause cache hint TTL values
to be ignored. (default EXPIRATION) -->
- <property name="type">EXPIRATION</property>
+ <property name="type">EXPIRATION</property>
+ <property name="location">resultset</property>
</bean>
<bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -31,7 +31,6 @@
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.core.TeiidRuntimeException;
public class ClusterableCacheFactory implements CacheFactory, Serializable {
@@ -42,7 +41,7 @@
private String cacheManagerName;
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (this.delegate == null) {
Object cacheManager = getClusteredCache();
if (cacheManager == null) {
@@ -56,7 +55,7 @@
}
}
}
- return delegate.get(type, config);
+ return delegate.get(location, config);
}
public void setResultsetCacheName(String name) {
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -36,7 +36,6 @@
import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
-import org.teiid.cache.Cache.Type;
import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
@@ -55,7 +54,7 @@
/**
* {@inheritDoc}
*/
- public Cache get(Type type, CacheConfiguration config) {
+ public Cache get(String location, CacheConfiguration config) {
if (!destroyed) {
if (!this.cacheStore.getCacheStatus().allowInvocations()) {
@@ -63,7 +62,7 @@
}
Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
- Node node = cacheRoot.addChild(Fqn.fromString(type.location()));
+ Node node = cacheRoot.addChild(Fqn.fromString(location));
node.setResident(true);
Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -28,29 +28,7 @@
* Abstraction over cache providers
*/
public interface Cache<K, V> {
-
- public enum Type {
- MATTABLES("MatTables"), //$NON-NLS-1$
- MATTABLEUPDATES("MatTableUpdates"), //$NON-NLS-1$
- RESULTSET("ResultSet"), //$NON-NLS-1$
- RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
- PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
- private String location;
-
- Type(String location){
- this.location = location;
- }
-
- Type(Type base, String location){
- this.location = base.location+"/"+location; //$NON-NLS-1$
- }
-
- public String location() {
- return this.location;
- }
- }
-
/**
* Retrieves the value for the given Key
*
Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -30,9 +30,7 @@
@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
public class CacheConfiguration {
-
- public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
-
+
public enum Policy {
LRU, // Least Recently Used
EXPIRATION
@@ -43,14 +41,16 @@
private int maxEntries;
private boolean enabled = true;
private String name;
-
+ private String location;
+
public CacheConfiguration() {
}
- public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
+ public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes, String location) {
this.policy = policy;
this.maxage = maxAgeInSeconds;
this.maxEntries = maxNodes;
+ this.location = location;
}
public Policy getPolicy() {
@@ -89,6 +89,15 @@
this.name = name;
}
+ @ManagementProperty(description="location prefix in cache", readOnly=true)
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheFactory.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/CacheFactory.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -30,7 +30,7 @@
* @param config configuration setup for the cache
* @return
*/
- <K,V> Cache<K, V> get(Cache.Type type, CacheConfiguration config);
+ <K,V> Cache<K, V> get(String location, CacheConfiguration config);
/**
* Destroy the cache factory and any caches underneath.
Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/DefaultCacheFactory.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -23,18 +23,19 @@
import java.io.Serializable;
-import org.teiid.cache.Cache.Type;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.core.TeiidRuntimeException;
public class DefaultCacheFactory implements CacheFactory, Serializable {
private static final long serialVersionUID = -5541424157695857527L;
+ private static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100, "default"); // 1 hours with 100 nodes. //$NON-NLS-1$
DefaultCache cacheRoot;
private volatile boolean destroyed = false;
public DefaultCacheFactory() {
- this(CacheConfiguration.DEFAULT);
+ this(DEFAULT);
}
public DefaultCacheFactory(CacheConfiguration config) {
@@ -47,9 +48,9 @@
}
@Override
- public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
+ public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
if (!destroyed) {
- return cacheRoot.addChild(type.location());
+ return cacheRoot.addChild(location);
}
throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -44,7 +44,6 @@
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.CacheConfiguration.Policy;
@@ -694,24 +693,23 @@
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
- this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
+ this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
this.rsCache.setBufferManager(this.bufferManager);
}
//prepared plan cache
- prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
+ prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount(), "PreparedCache")); //$NON-NLS-1$
prepPlanCache.setBufferManager(this.bufferManager);
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1));
+ matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1, "MaterilizationTables")); //$NON-NLS-1$
matTables.setBufferManager(this.bufferManager);
}
- dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
- this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
+ dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
}
public void setBufferService(BufferService service) {
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -51,6 +51,10 @@
*/
public class SessionAwareCache<T> {
public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
+ public enum Type {
+ RESULTSET,
+ PREPAREDPLAN;
+ }
private Cache<CacheID, T> localCache;
private Cache<CacheID, T> distributedCache;
@@ -68,23 +72,24 @@
}
SessionAwareCache(int maxSize){
- this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
+ this(new DefaultCacheFactory(), Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize, "default")); //$NON-NLS-1$
}
- SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
+ SessionAwareCache (final CacheFactory cacheFactory, final Type type, final CacheConfiguration config){
this.maxSize = config.getMaxEntries();
if(this.maxSize < 0){
this.maxSize = Integer.MAX_VALUE;
}
this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
- if (type == Cache.Type.PREPAREDPLAN) {
+ if (type == Type.PREPAREDPLAN) {
this.distributedCache = localCache;
}
else {
- this.distributedCache = cacheFactory.get(type, config);
- if (type == Cache.Type.RESULTSET) {
- this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+ String location = config.getLocation()+"/"+type.name(); //$NON-NLS-1$
+ this.distributedCache = cacheFactory.get(location, config);
+ if (type == Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(location+"/batches", config); //$NON-NLS-1$
}
else {
this.tupleBatchCache = this.distributedCache;
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -153,8 +153,8 @@
this.cache = cache;
this.distributedCache = distibutedCache;
if (distibutedCache != null) {
- CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1);
- tables = cacheFactory.get(Cache.Type.MATTABLES, cc);
+ CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1, "MaterializationUpdates"); //$NON-NLS-1$
+ tables = cacheFactory.get(cc.getLocation(), cc);
}
}
Modified: branches/7.1.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/7.1.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-28 16:30:26 UTC (rev 2882)
+++ branches/7.1.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-01-29 04:41:29 UTC (rev 2883)
@@ -87,7 +87,7 @@
});
DQPConfiguration config = new DQPConfiguration();
- config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250));
+ config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.start(config);
this.sessionService.setDqp(this.dqp);
13 years, 11 months
teiid SVN: r2882 - branches/7.3.x/runtime/src/test/java/org/teiid/transport.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-01-28 11:30:26 -0500 (Fri, 28 Jan 2011)
New Revision: 2882
Modified:
branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java
Log:
TEIID-1451 ensuring that the logon result gets cleared when disconnected
Modified: branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java
===================================================================
--- branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-28 16:30:06 UTC (rev 2881)
+++ branches/7.3.x/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-01-28 16:30:26 UTC (rev 2882)
@@ -28,6 +28,7 @@
import java.net.InetSocketAddress;
import java.util.Properties;
+import org.junit.After;
import org.junit.Test;
import org.teiid.client.security.ILogon;
import org.teiid.client.security.InvalidSessionException;
@@ -58,6 +59,15 @@
private SocketServerConnectionFactory sscf;
private InetSocketAddress addr = new InetSocketAddress(0);
private int logonAttempts;
+
+ @After public void tearDown() {
+ if (this.listener != null) {
+ this.listener.stop();
+ }
+ if (this.listener1 != null) {
+ this.listener1.stop();
+ }
+ }
private SocketServerConnection helpEstablishConnection(boolean clientSecure, SSLConfiguration config, Properties socketConfig) throws CommunicationException,
ConnectionException {
@@ -121,6 +131,7 @@
//bring the first back up
listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
assertTrue(conn.isOpen(1000));
+ assertEquals(3, logonAttempts);
conn.close();
}
13 years, 11 months