[teiid-commits] teiid SVN: r1727 - in branches/JCA: adminshell/src/main/resources/scripts and 147 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sat Jan 9 19:20:04 EST 2010


Author: rareddy
Date: 2010-01-09 19:19:53 -0500 (Sat, 09 Jan 2010)
New Revision: 1727

Added:
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/AbstractUpdateExecution.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalSObjectResult.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/PackageVersion.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/ManagedBatch.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBuffer.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/MemoryStorageManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchCollector.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchIterator.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/CollectionTupleSource.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestCollectionTupleSource.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestProcedureResolving.java
Removed:
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java
   branches/JCA/client/src/main/java/com/metamatrix/dqp/internal/
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/BaseXMLTranslator.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLDomSourceTranslator.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLReaderFactory.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLSAXSourceTranslator.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLStreamSourceTranslator.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ChecksumUtil.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ResourceNameUtil.java
   branches/JCA/common-core/src/test/java/com/metamatrix/core/util/TestResourceNameUtil.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/api/core/
   branches/JCA/common-internal/src/main/resources/com/metamatrix/common/util/crypto/
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/CachingConnector.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/cache/
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedOnMemoryException.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerLobChunkStream.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerPropertyNames.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/MemoryNotAvailableException.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceID.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceNotFoundException.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferConfig.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferStats.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/ManagedBatch.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/SizeUtility.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleGroupInfo.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceImpl.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceInfo.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/storage/
   branches/JCA/engine/src/main/java/com/metamatrix/connector/
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeProcessor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/OptimizerContext.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BaseProcessorPlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/NullTupleSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SQLSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/XMLSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecSqlInstruction.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/UpdateCountTupleSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchCollector.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchIterator.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/TupleCollector.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/CommandContainer.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXMLTranslator.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheID.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheResults.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCache.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCacheUtil.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobChunkStream.java
   branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/TestTupleSourceID.java
   branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/impl/
   branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/storage/file/
   branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParseCommandType.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestNullTupleSource.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/QueryMetadataInterfaceBuilder.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestCacheID.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestResultSetCache.java
   branches/JCA/metadata/src/test/java/com/metamatrix/connector/
   branches/JCA/metadata/src/test/java/com/metamatrix/metadata/runtime/FakeQueryMetadata.java
Modified:
   branches/JCA/adminshell/src/main/java/bsh/Interpreter.java
   branches/JCA/adminshell/src/main/resources/scripts/jdbc.bsh
   branches/JCA/build/kit-runtime/deploy.properties
   branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
   branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
   branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
   branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
   branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMStatement.java
   branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
   branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java
   branches/JCA/client/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
   branches/JCA/client/src/main/java/com/metamatrix/common/lob/ByteLobChunkStream.java
   branches/JCA/client/src/main/java/com/metamatrix/common/lob/LobChunkInputStream.java
   branches/JCA/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
   branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
   branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ExecutionProperties.java
   branches/JCA/client/src/main/resources/teiid-client-settings.properties
   branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
   branches/JCA/client/src/test/java/com/metamatrix/common/lob/TestLobChunkInputStream.java
   branches/JCA/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java
   branches/JCA/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/Streamable.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLTranslator.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
   branches/JCA/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/FileUtils.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
   branches/JCA/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java
   branches/JCA/common-internal/src/main/resources/com/metamatrix/vdb/materialization/template/scriptMaterializedView.stg
   branches/JCA/common-internal/src/test/java/com/metamatrix/common/vdb/api/TestDEFReaderWriter.java
   branches/JCA/common-internal/src/test/java/com/metamatrix/vdb/edit/materialization/TestMaterializedViewScriptGenerator.java
   branches/JCA/common-internal/src/test/resources/materializedView/expected/Load_MatviewVDB.ddl
   branches/JCA/common-internal/src/test/resources/materializedView/expected/MatviewTheFirst_1_Load.ddl
   branches/JCA/common-internal/src/test/resources/materializedView/expected/MetaMatrix_load.txt
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
   branches/JCA/connector-api/src/main/resources/connector-base.xml
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Constants.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeleteExecutionImpl.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/InsertExecutionImpl.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionImpl.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
   branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/UpdateVisitor.java
   branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnection.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/AbstractCachingConnector.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectionImpl.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectorState.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileExecution.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectionImpl.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectorState.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPRequest.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectionImpl.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectorState.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/file/FileExecution.java
   branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java
   branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/ChildRelationship.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalResult.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeSObjectResult.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/EmailFileAttachment.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Field.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/GetUserInfoResult.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SforceServiceLocator.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SingleEmailMessage.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Soap.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SoapBindingStub.java
   branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/StatusCode.java
   branches/JCA/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
   branches/JCA/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml
   branches/JCA/engine/src/main/java/com/metamatrix/cache/CacheConfiguration.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedException.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/IndexedTupleSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/StorageManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBatch.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/batch/BatchedUpdatePlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanHints.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinRegion.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/NewCalculateCostUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushNonJoinCriteria.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlannerEnvironment.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLStagaingQueryPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xquery/XQueryPlanner.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/parser/QueryParser.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/TempTableDataManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SqlEval.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentCriteriaProcessor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentValueSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinStrategy.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/MergeJoinStrategy.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/PartitionedSortJoin.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SourceState.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/CommandResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/ProcedureContainerResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/QueryResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/BatchedUpdateResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DeleteResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SetQueryResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SimpleQueryResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/TempTableResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateProcedureResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XMLQueryResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XQueryResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/BatchedUpdateCommand.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/GroupContext.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/ProcedureContainer.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Query.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/StoredProcedure.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/XQuery.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/Block.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/CreateUpdateProcedureCommand.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/symbol/MultipleElementSymbol.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ElementSymbolOptimizer.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/SymbolMap.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ValueIteratorSource.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/VariableContext.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStore.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStoreImpl.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/util/CommandContext.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/validator/Validator.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/XQueryExpression.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXQueryExpression.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItemFactory.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlanCache.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
   branches/JCA/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
   branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
   branches/JCA/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties
   branches/JCA/engine/src/main/resources/com/metamatrix/query/i18n.properties
   branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/BufferManagerFactory.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestDependentJoins.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestInlineView.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestStoredProcedurePlanning.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCalculateCostUtil.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePlaceAccess.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestBaseProcessorPlan.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestDependentJoins.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestVirtualDepJoin.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/BlockingFakeRelationalNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/NodeTestUtil.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestDuplicateFilter.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestJoinNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSelectNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestUnionAllNode.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestInstructions.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestBlock.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestCreateUpdateProcedureCommand.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/sql/util/TestElementSymbolOptimizer.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
   branches/JCA/engine/src/test/java/com/metamatrix/query/xquery/TestXQueryEngine.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
   branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
   branches/JCA/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java
   branches/JCA/metadata/src/test/java/com/metamatrix/internal/core/index/TestGammaCompressedIndexBlock.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedMetadataService.java
   branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
   branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestTPCR.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java
Log:
TEIID-833: forward merging trunk 1724 into JCA branch

Modified: branches/JCA/adminshell/src/main/java/bsh/Interpreter.java
===================================================================
--- branches/JCA/adminshell/src/main/java/bsh/Interpreter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/adminshell/src/main/java/bsh/Interpreter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -97,7 +97,7 @@
 {
 	/* --- Begin static members --- */
 
-	public static final String VERSION = "2.0b5";
+	public static final String VERSION = "2.0b4";
 	/*
 		Debug utils are static so that they are reachable by code that doesn't
 		necessarily have an interpreter reference (e.g. tracing in utils).
@@ -251,7 +251,7 @@
 		this( new StringReader(""), 
 			System.out, System.err, false, null );
         evalOnly = true;
-		setu( "bsh.evalOnly", Primitive.TRUE );
+		setu( "bsh.evalOnly", new Primitive(true) );
     }
 
 	// End constructors
@@ -297,9 +297,9 @@
 		}
 
 		// bsh.interactive
-		setu( "bsh.interactive", interactive ? Primitive.TRUE : Primitive.FALSE );
+		setu( "bsh.interactive", new Primitive(interactive) );
 		// bsh.evalOnly
-		setu( "bsh.evalOnly", evalOnly ? Primitive.TRUE : Primitive.FALSE );
+		setu( "bsh.evalOnly", new Primitive(evalOnly) );
 	}
 
 	/**
@@ -495,12 +495,17 @@
             catch(InterpreterError e)
             {
                 error("Internal Error: " + e.getMessage());
+                if ( DEBUG ) {
+                	e.printStackTrace();
+                }
                 if(!interactive)
                     eof = true;
             }
             catch(TargetError e)
             {
                 error("// Uncaught Exception: " + e );
+				if ( DEBUG && e.inNativeCode() )
+					e.printStackTrace( DEBUG, err );
                 if(!interactive)
                     eof = true;
 				setu("$_e", e.getTarget());
@@ -635,14 +640,6 @@
                 if (localInterpreter.get_jjtree().nodeArity() > 0)
                 {
                     node = (SimpleNode)localInterpreter.get_jjtree().rootNode();
-					// quick filter for when we're running as a compiler only
-					if ( getSaveClasses()
-						&& !(node instanceof BSHClassDeclaration)
-						&& !(node instanceof BSHImportDeclaration )
-						&& !(node instanceof BSHPackageDeclaration )
-					)
-						continue;
-
 					// nodes remember from where they were sourced
 					node.setSourceFile( sourceFileInfo );
 
@@ -831,13 +828,12 @@
 		Get the value of the name.
 		name may be any value. e.g. a variable or field
 	*/
-    public Object get( String name ) throws EvalError
-	{
+    public Object get( String name ) throws EvalError {
 		try {
 			Object ret = globalNameSpace.get( name, this );
 			return Primitive.unwrap( ret );
-		} catch ( UtilEvalError e ) {
-			throw e.toEvalError( SimpleNode.JAVACODE, new CallStack() );
+		} catch ( UtilEvalError e ) { 
+			throw e.toEvalError( SimpleNode.JAVACODE, new CallStack() ); 
 		}
 	}
 
@@ -901,7 +897,7 @@
         set(name, new Primitive(value));
 	}
     public void set(String name, boolean value) throws EvalError {
-        set(name, value ? Primitive.TRUE : Primitive.FALSE);
+        set(name, new Primitive(value));
 	}
 
 	/**
@@ -1238,13 +1234,4 @@
 	public boolean getShowResults()  {
 		return showResults;
 	}
-
-	public static String getSaveClassesDir() {
-		return System.getProperty("saveClasses");
-	}
-
-	public static boolean getSaveClasses()  {
-		return getSaveClassesDir() != null;
-	}
 }
-

Modified: branches/JCA/adminshell/src/main/resources/scripts/jdbc.bsh
===================================================================
--- branches/JCA/adminshell/src/main/resources/scripts/jdbc.bsh	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/adminshell/src/main/resources/scripts/jdbc.bsh	2010-01-10 00:19:53 UTC (rev 1727)
@@ -182,7 +182,7 @@
 
 
 int FETCHSIZE=1000;
-int MAXROWS=500;
+int MAXROWS=0;
 
 private void setParameters(Object[] params) {
     if (params != null && params.length > 0) {

Modified: branches/JCA/build/kit-runtime/deploy.properties
===================================================================
--- branches/JCA/build/kit-runtime/deploy.properties	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/build/kit-runtime/deploy.properties	2010-01-10 00:19:53 UTC (rev 1727)
@@ -47,11 +47,11 @@
 # BufferManager Settings
 #
 
-#The max size of a batch sent between connector and query service. Should be even multiple of processorBatchSize. (default 2000)
-dqp.buffer.connectorBatchSize=2000
+#The max size of a batch sent between connector and query service. Should be even multiple of processorBatchSize. (default 2048)
+dqp.buffer.connectorBatchSize=2048
 
-#The max size of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 2000)
-dqp.buffer.processorBatchSize=2000
+#The max size of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 1024)
+dqp.buffer.processorBatchSize=1024
 
 #Defines whether to use disk buffering or not. (default true)
 dqp.buffer.useDisk=true
@@ -78,12 +78,15 @@
 #Denotes whether or not result set caching is enabled. (default false)
 ResultSetCache.enabled=false
 
-#The maximum size in MB the result set cache will be allowed to grow to before objects are removed. 0 indicates no limit. (default 50)
-#ResultSetCache.maxSizeInMB=50
+#The maximum size of an result set cache entry in bytes. 0 indicates no limit. (default 1001024)
+#ResultSetCache.maxEntrySize=1001024
 
-#The maximum time a result set will be kept in cache before being automatically cleared. 0 indicates no limit. (default 3600000)
-#ResultSetCache.maxAgeInSeconds=3600000
+#The maximum number of result set cache entries. 0 indicates no limit. (default 1024)
+#ResultSetCache.maxEntries=1024
 
+#The maximum time in seconds a result set will be kept in cache before being automatically cleared. 0 indicates no limit. (default 3600)
+#ResultSetCache.maxAge=3600
+
 #Defines whether caching is restricted to a specific session ('session') or a specific VDB version ('vdb'). (default vdb)	
 #ResultSetCache.scope=vdb
 

Modified: branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,7 +38,6 @@
 import org.jboss.cache.eviction.FIFOAlgorithmConfig;
 import org.jboss.cache.eviction.LFUAlgorithmConfig;
 import org.jboss.cache.eviction.LRUAlgorithmConfig;
-import org.jboss.cache.eviction.MRUAlgorithmConfig;
 import org.jboss.cache.jmx.CacheJmxWrapperMBean;
 
 import com.metamatrix.cache.Cache;
@@ -91,11 +90,6 @@
 			lru.setTimeToLive(-1); // -1 no limit
 			evictionConfig = lru;
 		}
-		else if (config.getPolicy() == Policy.MRU) {
-			MRUAlgorithmConfig mru = new MRUAlgorithmConfig();
-			mru.setMaxNodes(config.getMaxNodes());
-			evictionConfig = mru;
-		}
 		else if (config.getPolicy() == Policy.FIFO) {
 			FIFOAlgorithmConfig fifo = new FIFOAlgorithmConfig();
 			fifo.setMaxNodes(config.getMaxNodes());

Modified: branches/JCA/client/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,9 +22,6 @@
 
 package com.metamatrix.api.exception.query;
 
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 
 /**
  * Thrown when a query cannot be parsed.  This is most likely due to not 

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -69,6 +69,8 @@
  */
 public class SocketServerInstanceImpl implements SocketServerInstance {
 	
+	static final int HANDSHAKE_RETRIES = 10;
+
 	private AtomicInteger MESSAGE_ID = new AtomicInteger();
 
 	private HostInfo hostInfo;
@@ -124,17 +126,24 @@
     }
     
     private void doHandshake() throws IOException, CommunicationException {
-    	final Handshake handshake;
-        try {
-			Object obj = this.socketChannel.read();
-			
-			if (!(obj instanceof Handshake)) {
-				throw new CommunicationException(CommPlatformPlugin.Util.getString("SocketServerInstanceImpl.handshake_error"));  //$NON-NLS-1$
+    	Handshake handshake = null;
+    	for (int i = 0; i < HANDSHAKE_RETRIES; i++) {
+	        try {
+				Object obj = this.socketChannel.read();
+				
+				if (!(obj instanceof Handshake)) {
+					throw new CommunicationException(CommPlatformPlugin.Util.getString("SocketServerInstanceImpl.handshake_error"));  //$NON-NLS-1$
+				}
+				handshake = (Handshake)obj;
+				break;
+			} catch (ClassNotFoundException e1) {
+				throw new CommunicationException(e1);
+			} catch (SocketTimeoutException e) {
+				if (i == HANDSHAKE_RETRIES - 1) {
+					throw e;
+				}
 			}
-			handshake = (Handshake)obj;
-		} catch (ClassNotFoundException e1) {
-			throw new CommunicationException(e1);
-		}
+    	}
 
         try {
             if (!getVersionInfo().equals(handshake.getVersion())) {
@@ -312,15 +321,15 @@
 							long start = System.currentTimeMillis();
 							try {
 								receivedMessage(socketChannel.read());
+							} catch (SocketTimeoutException e) {
 							} catch (IOException e) {
-								if (e instanceof SocketTimeoutException) {
-									timeoutMillis -= (System.currentTimeMillis() - start);
-									continue;
-								}
 								exceptionOccurred(e);
 							} catch (ClassNotFoundException e) {
 								exceptionOccurred(e);
 							}
+							if (!isDone()) {
+								timeoutMillis -= (System.currentTimeMillis() - start);
+							}
 						}
 						return super.get(timeout, unit);
 					}

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/lob/ByteLobChunkStream.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/lob/ByteLobChunkStream.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/lob/ByteLobChunkStream.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -31,9 +31,6 @@
 /**
  * A wrapper class, given a InputStream object can convert a underlying 
  * stream into sequence of ByteLobChunk objects of given chunk size. 
- * Opposite of the ByteLobChunkInputStream.
- * 
- * @see ByteLobChunkInputStream
  */
 public class ByteLobChunkStream  implements LobChunkProducer {
     private PushbackInputStream stream;

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/lob/LobChunkInputStream.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/lob/LobChunkInputStream.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/lob/LobChunkInputStream.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,13 +22,13 @@
 
 package com.metamatrix.common.lob;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.nio.charset.Charset;
 
+import com.metamatrix.common.types.Streamable;
 import com.metamatrix.core.CorePlugin;
 
 
@@ -38,16 +38,13 @@
  * stream the lob data. 
  */
 public class LobChunkInputStream extends InputStream {
-    LobChunkProducer reader;
+    private LobChunkProducer reader;
 
-    byte[] byteData = null;
-    int currentCounter = 0;
-    boolean lastChunk = false;
-    int availableCounter = 0;
-    boolean closed = false;
+    private byte[] byteData = null;
+    private int currentCounter = 0;
+    private boolean lastChunk = false;
+    private boolean closed = false;
     
-    byte[] contents = null;
-    
     public LobChunkInputStream(LobChunkProducer reader) {
         this.reader = reader;
     }
@@ -56,37 +53,19 @@
         if (this.closed) {
             throw new IllegalStateException(CorePlugin.Util.getString("stream_closed")); //$NON-NLS-1$
         }        
-        if (this.availableCounter == 0) {
+        while (this.byteData == null || this.byteData.length <= currentCounter) {
         	if (this.lastChunk) {
 	            // we are done
 	            return -1;
         	}
-            fetchNextChunk();
-        }
-
-        // so we have data
-        int ret = -1;
-        if (this.availableCounter > 0) {
-            ret = (byteData[currentCounter++] & 0xFF);
-            this.availableCounter--;
-        }
-        return ret;
-    }
-
-    void fetchNextChunk() throws IOException {
-    	LobChunk value = this.reader.getNextChunk();
-        if (value != null) {
+        	LobChunk value = this.reader.getNextChunk();
             this.lastChunk = value.isLast();
             this.byteData = value.getBytes();
             this.currentCounter = 0;
-            this.availableCounter = this.byteData.length;
-        } else {
-            throw new IOException(CorePlugin.Util.getString("lob.invaliddata")); //$NON-NLS-1$
         }
-    }
 
-    public int read(byte[] b) throws IOException {
-        return read(b, 0, b.length);
+        // so we have data
+        return (byteData[currentCounter++] & 0xFF);
     }
 
     /**  
@@ -97,30 +76,10 @@
         this.reader.close();
     }
 
-    /** 
-     * Get the byte contents of the input stream. use caution as this may use up VM memory as
-     * the contents are loaded into memory.
-     */
-    public byte[] getByteContents() throws IOException {
-        if (this.contents == null) {
-            ByteArrayOutputStream bos = new ByteArrayOutputStream(100*1024);
-            byte[] buf = new byte[100*1024];
-            int read = read(buf);                    
-            while(read != -1) {
-                bos.write(buf, 0, read);
-                read = read(buf);
-            }
-            close();
-            this.contents = bos.toByteArray();
-            bos.close();
-        }
-        return this.contents;
-    }
-    
     /**
-     * @return a valid UTF16 based reader
+     * @return a valid reader
      */
-    public Reader getUTF16Reader() {
-    	return new InputStreamReader(this, Charset.forName("UTF-16")); //$NON-NLS-1$
+    public Reader getReader() {
+    	return new InputStreamReader(this, Charset.forName(Streamable.ENCODING));
     }
 }

Modified: branches/JCA/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -42,9 +42,6 @@
 
     // cache properties
     public static final String USE_RESULTSET_CACHE = "ResultSetCache.enabled"; //$NON-NLS-1$
-    public static final String MAX_RESULTSET_CACHE_SIZE = "ResultSetCache.maxSizeInMB"; //$NON-NLS-1$
-	public static final String MAX_RESULTSET_CACHE_AGE = "ResultSetCache.maxAgeInSeconds"; //$NON-NLS-1$
-	public static final String RESULTSET_CACHE_SCOPE = "ResultSetCache.scope"; //$NON-NLS-1$
 	public static final String MAX_CODE_TABLE_RECORDS_PER_TABLE = "CodeTables.maxRowsPerTable"; //$NON-NLS-1$
 	public static final String MAX_CODE_TABLE_RECORDS = "CodeTables.maxRows"; //$NON-NLS-1$
 	public static final String MAX_CODE_TABLES = "CodeTables.maxCount"; //$NON-NLS-1$

Modified: branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -68,9 +68,6 @@
     // Treat the double quoted strings as variables in the command
     private boolean ansiQuotedIdentifiers = true;
     
-    //whether query plan is allowed or not
-    private boolean queryPlanAllowed = true;
-    
     private boolean showPlan = false;
     
     private int rowLimit;
@@ -204,7 +201,7 @@
      */
     public String getTxnAutoWrapMode() {
     	if (txnAutoWrapMode == null) {
-    		return ExecutionProperties.AUTO_WRAP_OPTIMISTIC;
+    		return ExecutionProperties.TXN_WRAP_AUTO;
     	}
         return txnAutoWrapMode;
     }
@@ -217,10 +214,9 @@
     public void setTxnAutoWrapMode(String txnAutoWrapMode) throws MetaMatrixProcessingException {
     	if (txnAutoWrapMode != null) {
     		txnAutoWrapMode = txnAutoWrapMode.toUpperCase();
-    		if (!(txnAutoWrapMode.equals(ExecutionProperties.AUTO_WRAP_OFF)
-    			|| txnAutoWrapMode.equals(ExecutionProperties.AUTO_WRAP_ON)
-    			|| txnAutoWrapMode.equals(ExecutionProperties.AUTO_WRAP_OPTIMISTIC)
-    			|| txnAutoWrapMode.equals(ExecutionProperties.AUTO_WRAP_PESSIMISTIC))) {
+    		if (!(txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_OFF)
+    			|| txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_ON)
+    			|| txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_AUTO))) {
     			throw new MetaMatrixProcessingException(CommonCommPlugin.Util.getString("RequestMessage.invalid_txnAutoWrap", txnAutoWrapMode)); //$NON-NLS-1$
     		}
     	} 
@@ -315,14 +311,6 @@
 		this.ansiQuotedIdentifiers = ansiQuotedIdentifiers;
 	}
 
-    public void setQueryPlanAllowed(boolean allowed) {
-    	queryPlanAllowed = allowed;
-    }
-
-    public boolean isQueryPlanAllowed() {
-        return queryPlanAllowed;
-    }
-    
     /** 
      * @return Returns the showPlan.
      * @since 4.3

Modified: branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ExecutionProperties.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ExecutionProperties.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ExecutionProperties.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,8 +30,6 @@
  */
 public interface ExecutionProperties {
 
-    
-    
     /** Execution property name for XML format */
     public static final String PROP_XML_FORMAT = "XMLFormat"; //$NON-NLS-1$
     
@@ -39,7 +37,7 @@
     public static final String PROP_XML_VALIDATION = "XMLValidation"; //$NON-NLS-1$
 
     /** Execution property name for transaction auto wrap mode */
-    public static final String PROP_TXN_AUTO_WRAP = "txnAutoWrap"; //$NON-NLS-1$
+    public static final String PROP_TXN_AUTO_WRAP = "autoCommitTxn"; //$NON-NLS-1$
 
     /** Execution property name for partial results mode */
     public static final String PROP_PARTIAL_RESULTS_MODE = "partialResultsMode"; //$NON-NLS-1$
@@ -52,22 +50,18 @@
 
     /** Transaction auto wrap constant - never wrap a command execution in a transaction
      *  and allow multi-source updates to occur outside of a transaction. */
-    public static final String AUTO_WRAP_OFF = "OFF"; //$NON-NLS-1$
+    public static final String TXN_WRAP_OFF = "OFF"; //$NON-NLS-1$
 
     /** Transaction auto wrap constant - always wrap every non-transactional command
      *  execution in a transaction. */
-    public static final String AUTO_WRAP_ON = "ON"; //$NON-NLS-1$
+    public static final String TXN_WRAP_ON = "ON"; //$NON-NLS-1$
 
-    /** Transaction auto wrap constant - pessimistic mode assumes that any command
-     *  execution might require a transaction to be wrapped around it.  To determine
-     *  this an extra server call is made to check whether the command requires
-     *  a transaction and a transaction will be automatically started.  This is most
-     *  accurate and safe, but has a performance impact. */
-    public static final String AUTO_WRAP_PESSIMISTIC = "PESSIMISTIC"; //$NON-NLS-1$
+    /**
+     * Transaction auto wrap constant - checks if a command
+     * requires a transaction and will be automatically wrap it.
+     */
+    public static final String TXN_WRAP_AUTO = "AUTO"; //$NON-NLS-1$
 
-    /** Transaction auto wrap constant */
-    public static final String AUTO_WRAP_OPTIMISTIC = "OPTIMISTIC"; //$NON-NLS-1$
-
     /** 
      * Whether to use result set cache if it is available 
      * @since 4.2 
@@ -104,6 +98,5 @@
      */
     public static final String SQL_OPTION_SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
     
-    public static final String PLAN_NOT_ALLOWED = "planNotAllowed"; //$NON-NLS-1$
 }
     
\ No newline at end of file

Modified: branches/JCA/client/src/main/resources/teiid-client-settings.properties
===================================================================
--- branches/JCA/client/src/main/resources/teiid-client-settings.properties	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/main/resources/teiid-client-settings.properties	2010-01-10 00:19:53 UTC (rev 1727)
@@ -100,7 +100,7 @@
 # synchronous calls.
 #
 
-org.teiid.sockets.synchronousttl=120000
+org.teiid.sockets.synchronousttl=240000
 
 #
 # Set the socket receive buffer size (in bytes)

Modified: branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -120,7 +120,9 @@
 	}
 
 	public void testHandshakeTimeout() throws Exception {
-		final FakeObjectChannel channel = new FakeObjectChannel(Arrays.asList(new SocketTimeoutException()));
+		SocketTimeoutException[] exs = new SocketTimeoutException[SocketServerInstanceImpl.HANDSHAKE_RETRIES];
+		Arrays.fill(exs, new SocketTimeoutException());
+		final FakeObjectChannel channel = new FakeObjectChannel(Arrays.asList(exs));
 		
 		try {
 			createInstance(channel);

Modified: branches/JCA/client/src/test/java/com/metamatrix/common/lob/TestLobChunkInputStream.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/common/lob/TestLobChunkInputStream.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/test/java/com/metamatrix/common/lob/TestLobChunkInputStream.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,6 +30,7 @@
 
 import junit.framework.TestCase;
 
+import com.metamatrix.core.util.ObjectConverterUtil;
 import com.metamatrix.core.util.UnitTestUtil;
 
 public class TestLobChunkInputStream extends TestCase {
@@ -53,7 +54,7 @@
         
         LobChunkInputStream reader = new LobChunkInputStream(chunkProducer);
         
-        String fileContents = new String(reader.getByteContents());
+        String fileContents = new String(ObjectConverterUtil.convertToByteArray(reader));
         assertEquals(readFile(new FileInputStream(f)), fileContents);
     }
             

Modified: branches/JCA/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -53,8 +53,8 @@
     
     public void testToString() {
         assertEquals(XID1Copy.toString(), XID1.toString());
-        assertEquals("MMXid global:1 branch:null format:0", XID1.toString()); //$NON-NLS-1$
-        assertEquals("MMXid global:2 branch:3 format:0", XID2.toString()); //$NON-NLS-1$
+        assertEquals("Teiid-Xid global:1 branch:null format:0", XID1.toString()); //$NON-NLS-1$
+        assertEquals("Teiid-Xid global:2 branch:3 format:0", XID2.toString()); //$NON-NLS-1$
     }
     
 }

Modified: branches/JCA/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -60,7 +60,7 @@
         message.setStyleSheet("myStyleSheet"); //$NON-NLS-1$
         message.setExecutionPayload("myExecutionPayload"); //$NON-NLS-1$
         try {
-			message.setTxnAutoWrapMode(ExecutionProperties.AUTO_WRAP_ON);
+			message.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_ON);
 		} catch (MetaMatrixProcessingException e) {
 			throw new RuntimeException(e);
 		} 
@@ -89,7 +89,7 @@
         assertEquals(new Date(12345678L), copy.getProcessingTimestamp());
         assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$
         assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$
-        assertEquals(ExecutionProperties.AUTO_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
+        assertEquals(ExecutionProperties.TXN_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
         assertTrue(copy.getValidationMode());
         assertEquals("xMLFormat", copy.getXMLFormat()); //$NON-NLS-1$
         assertTrue(copy.getShowPlan());

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -188,38 +188,6 @@
     
     private String disableLocalTxn;
 
-    /**
-     * A setting that controls how connections created by this DataSource manage transactions for client
-     * requests when client applications do not use transactions.  Because a Teiid virtual database
-     * will likely deal with multiple underlying information sources, Teiid will execute
-     * all client requests within the contexts of transactions.  This method determines the semantics
-     * of creating such transactions when the client does not explicitly do so.
-     * <p>
-     * The allowable values for this property are:
-     * <ul>
-     *   <li>"<code>OFF</code>" - Nothing is ever wrapped in a transaction and the server will execute
-     * multi-source updates happily but outside a transaction.  This is least safe but highest performance.
-     * The {@link #TXN_AUTO_WRAP_OFF} constant value is provided for convenience.</li>
-     *   <li>"<code>ON</code>" - Always wrap every command in a transaction.  This is most safe but lowest
-     * performance.
-     * The {@link #TXN_AUTO_WRAP_ON} constant value is provided for convenience.</li>
-     *   <li>"<code>PESSIMISTIC</code>" - Assume that any command might require a transaction.  Make a server
-     * call to check whether the command being executed needs a transaction and wrap the command in a
-     * transaction if necessary.  This will auto wrap in exactly the cases where it is needed but requires
-     * an extra server call on every command execution (including queries).  This is as safe as ON, but
-     * lower performance than OFF for cases where no transaction is actually needed (like queries).
-     * This is the default value.
-     * The {@link #TXN_AUTO_WRAP_PESSIMISTIC} constant value is provided for convenience.</li>
-     *   <li>"<code>OPTIMISTIC</code>" - same as OFF but assume that no command not in a transaction actually
-     * needs one.  In other words, we're letting the user decide when to use and not use a transaction and
-     * assuming they are doing it correctly.  Only difference from OFF is that if the user executes a command
-     * that requires a transaction but they don't use one, we will detect this and throw an exception.  This
-     * provides the safety of ON or PESSIMISTIC mode but better performance in the common case of queries
-     * that are not multi-source.
-     * The {@link #TXN_AUTO_WRAP_OPTIMISTIC} constant value is provided for convenience.</li>
-     * </ul>
-     * </p>
-     */
     private String transactionAutoWrap;
     
     private boolean ansiQuotedIdentifiers = true;
@@ -239,35 +207,21 @@
      * Transaction auto wrap constant - never wrap a command execution in a transaction
      * and allow multi-source updates to occur outside of a transaction.
      */
-    public static final String TXN_AUTO_WRAP_OFF = "OFF"; //$NON-NLS-1$
+    public static final String TXN_WRAP_OFF = ExecutionProperties.TXN_WRAP_OFF;
 
     /**
      * Transaction auto wrap constant - always wrap every non-transactional command
      * execution in a transaction.
      */
-    public static final String TXN_AUTO_WRAP_ON = "ON"; //$NON-NLS-1$
+    public static final String TXN_WRAP_ON = ExecutionProperties.TXN_WRAP_ON;
 
     /**
-     * Transaction auto wrap constant - pessimistic mode assumes that any command
-     * execution might require a transaction to be wrapped around it.  To determine
-     * this an extra server call is made to check whether the command requires
-     * a transaction and a transaction will be automatically started.  This is most
-     * accurate and safe, but has a performance impact.
+     * Transaction auto wrap constant - checks if a command
+     * requires a transaction and will be automatically wrap it.
      */
-    public static final String TXN_AUTO_WRAP_PESSIMISTIC = "PESSIMISTIC"; //$NON-NLS-1$
+    public static final String TXN_WRAP_AUTO = ExecutionProperties.TXN_WRAP_AUTO;
 
     /**
-     * Transaction auto wrap constant - optimistic mode assumes that non-transactional
-     * commands typically do not require a transaction due to a multi-source update,
-     * so no transaction is created.  In this respect, this mode is identical to
-     * {@link #TXN_AUTO_WRAP_OFF}.  However, these modes differ because if we
-     * discover during server execution that multiple sources will be updated by
-     * a particular command, an exception is thrown to indicate that the command
-     * cannot be executed.  This is the default mode.
-     */
-    public static final String TXN_AUTO_WRAP_OPTIMISTIC = "OPTIMISTIC"; //$NON-NLS-1$
-
-    /**
      * String to hold additional properties that are not represented with an explicit getter/setter
      */
     private String additionalProperties;
@@ -677,7 +631,8 @@
     }
 
     /**
-     * @see #getTxnAutoWrap()
+     * @deprecated
+     * @see #getAutoCommitTxn()
      * @return
      */
     public String getTransactionAutoWrap() {
@@ -685,7 +640,8 @@
     }
 
     /**
-     * @see #setTxnAutoWrap(String)
+     * @deprecated
+     * @see #setAutoCommitTxn(String)
      * @param transactionAutoWrap
      */
     public void setTransactionAutoWrap(String transactionAutoWrap) {
@@ -702,13 +658,13 @@
      * @return the current setting, or null if the property has not been set and the default mode will
      * be used.
      */
-    public String getTxnAutoWrap() {
+    public String getAutoCommitTxn() {
 		return this.transactionAutoWrap;
 	}
     
     /**
      * Sets the setting for how connections are created by this DataSource manage transactions
-     * for client requests when client applications do not use transactions.
+     * for client requests with autoCommit = true.
      * Because a virtual database will likely deal with multiple underlying information sources,
      * Teiid will execute all client requests within the contexts of transactions.
      * This method determines the semantics of creating such transactions when the client does not
@@ -718,28 +674,18 @@
      * <ul>
      *   <li>"<code>OFF</code>" - Nothing is ever wrapped in a transaction and the server will execute
      * multi-source updates happily but outside a transaction.  This is least safe but highest performance.
-     * The {@link #TXN_AUTO_WRAP_OFF} constant value is provided for convenience.</li>
+     * The {@link #TXN_WRAP_OFF} constant value is provided for convenience.</li>
      *   <li>"<code>ON</code>" - Always wrap every command in a transaction.  This is most safe but lowest
      * performance.
-     * The {@link #TXN_AUTO_WRAP_ON} constant value is provided for convenience.</li>
-     *   <li>"<code>PESSIMISTIC</code>" - Assume that any command might require a transaction.  Make a server
-     * call to check whether the command being executed needs a transaction and wrap the command in a
-     * transaction if necessary.  This will auto wrap in exactly the cases where it is needed but requires
-     * an extra server call on every command execution (including queries).  This is as safe as ON, but
-     * lower performance than OFF for cases where no transaction is actually needed (like queries).
-     * The {@link #TXN_AUTO_WRAP_PESSIMISTIC} constant value is provided for convenience.</li>
-     *   <li>"<code>OPTIMISTIC</code>" - same as OFF but assume that no command not in a transaction actually
-     * needs one.  In other words, we're letting the user decide when to use and not use a transaction and
-     * assuming they are doing it correctly.  Only difference from OFF is that if the user executes a command
-     * that requires a transaction but they don't use one, we will detect this and throw an exception.  This
-     * provides the safety of ON or PESSIMISTIC mode but better performance in the common case of queries
-     * that are not multi-source.
-     * The {@link #TXN_AUTO_WRAP_OPTIMISTIC} constant value is provided for convenience.</li>
+     * The {@link #TXN_WRAP_ON} constant value is provided for convenience.</li>
+     *   <li>"<code>AUTO</code>" - checks if a command requires a transaction and will be automatically wrap it.
+     * This is the default mode.
+     * The {@link #TXN_WRAP_AUTO} constant value is provided for convenience.</li>
      * </ul>
      * </p>
      * @param transactionAutoWrap The transactionAutoWrap to set
      */
-    public void setTxnAutoWrap(String transactionAutoWrap) {
+    public void setAutoCommitTxn(String transactionAutoWrap) {
     	this.transactionAutoWrap = transactionAutoWrap;
     }
 
@@ -800,21 +746,18 @@
             return null;    // no longer require an app server name, 'cause will look on classpath
         }
         final String trimmedAutoWrap = autoWrap.trim();
-        if( TXN_AUTO_WRAP_ON.equals(trimmedAutoWrap) ) {
+        if( TXN_WRAP_ON.equals(trimmedAutoWrap) ) {
             return null;
         }
-        if( TXN_AUTO_WRAP_OFF.equals(trimmedAutoWrap) ) {
+        if( TXN_WRAP_OFF.equals(trimmedAutoWrap) ) {
             return null;
         }
-        if( TXN_AUTO_WRAP_OPTIMISTIC.equals(trimmedAutoWrap) ) {
+        if( TXN_WRAP_AUTO.equals(trimmedAutoWrap) ) {
             return null;
         }
-        if( TXN_AUTO_WRAP_PESSIMISTIC.equals(trimmedAutoWrap) ) {
-            return null;
-        }
 
         Object[] params = new Object[] {
-            TXN_AUTO_WRAP_ON, TXN_AUTO_WRAP_OFF, TXN_AUTO_WRAP_OPTIMISTIC, TXN_AUTO_WRAP_PESSIMISTIC };
+            TXN_WRAP_ON, TXN_WRAP_OFF, TXN_WRAP_AUTO };
         return JDBCPlugin.Util.getString("MMDataSource.Invalid_trans_auto_wrap_mode", params); //$NON-NLS-1$
     }
          

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -74,7 +74,7 @@
     /**
      * Returns true if the driver thinks that it can open a connection to the given URL. Typically drivers will return true if
      * they understand the subprotocol specified in the URL and false if they don't. Expected URL format is
-     * jdbc:metamatrix:VDB at pathToPropertyFile;version=1;logFile=<logFile.log>;logLevel=<logLevel>;txnAutoWrap=<?>
+     * jdbc:metamatrix:VDB at pathToPropertyFile;version=1;logFile=<logFile.log>;logLevel=<logLevel>;property=<?>
      * 
      * @param The URL used to establish a connection.
      * @return A boolean value indicating whether the driver understands the subprotocol.

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -104,7 +104,7 @@
      * <code>CLOB</code> value
      */
     public Reader getCharacterStream() throws SQLException {
-        return new LobChunkInputStream(lobChunckFactory.getLobChunkProducer()).getUTF16Reader();
+        return new LobChunkInputStream(lobChunckFactory.getLobChunkProducer()).getReader();
     }
 
     /**

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -134,7 +134,7 @@
         // set default properties if not overridden
         String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
         if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
-            info.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.AUTO_WRAP_OPTIMISTIC);
+            info.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.TXN_WRAP_AUTO);
         }
 
         // Get default fetch size
@@ -177,6 +177,10 @@
         this.disableLocalTransactions = Boolean.valueOf(this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)).booleanValue();
     }
     
+    protected Properties getConnectionProperties() {
+        return this.propInfo;
+    }
+    
     ClientSideDQP getDQP() {
     	return this.dqp;
     }

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -151,7 +151,7 @@
      * These include required and any optional properties specified in the URL.
      * Expected URL format -- jdbc:metamatrix:local:VDB at server:port;version=1;user=logon;
      * password=pw;logFile=<logFile.log>;
-     * logLevel=<logLevel>;txnAutoWrap=<?>;credentials=mycredentials
+     * logLevel=<logLevel>;credentials=mycredentials
      * @param The URL needed to be parsed.
      * @param The properties object which is to be updated with properties in the URL.
      * @throws SQLException if the URL is not in the expected format.
@@ -194,7 +194,7 @@
      * Typically drivers will return true if they understand the subprotocol specified
      * in the URL and false if they don't.
      * Expected URL format is
-     * jdbc:metamatrix:subprotocol:VDB at server:port;version=1;logFile=<logFile.log>;logLevel=<logLevel>;txnAutoWrap=<?>
+     * jdbc:metamatrix:subprotocol:VDB at server:port;version=1;logFile=<logFile.log>;logLevel=<logLevel>;
      * @param The URL used to establish a connection.
      * @return A boolean value indicating whether the driver understands the subprotocol.
      * @throws SQLException, should never occur

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,7 @@
 
 package com.metamatrix.jdbc;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
 import java.math.BigDecimal;
@@ -49,8 +50,11 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.lob.LobChunkInputStream;
 import com.metamatrix.common.types.BlobType;
 import com.metamatrix.common.types.ClobType;
+import com.metamatrix.common.types.InputStreamFactory;
+import com.metamatrix.common.types.SQLXMLImpl;
 import com.metamatrix.common.types.Streamable;
 import com.metamatrix.common.types.XMLType;
 import com.metamatrix.common.util.SqlUtil;
@@ -304,7 +308,20 @@
             currentValue = MMBlob.newInstance(new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, (Streamable)currentValue), (BlobType) currentValue);
         }
         else if (currentValue instanceof XMLType) {
-            currentValue = MMSQLXML.newInstance(new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, (Streamable)currentValue), (XMLType) currentValue);
+        	XMLType type = (XMLType)currentValue;
+        	if (Boolean.getBoolean(Streamable.FORCE_STREAMING)) {
+        		SQLXML sourceSQLXML = type.getReference();
+            	if (sourceSQLXML != null) {
+            		return sourceSQLXML;
+            	}
+            }
+        	final StreamingLobChunckProducer.Factory factory = new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, (Streamable)currentValue);
+        	currentValue = new SQLXMLImpl(new InputStreamFactory(Streamable.ENCODING) {
+        		@Override
+        		public InputStream getInputStream() throws IOException {
+        			return new LobChunkInputStream(factory.getLobChunkProducer());
+        		}
+        	});
         } 
         else if (currentValue instanceof java.util.Date) {
             return TimestampWithTimezone.create((java.util.Date)currentValue, serverTimeZone, getDefaultCalendar(), currentValue.getClass());

Deleted: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.jdbc;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.sql.SQLException;
-//## JDBC4.0-begin ##
-import java.sql.SQLXML;
-//## JDBC4.0-end ##
-
-/*## JDBC3.0-JDK1.5-begin ##
-import com.metamatrix.core.jdbc.SQLXML; 
-## JDBC3.0-JDK1.5-end ##*/
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import com.metamatrix.common.lob.LobChunkInputStream;
-import com.metamatrix.common.types.Streamable;
-import com.metamatrix.common.types.XMLType;
-import com.metamatrix.common.util.SqlUtil;
-import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
-
-
-/** 
- * A MM specific implementation of the SQLXML object which is capable of 
- * accessing the SQLXML object as local object when used in the embedded product
- * at the same time capable of using the streaming interface when used in 
- * remote clients.
- */
-public class MMSQLXML implements SQLXML {
-	private final StreamingLobChunckProducer.Factory lobChunckFactory;
-    
-    public static SQLXML newInstance(StreamingLobChunckProducer.Factory lobChunckFactory, XMLType srcXML) throws SQLException {
-    	if (Boolean.getBoolean(Streamable.FORCE_STREAMING)) {
-    		SQLXML sourceSQLXML = srcXML.getReference();
-        	if (sourceSQLXML != null) {
-        		return sourceSQLXML;
-        	}
-        }
-        return new MMSQLXML(lobChunckFactory);        
-    }
-    
-    public MMSQLXML(StreamingLobChunckProducer.Factory lobChunckFactory) throws SQLException {
-    	this.lobChunckFactory = lobChunckFactory;
-    }
-    
-    public Reader getCharacterStream() throws SQLException {
-    	return new LobChunkInputStream(lobChunckFactory.getLobChunkProducer()).getUTF16Reader();
-    }
-
-    public String getString() throws SQLException {
-    	LobChunkInputStream in = new LobChunkInputStream(lobChunckFactory.getLobChunkProducer());
-        try {
-        	//## JDBC4.0-begin ##
-			return new String(in.getByteContents(), Charset.forName("UTF-16")); //$NON-NLS-1$
-			//## JDBC4.0-end ##
-			/*## JDBC3.0-JDK1.5-begin ##
-			return new String(in.getByteContents(), "UTF-16"); //$NON-NLS-1$ 
-			## JDBC3.0-JDK1.5-end ##*/
-		} catch (IOException e) {
-			throw MMSQLException.create(e);
-		} 
-    }
-
-    public String toString() {
-        try {
-            return getString();
-        } catch (SQLException e) {
-            throw new RuntimeException(e);
-        }
-    }
-    
-    public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
-		if (sourceClass == null || sourceClass == StreamSource.class) {
-			return (T)new StreamSource(getCharacterStream());
-		}
-		throw new SQLException(JDBCPlugin.Util.getString("MMSQLXML.unsupported_source", sourceClass)); //$NON-NLS-1$
-	}
-
-	public InputStream getBinaryStream() throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-    
-	public void free() throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-
-	public OutputStream setBinaryStream() throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-
-	public Writer setCharacterStream() throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-
-	public <T extends Result> T setResult(Class<T> resultClass)
-			throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-
-	public void setString(String value) throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();	
-	}
-}

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -45,12 +45,13 @@
 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 com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.common.util.SqlUtil;
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.dqp.message.ParameterInfo;
@@ -154,6 +155,8 @@
     //Map<out/inout/return param index --> index in results>
     protected Map outParamIndexMap = new HashMap();
     
+    private Pattern setStatement = Pattern.compile("\\s*set\\s*(\\w+)\\s*=\\s*(\\w*)", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+    
     /**
      * Factory Constructor 
      * @param driverConnection
@@ -174,7 +177,7 @@
         this.driverConnection = driverConnection;
         this.resultSetType = resultSetType;
         this.resultSetConcurrency = resultSetConcurrency;
-        this.execProps = PropertiesUtils.clone(getConnectionProperties());
+        this.execProps = new Properties(this.driverConnection.getConnectionProperties());
         
         // Set initial fetch size
         String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
@@ -403,8 +406,20 @@
         throws SQLException, MMSQLException {
         checkStatement();
         resetExecutionState();
-        RequestMessage reqMessage = createRequestMessage(commands,
-				isBatchedCommand, requiresResultSet);
+        
+        //handle set statement
+        if (commands.length == 1 && requiresResultSet != Boolean.TRUE) {
+        	Matcher match = setStatement.matcher(commands[0]);
+        	if (match.matches()) {
+        		String key = match.group(1);
+        		String value = match.group(2);
+        		this.driverConnection.getConnectionProperties().setProperty(key, value);
+        		this.updateCounts = new int[] {0};
+        		return;
+        	}
+        }
+        
+        RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, requiresResultSet);
     	ResultsMessage resultsMsg = null;
         try {
         	resultsMsg = sendRequestMessageAndWait(reqMessage);
@@ -713,17 +728,12 @@
         }
     }
 
-    protected Properties getConnectionProperties() {
-        return driverConnection.propInfo;
-    }
-
     /**
      * Helper method for copy the connection properties to request message.
      * @param res Request message that these properties to be copied to.
-     * @param props Connection properties.
      * @throws MMSQLException 
      */
-    protected void copyPropertiesToRequest(RequestMessage res, Properties props) throws MMSQLException {
+    protected void copyPropertiesToRequest(RequestMessage res) throws MMSQLException {
         // Get partial mode
         String partial = getExecutionProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
         res.setPartialResults(Boolean.valueOf(partial).booleanValue());
@@ -757,8 +767,6 @@
         // Get result set cache mode
         String rsCache = getExecutionProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
         res.setUseResultSetCache(Boolean.valueOf(rsCache).booleanValue());
-        
-        res.setQueryPlanAllowed(!Boolean.valueOf(getExecutionProperty(ExecutionProperties.PLAN_NOT_ALLOWED)).booleanValue());
     }
 
     /**
@@ -853,7 +861,7 @@
         reqMsg.setRowLimit(this.maxRows);
 
         // Get connection properties and set them onto request message
-        copyPropertiesToRequest(reqMsg, getConnectionProperties());
+        copyPropertiesToRequest(reqMsg);
 
         reqMsg.setExecutionId(this.currentRequestID);
     	

Modified: branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -178,7 +178,7 @@
      * This method parses the URL and adds properties to the the properties object. These include required and any optional
      * properties specified in the URL. 
      * Expected URL format -- 
-     * jdbc:metamatrix:local:VDB@<pathToConfigFile>logFile=<logFile.log>; logLevel=<logLevel>;txnAutoWrap=<?>;credentials=mycredentials;
+     * jdbc:metamatrix:local:VDB@<pathToConfigFile>logFile=<logFile.log>; logLevel=<logLevel>;credentials=mycredentials;
      * 
      * @param The URL needed to be parsed.
      * @param The properties object which is to be updated with properties in the URL.

Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -46,7 +46,7 @@
     protected static final int    STD_PORT_NUMBER           = 7001;
     protected static final String STD_LOG_FILE              = UnitTestUtil.getTestScratchPath() + "/unitTestLogFile"; //$NON-NLS-1$
     protected static final int    STD_LOG_LEVEL             = 2;
-    protected static final String STD_TXN_AUTO_WRAP         = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+    protected static final String STD_TXN_WRAP         = MMDataSource.TXN_WRAP_AUTO;
     protected static final String STD_PARTIAL_MODE         = "false"; //$NON-NLS-1$
     protected static final String STD_CONFIG_FILE          = UnitTestUtil.getTestDataPath() + "/bqt/bqt.properties";  //$NON-NLS-1$
     protected static final String STD_ALTERNATE_SERVERS     = "unitTestServerName2:7001,unitTestServerName2:7002,unitTestServerName3:7001"; //$NON-NLS-1$
@@ -70,7 +70,7 @@
         dataSource.setDatabaseName(STD_DATABASE_NAME);
         dataSource.setPortNumber(STD_PORT_NUMBER);
         dataSource.setDataSourceName(STD_DATA_SOURCE_NAME);
-        dataSource.setTransactionAutoWrap(STD_TXN_AUTO_WRAP);
+        dataSource.setTransactionAutoWrap(STD_TXN_WRAP);
         dataSource.setPartialResultsMode(STD_PARTIAL_MODE);
         dataSource.setSecure(true);
         dataSource.setAlternateServers(STD_ALTERNATE_SERVERS);
@@ -280,7 +280,7 @@
 
     public void testGetTransactionAutoWrap() {
         final String result = dataSource.getTransactionAutoWrap();
-        assertEquals(result,STD_TXN_AUTO_WRAP);
+        assertEquals(result,STD_TXN_WRAP);
     }
     
     public void testGetShowPlan() {
@@ -393,17 +393,14 @@
 
 
     public void testReasonWhyInvalidTransactionAutoWrap1() {
-        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_AUTO_WRAP_OFF, VALID); //$NON-NLS-1$
+        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_WRAP_OFF, VALID); //$NON-NLS-1$
     }
     public void testReasonWhyInvalidTransactionAutoWrap2() {
-        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_AUTO_WRAP_ON, VALID); //$NON-NLS-1$
+        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_WRAP_ON, VALID); //$NON-NLS-1$
     }
     public void testReasonWhyInvalidTransactionAutoWrap3() {
-        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_AUTO_WRAP_OPTIMISTIC, VALID); //$NON-NLS-1$
+        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_WRAP_AUTO, VALID); //$NON-NLS-1$
     }
-    public void testReasonWhyInvalidTransactionAutoWrap4() {
-        helpTestReasonWhyInvalid("TransactionAutoWrap", MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC, VALID); //$NON-NLS-1$
-    }
     public void testReasonWhyInvalidTransactionAutoWrap5() {
         helpTestReasonWhyInvalid("TransactionAutoWrap", "off", INVALID);    // lowercase value //$NON-NLS-1$ //$NON-NLS-2$
     }
@@ -523,11 +520,11 @@
         final String vdbName = "vdbName"; //$NON-NLS-1$
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = false;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, false, secure, 
-                            "jdbc:teiid:vdbName at mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName"); //$NON-NLS-1$ 
     }
     
     public void testBuildURL3() {
@@ -535,11 +532,11 @@
         final String vdbName = "vdbName"; //$NON-NLS-1$
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = false;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, true, secure,
-                            "jdbc:teiid:vdbName at mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
     }
 
     // Test secure protocol
@@ -548,11 +545,11 @@
         final String vdbName = "vdbName"; //$NON-NLS-1$
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = true;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, true, secure,
-                            "jdbc:teiid:vdbName at mms://hostname:7001;ApplicationName=JDBC;serverURL=mms://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mms://hostname:7001;ApplicationName=JDBC;serverURL=mms://hostname:7001;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
     }
 
     /*
@@ -566,11 +563,11 @@
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
         final String alternateServers = "hostName:7002,hostName2:7001,hostName2:7002"; //$NON-NLS-1$
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = false;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
-                            "jdbc:teiid:vdbName at mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
     }
 
     /*
@@ -584,11 +581,11 @@
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
         final String alternateServers = "hostName:7002,hostName2:7001,hostName2:7002"; //$NON-NLS-1$
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = true;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
-                            "jdbc:teiid:vdbName at mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
     }
 
     /*
@@ -603,11 +600,11 @@
         final String vdbVersion = ""; //$NON-NLS-1$
         final int portNumber = 7001;
         final String alternateServers = "hostName:7002,hostName2,hostName2:7002"; //$NON-NLS-1$
-        final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
+        final String transactionAutoWrap = MMDataSource.TXN_WRAP_AUTO;
         final String partialMode = "false"; //$NON-NLS-1$
         final boolean secure = false;
         helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
-                            "jdbc:teiid:vdbName at mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
+                            "jdbc:teiid:vdbName at mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;partialResultsMode=false;autoCommitTxn=AUTO;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$ 
     }
     
     public void testBuildURL_AdditionalProperties() {

Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -54,12 +54,12 @@
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb at mms://localhost:1234")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://localhost:1234;version=x")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$       
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mms://127.0.0.1:1234")); //$NON-NLS-1$
         assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb at mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
@@ -79,7 +79,7 @@
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
         assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb at mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$        
     }
@@ -114,7 +114,7 @@
     
     public void testParseURL3() throws SQLException{
         Properties p = new Properties();
-        MMDriver.getInstance().parseURL("jdbc:metamatrix:BQT at mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;txnAutoWrap=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+        MMDriver.getInstance().parseURL("jdbc:metamatrix:BQT at mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));         //$NON-NLS-1$
         assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$

Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMStatement.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMStatement.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMStatement.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -27,6 +27,7 @@
 import java.sql.ResultSet;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Properties;
 
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -59,4 +60,13 @@
 		assertTrue(Arrays.equals(new int[] {1, 2}, statement.executeBatch()));
 	}
 	
+	@Test public void testSetStatement() throws Exception {
+		MMConnection conn = Mockito.mock(MMConnection.class);
+		Properties p = new Properties();
+		Mockito.stub(conn.getConnectionProperties()).toReturn(p);
+		MMStatement statement = new MMStatement(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+		assertFalse(statement.execute("set foo = bar")); //$NON-NLS-1$
+		assertEquals("bar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
 }

Modified: branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -48,22 +48,22 @@
 //        // Windows Path
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:\\metamatrix\\dqp\\dqp.properties")); //$NON-NLS-1$
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:\\metamatrix\\dqp\\dqp.properties;version=1")); //$NON-NLS-1$
-        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:\\metamatrix\\dqp\\dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES")); //$NON-NLS-1$
+        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:\\metamatrix\\dqp\\dqp.properties;version=1;autoCommitTxn=ON;partialResultsMode=YES")); //$NON-NLS-1$
         
         // Alternative windows path
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:/metamatrix/dqp/dqp.properties")); //$NON-NLS-1$
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:/metamatrix/dqp/dqp.properties;version=1")); //$NON-NLS-1$
-        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES")); //$NON-NLS-1$
+        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at c:/metamatrix/dqp/dqp.properties;version=1;autoCommitTxn=ON;partialResultsMode=YES")); //$NON-NLS-1$
 
         // Abosolute path (Unix or windows)
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties")); //$NON-NLS-1$
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1")); //$NON-NLS-1$
-        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES")); //$NON-NLS-1$
+        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1;autoCommitTxn=ON;partialResultsMode=YES")); //$NON-NLS-1$
 
         // relative path
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at ../../metamatrix/dqp/dqp.properties")); //$NON-NLS-1$
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at ../../metamatrix/dqp/dqp.properties;version=1")); //$NON-NLS-1$
-        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at ../../metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES")); //$NON-NLS-1$
+        assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at ../../metamatrix/dqp/dqp.properties;version=1;autoCommitTxn=ON;partialResultsMode=YES")); //$NON-NLS-1$
         
         // File URL should be supported (not sure)
         assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:metamatrix:BQT at file:///c:/metamatrix/dqp/dqp.properties")); //$NON-NLS-1$
@@ -103,7 +103,7 @@
     
     @Test public void testParseURL3() throws SQLException{
         Properties p = new Properties();
-        org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=4;txnAutoWrap=ON;partialResultsMode=YES;", p); //$NON-NLS-1$
+        org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=4;autoCommitTxn=ON;partialResultsMode=YES;", p); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4")); //$NON-NLS-1$

Modified: branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -48,12 +48,12 @@
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb at mms://localhost:1234")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://localhost:1234;version=x")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$       
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mms://127.0.0.1:1234")); //$NON-NLS-1$
         assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
@@ -76,7 +76,7 @@
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
-        assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+        assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
         assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:vdb at mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$        
     }
@@ -110,7 +110,7 @@
     
     @Test public void testParseURL3() throws SQLException{
         Properties p = new Properties();
-        SocketProfile.parseURL("jdbc:teiid:BQT at mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;txnAutoWrap=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+        SocketProfile.parseURL("jdbc:teiid:BQT at mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
         assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));         //$NON-NLS-1$
         assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/BaseXMLTranslator.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/BaseXMLTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/BaseXMLTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-/** 
- * Implements some common menthods that can be shared. 
- */
-public abstract class BaseXMLTranslator implements XMLTranslator {
-    static final String XMLPI = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ 
-    static final String newLine = "\n"; //$NON-NLS-1$
-    
-    Properties properties;
-        
-    protected BaseXMLTranslator(Properties props) {
-        this.properties = props;
-    }
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getString()
-     */
-    public String getString() throws IOException {
-       try {
-            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(idenityTransform)));
-            StringWriter sw = new StringWriter();
-            sw.write(XMLPI);
-            if (useIndentation()) {
-                sw.write(newLine); 
-            }
-            t.transform(getSource(), new StreamResult(sw));
-            return sw.toString(); 
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new IOException(e.getMessage());
-        }
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getReader()
-     */
-    public Reader getReader() throws IOException {
-        return new StringReader(getString());
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getInputStream()
-     */
-    public InputStream getInputStream() throws IOException {
-        return new ByteArrayInputStream(getBytes());
-    }
-    
-    /** 
-     * Get the XML contents in byte array form.
-     */
-    public byte[] getBytes() throws IOException {
-        try {
-            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(idenityTransform)));
-            ByteArrayOutputStream stream = new ByteArrayOutputStream();
-            stream.write(XMLPI.getBytes());
-            if (useIndentation()) {
-                stream.write(newLine.getBytes()); 
-            }            
-            t.transform(getSource(), new StreamResult(stream));
-            return stream.toByteArray(); 
-        } catch (Exception e) {
-            throw new IOException(e.getMessage());
-        }
-    }
-
-    public Properties getProperties() {
-        return this.properties;
-    }
-    
-    private boolean useIndentation() {
-        if (getProperties() != null) {
-            return "yes".equalsIgnoreCase(getProperties().getProperty(INDENT)); //$NON-NLS-1$            
-        }
-        return false;
-    }
-}

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,7 @@
 
 package com.metamatrix.common.types;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Blob;
@@ -42,17 +43,15 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.Source;
 
 import com.metamatrix.common.types.basic.AnyToObjectTransform;
 import com.metamatrix.common.types.basic.AnyToStringTransform;
 import com.metamatrix.common.types.basic.BooleanToNumberTransform;
-import com.metamatrix.common.types.basic.FloatingNumberToBigDecimalTransform;
-import com.metamatrix.common.types.basic.FloatingNumberToBigIntegerTransform;
 import com.metamatrix.common.types.basic.FixedNumberToBigDecimalTransform;
 import com.metamatrix.common.types.basic.FixedNumberToBigIntegerTransform;
+import com.metamatrix.common.types.basic.FloatingNumberToBigDecimalTransform;
+import com.metamatrix.common.types.basic.FloatingNumberToBigIntegerTransform;
 import com.metamatrix.common.types.basic.NullToAnyTransform;
 import com.metamatrix.common.types.basic.NumberToBooleanTransform;
 import com.metamatrix.common.types.basic.NumberToByteTransform;
@@ -64,6 +63,7 @@
 import com.metamatrix.common.types.basic.ObjectToAnyTransform;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
+import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.ArgCheck;
 
 /**
@@ -359,7 +359,7 @@
 
 		Map<String, Transform> innerMap = transforms.get(sourceName);
 		if (innerMap == null) {
-			innerMap = new HashMap<String, Transform>();
+			innerMap = new LinkedHashMap<String, Transform>();
 			transforms.put(sourceName, innerMap);
 		}
 		innerMap.put(targetName, transform);
@@ -602,7 +602,7 @@
 				return new BlobType(value);
 			}
 		});
-		sourceConverters.put(byte[].class, new SourceTransform<byte[], BlobType>() {
+		addSourceTransform(byte[].class, new SourceTransform<byte[], BlobType>() {
 			//## JDBC4.0-begin ##
 			@Override
 			//## JDBC4.0-end ##
@@ -610,7 +610,7 @@
 				return new BlobType(BlobType.createBlob(value));
 			}
 		});
-		sourceConverters.put(SQLXML.class, new SourceTransform<SQLXML, XMLType>() {
+		addSourceTransform(SQLXML.class, new SourceTransform<SQLXML, XMLType>() {
 			//## JDBC4.0-begin ##
 			@Override
 			//## JDBC4.0-end ##
@@ -618,34 +618,27 @@
 				return new XMLType(value);
 			}
 		});
-		sourceConverters.put(DOMSource.class, new SourceTransform<DOMSource, XMLType>() {
+		//Note: the default transform from non-InputStreamFactory source is a fully materialized string
+		addSourceTransform(Source.class, new SourceTransform<Source, XMLType>() {
 			//## JDBC4.0-begin ##
 			@Override
 			//## JDBC4.0-end ##
-			public XMLType transform(DOMSource value) {
-				return new XMLType(new SQLXMLImpl(value));
+			public XMLType transform(Source value) {
+				if (value instanceof InputStreamFactory) {
+					return new XMLType(new SQLXMLImpl((InputStreamFactory)value));
+				}
+				StandardXMLTranslator sxt = new StandardXMLTranslator(value, null);
+				try {
+					return new XMLType(new SQLXMLImpl(sxt.getString()));
+				} catch (IOException e) {
+					throw new MetaMatrixRuntimeException(e);
+				}
 			}
 		});
-		sourceConverters.put(SAXSource.class, new SourceTransform<SAXSource, XMLType>() {
+		addSourceTransform(Date.class, new SourceTransform<Date, Timestamp>() {
 			//## JDBC4.0-begin ##
 			@Override
 			//## JDBC4.0-end ##
-			public XMLType transform(SAXSource value) {
-				return new XMLType(new SQLXMLImpl(value));
-			}
-		});
-		sourceConverters.put(StreamSource.class, new SourceTransform<StreamSource, XMLType>() {
-			//## JDBC4.0-begin ##
-			@Override
-			//## JDBC4.0-end ##
-			public XMLType transform(StreamSource value) {
-				return new XMLType(new SQLXMLImpl(value));
-			}
-		});
-		sourceConverters.put(Date.class, new SourceTransform<Date, Timestamp>() {
-			//## JDBC4.0-begin ##
-			@Override
-			//## JDBC4.0-end ##
 			public Timestamp transform(Date value) {
 				return new Timestamp(value.getTime());
 			}
@@ -702,4 +695,8 @@
             || DataTypeManager.DefaultDataTypes.CLOB.equals(type)
             || DataTypeManager.DefaultDataTypes.XML.equals(type);
     }
+    
+    public static <S> void addSourceTransform(Class<S> sourceClass, SourceTransform<S, ?> transform) {
+    	sourceConverters.put(sourceClass, transform);
+    }
 }

Copied: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java (from rev 1724, trunk/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java)
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java	                        (rev 0)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.common.types;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.transform.Source;
+
+public abstract class InputStreamFactory implements Source {
+	
+	private String encoding;
+	private String systemId;
+	
+	public InputStreamFactory(String encoding) {
+		this.encoding = encoding;
+	}
+	
+    /**
+     * Get a new InputStream
+     * @return
+     */
+    public abstract InputStream getInputStream() throws IOException;
+    
+    public String getEncoding() {
+		return encoding;
+	}
+    
+    @Override
+    public String getSystemId() {
+    	return this.systemId;
+    }
+    
+    @Override
+    public void setSystemId(String systemId) {
+    	this.systemId = systemId;
+    }
+    
+    public void free() throws IOException {
+    	
+    }
+}

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,138 +22,111 @@
 
 package com.metamatrix.common.types;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.sql.SQLException;
-//## JDBC4.0-begin ##
 import java.sql.SQLXML;
-//## JDBC4.0-end ##
 
-/*## JDBC3.0-JDK1.5-begin ##
-import com.metamatrix.core.jdbc.SQLXML; 
-## JDBC3.0-JDK1.5-end ##*/
-import java.util.Properties;
-
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
 
 import com.metamatrix.common.util.SqlUtil;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.ObjectConverterUtil;
 
 
 /** 
- * This metamatrix specific implementation of the SQLXML interface;
+ * Default SQLXML impl
  */
 public class SQLXMLImpl implements SQLXML {
     
-    XMLTranslator translator;
-        
-    public SQLXMLImpl(String str) {
-        this.translator = new XMLStreamSourceTranslator(str, new Properties());
-    }
-
-    public SQLXMLImpl(String str, Properties props) {
-        this.translator = new XMLStreamSourceTranslator(str, props);
-    }
+    private InputStreamFactory streamFactory;
     
-    public SQLXMLImpl(char[] str) {
-        this.translator = new XMLStreamSourceTranslator(str, new Properties());
+    public SQLXMLImpl(final byte[] bytes) {
+    	setStreamFactory(bytes);
     }
 
-    public SQLXMLImpl(char[] str, Properties props) {
-        this.translator = new XMLStreamSourceTranslator(str, props);
-    }    
+	private void setStreamFactory(final byte[] bytes) {
+		this.streamFactory = new InputStreamFactory(Streamable.ENCODING) {
+			@Override
+			public InputStream getInputStream() throws IOException {
+				return new ByteArrayInputStream(bytes);
+			}
+		};
+	}
     
-    public SQLXMLImpl(XMLReaderFactory factory) {
-        this(factory, new Properties());
+    public SQLXMLImpl(final String str) {
+    	try {
+			setStreamFactory(str.getBytes(Streamable.ENCODING));
+		} catch (UnsupportedEncodingException e) {
+			throw new MetaMatrixRuntimeException(e);
+		}
     }
-
-    // the reason we have factory insted of reader is the xml may be 
-    // and can be streamed multiple times by a client. If we have reader
-    // one it closed it may not be accessable.
-    public SQLXMLImpl(XMLReaderFactory factory, Properties props) {
-        this.translator = new XMLStreamSourceTranslator(factory, props);
-    }
-   
-    public SQLXMLImpl(StreamSource streamSource) {
-        this(streamSource, new Properties());
-    }
     
-    public SQLXMLImpl(StreamSource streamSource, Properties props) {
-        this.translator = new XMLStreamSourceTranslator(streamSource, props);
+    public SQLXMLImpl(InputStreamFactory factory) {
+        this.streamFactory = factory;
     }
-        
-    public SQLXMLImpl(DOMSource domSource) {
-        this.translator = new XMLDomSourceTranslator(domSource, new Properties());
-    }
     
-    public SQLXMLImpl(DOMSource domSource, Properties props) {
-        this.translator = new XMLDomSourceTranslator(domSource, props);
-    }
-
-    public SQLXMLImpl(SAXSource saxSource) {
-        this.translator = new XMLSAXSourceTranslator(saxSource, new Properties());
-    }    
-    
-    public SQLXMLImpl(SAXSource saxSource, Properties props) {
-        this.translator = new XMLSAXSourceTranslator(saxSource, props);
-    }    
-
-    public SQLXMLImpl(XMLTranslator translator) {
-        this.translator = translator;
-    }    
-    
     public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
-        try {
-            Source c = this.translator.getSource();
-            if (sourceClass == null || sourceClass == c.getClass()) {
-            	return (T)c;
-            }
-        } catch (IOException e) {
-            throw new SQLException(e.getMessage());
-        }
+		if (sourceClass == null || sourceClass == StreamSource.class) {
+			return (T)new StreamSource(getBinaryStream());
+		}
         throw new SQLException("Unsupported source type " + sourceClass);
     }
 
     public Reader getCharacterStream() throws SQLException {
-        try {
-            return translator.getReader();
-        } catch (IOException e) {
-            throw new SQLException(e.getMessage());
-        }
+    	if (this.streamFactory == null) {
+    		throw new SQLException("SQLXML already freed"); 
+    	}
+    	try {
+			return new InputStreamReader(this.streamFactory.getInputStream(), this.streamFactory.getEncoding());
+		} catch (IOException e) {
+			SQLException ex = new SQLException(e.getMessage());
+			ex.initCause(e);
+			throw ex;
+		}
     }
 
     public InputStream getBinaryStream() throws SQLException {
+    	if (this.streamFactory == null) {
+    		throw new SQLException("SQLXML already freed"); 
+    	}
         try {
-            return translator.getInputStream();
-        } catch (IOException e) {
-            throw new SQLException(e.getMessage());
-        }
+			return this.streamFactory.getInputStream();
+		} catch (IOException e) {
+			SQLException ex = new SQLException(e.getMessage());
+			ex.initCause(e);
+			throw ex;
+		}
     }
 
     public String getString() throws SQLException {
         try {
-            return translator.getString();
+            return new String(ObjectConverterUtil.convertToByteArray(getBinaryStream()), Streamable.ENCODING);
         } catch (IOException e) {
-            throw new SQLException(e.getMessage());
+			SQLException ex = new SQLException(e.getMessage());
+			ex.initCause(e);
+			throw ex;
         }
     }
 
     public OutputStream setBinaryStream() throws SQLException {
-        throw new SQLException("not implemented");//$NON-NLS-1$
+        throw SqlUtil.createFeatureNotSupportedException();
     }
 
     public Writer setCharacterStream() throws SQLException {
-        throw new SQLException("not implemented");//$NON-NLS-1$
+        throw SqlUtil.createFeatureNotSupportedException();
     }
 
     public void setString(String value) throws SQLException {
-        throw new SQLException("not implemented");//$NON-NLS-1$
+        throw SqlUtil.createFeatureNotSupportedException();
     }
 
     public String toString() {
@@ -165,7 +138,16 @@
     }
 
 	public void free() throws SQLException {
-		throw SqlUtil.createFeatureNotSupportedException();
+		if (this.streamFactory != null) {
+			try {
+				this.streamFactory.free();
+				this.streamFactory = null;
+			} catch (IOException e) {
+				SQLException ex = new SQLException(e.getMessage());
+				ex.initCause(e);
+				throw ex;
+			}
+		}
 	}
 
 	public <T extends Result> T setResult(Class<T> resultClass)

Copied: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java (from rev 1724, trunk/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java)
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java	                        (rev 0)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.common.types;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.Properties;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+public class StandardXMLTranslator extends XMLTranslator {
+    static String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$    
+    public static final String INDENT = "indent"; //$NON-NLS-1$
+    
+    public static final String idenityTransform = 
+            "<xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + lineSep + //$NON-NLS-1$
+            "<xsl:output method = \"xml\" omit-xml-declaration=\"yes\"/>" + lineSep + //$NON-NLS-1$
+            "<xsl:template match=\"@*|node()\">" + lineSep +//$NON-NLS-1$ 
+            "    <xsl:copy>\r\n" + lineSep+ //$NON-NLS-1$
+            "        <xsl:apply-templates select=\"@*|node()\"/>" +lineSep+//$NON-NLS-1$ 
+            "    </xsl:copy>" + lineSep + //$NON-NLS-1$
+            "</xsl:template>" + lineSep +//$NON-NLS-1$
+            "</xsl:stylesheet>" + lineSep + //$NON-NLS-1$
+            ""; //$NON-NLS-1$
+
+    static final String XMLPI = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ 
+    static final String newLine = "\n"; //$NON-NLS-1$
+    
+    private Source source;
+    private Properties properties;
+        
+    public StandardXMLTranslator(Source source, Properties props) {
+    	this.source = source;
+        this.properties = props;
+    }
+    
+    @Override
+    public void translate(Writer writer) throws IOException {
+        try {
+            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(idenityTransform)));
+            writer.write(XMLPI);
+            if (useIndentation()) {
+                writer.write(newLine); 
+            }
+            t.transform(source, new StreamResult(writer));
+        } catch (TransformerException e) {
+            IOException ex = new IOException(e.getMessage());
+            ex.initCause(e);
+            throw ex;
+        }
+    }
+        
+    private boolean useIndentation() {
+        if (properties != null) {
+            return "yes".equalsIgnoreCase(properties.getProperty(INDENT)); //$NON-NLS-1$            
+        }
+        return false;
+    }
+}

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/Streamable.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/Streamable.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/Streamable.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,7 +23,6 @@
 package com.metamatrix.common.types;
 
 import java.io.Serializable;
-import java.lang.ref.PhantomReference;
 
 import com.metamatrix.core.CorePlugin;
 
@@ -34,19 +33,13 @@
  * <p>A reference stream id is tuple source id for a Streamble object where the 
  * object is in buffer manager, but the contents will never be written to disk;
  * this is the ID that client needs to reference to get the chunk of data.
- * 
- * <p>A Persistent stream id is Tuple source id under which the server *may* 
- * have saved the data to disk in buffer manager. In case of XML it is saved
- * however in case of Clobs and Blobs it is not saved yet. This id is used by
- * the process worker to in case the reference object has lost its state and we 
- * need to reinsate the object from the disk.
  */
 public abstract class Streamable<T> implements Serializable {
+	public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
     public static final String FORCE_STREAMING = "FORCE_STREAMING"; //$NON-NLS-1$
     public static final int STREAMING_BATCH_SIZE_IN_BYTES = 102400; // 100K
 
     private String referenceStreamId;
-    private String persistenceStreamId;
     protected transient T reference;
     
     public Streamable() {
@@ -77,14 +70,6 @@
         this.referenceStreamId = id;
     }
     
-    public String getPersistenceStreamId() {
-        return persistenceStreamId;
-    }
-
-    public void setPersistenceStreamId(String id) {
-        this.persistenceStreamId = id;
-    } 
-    
     @Override
     public String toString() {
         return reference.toString();
@@ -104,8 +89,7 @@
     		return this.reference.equals(other.reference);
     	}
     	
-    	return this.persistenceStreamId == other.persistenceStreamId
-		&& this.referenceStreamId == other.referenceStreamId;
+    	return this.referenceStreamId == other.referenceStreamId;
     }
 
 }

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLDomSourceTranslator.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLDomSourceTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLDomSourceTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-
-/** 
- * This class converts the DOMSource input documents into other types of XML
- * documents.
- */
-public class XMLDomSourceTranslator extends BaseXMLTranslator {
-
-    DOMSource source;
-    
-    public XMLDomSourceTranslator(DOMSource source, Properties props) {
-        super(props);
-        this.source = source;
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getSource()
-     */
-    public Source getSource() throws IOException {
-        return source;
-    }
-}

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLReaderFactory.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLReaderFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLReaderFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import java.io.IOException;
-import java.io.Reader;
-
-
-/** 
- * A factory interface for generating the readers
- */
-public interface XMLReaderFactory {
-    /**
-     * Get a reader object 
-     * @return
-     */
-    Reader getReader() throws IOException;
-}

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLSAXSourceTranslator.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLSAXSourceTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLSAXSourceTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.sax.SAXSource;
-
-/** 
- * This class converts the DOMSource input documents into other types of XML
- * documents.
- */
-public class XMLSAXSourceTranslator extends BaseXMLTranslator {
-
-    SAXSource source;
-    
-    public XMLSAXSourceTranslator(SAXSource source, Properties props) {
-        super(props);
-        this.source = source;
-    }
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getSource()
-     */
-    public Source getSource()  throws IOException {
-        return source;
-    }    
-}

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLStreamSourceTranslator.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLStreamSourceTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLStreamSourceTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import java.io.CharArrayReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Properties;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-
-/** 
- * This class converts the Stream Source XML feed into other types of 
- * XML Sources. 
- */
-public class XMLStreamSourceTranslator extends BaseXMLTranslator {
-    
-    char[] srcString;
-    XMLReaderFactory readerFactory;
-    
-    public XMLStreamSourceTranslator(String xmlSource, Properties props) {
-        super(props);
-        this.srcString = xmlSource.toCharArray();
-        this.readerFactory = new CharArrayXMLReader(this.srcString);
-    }    
-    
-    public XMLStreamSourceTranslator(char[] xmlSource, Properties props) {
-        super(props);
-        this.srcString = xmlSource;
-        this.readerFactory = new CharArrayXMLReader(this.srcString);
-    }  
-    
-    public XMLStreamSourceTranslator(final StreamSource source, Properties props) {
-        super(props);
-        this.readerFactory = new StreamSourceXMLReader(source);
-    }    
-    
-    public XMLStreamSourceTranslator(XMLReaderFactory factory, Properties props) {
-        super(props);
-        this.readerFactory = factory;
-    }
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getSource()
-     */
-    public Source getSource() throws IOException {
-        return new StreamSource(this.readerFactory.getReader());
-    }
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getReader()
-     */
-    public Reader getReader() throws IOException {
-        StreamSource src = (StreamSource)getSource();        
-        if (src.getReader() != null) {
-            return src.getReader();
-        }     
-        return super.getReader();        
-    }  
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getInputStream()
-     */
-    public InputStream getInputStream() throws IOException {
-        StreamSource src = (StreamSource)getSource();
-        if (src.getInputStream() != null) {
-            return src.getInputStream();
-        }
-        return super.getInputStream();
-    }
-
-    /**  
-     * @see com.metamatrix.common.types.XMLTranslator#getString()
-     */
-    public String getString() throws IOException {
-        if (this.srcString != null) {
-            return new String(this.srcString);
-        }
-        return super.getString();
-    }
-    
-    static class CharArrayXMLReader implements XMLReaderFactory{
-        char[] contents;
-        
-        public CharArrayXMLReader(char[] content) {
-            this.contents = content;
-        }
-        
-        public Reader getReader() throws IOException {
-            return new CharArrayReader(contents);
-        }        
-    }
-    
-    static class StreamSourceXMLReader implements XMLReaderFactory {
-        StreamSource source;
-        
-        public StreamSourceXMLReader(StreamSource source) {
-            this.source = source;
-        }
-        
-        public Reader getReader() throws IOException {
-            InputStream stream = source.getInputStream();
-            if (stream != null) {
-                return new InputStreamReader(stream);
-            }
-            return source.getReader();
-        }         
-    }
-}

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLTranslator.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/XMLTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,67 +23,21 @@
 package com.metamatrix.common.types;
 
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.Properties;
+import java.io.StringWriter;
+import java.io.Writer;
 
-import javax.xml.transform.Source;
-
-
 /** 
  * This an interface defined to convert the various kinds of the XML sources
- * defined into another source kinds. For example a DOMSource.class source can be
- * converted to String or SAXSource, or StreamSource is converted to DOMSource etc.
+ * defined into a character stream. 
  */
-public interface XMLTranslator {
-    static String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$    
-    public static final String INDENT = "indent"; //$NON-NLS-1$
+public abstract class XMLTranslator {
     
-    public static final String idenityTransform = 
-            "<xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + lineSep + //$NON-NLS-1$
-            "<xsl:output method = \"xml\" omit-xml-declaration=\"yes\"/>" + lineSep + //$NON-NLS-1$
-            "<xsl:template match=\"@*|node()\">" + lineSep +//$NON-NLS-1$ 
-            "    <xsl:copy>\r\n" + lineSep+ //$NON-NLS-1$
-            "        <xsl:apply-templates select=\"@*|node()\"/>" +lineSep+//$NON-NLS-1$ 
-            "    </xsl:copy>" + lineSep + //$NON-NLS-1$
-            "</xsl:template>" + lineSep +//$NON-NLS-1$
-            "</xsl:stylesheet>" + lineSep + //$NON-NLS-1$
-            ""; //$NON-NLS-1$
+    public abstract void translate(Writer writer) throws IOException;
     
-    /**
-     * Get String form of the XML  
-     * @return string representing the XML source
-     * @throws IOException
-     */
-    String getString() throws IOException;
+	public String getString() throws IOException {
+		StringWriter writer = new StringWriter();
+		this.translate(writer);
+		return writer.toString();
+	}
     
-    /**
-     * Get the XML in the original source form; with however it got created. 
-     * @return
-     * @throws IOException
-     */
-    public Source getSource() throws IOException;
-    
-    
-    /**
-     * Get a Reader for the XML contents; 
-     * @return a Reader object for streaming the XML contents.
-     * @throws IOException
-     */
-    public Reader getReader() throws IOException;
-    
-    /**
-     * Get a InputStream  for the XMl contents; 
-     * @return a InputStream object for streaming the XML contents.
-     * @throws IOException
-     */
-    public InputStream getInputStream() throws IOException;
-    
-    /**
-     * Any specific Properties needed by the translator process, such
-     * as indenting etc. 
-     * @return properties
-     */
-    public Properties getProperties();
-    
 }

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -31,8 +31,9 @@
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
+import com.metamatrix.common.types.SQLXMLImpl;
+import com.metamatrix.common.types.StandardXMLTranslator;
 import com.metamatrix.common.types.Transform;
-import com.metamatrix.common.types.SQLXMLImpl;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.common.types.XMLType;
 import com.metamatrix.core.CorePlugin;
@@ -53,7 +54,8 @@
         try{        
              DocumentBuilder parser = factory.newDocumentBuilder();
              Document doc = parser.parse(new InputSource(new StringReader(xml)));
-             return new XMLType(new SQLXMLImpl(new DOMSource(doc)));
+             StandardXMLTranslator sxt = new StandardXMLTranslator(new DOMSource(doc), null);
+             return new XMLType(new SQLXMLImpl(sxt.getString()));
         }
         catch (Exception e){
             throw new TransformationException(e, CorePlugin.Util.getString("invalid_string")); //$NON-NLS-1$

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -820,12 +820,22 @@
                     String nestedkey = value.substring(start+2, end);
                     String nestedvalue = original.getProperty(nestedkey);
                     
-                    // this will handle case where we did not resolve, mark it blank
-                    if (nestedvalue == null) {
-                    	throw new MetaMatrixRuntimeException(CorePlugin.Util.getString("PropertiesUtils.failed_to_resolve_property", nestedkey)); //$NON-NLS-1$
-                    }                    
-                    value = value.substring(0,start)+nestedvalue+value.substring(end+1);
-                    modified = true;
+                    // in cases where the key and the nestedkey are the same, this has to be bypassed
+                    // because it will cause an infinite loop, and because there will be no value
+                    // for the nestedkey that doesnt contain ${..} in the value
+                    if (key.equals(nestedkey)) {
+                        matched = false;
+
+                    } else {
+
+                    
+                        // this will handle case where we did not resolve, mark it blank
+                        if (nestedvalue == null) {
+                        	throw new MetaMatrixRuntimeException(CorePlugin.Util.getString("PropertiesUtils.failed_to_resolve_property", nestedkey)); //$NON-NLS-1$
+                        }                    
+                        value = value.substring(0,start)+nestedvalue+value.substring(end+1);
+                        modified = true;
+                   }
                 }
             }
             if(modified) {

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ChecksumUtil.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ChecksumUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ChecksumUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.CRC32;
-import java.util.zip.Checksum;
-
-/**
- * This utility class provides mechanisms for computing the checksum.
- */
-public class ChecksumUtil {
-    
-    protected static final int BUFFER_SIZE = 1024;
-
-	/**
-	 * Compute and return the checksum (using the default CRC-32 algorithm) 
-	 * of the contents on the specified stream.
-	 * This method closes the stream upon completion.
-	 * @param stream the stream containing the contents for which
-	 * the checksum is to be computed; may not be null
-	 * @return the Checksum for the contents
-	 * @throws AssertionError if <code>stream</code> is null
-	 * @throws IOException if there is an error reading the stream
-	 */
-	public static Checksum computeChecksum( InputStream stream ) throws IOException {
-		Checksum checksum = new CRC32();
-		computeChecksum(stream,checksum);  
-		return checksum;  
-	}
-
-	/**
-	 * Compute the checksum of the contents on the specified stream
-	 * using the supplied Checksum algorithm, and modify that
-	 * Checksum instance with the checksum value.
-	 * This method closes the stream upon completion.
-	 * @param stream the stream containing the contents for which
-	 * the checksum is to be computed; may not be null
-	 * @param algorithm the checksum algorithm to be used.
-	 * @return the number of bytes from <code>stream</code>
-	 * that were processed
-	 * @throws AssertionError if <code>stream</code> or
-	 * <code>algorithm</code> is null
-	 * @throws IOException if there is an error reading the stream
-	 */
-	public static long computeChecksum( InputStream stream, Checksum algorithm ) throws IOException {
-        byte[] buffer = new byte[BUFFER_SIZE];
-        int n = 0;
-        long sizeInBytes = 0;
-
-		// Compute the checksum ...
-		IOException ioe = null;
-        try {
-	        while ((n = stream.read(buffer)) > -1){
-	            algorithm.update(buffer, 0, n);
-	            sizeInBytes += n;
-	        }
-        } catch ( IOException e ) {
-        	ioe = e;
-        } finally {
-            try {
-        		stream.close(); 
-            } catch ( IOException e ) {
-            	//Throw this only if there was no IOException from processing above    
-                if ( ioe == null ) {
-                	ioe = e;    
-                }
-            }   
-        }
-        if ( ioe != null ) {
-        	throw ioe;    
-        }
-		return sizeInBytes;
-	}
-
-}

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/FileUtils.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/FileUtils.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/FileUtils.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -750,29 +750,6 @@
     }
     
     /**
-     * Compute checksum for the given file. 
-     * @param f The file for which checksum needs to be computed
-     * @return The checksum
-     * @since 4.3
-     */
-    public static long getCheckSum(final File f)  throws Exception {
-        ArgCheck.isNotNull(f);
-        FileInputStream is = null;
-        try {
-            is = new FileInputStream(f);
-            return ChecksumUtil.computeChecksum(is).getValue();
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (IOException err1) {
-                }
-            }
-        }
-    }    
-
-    
-    /**
      * Test whether it's possible to read and write files in the specified directory. 
      * @param dirPath Name of the directory to test
      * @throws MetaMatrixException

Deleted: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ResourceNameUtil.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ResourceNameUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ResourceNameUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,369 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.util;
-
-import com.metamatrix.core.CoreConstants;
-import com.metamatrix.core.CorePlugin;
-
-/** 
- * Utility class used for determining if proposed resource names are reserved names or not.
- * This applies for *.vdb, *.xmi and *.xsd resources
- * NOTE: These lists are arranged in alphabetical order. When adding new reserved names, please place them appropriately.
- * @since 4.3
- */
-public abstract class ResourceNameUtil {
-    private static final String INVALID_EXTENSION_ERROR_ID = "ResourceNameUtil.invalidFileExtensionError"; //$NON-NLS-1$
-    private static final String COMMA_SPACE = ", "; //$NON-NLS-1$
-    
-    // STATIC RESERVED NAME CONSTANTS
-    public static final String XMI_FILE_EXTENSION   = "xmi"; //$NON-NLS-1$
-    public static final String VDB_FILE_EXTENSION   = "vdb"; //$NON-NLS-1$
-    public static final String XSD_FILE_EXTENSION   = "xsd"; //$NON-NLS-1$
-    public static final String XML_FILE_EXTENSION   = "xml"; //$NON-NLS-1$
-    public static final String WSDL_FILE_EXTENSION  = "wsdl"; //$NON-NLS-1$
-    
-    public static final String DOT_XMI_FILE_EXTENSION = ".xmi"; //$NON-NLS-1$
-    public static final String DOT_VDB_FILE_EXTENSION   = ".vdb"; //$NON-NLS-1$
-    public static final String DOT_XSD_FILE_EXTENSION   = ".xsd"; //$NON-NLS-1$
-    public static final String DOT_XML_FILE_EXTENSION   = ".xml"; //$NON-NLS-1$
-    public static final String DOT_WSDL_FILE_EXTENSION   = ".wsdl"; //$NON-NLS-1$
-    
-    public static final String ADMIN_NAME                       = "Admin"; //$NON-NLS-1$
-    public static final String BUILTINDATATYPES_NAME            = "builtInDataTypes"; //$NON-NLS-1$
-    public static final String BUILTINRELATIONALTYPES_NAME      = "builtInRelationshipTypes"; //$NON-NLS-1$
-    public static final String CORE_NAME                        = "Core"; //$NON-NLS-1$
-    public static final String DATAACCESS_NAME                  = "Dataaccess"; //$NON-NLS-1$
-    public static final String DATASERVICESYSTEMMODEL_NAME      = "DataServiceSystemModel"; //$NON-NLS-1$
-    public static final String DTCBASE_NAME                     = "DtcBase"; //$NON-NLS-1$
-    public static final String ECORE_NAME                       = "Ecore"; //$NON-NLS-1$
-    public static final String ENTERPRISEDATATYPES_NAME         = "EnterpriseDatatypes"; //$NON-NLS-1$
-    public static final String EXTENSION_NAME                   = "Extension"; //$NON-NLS-1$
-    public static final String FUNCTION_NAME                    = "Function"; //$NON-NLS-1$
-    public static final String HELP_NAME                        = "Help"; //$NON-NLS-1$
-    public static final String JDBC_NAME                        = "Jdbc"; //$NON-NLS-1$
-    public static final String JDBCMODEL_NAME                   = "jdbcModel"; //$NON-NLS-1$
-    public static final String JDBCSYSTEM_NAME                  = "JDBCSystem"; //$NON-NLS-1$
-    public static final String MAGICXMLSCHEMA_NAME              = "MagicXMLSchema"; //$NON-NLS-1$
-    public static final String MANIFEST_NAME                    = "Manifest"; //$NON-NLS-1$
-    public static final String MAPPING_NAME                     = "Mapping"; //$NON-NLS-1$
-    public static final String MBR_NAME                         = "Mbr"; //$NON-NLS-1$
-    public static final String METAMATRIX_VDBMANIFESTMODEL_NAME = "MetaMatrix-VdbManifestModel"; //$NON-NLS-1$
-    public static final String METAMODELRELATIONALMODEL_NAME    = "MetamodelRelationalModel"; //$NON-NLS-1$
-    public static final String NAMESPACE_NAME                   = "namespace"; //$NON-NLS-1$
-    public static final String PRIMATIVETYPES_NAME              = "primitiveTypes"; //$NON-NLS-1$
-    public static final String RELATIONAL_NAME                  = "Relational"; //$NON-NLS-1$
-    public static final String RELATIONSHIP_NAME                = "Relationship"; //$NON-NLS-1$
-    public static final String SIMPLEDATATYPES_INSTANCE_NAME    = "SimpleDatatypes-instance"; //$NON-NLS-1$
-    public static final String SYSTEM_NAME                      = CoreConstants.SYSTEM_MODEL;    
-    public static final String SYSTEMADMIN_NAME                 = CoreConstants.SYSTEM_ADMIN_MODEL_NAME;
-    public static final String SYSTEMADMINPHYSICAL_NAME         = CoreConstants.SYSTEM_ADMIN_PHYSICAL_MODEL_NAME;
-    public static final String SYSTEMPHYSICAL_NAME              = CoreConstants.SYSTEM_PHYSICAL_MODEL_NAME;
-    public static final String SYSTEMSCHEMA_NAME                = "SystemSchema"; //$NON-NLS-1$
-    public static final String SYSTEMVIRTUALDATABASE_NAME       = "SystemVirtualDatabase"; //$NON-NLS-1$
-    public static final String SYSTEMODBCMODEL                  = "System.ODBC"; //$NON-NLS-1$
-    public static final String TRANSFORMATION_NAME              = "Transformation"; //$NON-NLS-1$
-    public static final String UML2_NAME                        = "Uml2"; //$NON-NLS-1$
-    public static final String WEBSERVICE_NAME                  = "Webservice"; //$NON-NLS-1$
-    public static final String WSDL1_1_NAME                     = "WSDL1_1"; //$NON-NLS-1$
-    public static final String WSDLSOAP_NAME                    = "WSDLSOAP"; //$NON-NLS-1$
-    public static final String XML_NAME                         = "Xml"; //$NON-NLS-1$
-    public static final String XMLSCHEMA_NAME                   = "XMLSchema"; //$NON-NLS-1$
-    public static final String XMLSCHEMA_INSTANCE_NAME          = "XMLSchema-instance"; //$NON-NLS-1$
-    public static final String XSD_NAME                         = "Xsd"; //$NON-NLS-1$
-    
-    public static final String[] RESERVED_VDB_NAMES = {
-        ADMIN_NAME,
-        HELP_NAME,
-        SYSTEM_NAME,
-        SYSTEMVIRTUALDATABASE_NAME,
-    };
-
-    public static final String USERFILES_FOLDERNAME             = "user-files"; //$NON-NLS-1$
-    
-    public static final String[] RESERVED_XMI_NAMES = {
-        CORE_NAME,
-        BUILTINRELATIONALTYPES_NAME,
-        DATAACCESS_NAME,
-        DATASERVICESYSTEMMODEL_NAME,
-        DTCBASE_NAME,
-        ECORE_NAME,
-        ENTERPRISEDATATYPES_NAME,
-        EXTENSION_NAME,
-        FUNCTION_NAME,
-        JDBC_NAME,
-        JDBCMODEL_NAME,
-        JDBCSYSTEM_NAME,
-        MANIFEST_NAME,
-        MAPPING_NAME,
-        MBR_NAME,
-        METAMATRIX_VDBMANIFESTMODEL_NAME,
-        METAMODELRELATIONALMODEL_NAME,
-        PRIMATIVETYPES_NAME,
-        RELATIONAL_NAME,
-        RELATIONSHIP_NAME,
-        SIMPLEDATATYPES_INSTANCE_NAME,
-        SYSTEM_NAME,
-        SYSTEMADMIN_NAME,
-        SYSTEMADMINPHYSICAL_NAME,
-        SYSTEMPHYSICAL_NAME,
-        TRANSFORMATION_NAME,
-        UML2_NAME,
-        WEBSERVICE_NAME,
-        WSDL1_1_NAME,
-        WSDLSOAP_NAME,
-        XML_NAME,
-        XSD_NAME,
-    };
-
-
-    public static final String[] RESERVED_XSD_NAMES = {
-        BUILTINDATATYPES_NAME,
-        ENTERPRISEDATATYPES_NAME,
-        MAGICXMLSCHEMA_NAME,
-        NAMESPACE_NAME,
-        SIMPLEDATATYPES_INSTANCE_NAME,
-        SYSTEMSCHEMA_NAME,
-        XML_NAME,
-        XMLSCHEMA_NAME,
-        XMLSCHEMA_INSTANCE_NAME,
-    };
-    
-    
-    public static final String[] RESERVED_PROJECT_NAMES = {
-        USERFILES_FOLDERNAME,
-    };
-    
-    /**
-     * This method checks whether or not a proposed project name is reserved or not.
-     * @param proposedName may or may not inlude the file extension
-     * @return true if it is reserved, false if not.
-     * @since 5.5.3
-     */
-    public static boolean isReservedProjectName(String proposedName) {
-        if( proposedName == null || proposedName.length() <= 0 ){
-            return false;
-        }
-        
-        for( int i=0; i<RESERVED_PROJECT_NAMES.length; i++ ) {
-            if( proposedName.equalsIgnoreCase(RESERVED_PROJECT_NAMES[i])) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
-    
-    /**
-     * This method checks whether or not a proposed vdb name is reserved or not.
-     * It will return false if the proposed name includes an extension AND one or more "." characters.
-     * @param proposedName may or may not inlude the file extension
-     * @return true if it is reserved, false if not.
-     * @throws IllegalArgumentException if proposed name contains an apparent file extension (one or more '.' characters) 
-     * and it is NOT a ".vdb" extension
-     * @since 5.0
-     */
-    public static boolean isReservedVdbName(String proposedName) throws IllegalArgumentException {
-        if( proposedName == null || proposedName.length() <= 0 ){
-            return false;
-        }
-        
-        // Check the extension
-        if ( proposedName.indexOf('.') != -1 ) {
-            // Check ends with
-            if( !proposedName.endsWith(DOT_VDB_FILE_EXTENSION)) {
-                throw new IllegalArgumentException(CorePlugin.Util.getString(INVALID_EXTENSION_ERROR_ID, proposedName, VDB_FILE_EXTENSION));
-            }
-            
-            // So, let's take the extension off
-            proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_VDB_FILE_EXTENSION));
-            
-            // If the name still has a "." in it, then it will not be a reserved name
-            // Note 
-            if ( proposedName.indexOf('.') != -1 ) {
-                return false;
-            }
-        }
-
-        for( int i=0; i<RESERVED_VDB_NAMES.length; i++ ) {
-            if( proposedName.equalsIgnoreCase(RESERVED_VDB_NAMES[i])) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
-    
-    /**
-     * This method checks whether or not a proposed xmi model name is reserved or not.
-     * It will return false if the proposed name includes an extension AND one or more "." characters.
-     * @param proposedName may or may not inlude the file extension
-     * @return true if it is reserved, false if not.
-     * @throws IllegalArgumentException if proposed name contains an apparent file extension (one or more '.' characters) 
-     * and it is NOT a ".xmi" extension
-     * @since 5.0
-     */
-    public static boolean isReservedModelName(String proposedName) throws IllegalArgumentException  {
-        if( proposedName == null || proposedName.length() <= 0 ){
-            return false;
-        }
-        
-        // Check the extension
-        if ( proposedName.indexOf('.') != -1 ) {
-            // Check ends with
-            if( !proposedName.endsWith(DOT_XMI_FILE_EXTENSION)) {
-                throw new IllegalArgumentException(CorePlugin.Util.getString(INVALID_EXTENSION_ERROR_ID, proposedName, XMI_FILE_EXTENSION));
-            }
-            
-            // So, let's take the extension off
-            proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_XMI_FILE_EXTENSION));
-            
-            // If the name still has a "." in it, then it will not be a reserved name
-            // Note 
-            if ( proposedName.indexOf('.') != -1 ) {
-                return false;
-            }
-        }
-        
-        for( int i=0; i<RESERVED_XMI_NAMES.length; i++ ) {
-            if( proposedName.equalsIgnoreCase(RESERVED_XMI_NAMES[i])) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
-    
-    /**
-     * This method checks whether or not a proposed xsd model name is reserved or not.
-     * It will return false if the proposed name includes an extension AND one or more "." characters.
-     * @param proposedName may or may not inlude the file extension
-     * @return true if it is reserved, false if not.
-     * @throws IllegalArgumentException if proposed name contains an apparent file extension (one or more '.' characters) 
-     * and it is NOT a ".xsd" extension
-     * @since 5.0
-     */
-    public static boolean isReservedSchemaName(String proposedName) throws IllegalArgumentException  {
-        if( proposedName == null || proposedName.length() <= 0 ){
-            return false;
-        }
-        
-        // Check the extension
-        if ( proposedName.indexOf('.') != -1 ) {
-            // Check ends with
-            if( !proposedName.endsWith(DOT_XSD_FILE_EXTENSION)) {
-                throw new IllegalArgumentException(CorePlugin.Util.getString(INVALID_EXTENSION_ERROR_ID, proposedName, XSD_FILE_EXTENSION));
-            }
-            
-            // So, let's take the extension off
-            proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_XSD_FILE_EXTENSION));
-            
-            // If the name still has a "." in it, then it will not be a reserved name
-            // Note 
-            if ( proposedName.indexOf('.') != -1 ) {
-                return false;
-            }
-        }
-        
-        for( int i=0; i<RESERVED_XSD_NAMES.length; i++ ) {
-            if( proposedName.equalsIgnoreCase(RESERVED_XSD_NAMES[i])) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
-    
-    /**
-     * This method checks whether or not a proposed name is reserved or not.
-     * It will check all reserved resource names including vdb, xmi and xsd resources.
-     * It will return false if the proposed name includes an extension AND one or more "." characters.
-     * @param proposedName may or may not inlude the file extension
-     * @return true if it is reserved, false if not.
-     * @throws IllegalArgumentException if proposed name contains an apparent file extension (one or more '.' characters) 
-     * and it is NOT a ".xmi, .xsd, or .vdb" extension
-     * @since 5.0
-     */
-    public static boolean isReservedResourceName(String proposedName) throws IllegalArgumentException  {
-        boolean result = false;
-        
-        if( proposedName == null || proposedName.length() <= 0 ){
-            return false;
-        }
-        
-        // Check the extension
-        if ( proposedName.indexOf('.') != -1 ) {
-            // Check ends with
-            if( !proposedName.endsWith(DOT_XSD_FILE_EXTENSION) && 
-                !proposedName.endsWith(DOT_XMI_FILE_EXTENSION) &&
-                !proposedName.endsWith(DOT_VDB_FILE_EXTENSION)) {
-                String allExtensions = XMI_FILE_EXTENSION + COMMA_SPACE + XSD_FILE_EXTENSION + COMMA_SPACE + VDB_FILE_EXTENSION;
-                throw new IllegalArgumentException(CorePlugin.Util.getString(INVALID_EXTENSION_ERROR_ID, proposedName, allExtensions));
-            }
-            
-            
-            // So, let's take the extension off
-            if( proposedName.endsWith(DOT_XSD_FILE_EXTENSION)) {
-                proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_XSD_FILE_EXTENSION));
-                if ( proposedName.indexOf('.') != -1 ) {
-                    result = false;
-                } else  {
-                    result = isReservedSchemaName(proposedName);
-                }
-            }
-            
-            if( !result ) {
-                if( proposedName.endsWith(DOT_XMI_FILE_EXTENSION)) {
-                    proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_XMI_FILE_EXTENSION));
-                    if ( proposedName.indexOf('.') != -1 ) {
-                        result = false;
-                    } else  {
-                        result = isReservedModelName(proposedName);
-                    }
-                }
-            }
-            
-            if( !result ) {
-                if( proposedName.endsWith(DOT_VDB_FILE_EXTENSION)) {
-                    proposedName = proposedName.substring(0, proposedName.lastIndexOf(DOT_VDB_FILE_EXTENSION));
-                    if ( proposedName.indexOf('.') != -1 ) {
-                        result = false;
-                    } else  {
-                        result = isReservedVdbName(proposedName);
-                    }
-                }
-            }
-        } else {
-            result = isReservedSchemaName(proposedName);
-            
-            if( !result ) {
-                result = isReservedModelName(proposedName);
-            }
-            
-            if( !result ) {
-                result = isReservedVdbName(proposedName);
-            }
-        }
-        
-        return result;
-    }
-}

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,24 +22,19 @@
 
 package com.metamatrix.common.types;
 
+import static org.junit.Assert.*;
+
 import java.sql.Types;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Set;
 
 import javax.sql.rowset.serial.SerialBlob;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class TestDataTypeManager extends TestCase {
+public class TestDataTypeManager {
 
-	// ################################## FRAMEWORK ################################
-	
-	public TestDataTypeManager(String name) { 
-		super(name);
-	}	
-	
-	// ################################## TEST HELPERS ################################
-	
     private void helpDetermineDataType(Object value, Class expectedClass) { 
         Class actualClass = DataTypeManager.determineDataTypeClass(value);
         assertNotNull("Should never receive null when determining data type of object: " + value); //$NON-NLS-1$
@@ -88,7 +83,7 @@
 
 	// ################################## ACTUAL TESTS ################################
 	
-	public void testTypeMappings() {
+	@Test public void testTypeMappings() {
 		Set dataTypeNames = DataTypeManager.getAllDataTypeNames();
 		Iterator iter = dataTypeNames.iterator();
 		while(iter.hasNext()) { 
@@ -100,7 +95,7 @@
 		}
 	}
     
-    public void testCheckConversions() {
+    @Test public void testCheckConversions() {
         for (int src = 0; src < dataTypes.length; src++) {
             for (int tgt =0; tgt < dataTypes.length; tgt++) {
                 char c = conversions[src][tgt];
@@ -125,22 +120,22 @@
     }
 	
     /** Test determine data type for a STRING object. */
-    public void testDetermineDataType1() {
+    @Test public void testDetermineDataType1() {
         helpDetermineDataType("abc", DataTypeManager.DefaultDataClasses.STRING); //$NON-NLS-1$
     }
 
     /** Test determine data type for a NULL object. */
-    public void testDetermineDataType2() {
+    @Test public void testDetermineDataType2() {
         helpDetermineDataType(null, DataTypeManager.DefaultDataClasses.NULL);
     }
     	
     /** Test determine data type for an unknown object type - should be typed as an OBJECT. */
-    public void testDetermineDataType3() throws Exception {
+    @Test public void testDetermineDataType3() throws Exception {
         java.net.URL url = new java.net.URL("http://fake"); //$NON-NLS-1$
         helpDetermineDataType(url, DataTypeManager.DefaultDataClasses.OBJECT);
     }
     
-    public void testCheckAllConversions() {
+    @Test public void testCheckAllConversions() {
         Set allTypes = DataTypeManager.getAllDataTypeNames();
         Iterator srcIter = allTypes.iterator();
         while(srcIter.hasNext()) { 
@@ -160,7 +155,7 @@
         }        
     }
     
-    public void testTimeConversions() {
+    @Test public void testTimeConversions() {
         Transform t = DataTypeManager.getTransform(DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.DATE);
         
         assertEquals(DataTypeManager.DefaultDataClasses.DATE, t.getTargetType());
@@ -170,7 +165,7 @@
         assertEquals(DataTypeManager.DefaultDataClasses.TIMESTAMP, t.getTargetType());
     }
     
-    public void testJDBCSQLTypeInfo() {
+    @Test public void testJDBCSQLTypeInfo() {
         
         String[] types = MMJDBCSQLTypeInfo.getMMTypeNames();
         
@@ -193,7 +188,7 @@
         assertEquals(Types.CHAR, MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.CHAR));
     }
     
-    public void testRuntimeTypeConversion() throws Exception {
+    @Test public void testRuntimeTypeConversion() throws Exception {
     	assertNull(DataTypeManager.convertToRuntimeType(null));
     	
     	assertTrue(DataTypeManager.convertToRuntimeType(new SerialBlob(new byte[0])) instanceof BlobType);
@@ -207,10 +202,19 @@
     	assertEquals(bar, DataTypeManager.convertToRuntimeType(bar));
     }
     
-    public void testObjectType() {
+    @Test public void testObjectType() {
     	assertEquals(DataTypeManager.DefaultDataClasses.OBJECT, DataTypeManager.getDataTypeClass("foo")); //$NON-NLS-1$
     	
     	assertEquals(DataTypeManager.DefaultDataTypes.OBJECT, DataTypeManager.getDataTypeName(TestDataTypeManager.class));
     }
+    
+    @Test public void testImplicitConversions() {
+    	assertEquals(Arrays.asList(DataTypeManager.DefaultDataTypes.LONG, 
+    			DataTypeManager.DefaultDataTypes.BIG_INTEGER, 
+    			DataTypeManager.DefaultDataTypes.DOUBLE, 
+    			DataTypeManager.DefaultDataTypes.BIG_DECIMAL, 
+    			DataTypeManager.DefaultDataTypes.STRING, 
+    			DataTypeManager.DefaultDataTypes.OBJECT), DataTypeManager.getImplicitConversions(DataTypeManager.DefaultDataTypes.INTEGER));
+    }
 	
 }

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,15 +22,10 @@
 
 package com.metamatrix.common.types;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Reader;
-import java.io.StringReader;
 import java.sql.SQLException;
-import java.util.Properties;
 
-import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
 import junit.framework.TestCase;
@@ -44,57 +39,34 @@
 public class TestSQLXMLImpl extends TestCase {
 
     String testStr = "<foo>test</foo>"; //$NON-NLS-1$
-    
-    XMLTranslator translator = new XMLTranslator() {        
-        public String getString() throws IOException {
-            return testStr; 
-        }
-        public Source getSource() throws IOException {
-            return new StreamSource(new StringReader(testStr));
-        }
-        public Reader getReader() throws IOException {
-            return new StringReader(testStr);
-        }
-
-        public InputStream getInputStream() throws IOException {
-            return new ByteArrayInputStream(testStr.getBytes());
-        }
-
-        public Properties getProperties() {
-            Properties p = new Properties();
-            p.setProperty("indent", "yes"); //$NON-NLS-1$ //$NON-NLS-2$
-            return p;
-        }        
-    };
-    
+        
 	//## JDBC4.0-begin ##
     public void testGetSource() throws Exception {        
-        SQLXMLImpl xml = new SQLXMLImpl(translator);
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);
         assertTrue(xml.getSource(null) instanceof StreamSource);
         
         StreamSource ss = (StreamSource)xml.getSource(null);
-        assertEquals(testStr, getContents(ss.getReader()));
+        assertEquals(testStr, new String(ObjectConverterUtil.convertToByteArray(ss.getInputStream()), Streamable.ENCODING));
     }
 	//## JDBC4.0-end ##
     
     public void testGetCharacterStream() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);
         assertEquals(testStr, getContents(xml.getCharacterStream()));
     }
 
     public void testGetBinaryStream() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);
-        assertEquals(testStr, ObjectConverterUtil.convertToString(xml.getBinaryStream()));
-
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);
+        assertEquals(testStr, new String(ObjectConverterUtil.convertToByteArray(xml.getBinaryStream()), Streamable.ENCODING));
     }
 
     public void testGetString() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);
         assertEquals(testStr, xml.getString());
     }
 
     public void testSetBinaryStream() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);        
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);        
         try {
             xml.setBinaryStream();
             fail("we do not support this yet.."); //$NON-NLS-1$
@@ -103,7 +75,7 @@
     }
 
     public void testSetCharacterStream() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);        
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);        
         try {
             xml.setCharacterStream();
             fail("we do not support this yet.."); //$NON-NLS-1$
@@ -112,7 +84,7 @@
     }
 
     public void testSetString() throws Exception {
-        SQLXMLImpl xml = new SQLXMLImpl(translator);        
+        SQLXMLImpl xml = new SQLXMLImpl(testStr);        
         try {
             xml.setString(testStr);
             fail("we do not support this yet.."); //$NON-NLS-1$

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,19 +22,12 @@
 
 package com.metamatrix.common.types;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
 import java.io.StringReader;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
 import javax.xml.transform.stream.StreamSource;
 
-import com.metamatrix.core.util.ObjectConverterUtil;
-
 import junit.framework.TestCase;
 
 
@@ -83,83 +76,12 @@
         "      </publishingInformation>\r\n" +  //$NON-NLS-1$
         "   </book>\r\n" + //$NON-NLS-1$
         "</Books:bookCollection>"; //$NON-NLS-1$
-    /*
-     * Test method for 'com.metamatrix.common.types.XMLStreamSourceTranslator.getReader()'
-     */
-    public void testGetReader() throws Exception {        
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(new StreamSource(new StringReader(sourceXML)),  new Properties());
-        Reader reader = translator.getReader();
-        assertEquals(sourceXML, ObjectConverterUtil.convertToString(reader));
-    }
-
-    public void testCharInput() throws Exception {        
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(sourceXML.toCharArray(),  new Properties());
-        Reader reader = translator.getReader();
-        assertEquals(sourceXML, ObjectConverterUtil.convertToString(reader));
-    }
-    
-    public void testXMLReaderFactory() throws Exception {        
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(new XMLReaderFactory() {
-            public Reader getReader() throws IOException {
-                return new StringReader(sourceXML);
-            }            
-        }, new Properties());
-        Reader reader = translator.getReader();
-        assertEquals(sourceXML, ObjectConverterUtil.convertToString(reader));
-    }    
-    
-    /*
-     * Test method for 'com.metamatrix.common.types.XMLStreamSourceTranslator.getInputStream()'
-     */
-    public void testGetInputStream() throws Exception {
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(new StreamSource(new ByteArrayInputStream(sourceXML.getBytes())),  new Properties());
-        InputStream stream = translator.getInputStream();
-        ByteArrayOutputStream out = getCoontents(stream);       
-        compareDocuments(sourceXML, new String(out.toByteArray()));
-    }
-
-    private ByteArrayOutputStream getCoontents(InputStream stream) throws IOException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        
-        int chr = stream.read();
-        while(chr != -1) {
-            out.write((byte)chr);
-            chr = stream.read();
-        }
-        return out;
-    }
-
+   
     public void testStreamSourceWithStream() throws Exception {
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(new StreamSource(new StringReader(sourceXML)),  new Properties());
-        InputStream stream = translator.getInputStream();
-        ByteArrayOutputStream out = getCoontents(stream);       
-        compareDocuments(sourceXML, new String(out.toByteArray()));
+        StandardXMLTranslator translator = new StandardXMLTranslator(new StreamSource(new StringReader(sourceXML)),  new Properties());
+        compareDocuments(sourceXML, translator.getString());
     }    
     
-    /*
-     * Test method for 'com.metamatrix.common.types.XMLStreamSourceTranslator.getSource()'
-     */
-    public void testGetSource() throws Exception {
-        StreamSource src = new StreamSource(new StringReader(sourceXML));
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(src, new Properties());
-        assertTrue(translator.getSource() instanceof StreamSource);
-        StreamSource s = (StreamSource)translator.getSource();
-        Reader reader = s.getReader();
-        assertEquals(sourceXML, ObjectConverterUtil.convertToString(reader));
-    }
-
-    /*
-     * Test method for 'com.metamatrix.common.types.BaseXMLTranslator.getString()'
-     */
-    public void testGetString() throws Exception {
-        XMLStreamSourceTranslator translator = new XMLStreamSourceTranslator(sourceXML,  new Properties());
-        assertEquals(sourceXML, translator.getString());
-
-        // in the case of the stream source there is optimization that 
-        // if a string is used to xmlize then same string is returned.
-        assertEquals(sourceXML, translator.getString());
-    }
-
     private void compareDocuments(String expectedDoc, String actualDoc) {
         StringTokenizer tokens1 = new StringTokenizer(expectedDoc, "\r\n"); //$NON-NLS-1$
         StringTokenizer tokens2 = new StringTokenizer(actualDoc, "\n");//$NON-NLS-1$

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -52,7 +52,6 @@
         String pkey = "peresistkeytodata"; //$NON-NLS-1$
         XMLType xv = new XMLType(xml);
         xv.setReferenceStreamId(key); 
-        xv.setPersistenceStreamId(pkey);
         
         // now force to serialize
         File saved = new File(UnitTestUtil.getTestScratchPath()+"/xmlsaved.bin"); //$NON-NLS-1$
@@ -66,7 +65,6 @@
                 
         // make sure we have kept the reference stream id
         assertEquals(key, read.getReferenceStreamId());
-        assertEquals(pkey, read.getPersistenceStreamId());
         
         // and lost the original object
         assertNull(read.getReference());

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -46,7 +46,7 @@
        StringToSQLXMLTransform transform = new StringToSQLXMLTransform();
        
        SQLXML xmlValue = (SQLXML)transform.transformDirect(xml);
-       assertEquals(xml, xmlValue.getString());
+       assertEquals(xml.replaceAll("[\r]", ""), xmlValue.getString().replaceAll("[\r]", ""));
     }
     
     public void testBadXML() {

Modified: branches/JCA/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -651,6 +651,15 @@
         } catch(RuntimeException e) {
         	// pass
         }
+        
+        
+        // JIRA:  TEIID-909 - The resolveNestedProperties logic goes in a loop when the key is also in the  value as ${key}.  
+        Properties dups = new Properties();
+        dups.setProperty("usethis", "${usethis}");
+        
+        dups = PropertiesUtils.resolveNestedProperties(dups);
+        
+        
 
     }
     

Deleted: branches/JCA/common-core/src/test/java/com/metamatrix/core/util/TestResourceNameUtil.java
===================================================================
--- branches/JCA/common-core/src/test/java/com/metamatrix/core/util/TestResourceNameUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-core/src/test/java/com/metamatrix/core/util/TestResourceNameUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,263 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.util;
-
-import junit.framework.TestCase;
-
-
-/** 
- * @since 4.3
- */
-public class TestResourceNameUtil extends TestCase {
-    
-    private static final String NON_RESERVED_VDB_NAME               = "SomeVdb";                //$NON-NLS-1$
-    private static final String NON_RESERVED_VDB_NAME_WITH_EXT      = "SomeVdb.vdb";            //$NON-NLS-1$
-    private static final String RESERVED_VDB_NAME                   = "System";                 //$NON-NLS-1$
-    private static final String RESERVED_VDB_NAME_WITH_EXT          = "System.vdb";             //$NON-NLS-1$
-    private static final String ILLEGAL_VDB_EXTENSION_NAME          = "SomeVdb.someExtension";  //$NON-NLS-1$
-    private static final String RESERVED_VDB_NAME_WITH_EXT_WITH_DOTS = "System.a.b.vdb";  //$NON-NLS-1$
-    
-    private static final String NON_RESERVED_XMI_NAME               = "SomeModel";                  //$NON-NLS-1$
-    private static final String NON_RESERVED_XMI_NAME_WITH_EXT      = "SomeModel.xmi";              //$NON-NLS-1$
-    private static final String RESERVED_XMI_NAME                   = "System";                     //$NON-NLS-1$
-    private static final String RESERVED_XMI_NAME_WITH_EXT          = "System.xmi";                 //$NON-NLS-1$
-    private static final String ILLEGAL_XMI_EXTENSION_NAME          = "SomeModel.someExtension";    //$NON-NLS-1$
-    private static final String RESERVED_XMI_NAME_WITH_EXT_WITH_DOTS = "System.a.b.xmi";  //$NON-NLS-1$
- 
-    private static final String NON_RESERVED_XSD_NAME               = "SomeSchema";                  //$NON-NLS-1$
-    private static final String NON_RESERVED_XSD_NAME_WITH_EXT      = "SomeSchema.xsd";              //$NON-NLS-1$
-    private static final String RESERVED_XSD_NAME                   = "SystemSchema";                //$NON-NLS-1$
-    private static final String RESERVED_XSD_NAME_WITH_EXT          = "SystemSchema.xsd";            //$NON-NLS-1$
-    private static final String ILLEGAL_XSD_EXTENSION_NAME          = "SomeSchema.someExtension";    //$NON-NLS-1$
-    private static final String RESERVED_XSD_NAME_WITH_EXT_WITH_DOTS = "SystemSchema.a.b.xsd";  //$NON-NLS-1$
-    
-    private static final String MSG_EXPECTED = "Expected: "; //$NON-NLS-1$
-    private static final String MSG_VDB_NAME = "VDB Name ["; //$NON-NLS-1$
-    private static final String MSG_XSD_NAME = "XSD Name ["; //$NON-NLS-1$
-    private static final String MSG_XMI_NAME = "Xmi Model Name ["; //$NON-NLS-1$
-    private static final String MSG_RESOURCE_NAME = "XSD Name ["; //$NON-NLS-1$
-    private static final String MSG_IS_NOT_RESERVED = "] is NOT RESERVED"; //$NON-NLS-1$
-    private static final String MSG_IS_RESERVED = "] IS RESERVED"; //$NON-NLS-1$
-    private static final String MSG_THROW_ILLEGAL_ARG_EXC = "] to throw IllegalArgumentException"; //$NON-NLS-1$
-    
-    /** 
-     * 
-     * @since 4.3
-     */
-    public TestResourceNameUtil() {
-        super();
-    }
-
-    /** 
-     * @param theName
-     * @since 4.3
-     */
-    public TestResourceNameUtil(String theName) {
-        super(theName);
-    }
-      
-    // ------------------------------------------------
-    // Test for VDB names
-    // ------------------------------------------------
-    public void testNonReservedVdbNameWithoutExtension() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      NON_RESERVED_VDB_NAME + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedVdbName(NON_RESERVED_VDB_NAME));
-    }
-    
-    public void testNonReservedVdbNameWithExtension() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      NON_RESERVED_VDB_NAME_WITH_EXT + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedVdbName(NON_RESERVED_VDB_NAME_WITH_EXT));
-    }
-    
-    public void testReservedVdbNameWithoutExtension() {
-        assertTrue(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_VDB_NAME + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedVdbName(RESERVED_VDB_NAME));
-    }
-    
-    public void testReservedVdbNameWithExtension() {
-        assertTrue(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_VDB_NAME_WITH_EXT + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedVdbName(RESERVED_VDB_NAME_WITH_EXT));
-    }
-    
-    public void testFailIllegalVdbName() {
-        try {
-            ResourceNameUtil.isReservedVdbName(ILLEGAL_VDB_EXTENSION_NAME);
-            fail(MSG_EXPECTED + MSG_VDB_NAME + ILLEGAL_VDB_EXTENSION_NAME + MSG_THROW_ILLEGAL_ARG_EXC);
-        } catch (IllegalArgumentException e) {
-        }
-    }
-    
-    public void testReservedVdbNameWithExtensionAndDots() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_VDB_NAME_WITH_EXT_WITH_DOTS + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedVdbName(RESERVED_VDB_NAME_WITH_EXT_WITH_DOTS));
-    }
-    
-    // ------------------------------------------------
-    // Test for XMI model names
-    // ------------------------------------------------
-    public void testNonReservedXmiNameWithoutExtension() {
-        assertFalse(MSG_EXPECTED + MSG_XMI_NAME + 
-                                                      NON_RESERVED_XMI_NAME + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedModelName(NON_RESERVED_XMI_NAME));
-    }
-    
-    public void testNonReservedXmiNameWithExtension() {
-        assertFalse(MSG_EXPECTED + MSG_XMI_NAME + 
-                                                      NON_RESERVED_XMI_NAME_WITH_EXT + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedModelName(NON_RESERVED_XMI_NAME_WITH_EXT));
-    }
-    
-    public void testReservedXmiNameWithoutExtension() {
-        assertTrue(MSG_EXPECTED + MSG_XMI_NAME + 
-                                                      RESERVED_XMI_NAME + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedModelName(RESERVED_XMI_NAME));
-    }
-    
-    public void testReservedXmiNameWithExtension() {
-        assertTrue(MSG_EXPECTED + MSG_XMI_NAME + 
-                                                      RESERVED_XMI_NAME_WITH_EXT + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedModelName(RESERVED_XMI_NAME_WITH_EXT));
-    }
-    
-    public void testFailIllegalXmiName() {
-        try {
-            ResourceNameUtil.isReservedModelName(ILLEGAL_XMI_EXTENSION_NAME);
-            fail(MSG_EXPECTED + MSG_XSD_NAME + ILLEGAL_XMI_EXTENSION_NAME + MSG_THROW_ILLEGAL_ARG_EXC);
-        } catch (IllegalArgumentException e) {
-        }
-    }
-    
-    public void testReservedXmiNameWithExtensionAndDots() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_XMI_NAME_WITH_EXT_WITH_DOTS + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedModelName(RESERVED_XMI_NAME_WITH_EXT_WITH_DOTS));
-    }
-    
-    // ------------------------------------------------
-    // Test for XSD model names
-    // ------------------------------------------------
-    public void testNonReservedXsdNameWithoutExtension() {
-        assertFalse(MSG_EXPECTED + MSG_XSD_NAME + 
-                                                      NON_RESERVED_XSD_NAME + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedSchemaName(NON_RESERVED_XSD_NAME));
-    }
-    
-    public void testNonReservedXsdNameWithExtension() {
-        assertFalse(MSG_EXPECTED + MSG_XSD_NAME + 
-                                                      NON_RESERVED_XSD_NAME_WITH_EXT + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedSchemaName(NON_RESERVED_XSD_NAME_WITH_EXT));
-    }
-    
-    public void testReservedXsdNameWithoutExtension() {
-        assertTrue(MSG_EXPECTED + MSG_XSD_NAME + 
-                                                      RESERVED_XSD_NAME + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedSchemaName(RESERVED_XSD_NAME));
-    }
-    
-    public void testReservedXsdNameWithExtension() {
-        assertTrue(MSG_EXPECTED + MSG_XSD_NAME + 
-                                                      RESERVED_XSD_NAME_WITH_EXT + 
-                   MSG_IS_RESERVED,
-                   ResourceNameUtil.isReservedSchemaName(RESERVED_XSD_NAME_WITH_EXT));
-    }
-    
-    public void testFailIllegalXsdName() {
-        try {
-            ResourceNameUtil.isReservedSchemaName(ILLEGAL_XSD_EXTENSION_NAME);
-            fail(MSG_EXPECTED + MSG_XSD_NAME + ILLEGAL_XSD_EXTENSION_NAME + MSG_THROW_ILLEGAL_ARG_EXC);
-        } catch (IllegalArgumentException e) {
-        }
-    }
-    
-    public void testReservedXsdNameWithExtensionAndDots() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_XSD_NAME_WITH_EXT_WITH_DOTS + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedSchemaName(RESERVED_XSD_NAME_WITH_EXT_WITH_DOTS));
-    }
-    
-    
-    // ------------------------------------------------
-    // Test for RESOURCE names
-    // ------------------------------------------------
-    public void testNonReservedResourceNameWithoutExtension() {
-        assertFalse(MSG_EXPECTED + MSG_RESOURCE_NAME + 
-                    NON_RESERVED_VDB_NAME + 
-                    MSG_IS_NOT_RESERVED,
-                    ResourceNameUtil.isReservedResourceName(NON_RESERVED_VDB_NAME));
-    }
-    
-    public void testNonReservedResourceNameWithExtension() {
-        assertFalse(MSG_EXPECTED + MSG_RESOURCE_NAME + 
-                    NON_RESERVED_VDB_NAME_WITH_EXT + 
-                    MSG_IS_NOT_RESERVED,
-                    ResourceNameUtil.isReservedResourceName(NON_RESERVED_VDB_NAME_WITH_EXT));
-    }
-    
-    public void testReservedResourceNameWithoutExtension() {
-        assertTrue(MSG_EXPECTED + MSG_RESOURCE_NAME + 
-                    RESERVED_XSD_NAME + 
-                    MSG_IS_RESERVED,
-                    ResourceNameUtil.isReservedResourceName(RESERVED_XSD_NAME));
-    }
-    
-    public void testReservedResourceNameWithExtension() {
-        assertTrue(MSG_EXPECTED + MSG_RESOURCE_NAME + 
-                    RESERVED_VDB_NAME_WITH_EXT + 
-                    MSG_IS_RESERVED,
-                    ResourceNameUtil.isReservedResourceName(RESERVED_VDB_NAME_WITH_EXT));
-    }
-    
-    public void testFailIllegalResourceName() {
-        try {
-            ResourceNameUtil.isReservedResourceName(ILLEGAL_VDB_EXTENSION_NAME);
-            fail(MSG_EXPECTED + MSG_RESOURCE_NAME + ILLEGAL_VDB_EXTENSION_NAME + MSG_THROW_ILLEGAL_ARG_EXC);
-        } catch (IllegalArgumentException e) {
-        }
-    }
-    
-    public void testReservedResourceNameWithExtensionAndDots() {
-        assertFalse(MSG_EXPECTED + MSG_VDB_NAME + 
-                                                      RESERVED_XSD_NAME_WITH_EXT_WITH_DOTS + 
-                   MSG_IS_NOT_RESERVED,
-                   ResourceNameUtil.isReservedResourceName(RESERVED_XSD_NAME_WITH_EXT_WITH_DOTS));
-    }
-}

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -27,15 +27,15 @@
 import java.util.Map;
 import java.util.Set;
 
-import com.metamatrix.core.log.MessageLevel;
-
 public class LogConfigurationImpl implements LogConfiguration, Serializable {
 
 	private static final long serialVersionUID = 4626429149431532292L;
 	
 	Map<String, Integer> contextMap = null;
+	private int defaultLevel;
 	
-	public LogConfigurationImpl() {
+	public LogConfigurationImpl(int defaultLevel) {
+		this.defaultLevel = defaultLevel;
 		this.contextMap = new HashMap<String, Integer>();
 	}
 	
@@ -58,7 +58,7 @@
 		if (level != null) {
 			return level;
 		}
-		return MessageLevel.NONE;
+		return defaultLevel;
 	}
 
 	private String fixContext(String context) {

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -86,7 +86,7 @@
  */
 public final class LogManager {
 
-    static LogConfiguration configuration = new LogConfigurationImpl(); // either injected or manually set using the set methods
+    static LogConfiguration configuration = new LogConfigurationImpl(MessageLevel.DETAIL); // either injected or manually set using the set methods
     
     static LogListener logListener = new JavaLogWriter(); // either injected or manually set using the set methods
 

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,6 +38,7 @@
 import org.jdom.Element;
 import org.jdom.JDOMException;
 
+import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.CommonPlugin;
 import com.metamatrix.common.config.api.ComponentType;
 import com.metamatrix.common.config.api.ConnectorBinding;
@@ -55,7 +56,7 @@
     private static final String TRUE = "true"; //$NON-NLS-1$
 	private final static String UNKNOWN = "Unknown"; //$NON-NLS-1$
     
-    public BasicVDBDefn read(InputStream defStream) throws IOException {
+    public BasicVDBDefn read(InputStream defStream) throws IOException, MetaMatrixComponentException {
     	BasicVDBDefn vdbDefn = null;
         try {
         	XMLReaderWriter reader = new XMLReaderWriterImpl();
@@ -80,7 +81,7 @@
             loadConnectorBindings(vdbDefn, root);
             
         } catch (JDOMException e) {
-            throw new IOException(CommonPlugin.Util.getString("VDBDefnXMLHelper.Unable_to_read_defn_file"));//$NON-NLS-1$
+            throw new MetaMatrixComponentException(e, CommonPlugin.Util.getString("VDBDefnXMLHelper.Unable_to_read_defn_file"));//$NON-NLS-1$
         } 
         return vdbDefn;
     }

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -96,7 +96,7 @@
         return CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(modelName);
     }
 		
-	public static VDBArchive loadVDB(URL vdbURL, File deployDirectory) throws IOException {
+	public static VDBArchive loadVDB(URL vdbURL, File deployDirectory) throws IOException, MetaMatrixComponentException {
 		boolean loadedFromDef = false;
     	BasicVDBDefn def = null;
     	String vdblocation = vdbURL.toString().toLowerCase();
@@ -177,7 +177,7 @@
 	 * @return
 	 * @throws IOException
 	 */
-	public VDBArchive(InputStream vdbStream) throws IOException {
+	public VDBArchive(InputStream vdbStream) throws IOException, MetaMatrixComponentException {
 		this.tempVDB = true;
 		loadFromFile(createTempVDB(vdbStream));
 	}
@@ -187,11 +187,11 @@
 	 * @param vdb
 	 * @throws IOException
 	 */
-	public VDBArchive(File vdb) throws IOException {
+	public VDBArchive(File vdb) throws IOException, MetaMatrixComponentException {
 		loadFromFile(vdb);
 	}
 
-	private void loadFromFile(File vdb) throws ZipException, IOException {
+	private void loadFromFile(File vdb) throws ZipException, IOException, MetaMatrixComponentException {
 		this.vdbFile = vdb;
 		this.archive = new ZipFile(this.vdbFile);
 		this.tempDir = TempDirectory.getTempDirectory(null);
@@ -210,7 +210,7 @@
 	 * @return BasicVDBDefn
 	 * @throws IOException
 	 */
-	private void load() throws IOException{
+	private void load() throws IOException, MetaMatrixComponentException{
 		this.pathsInArchive = Collections.unmodifiableSet(getListOfEntries());
 		
 		// check if manifest file is available then load it.
@@ -311,8 +311,9 @@
 		BasicVDBDefn manifestVdb = manifest.getVDB();
 		
 		// if models defined n the def file; add them the manifest
-		if (models == null || models.isEmpty()) {
+		if (models.isEmpty()) {
 			mydef.setModelInfos(manifestVdb.getModels());
+			models = mydef.getModels();
 		}
 
 		// if they are defined, but incomplete them add that info.
@@ -328,9 +329,9 @@
 	}
 	
 	private static InputStream getStream(String wantedFile, ZipFile archive) throws IOException {
-        Enumeration entries = archive.entries();
+        Enumeration<? extends ZipEntry> entries = archive.entries();
         while(entries.hasMoreElements()) {
-            ZipEntry entry = (ZipEntry)entries.nextElement();
+            ZipEntry entry = entries.nextElement();
             if (entry != null && entry.getName().equalsIgnoreCase(wantedFile)) {
                 return archive.getInputStream(entry);
             }
@@ -341,13 +342,17 @@
 	private HashSet<String> getListOfEntries() {
 		HashSet<String> files = new HashSet<String>();
 		File[] allFiles = FileUtils.findAllFilesInDirectoryRecursively(deployDirectory.getAbsolutePath());
-		int length = deployDirectory.getAbsolutePath().length();
+		int length = getAbstractPath(deployDirectory).length() - 1;
 		for (File file : allFiles) {
-			files.add(file.getAbsolutePath().substring(length));
+			files.add(getAbstractPath(file).substring(length));
 		}
 		return files;
 	}
 	
+    private static String getAbstractPath(File f) {
+    	return f.getAbsoluteFile().toURI().getPath();
+    }
+	
 	private void checkOpen() {
 		if(!open) {
 			throw new IllegalStateException("Archive already closed"); //$NON-NLS-1$
@@ -362,7 +367,7 @@
 	 * @return VDBDefn
 	 * @throws IOException 
 	 */
-	public static BasicVDBDefn readFromDef(InputStream defStream) throws IOException {
+	public static BasicVDBDefn readFromDef(InputStream defStream) throws IOException, MetaMatrixComponentException {
 		DEFReaderWriter reader = new DEFReaderWriter();
 		BasicVDBDefn vdbDefn = reader.read(defStream);
 		return vdbDefn;

Modified: branches/JCA/common-internal/src/main/resources/com/metamatrix/vdb/materialization/template/scriptMaterializedView.stg
===================================================================
--- branches/JCA/common-internal/src/main/resources/com/metamatrix/vdb/materialization/template/scriptMaterializedView.stg	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/main/resources/com/metamatrix/vdb/materialization/template/scriptMaterializedView.stg	2010-01-10 00:19:53 UTC (rev 1727)
@@ -50,7 +50,7 @@
 temp( it ) ::= "$it$_TEMP"
 
 populateLoad() ::= <<
-SELECT $columnNames; separator=", "$ INTO $materializationStageTableName$ FROM $virtualGroupName$ OPTION NOCACHE;>>
+SELECT $columnNames; separator=", "$ INTO $materializationStageTableName$ FROM $virtualGroupName$ OPTION NOCACHE $virtualGroupName$;>>
 
 renameTables() ::= <<
 $rename(old=materializationTableNameInSrc, new=materializationTableNameInSrc:temp())$

Modified: branches/JCA/common-internal/src/test/java/com/metamatrix/common/vdb/api/TestDEFReaderWriter.java
===================================================================
--- branches/JCA/common-internal/src/test/java/com/metamatrix/common/vdb/api/TestDEFReaderWriter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/test/java/com/metamatrix/common/vdb/api/TestDEFReaderWriter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -92,7 +92,7 @@
 		assertNull(defn.getConnectorType("dummy"));
 	}
 	
-	public void testDEFWrite() throws IOException {
+	public void testDEFWrite() throws Exception {
 		File defFile = new File(UnitTestUtil.getTestDataPath()+"/example.def");
 		File exportedFile = new File(UnitTestUtil.getTestDataPath()+"/example.def.exported");
 		

Modified: branches/JCA/common-internal/src/test/java/com/metamatrix/vdb/edit/materialization/TestMaterializedViewScriptGenerator.java
===================================================================
--- branches/JCA/common-internal/src/test/java/com/metamatrix/vdb/edit/materialization/TestMaterializedViewScriptGenerator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/test/java/com/metamatrix/vdb/edit/materialization/TestMaterializedViewScriptGenerator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -39,7 +39,6 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.core.util.FileUtil;
-import com.metamatrix.core.util.StringUtilities;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.vdb.materialization.DatabaseDialect;
 import com.metamatrix.vdb.materialization.MaterializedViewScriptGenerator;
@@ -226,7 +225,7 @@
     	
         String actual = FileUtil.read(new FileReader(actualFile)).trim();
         String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataFile("/materializedView/expected/" + expectedFileName))).trim(); //$NON-NLS-1$ 
-        assertEquals(StringUtilities.removeChars(expected, new char[] {'\r'}), actual);
+        assertEquals(expected.replaceAll("[\r]", ""), actual.replaceAll("[\r]", ""));
         actualFile.delete();
     }
     

Modified: branches/JCA/common-internal/src/test/resources/materializedView/expected/Load_MatviewVDB.ddl
===================================================================
--- branches/JCA/common-internal/src/test/resources/materializedView/expected/Load_MatviewVDB.ddl	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/test/resources/materializedView/expected/Load_MatviewVDB.ddl	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,2 +1,2 @@
 -- MetaMatrix script. Populate MatviewVDB cache table.
-SELECT col_1, col_2, col_3, col_4, col_5 INTO A_physical_staging_table FROM A_virtual_table OPTION NOCACHE;
+SELECT col_1, col_2, col_3, col_4, col_5 INTO A_physical_staging_table FROM A_virtual_table OPTION NOCACHE A_virtual_table;

Modified: branches/JCA/common-internal/src/test/resources/materializedView/expected/MatviewTheFirst_1_Load.ddl
===================================================================
--- branches/JCA/common-internal/src/test/resources/materializedView/expected/MatviewTheFirst_1_Load.ddl	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/test/resources/materializedView/expected/MatviewTheFirst_1_Load.ddl	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,2 +1,2 @@
 -- MetaMatrix script. Populate MatviewTheFirst cache table.
-SELECT col_1, col_2, col_3, col_4, col_5 INTO A_physical_staging_table FROM A_virtual_table OPTION NOCACHE;
+SELECT col_1, col_2, col_3, col_4, col_5 INTO A_physical_staging_table FROM A_virtual_table OPTION NOCACHE A_virtual_table;

Modified: branches/JCA/common-internal/src/test/resources/materializedView/expected/MetaMatrix_load.txt
===================================================================
--- branches/JCA/common-internal/src/test/resources/materializedView/expected/MetaMatrix_load.txt	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/common-internal/src/test/resources/materializedView/expected/MetaMatrix_load.txt	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,2 +1,2 @@
 -- MetaMatrix script. Populate view1 cache table.
-SELECT column1, column2, column3 INTO materializationStageTableName FROM virtualGroupName OPTION NOCACHE;
+SELECT column1, column2, column3 INTO materializationStageTableName FROM virtualGroupName OPTION NOCACHE virtualGroupName;

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -64,11 +64,6 @@
 	 */
 	public boolean isXaCapable();
 	
-	boolean isResultSetCacheEnabled();
-	int getResultSetCacheMaxSize();
-	int getResultSetCacheMaxAge();
-	String getResultSetCacheScope();
-	
     /**
      * Indicates whether the connector represents a pooled resource.  If it does, then
      * synchronous workers will be used.

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -63,11 +63,6 @@
 	private int maxResultRows = -1;
 	private boolean xaCapable;
 	
-	
-	private boolean resultSetCacheEnabled = false;
-	private int resultSetCacheMaxSize = 20;
-	private int resultSetCacheMaxAge =  3600000;
-	private String resultSetCacheScope = "vdb";
 	private boolean synchWorkers = true;
 	private String overrideCapabilitiesFile;
 	
@@ -170,42 +165,6 @@
 	}	
 	
 	@Override
-	public boolean isResultSetCacheEnabled() {
-		return resultSetCacheEnabled;
-	}
-
-	public void setResultSetCacheEnabled(Boolean arg0) {
-		this.resultSetCacheEnabled = arg0.booleanValue();
-	}
-
-	@Override
-	public int getResultSetCacheMaxSize() {
-		return resultSetCacheMaxSize;
-	}
-
-	public void setResultSetCacheMaxSize(Integer arg0) {
-		this.resultSetCacheMaxSize = arg0.intValue();
-	}
-
-	@Override
-	public int getResultSetCacheMaxAge() {
-		return resultSetCacheMaxAge;
-	}
-
-	public void setResultSetCacheMaxAge(Integer arg0) {
-		this.resultSetCacheMaxAge = arg0.intValue();
-	}
-	
-	@Override
-	public String getResultSetCacheScope() {
-		return resultSetCacheScope;
-	}
-
-	public void setResultSetCacheScope(String arg0) {
-		this.resultSetCacheScope = arg0;
-	}	
-
-	@Override
 	public ILanguageFactory getLanguageFactory() {
 		return LanguageFactoryImpl.INSTANCE;
 	}

Modified: branches/JCA/connector-api/src/main/resources/connector-base.xml
===================================================================
--- branches/JCA/connector-api/src/main/resources/connector-base.xml	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connector-api/src/main/resources/connector-base.xml	2010-01-10 00:19:53 UTC (rev 1727)
@@ -12,13 +12,6 @@
             <PropertyDefinition Name="ServiceClassName" DisplayName="Service Class Name" ShortDescription="" DefaultValue="com.metamatrix.server.connector.service.ConnectorService" IsRequired="true" IsModifiable="false" />
             <PropertyDefinition Name="MaxResultRows" DisplayName="Maximum Result Rows" ShortDescription="" DefaultValue="10000" IsRequired="true" PropertyType="Integer" IsExpert="true" />
             <PropertyDefinition Name="SynchWorkers" DisplayName="Synchronous Workers" ShortDescription="Whether worker threads will be bound to connections. Asynch connectors should set this value to false." DefaultValue="true" IsRequired="true" PropertyType="Boolean" IsExpert="true" />
-            <PropertyDefinition Name="ResultSetCacheEnabled" DisplayName="ResultSet Cache Enabled" ShortDescription="" DefaultValue="false"  PropertyType="Boolean"   IsExpert="true"  IsMasked="false"   />
-            <PropertyDefinition Name="ResultSetCacheMaxSize" DisplayName="ResultSet Cache Maximum Size (megabytes)" ShortDescription="" DefaultValue="20" PropertyType="Integer" IsExpert="true" />
-            <PropertyDefinition Name="ResultSetCacheMaxAge" DisplayName="ResultSet Cache Maximum Age (milliseconds)" ShortDescription="" DefaultValue="3600000" PropertyType="Long" IsExpert="true" />
-            <PropertyDefinition Name="ResultSetCacheScope" DisplayName="ResultSet Cache Scope" ShortDescription="" DefaultValue="vdb" IsExpert="true">
-                <AllowedValue>vdb</AllowedValue>
-                <AllowedValue>session</AllowedValue>
-            </PropertyDefinition>
             <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Set to true if this is an XA Connector" DefaultValue="false" IsRequired="true" PropertyType="Boolean" IsExpert="true"  IsMasked="false"  />
             <PropertyDefinition Name="ConnectionPoolEnabled" DisplayName="Connection Pool Enabled" ShortDescription="Enable the use of connection pooling with this connector." DefaultValue="true" IsRequired="true" PropertyType="Boolean" IsExpert="true"  IsMasked="false"  />
             <PropertyDefinition Name="UseCredentialMap" DisplayName="Requires Credential Map" ShortDescription="Set to true if this connector requires credentials to be passed via a credential map." DefaultValue="false" IsRequired="true" PropertyType="Boolean" IsExpert="true"  IsMasked="false"  />

Modified: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -73,7 +73,7 @@
         try {
             command = QueryParser.getQueryParser().parseCommand(queryString);
             QueryResolver.resolveCommand(command, metadata);
-            command = QueryRewriter.rewrite(command, null, metadata, null);
+            command = QueryRewriter.rewrite(command, metadata, null);
             expandAllSymbol(command);            
             if (generateAliases) {
                 command.acceptVisitor(new AliasGenerator(supportsGroupAlias));

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -46,6 +46,8 @@
 import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
 import org.teiid.connector.metadata.runtime.ProcedureParameter.Type;
 
+import com.metamatrix.core.util.StringUtil;
+
 /**
  * Reads from {@link DatabaseMetaData} and creates metadata through the {@link MetadataFactory}.
  */
@@ -78,12 +80,14 @@
 	private String catalog;
 	private String schemaPattern;	
 	private boolean importApproximateIndexes = true;
-	private boolean widenUnsingedTypes;
+	private boolean widenUnsingedTypes = true;
+	private boolean quoteNameInSource = true;
 	//TODO add an option to not fully qualify name in source
 	
 	private ConnectorLogger logger;
 	JDBCManagedConnectionFactory config;
 	private Set<String> unsignedTypes = new HashSet<String>();
+	private String quoteString;
 	
 
 	
@@ -96,8 +100,13 @@
 			throws SQLException, ConnectorException {
 		DatabaseMetaData metadata = conn.getMetaData();
 		
+		quoteString = metadata.getIdentifierQuoteString();
+		if (quoteString != null && quoteString.trim().length() == 0) {
+			quoteString = null;
+		}
+		
 		if (widenUnsingedTypes) {
-			ResultSet rs = metadata.getTableTypes();
+			ResultSet rs = metadata.getTypeInfo();
 			while (rs.next()) {
 				String name = rs.getString(1);
 				boolean unsigned = rs.getBoolean(10);
@@ -133,9 +142,9 @@
 			String procedureCatalog = procedures.getString(1);
 			String procedureSchema = procedures.getString(2);
 			String procedureName = procedures.getString(3);
-			String fullProcedureName = getTableName(procedureCatalog, procedureSchema, procedureName);
+			String fullProcedureName = getFullyQualifiedName(procedureCatalog, procedureSchema, procedureName);
 			ProcedureRecordImpl procedure = metadataFactory.addProcedure(useFullSchemaName?fullProcedureName:procedureName);
-			procedure.setNameInSource(fullProcedureName);
+			procedure.setNameInSource(getFullyQualifiedName(procedureCatalog, procedureSchema, procedureName, true));
 			ResultSet columns = metadata.getProcedureColumns(catalog, procedureSchema, procedureName, null);
 			while (columns.next()) {
 				String columnName = columns.getString(4);
@@ -191,9 +200,9 @@
 			String tableCatalog = tables.getString(1);
 			String tableSchema = tables.getString(2);
 			String tableName = tables.getString(3);
-			String fullName = getTableName(tableCatalog, tableSchema, tableName);
+			String fullName = getFullyQualifiedName(tableCatalog, tableSchema, tableName);
 			Table table = metadataFactory.addTable(useFullSchemaName?fullName:tableName);
-			table.setNameInSource(fullName);
+			table.setNameInSource(getFullyQualifiedName(tableCatalog, tableSchema, tableName, true));
 			table.setSupportsUpdate(true);
 			String remarks = tables.getString(5);
 			table.setAnnotation(remarks);
@@ -216,7 +225,7 @@
 			String tableCatalog = columns.getString(1);
 			String tableSchema = columns.getString(2);
 			String tableName = columns.getString(3);
-			String fullTableName = getTableName(tableCatalog, tableSchema, tableName);
+			String fullTableName = getFullyQualifiedName(tableCatalog, tableSchema, tableName);
 			TableInfo tableInfo = tableMap.get(fullTableName);
 			if (tableInfo == null) {
 				tableInfo = tableMap.get(tableName);
@@ -230,6 +239,7 @@
 			type = checkForUnsigned(type, typeName);
 			//note that the resultset is already ordered by position, so we can rely on just adding columns in order
 			Column column = metadataFactory.addColumn(columnName, TypeFacility.getDataTypeNameFromSQLType(type), tableInfo.table);
+			column.setNameInSource(quoteName(columnName));
 			column.setNativeType(columns.getString(6));
 			column.setRadix(columns.getInt(10));
 			column.setNullType(NullType.values()[columns.getShort(11)]);
@@ -243,6 +253,13 @@
 		}
 		columns.close();
 	}
+	
+	private String quoteName(String name) {
+		if (quoteNameInSource) {
+			return quoteString + StringUtil.replaceAll(name, quoteString, quoteString + quoteString) + quoteString;
+		}
+		return name;
+	}
 
 	private void getPrimaryKeys(MetadataFactory metadataFactory,
 			DatabaseMetaData metadata, Map<String, TableInfo> tableMap)
@@ -298,7 +315,7 @@
 					String tableCatalog = fks.getString(1);
 					String tableSchema = fks.getString(2);
 					String tableName = fks.getString(3);
-					String fullTableName = getTableName(tableCatalog, tableSchema, tableName);
+					String fullTableName = getFullyQualifiedName(tableCatalog, tableSchema, tableName);
 					pkTable = tableMap.get(fullTableName);
 					if (pkTable == null) {
 						throw new ConnectorException(JDBCPlugin.Util.getString("JDBCMetadataProcessor.cannot_find_primary", fullTableName)); //$NON-NLS-1$
@@ -357,14 +374,17 @@
 		}
 	}
 
-	private static String getTableName(String tableCatalog, String tableSchema,
-			String tableName) {
-		String fullName = tableName;
-		if (tableSchema != null && tableSchema.length() > 0) {
-			fullName = tableSchema + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
+	private String getFullyQualifiedName(String catalogName, String schemaName, String objectName) {
+		return getFullyQualifiedName(catalogName, schemaName, objectName, false);
+	}
+	
+	private String getFullyQualifiedName(String catalogName, String schemaName, String objectName, boolean quoted) {
+		String fullName = (quoted?quoteName(objectName):objectName);
+		if (schemaName != null && schemaName.length() > 0) {
+			fullName = (quoted?quoteName(schemaName):schemaName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
 		}
-		if (tableCatalog != null && tableCatalog.length() > 0) {
-			fullName = tableCatalog + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
+		if (catalogName != null && catalogName.length() > 0) {
+			fullName = (quoted?quoteName(catalogName):catalogName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
 		}
 		return fullName;
 	}
@@ -406,6 +426,10 @@
 	public void setWidenUnsingedTypes(boolean widenUnsingedTypes) {
 		this.widenUnsingedTypes = widenUnsingedTypes;
 	}
+	
+	public void setQuoteNameInSource(boolean quoteIdentifiers) {
+		this.quoteNameInSource = quoteIdentifiers;
+	}
 
 	// Importer specific properties
 	public void setCatalog(String catalog) {

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Constants.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Constants.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Constants.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -45,5 +45,7 @@
 	public static final String RESTRICTED_MULTISELECT_PICKLIST_TYPE = "restrictedmultiselectpicklist"; //$NON-NLS-1$
 
 	public static final String SUPPORTS_QUERY = "Supports Query";
+	
+	public static final String SUPPORTS_RETRIEVE = "Supports Retrieve";
 
 }

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -41,13 +41,16 @@
 import com.metamatrix.connector.salesforce.SalesForceManagedConnectionFactory;
 import com.metamatrix.connector.salesforce.connection.impl.ConnectionImpl;
 import com.metamatrix.connector.salesforce.execution.DataPayload;
+import com.metamatrix.connector.salesforce.execution.DeleteExecutionImpl;
 import com.metamatrix.connector.salesforce.execution.DeletedResult;
+import com.metamatrix.connector.salesforce.execution.InsertExecutionImpl;
 import com.metamatrix.connector.salesforce.execution.ProcedureExecutionParentImpl;
 import com.metamatrix.connector.salesforce.execution.QueryExecutionImpl;
-import com.metamatrix.connector.salesforce.execution.UpdateExecutionParent;
+import com.metamatrix.connector.salesforce.execution.UpdateExecutionImpl;
 import com.metamatrix.connector.salesforce.execution.UpdatedResult;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.sforce.soap.partner.QueryResult;
+import com.sforce.soap.partner.sobject.SObject;
 
 public class SalesforceConnection extends BasicConnection {
 
@@ -89,7 +92,15 @@
 	public UpdateExecution createUpdateExecution(ICommand command,
 			ExecutionContext executionContext, RuntimeMetadata metadata)
 			throws ConnectorException {
-		return new UpdateExecutionParent(command, this, metadata, executionContext, connectorEnv);
+		UpdateExecution result = null;
+		if(command instanceof org.teiid.connector.language.IDelete) {
+			result = new DeleteExecutionImpl(command, this, metadata, executionContext, connectorEnv);
+		} else if (command instanceof org.teiid.connector.language.IInsert) {
+			result = new InsertExecutionImpl(command, this, metadata, executionContext, connectorEnv);
+		} else if (command instanceof org.teiid.connector.language.IUpdate) {
+			result = new UpdateExecutionImpl(command, this, metadata, executionContext, connectorEnv);
+		}
+		return result;
 
 	}
 	
@@ -143,4 +154,11 @@
 			Calendar endCalendar) throws ConnectorException {
 		return connection.getDeleted(objectName, startCalendar, endCalendar);
 	}
+	
+	public QueryResult retrieve(String fieldList, String sObjectType, String[] ids) throws ConnectorException {
+		SObject[] objects = connection.retrieve(fieldList, sObjectType, ids);
+		QueryResult result = new QueryResult(true, "teiid_created_result",
+		           objects, objects.length);
+		return result;
+	}
 }

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -330,4 +330,14 @@
 			throw new ConnectorException(e, e.getMessage());
 		}
 	}
+	
+	public SObject[] retrieve(String fieldList, String sObjectType, String[] ids) throws ConnectorException {
+		try {
+			return binding.retrieve(fieldList, sObjectType, ids);
+		} catch (ApiFault e) {
+			throw new ConnectorException(e.getMessage());
+		} catch (RemoteException e) {
+			throw new ConnectorException(e, e.getMessage());
+		}
+	}
 }

Copied: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/AbstractUpdateExecution.java (from rev 1724, trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/AbstractUpdateExecution.java)
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/AbstractUpdateExecution.java	                        (rev 0)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/AbstractUpdateExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.ArrayList;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.DataNotAvailableException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.UpdateExecution;
+import org.teiid.connector.basic.BasicExecution;
+import org.teiid.connector.language.ICommand;
+import org.teiid.connector.language.ICompareCriteria;
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+
+import com.metamatrix.connector.salesforce.Util;
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
+import com.metamatrix.connector.salesforce.execution.visitors.IQueryProvidingVisitor;
+import com.sforce.soap.partner.QueryResult;
+import com.sforce.soap.partner.sobject.SObject;
+
+/**
+ * 
+ * Parent class to the Update, Delete, and Insert execution classes.
+ * Provisions the correct impl and contains some common code to 
+ * get IDs of Salesforce objects.
+ *
+ */
+public abstract class AbstractUpdateExecution extends BasicExecution implements UpdateExecution {
+
+	protected SalesforceConnection connection;
+	protected RuntimeMetadata metadata;
+	protected ExecutionContext context;
+	protected ConnectorEnvironment connectorEnv;
+	protected ICommand command;
+	protected int result;
+
+	public AbstractUpdateExecution(ICommand command, SalesforceConnection salesforceConnection,
+			RuntimeMetadata metadata, ExecutionContext context,
+			ConnectorEnvironment connectorEnv) {
+		this.connection = salesforceConnection;
+		this.metadata = metadata;
+		this.context = context;
+		this.connectorEnv = connectorEnv;
+		this.command = command;
+	}
+
+	@Override
+	public void cancel() throws ConnectorException {
+	}
+
+	@Override
+	public void close() throws ConnectorException {
+	}
+	
+	@Override
+	public int[] getUpdateCounts() throws DataNotAvailableException,
+			ConnectorException {
+		return new int[] {result};
+	}
+
+	public RuntimeMetadata getMetadata() {
+		return metadata;
+	}
+
+	public ConnectorEnvironment getConnectorEnv() {
+		return connectorEnv;
+	}
+	
+	public SalesforceConnection getConnection() {
+		return connection;
+	}
+
+	String[] getIDs(ICriteria criteria, IQueryProvidingVisitor visitor) throws ConnectorException {
+		String[] Ids = null;
+		if (visitor.hasOnlyIDCriteria()) {
+			try {
+				String Id = ((ICompareCriteria)criteria).getRightExpression().toString();
+				Id = Util.stripQutes(Id);
+				Ids = new String[] { Id };
+			} catch (ClassCastException cce) {
+				throw new RuntimeException(
+						"Error:  The delete criteria is not a CompareCriteria");
+			}
+	
+		} else if (visitor.hasCriteria()) {
+			String query = visitor.getQuery();
+			QueryResult results = getConnection().query(query, context.getBatchSize(), Boolean.FALSE);
+			if (null != results && results.getSize() > 0) {
+				ArrayList<String> idList = new ArrayList<String>(results
+						.getRecords().length);
+				for (int i = 0; i < results.getRecords().length; i++) {
+					SObject sObject = results.getRecords(i);
+					idList.add(sObject.getId());
+				}
+				Ids = idList.toArray(new String[0]);
+			}
+		}
+		return Ids;
+	}
+}

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeleteExecutionImpl.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeleteExecutionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeleteExecutionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -21,22 +21,33 @@
  */
 package com.metamatrix.connector.salesforce.execution;
 
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IDelete;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
 import com.metamatrix.connector.salesforce.execution.visitors.DeleteVisitor;
 
-public class DeleteExecutionImpl {
+public class DeleteExecutionImpl extends AbstractUpdateExecution {
 
-	public int execute(IDelete delete, UpdateExecutionParent parent) throws ConnectorException {
-		
-		int result = 0;
-		DeleteVisitor dVisitor = new DeleteVisitor(parent.getMetadata());
-		dVisitor.visitNode(delete);
-		String[] Ids = parent.getIDs(delete.getCriteria(), dVisitor);
+
+	public DeleteExecutionImpl(ICommand command,
+			SalesforceConnection salesforceConnection,
+			RuntimeMetadata metadata, ExecutionContext context,
+			ConnectorEnvironment connectorEnv) {
+		super(command, salesforceConnection, metadata, context, connectorEnv);
+	}
+
+	@Override
+	public void execute() throws ConnectorException {
+		DeleteVisitor dVisitor = new DeleteVisitor(getMetadata());
+		dVisitor.visitNode(command);
+		String[] Ids = getIDs(((IDelete)command).getCriteria(), dVisitor);
 		if(null != Ids && Ids.length > 0) {
-			result = parent.getConnection().delete(Ids);
+			result = getConnection().delete(Ids);
 		}
-		return result;
 	}
 }

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/InsertExecutionImpl.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/InsertExecutionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/InsertExecutionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,21 +22,32 @@
 package com.metamatrix.connector.salesforce.execution;
 
 
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IInsert;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
 import com.metamatrix.connector.salesforce.execution.visitors.InsertVisitor;
 
-public class InsertExecutionImpl {
+public class InsertExecutionImpl extends AbstractUpdateExecution {
 
-	public int execute(IInsert insert,
-			UpdateExecutionParent salesforceUpdateExecution) throws ConnectorException {
-		
-		InsertVisitor visitor = new InsertVisitor(salesforceUpdateExecution.getMetadata());
-		visitor.visit(insert);
+	public InsertExecutionImpl(ICommand command,
+			SalesforceConnection salesforceConnection,
+			RuntimeMetadata metadata, ExecutionContext context,
+			ConnectorEnvironment connectorEnv) {
+		super(command, salesforceConnection, metadata, context, connectorEnv);
+	}
+
+	@Override
+	public void execute() throws ConnectorException {
+		InsertVisitor visitor = new InsertVisitor(getMetadata());
+		visitor.visit((IInsert)command);
 		DataPayload data = new DataPayload();
 		data.setType(visitor.getTableName());
 		data.setMessageElements(visitor.getMessageElements());
-		return salesforceUpdateExecution.getConnection().create(data);
+		result = getConnection().create(data);		
 	}
 }

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -118,18 +118,28 @@
 		connectorEnv.getLogger().logInfo(
 				getLogPreamble() + "Incoming Query: " + query.toString());
 		IFrom from = ((IQuery)query).getFrom();
+		String finalQuery;
 		if(from.getItems().get(0) instanceof IJoin) {
 			visitor = new JoinQueryVisitor(metadata);
+			visitor.visitNode(query);
+			finalQuery = visitor.getQuery().trim();
+			connectorEnv.getLogger().logInfo(
+					getLogPreamble() + "Executing Query: " + finalQuery);
+			
+			results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
 		} else {
 			visitor = new SelectVisitor(metadata);
+			visitor.visitNode(query);
+			if(visitor.canRetrieve()) {
+				results = connection.retrieve(visitor.getRetrieveFieldList(),
+						visitor.getTableName(), visitor.getIdInCriteria());
+			} else {
+				finalQuery = visitor.getQuery().trim();
+				connectorEnv.getLogger().logInfo(
+						getLogPreamble() + "Executing Query: " + finalQuery);
+				results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
+			}
 		}
-		visitor.visitNode(query);
-		String finalQuery;
-		finalQuery = visitor.getQuery().trim();
-		connectorEnv.getLogger().logInfo(
-				getLogPreamble() + "Executing Query: " + finalQuery);
-		
-		results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
 	}
 	
 	@SuppressWarnings("unchecked")

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionImpl.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -27,29 +27,39 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis.message.MessageElement;
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IElement;
 import org.teiid.connector.language.ILiteral;
 import org.teiid.connector.language.ISetClause;
 import org.teiid.connector.language.IUpdate;
 import org.teiid.connector.metadata.runtime.Element;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 import com.metamatrix.connector.salesforce.Util;
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
 import com.metamatrix.connector.salesforce.execution.visitors.UpdateVisitor;
 
-public class UpdateExecutionImpl {
+public class UpdateExecutionImpl extends AbstractUpdateExecution {
 
-	public int execute(IUpdate update, UpdateExecutionParent parent)
-			throws ConnectorException {
-		int result = 0;
-		UpdateVisitor visitor = new UpdateVisitor(parent
-				.getMetadata());
-		visitor.visit(update);
-		String[] Ids = parent.getIDs(update.getCriteria(), visitor);
+	public UpdateExecutionImpl(ICommand command,
+			SalesforceConnection salesforceConnection,
+			RuntimeMetadata metadata, ExecutionContext context,
+			ConnectorEnvironment connectorEnv) {
+		super(command, salesforceConnection, metadata, context, connectorEnv);
+	}
 
+	@Override
+	public void execute() throws ConnectorException {
+		UpdateVisitor visitor = new UpdateVisitor(getMetadata());
+		visitor.visit((IUpdate)command);
+		String[] Ids = getIDs(((IUpdate)command).getCriteria(), visitor);
+
 		if (null != Ids && Ids.length > 0) {
 			List<MessageElement> elements = new ArrayList<MessageElement>();
-			for (ISetClause clause : update.getChanges().getClauses()) {
+			for (ISetClause clause : ((IUpdate)command).getChanges().getClauses()) {
 				IElement element = clause.getSymbol();
 				Element column = element.getMetadataObject();
 				String val = ((ILiteral) clause.getValue())
@@ -69,9 +79,7 @@
 				updateDataList.add(data);
 			}
 
-			result = parent.getConnection().update(updateDataList);
+			result = getConnection().update(updateDataList);
 		}
-		return result;
 	}
-
 }

Deleted: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package com.metamatrix.connector.salesforce.execution;
-
-import java.util.ArrayList;
-
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.DataNotAvailableException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.UpdateExecution;
-import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IUpdate;
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-
-import com.metamatrix.connector.salesforce.Util;
-import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
-import com.metamatrix.connector.salesforce.execution.visitors.IQueryProvidingVisitor;
-import com.sforce.soap.partner.QueryResult;
-import com.sforce.soap.partner.sobject.SObject;
-
-/**
- * 
- * Parent class to the Update, Delete, and Insert execution classes.
- * Provisions the correct impl and contains some common code to 
- * get IDs of Salesforce objects.
- *
- */
-public class UpdateExecutionParent extends BasicExecution implements UpdateExecution {
-
-	private SalesforceConnection connection;
-	private RuntimeMetadata metadata;
-	private ExecutionContext context;
-	private ConnectorEnvironment connectorEnv;
-	private ICommand command;
-	private int result;
-
-	public UpdateExecutionParent(ICommand command, SalesforceConnection salesforceConnection,
-			RuntimeMetadata metadata, ExecutionContext context,
-			ConnectorEnvironment connectorEnv) {
-		this.connection = salesforceConnection;
-		this.metadata = metadata;
-		this.context = context;
-		this.connectorEnv = connectorEnv;
-		this.command = command;
-	}
-
-	@Override
-	public void cancel() throws ConnectorException {
-	}
-
-	@Override
-	public void close() throws ConnectorException {
-	}
-
-	@Override
-	public void execute() throws ConnectorException {
-		if(command instanceof org.teiid.connector.language.IDelete) {
-			DeleteExecutionImpl ex = new DeleteExecutionImpl();
-			result = ex.execute(((IDelete)command), this);
-		} else if (command instanceof org.teiid.connector.language.IInsert) {
-			InsertExecutionImpl ex = new InsertExecutionImpl();
-			result = ex.execute(((IInsert)command), this);
-		} else if (command instanceof org.teiid.connector.language.IUpdate) {
-			UpdateExecutionImpl ex = new UpdateExecutionImpl();
-			result = ex.execute(((IUpdate)command), this);
-		}
-	}
-	
-	@Override
-	public int[] getUpdateCounts() throws DataNotAvailableException,
-			ConnectorException {
-		return new int[] {result};
-	}
-
-	public RuntimeMetadata getMetadata() {
-		return metadata;
-	}
-
-	public ConnectorEnvironment getConnectorEnv() {
-		return connectorEnv;
-	}
-	
-	public SalesforceConnection getConnection() {
-		return connection;
-	}
-
-	String[] getIDs(ICriteria criteria, IQueryProvidingVisitor visitor) throws ConnectorException {
-		String[] Ids = null;
-		if (visitor.hasOnlyIDCriteria()) {
-			try {
-				String Id = ((ICompareCriteria)criteria).getRightExpression().toString();
-				Id = Util.stripQutes(Id);
-				Ids = new String[] { Id };
-			} catch (ClassCastException cce) {
-				throw new RuntimeException(
-						"Error:  The delete criteria is not a CompareCriteria");
-			}
-	
-		} else if (visitor.hasCriteria()) {
-			String query = visitor.getQuery();
-			QueryResult results = getConnection().query(query, context.getBatchSize(), Boolean.FALSE);
-			if (null != results && results.getSize() > 0) {
-				ArrayList<String> idList = new ArrayList<String>(results
-						.getRecords().length);
-				for (int i = 0; i < results.getRecords().length; i++) {
-					SObject sObject = results.getRecords(i);
-					idList.add(sObject.getId());
-				}
-				Ids = idList.toArray(new String[0]);
-			}
-		}
-		return Ids;
-	}
-}

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -76,6 +76,10 @@
     protected Group table;
     boolean onlyIDCriteria;
     protected Boolean queryAll = Boolean.FALSE;
+	
+    // support for invoking a retrieve when possible.
+    protected IInCriteria idInCriteria = null;
+	
 
     public CriteriaVisitor( RuntimeMetadata metadata ) {
         this.metadata = metadata;
@@ -322,9 +326,12 @@
 
     private void appendCriteria( IInCriteria criteria ) throws ConnectorException {
         StringBuffer queryString = new StringBuffer();
+        IExpression leftExp = criteria.getLeftExpression();
+        if(isIdColumn(leftExp)) {
+        	idInCriteria  = criteria;
+        }
+        queryString.append(getValue(leftExp));
         queryString.append(' ');
-        queryString.append(getValue(criteria.getLeftExpression()));
-        queryString.append(' ');
         if (criteria.isNegated()) {
             queryString.append("NOT ");
         }
@@ -354,7 +361,7 @@
         return result;
     }
 
-    private String getValue( IExpression expr ) throws ConnectorException {
+    protected String getValue( IExpression expr ) throws ConnectorException {
         String result;
         if (expr instanceof IElement) {
             IElement element = (IElement)expr;
@@ -378,7 +385,7 @@
         }
         List<Element> columnIds = table.getChildren();
         for (Element element : columnIds) {
-            String name = table.getName() + '.' + element.getName();
+            String name = table.getName() + '.' + element.getNameInSource();
             columnElementsByName.put(name, element);
 
             // influences queryAll behavior

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -64,7 +64,7 @@
 				String val;
 				if(value instanceof ILiteral) {
 					ILiteral literalValue = (ILiteral)value;
-					val = this.stripQutes((String)literalValue.getValue());
+					val = this.stripQutes(literalValue.getValue().toString());
 				} else {
 					val = value.toString();
 				}

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -51,6 +51,7 @@
 	private int idIndex = -1; // index of the ID select symbol.
 	protected List<ISelectSymbol> selectSymbols;
 	protected StringBuffer limitClause = new StringBuffer();
+	private Boolean supportsRetrieve;
 	
 	public SelectVisitor(RuntimeMetadata metadata) {
 		super(metadata);
@@ -112,6 +113,7 @@
 			if(fromItem instanceof IGroup) {
 				table = ((IGroup)fromItem).getMetadataObject();
 		        String supportsQuery = (String)table.getProperties().get(Constants.SUPPORTS_QUERY);
+		        supportsRetrieve = Boolean.valueOf((String)table.getProperties().get(Constants.SUPPORTS_RETRIEVE));
 		        if (!Boolean.valueOf(supportsQuery)) {
 		            throw new ConnectorException(table.getNameInSource() + " "
 		                                         + Messages.getString("CriteriaVisitor.query.not.supported"));
@@ -198,4 +200,37 @@
 		return queryAll;
 	}
 
+
+	public String getRetrieveFieldList() throws ConnectorException {
+		assertRetrieveValidated();
+		StringBuffer result = new StringBuffer();
+		addSelectSymbols(table.getNameInSource(), result);
+		return result.toString();
+	}
+
+
+	public String[] getIdInCriteria() throws ConnectorException {
+		assertRetrieveValidated();
+		List<IExpression> expressions = this.idInCriteria.getRightExpressions();
+		String[] result = new String[expressions.size()];
+		for(int i = 0; i < expressions.size(); i++) {
+			result[i] = getValue(expressions.get(i));
+		}      
+		return result;
+	}
+
+	private void assertRetrieveValidated() throws AssertionError {
+		if(!hasOnlyIDCriteria()) {
+			throw new AssertionError("Must call hasOnlyIdInCriteria() before this method");
+		}
+	}
+
+	public boolean hasOnlyIdInCriteria() {
+		return hasOnlyIDCriteria() && idInCriteria != null;
+	}
+	
+	public boolean canRetrieve() {
+		return supportsRetrieve && hasOnlyIDCriteria();
+	}
+
 }

Modified: branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/UpdateVisitor.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/UpdateVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/UpdateVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -21,8 +21,6 @@
  */
 package com.metamatrix.connector.salesforce.execution.visitors;
 
-import java.util.Iterator;
-
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.language.IUpdate;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;

Modified: branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -132,23 +132,37 @@
 		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$
 	}
+
 	
-	// I can't really write this test until I see what teiid is going to pass the connectro based upon the user query.
-	// SELECT Account.Name AS c_0, Contact.Name AS c_1 FROM Contact LEFT OUTER JOIN Account ON Account.Id = Contact.AccountId
+	@Test public void testIN() throws Exception {
+		IQuery command = (IQuery)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
+		IQuery command = (IQuery)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(new String[]{"1", "2", "3"}, visitor.getIdInCriteria());	
+	}
+	
 	@Test public void testJoin() throws Exception {
 		IQuery command = (IQuery)translationUtility.parseCommand("SELECT Account.Name, Contact.Name FROM Contact LEFT OUTER JOIN Account ON Account.Id = Contact.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$
-		// SELECT Contact.Id, Contact.Name, Account.Name FROM Contact WHERE Account.Industry != 'media'
-		// Looks like using q names will work, but we need to distinguish between the parent and child table somehow cannot send
-		// SELECT Contact.Id, Contact.Name, Account.Name FROM Contact, Account WHERE Account.Industry != 'media'
 	}
 	
 	@Test public void testJoin2() throws Exception {
 		IQuery command = (IQuery)translationUtility.parseCommand("SELECT Account.Name, Contact.Name FROM Account LEFT OUTER JOIN Contact ON Account.Id = Contact.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$

Deleted: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/CachingConnector.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/CachingConnector.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/CachingConnector.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.xml;
-
-
-public interface CachingConnector extends StatefulConnector {
-
-}
\ No newline at end of file

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnection.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnection.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnection.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,5 +35,5 @@
 
 	public XMLBaseManagedConnectionFactory getConnectorEnv();
 	
-	public TrustedPayloadHandler getTrustedPayloadHandler() throws ConnectorException;
+	public TrustedPayloadHandler getTrustedPayloadHandler() throws ConnectorException;
 }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,6 +23,9 @@
 
 package com.metamatrix.connector.xml;
 
+import java.sql.SQLXML;
+import java.util.Map;
+
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorCapabilities;
 import org.teiid.connector.api.ConnectorException;
@@ -41,11 +44,13 @@
 
 	public abstract IQueryPreprocessor getPreprocessor();
 
-	public abstract Connection getConnection(CachingConnector connector)
+	public abstract Connection getConnection(StatefulConnector connector)
 			throws ConnectorException;
 
 	public String getPluggableInputStreamFilterClass();
 
 	public boolean isCaching();
+	
+	public Map<String, SQLXML> getResponses();
 
 }
\ No newline at end of file

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/AbstractCachingConnector.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/AbstractCachingConnector.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/AbstractCachingConnector.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,13 +25,10 @@
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 
-import com.metamatrix.connector.xml.CachingConnector;
-
 //TODO This class used to hold the internal connector cache.  
 // I'm leaving it here so I can add cachein at a scope other than REQUEST.
 
-public abstract class AbstractCachingConnector extends LoggingConnector
-		implements CachingConnector {
+public abstract class AbstractCachingConnector extends LoggingConnector {
 
 	public AbstractCachingConnector() {
 		super();

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -29,21 +29,21 @@
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.basic.BasicConnection;
 
-import com.metamatrix.connector.xml.CachingConnector;
 import com.metamatrix.connector.xml.SecureConnectorState;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.TrustedPayloadHandler;
 import com.metamatrix.connector.xml.XMLConnection;
 import com.metamatrix.connector.xml.XMLConnectorState;
 
 public class XMLConnectionImpl extends BasicConnection implements XMLConnection {
 
-	private CachingConnector connector;
+	private StatefulConnector connector;
 
 	private XMLBaseManagedConnectionFactory connectorEnv;
 	private TrustedPayloadHandler payloadHandler;
 	private Subject subject;
 	
-	public XMLConnectionImpl(CachingConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
+	public XMLConnectionImpl(StatefulConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
 		this.connector = connector;
 		this.connectorEnv = connectorEnv;
 		this.subject = ConnectionContext.getSubject();
@@ -64,7 +64,7 @@
 		return connector.getState();
 	}
 
-	public CachingConnector getConnector() {
+	public StatefulConnector getConnector() {
 		return connector;
 	}
 	

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,6 +23,10 @@
 
 package com.metamatrix.connector.xml.base;
 
+import java.io.InputStream;
+import java.sql.SQLXML;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Properties;
 
 import org.teiid.connector.api.ConnectorCapabilities;
@@ -32,6 +36,7 @@
 import com.metamatrix.connector.xml.IQueryPreprocessor;
 import com.metamatrix.connector.xml.SAXFilterProvider;
 import com.metamatrix.connector.xml.XMLConnectorState;
+import com.metamatrix.core.util.ReflectionHelper;
 
 public abstract class XMLConnectorStateImpl implements Cloneable,
         XMLConnectorState {
@@ -74,6 +79,8 @@
 
 
 	private boolean caching = false;
+	
+	private Map<String, SQLXML> responses = new HashMap<String, SQLXML>();
 
     public XMLConnectorStateImpl() {
         setPreprocess(true);
@@ -292,4 +299,29 @@
 	public String getPluggableInputStreamFilterClass() {
 		return m_pluggableInputStreamFilterClass;
 	}
+	
+	public InputStream addStreamFilters(InputStream stream)
+	throws ConnectorException {
+
+		if (isLogRequestResponse()) {
+			stream = new LoggingInputStreamFilter(stream, logger);
+		}
+		
+		if (getPluggableInputStreamFilterClass() != null) {
+			try {
+				stream = (InputStream) ReflectionHelper.create(getPluggableInputStreamFilterClass(), new Object[] { stream,
+					logger}, new Class[] {
+					java.io.InputStream.class,
+					ConnectorLogger.class }, Thread.currentThread().getContextClassLoader());
+			} catch (Exception cnf) {
+				throw new ConnectorException(cnf);
+			}
+		}
+		return stream;
+	}
+	
+	@Override
+	public Map<String, SQLXML> getResponses() {
+		return this.responses;
+	}
 }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectionImpl.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -7,13 +7,13 @@
 import org.teiid.connector.language.IQueryCommand;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 import com.metamatrix.connector.xml.base.XMLConnectionImpl;
 
 public class FileConnectionImpl extends XMLConnectionImpl {
 
-	public FileConnectionImpl(CachingConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
+	public FileConnectionImpl(StatefulConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
 		super(connector, connectorEnv);
 	}
 	

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectorState.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectorState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileConnectorState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,20 +23,14 @@
 
 package com.metamatrix.connector.xml.file;
 
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
 import java.util.Properties;
 
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ExecutionContext;
 
-import com.metamatrix.connector.xml.CachingConnector;
-import com.metamatrix.connector.xml.base.LoggingInputStreamFilter;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 import com.metamatrix.connector.xml.base.XMLConnectorStateImpl;
-import com.metamatrix.connector.xml.cache.CachingInputStreamFilter;
 
 
 public class FileConnectorState extends XMLConnectorStateImpl {
@@ -107,34 +101,8 @@
 		return m_directoryPath;
 	}
 
-	public Connection getConnection(CachingConnector connector) throws ConnectorException {
+	public Connection getConnection(StatefulConnector connector) throws ConnectorException {
 		return new FileConnectionImpl(connector, this.config);
 	}
-
-	public InputStream addStreamFilters(InputStream stream)
-			throws ConnectorException {
-
-		if (isLogRequestResponse()) {
-			stream = new LoggingInputStreamFilter(stream, logger);
-		}
-
-		try {
-			Class pluggableFilter = Class
-					.forName(getPluggableInputStreamFilterClass());
-			Constructor ctor = pluggableFilter.getConstructor(new Class[] {
-					java.io.InputStream.class,
-					ConnectorLogger.class });
-			stream = (InputStream) ctor.newInstance(new Object[] { stream,
-					logger });
-		} catch (Exception cnf) {
-			throw new ConnectorException(cnf);
-		}
-		return stream;
-	}
 	
-	public InputStream addCachingStreamFilters(InputStream stream, ExecutionContext context, String queryId) throws ConnectorException {
-		stream = addStreamFilters(stream);
-		stream = new CachingInputStreamFilter(stream, context, queryId);
-		return stream;
-	}
 }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileExecution.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileExecution.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/file/FileExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,5 +1,6 @@
 package com.metamatrix.connector.xml.file;
 
+import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -24,7 +25,6 @@
 import com.metamatrix.connector.xml.base.OutputXPathDesc;
 import com.metamatrix.connector.xml.base.QueryAnalyzer;
 import com.metamatrix.connector.xml.base.XMLConnectionImpl;
-import com.metamatrix.connector.xml.cache.CachedXMLStream;
 import com.metamatrix.connector.xml.streaming.BaseStreamingExecution;
 import com.metamatrix.connector.xml.streaming.DocumentImpl;
 import com.metamatrix.connector.xml.streaming.InvalidPathException;
@@ -241,24 +241,9 @@
 		}
 		
 		private Document getDocument() throws ConnectorException {
-			Document doc;
-			String cacheKey = queryID + Integer.valueOf(docNumber).toString();
-			if(state.isCaching()) {
-				if(null != exeContext.get(queryID)) {
-					InputStream stream = new CachedXMLStream(exeContext, queryID);
-					doc = new DocumentImpl(stream, cacheKey);
-					logger.logTrace("Got " + queryID + " from the cache");
-				} else {
-					InputStream stream = getDocumentStream(docNumber);
-					stream = state.addCachingStreamFilters(stream, exeContext, queryID);
-					doc = new DocumentImpl(stream, cacheKey); 
-				}
-			} else {
-				InputStream stream = getDocumentStream(docNumber);
-				stream = state.addStreamFilters(stream);
-				doc = new DocumentImpl(stream, cacheKey);
- 			}
-			return doc;
+			InputStream stream = getDocumentStream(docNumber);
+			stream = state.addStreamFilters(stream);
+			return new DocumentImpl(stream, queryID + docNumber);
 		}
 		
 		private InputStream getDocumentStream(int i) throws ConnectorException {
@@ -267,7 +252,7 @@
 				File xmlFile = new File(xmlFileName);
 				logger.logTrace(
 								"XML Connector Framework: retrieving document from " + xmlFileName); //$NON-NLS-1$
-				InputStream retval = new FileInputStream(xmlFile);
+				InputStream retval = new BufferedInputStream(new FileInputStream(xmlFile));
 				logger.logTrace(
 						"XML Connector Framework: retrieved file " + xmlFileName); //$NON-NLS-1$
 				return retval;

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectionImpl.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -7,13 +7,13 @@
 import org.teiid.connector.language.IQueryCommand;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 import com.metamatrix.connector.xml.base.XMLConnectionImpl;
 
 public class HTTPConnectionImpl extends XMLConnectionImpl {
 
-	public HTTPConnectionImpl(CachingConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
+	public HTTPConnectionImpl(StatefulConnector connector, XMLBaseManagedConnectionFactory connectorEnv) throws ConnectorException {
 		super(connector,connectorEnv);
 	}
 	

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectorState.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectorState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPConnectorState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,7 +38,7 @@
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorException;
 
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.SecureConnectorStateImpl;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 
@@ -405,7 +405,7 @@
         return m_httpBasicAuthPwd;
     }
 
-    public Connection getConnection(CachingConnector connector)
+    public Connection getConnection(StatefulConnector connector)
             throws ConnectorException {
         return new HTTPConnectionImpl(connector, this.config);
     }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPRequest.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPRequest.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/http/HTTPRequest.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -3,15 +3,19 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
-import java.lang.reflect.Constructor;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLEncoder;
+import java.sql.SQLException;
+import java.sql.SQLXML;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.NameValuePair;
@@ -23,7 +27,6 @@
 import org.jdom.Document;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ExecutionContext;
 
 import com.metamatrix.connector.xml.Constants;
 import com.metamatrix.connector.xml.SAXFilterProvider;
@@ -32,12 +35,11 @@
 import com.metamatrix.connector.xml.base.CriteriaDesc;
 import com.metamatrix.connector.xml.base.DocumentBuilder;
 import com.metamatrix.connector.xml.base.ExecutionInfo;
-import com.metamatrix.connector.xml.base.LoggingInputStreamFilter;
 import com.metamatrix.connector.xml.base.OutputXPathDesc;
 import com.metamatrix.connector.xml.base.ParameterDescriptor;
 import com.metamatrix.connector.xml.base.RequestGenerator;
-import com.metamatrix.connector.xml.cache.CachedXMLStream;
 import com.metamatrix.connector.xml.streaming.DocumentImpl;
+import com.metamatrix.core.util.Assertion;
 
 public class HTTPRequest extends BaseRequest {
 	
@@ -50,8 +52,9 @@
     public static final String PARM_INPUT_XPATH_TABLE_PROPERTY_NAME = "XPathRootForInput"; //$NON-NLS-1$
 
     public static final String PARM_INPUT_NAMESPACE_TABLE_PROPERTY_NAME = "NamespaceForDocument"; //$NON-NLS-1$
-
-
+    
+    protected SQLXML response;
+    
 	public HTTPRequest(HTTPConnectorState state, XMLExecution execution,
 			ExecutionInfo exeInfo, List<CriteriaDesc> parameters) throws ConnectorException {
 		super(state, execution, exeInfo, parameters);
@@ -76,35 +79,32 @@
 	
 	public com.metamatrix.connector.xml.Document getDocumentStream() throws ConnectorException {
 		com.metamatrix.connector.xml.Document document;
-		ExecutionContext exeContext = execution.getExeContext();
-        String cacheKey = getCacheKey();
+		//ExecutionContext exeContext = execution.getExeContext();
 
-        // Is this a request part joining across a document
-        CriteriaDesc criterion = this.exeInfo.getResponseIDCriterion();
-        if (null != criterion) {
-            String responseid = (String) (criterion.getValues().get(0));
-            
-            if(null == exeContext.get(responseid)) {
-            	throw new ConnectorException(Messages.getString("HTTPExecutor.No.doc.in.cache"));
-            } else {
-            	InputStream stream = new CachedXMLStream(exeContext, responseid);
-            	document = new DocumentImpl(stream, cacheKey);
-
-            }
-        } else {
-        	// Not a join, but might still be cached.
-            if (null == exeContext.get(cacheKey)) {
-            	// Not cached, so make the request
-                SAXFilterProvider provider = null;
-                provider = getState().getSAXFilterProvider();
-                InputStream responseBody = executeRequest();
-                InputStream filteredStream = addStreamFilters(responseBody, getLogger());
-                document = new DocumentImpl(filteredStream, cacheKey);
-            } else {
-            	InputStream stream = new CachedXMLStream(exeContext, cacheKey);
-            	document = new DocumentImpl(stream, cacheKey);
-            }
-        }
+		try {
+	        // Is this a request part joining across a document
+	        CriteriaDesc criterion = this.exeInfo.getResponseIDCriterion();
+	        if (null != criterion) {
+	            String responseid = (String) (criterion.getValues().get(0));
+	            SQLXML xml = this.execution.getConnection().getState().getResponses().get(responseid);
+	            Assertion.isNotNull(xml);
+	        	document = new DocumentImpl(xml.getBinaryStream(), responseid);
+	        } else {
+	        	// Not a join, but might still be cached.
+	            //if (null == exeContext.get(cacheKey)) {
+	            	// Not cached, so make the request
+	                SAXFilterProvider provider = getState().getSAXFilterProvider();
+	                InputStream responseBody = executeRequest();
+	                InputStream filteredStream = getState().addStreamFilters(responseBody);
+	                document = new DocumentImpl(filteredStream, this.execution.getExeContext().getExecutionCountIdentifier());
+	            //} else {
+	            //	InputStream stream = new CachedXMLStream(exeContext, cacheKey);
+	            //	document = new DocumentImpl(stream, cacheKey);
+	            //}
+	        }
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
 		return document;
 	}
 	
@@ -137,46 +137,20 @@
         return m_allowHttp500;
     }
     
-
-
 	public void release() {
-		request.releaseConnection();
+		if (request != null) {
+			request.releaseConnection();
+		}
+		if (response != null) {
+			this.execution.getConnection().getState().getResponses().remove(this.execution.getExeContext().getExecutionCountIdentifier());
+			try {
+				response.free();
+			} catch (SQLException e) {
+			}
+			response = null;
+		}
 	}
 
-    protected String getCacheKey() throws ConnectorException {
-
-        if (request == null) {
-            String message = com.metamatrix.connector.xml.http.Messages
-                    .getString("HttpExecutor.cannot.create.cachekey");
-            throw new ConnectorException(message);
-        }
-        // the key consists of a String in the form of
-        // |uri|parameterList|
-        String session = execution.getExeContext().getRequestIdentifier();
-
-        StringBuffer cacheKey = new StringBuffer();
-        cacheKey.append("|");
-        cacheKey.append(session);
-        cacheKey.append("|");
-        cacheKey.append(getUriString());
-        cacheKey.append("|"); //$NON-NLS-1$
-
-        if (request instanceof PostMethod) {
-            NameValuePair[] pairs = ((PostMethod) request).getParameters();
-            if (pairs == null || pairs.length == 0) {
-                if (((PostMethod) request).getRequestEntity() != null) {
-                    String requestBodyAsString = ((StringRequestEntity) (((PostMethod) request).getRequestEntity())).getContent();
-                    cacheKey.append(requestBodyAsString);
-                }
-            } else {
-                cacheKey.append(generatePairString(pairs));
-            }
-        } else {
-            cacheKey.append(request.getQueryString());
-        }
-        return cacheKey.toString();
-    }
-
     protected InputStream executeRequest() throws ConnectorException {
         HttpClient client = (getState()).getClient();
         XMLConnection conn = execution.getConnection();
@@ -198,10 +172,19 @@
         modifyRequest(client, request);
         InputStream responseBody = m_requestor.fetchXMLDocument(client,
                 request, getAllowHttp500());
-        return responseBody;
+        try {
+        	createSQLXML(new StreamSource(responseBody));
+        	return response.getBinaryStream();
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		} 
     }
+    
+	protected void createSQLXML(Source output) {
+		response = (SQLXML)this.execution.getConnection().getConnectorEnv().getTypeFacility().convertToRuntimeType(output);
+		this.execution.getConnection().getState().getResponses().put(this.execution.getExeContext().getExecutionCountIdentifier(), response);
+	}
 
-
     private void createRequests() throws ConnectorException {
         if (checkIfRequestIsNeeded(exeInfo)) {
             setRequests(this.parameters, getUriString());
@@ -493,26 +476,6 @@
 		return getState().getLogger();
 	}
 
-
-	public InputStream addStreamFilters(InputStream response, ConnectorLogger logger)
-	throws ConnectorException {
-		
-		if(getState().isLogRequestResponse()) {
-			response = new LoggingInputStreamFilter(response, logger);
-		}
-		
-		InputStream filter = null;
-		try {
-			Class pluggableFilter = Thread.currentThread().getContextClassLoader().loadClass(getState().getPluggableInputStreamFilterClass());
-			Constructor ctor = pluggableFilter.getConstructor(
-					new Class[] { java.io.InputStream.class, org.teiid.connector.api.ConnectorLogger.class});
-			filter = (InputStream) ctor.newInstance(new Object[] {response, logger});
-		} catch (Exception cnf) {
-			throw new ConnectorException(cnf);
-		}
-		return filter;
-	}
-
 	/**
 	 * Examines the Query to determine if a request to a source is needed.  If any of the 
 	 * request parameters is a ResponseIn, then we don't need to make a request because it 

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectionImpl.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectionImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectionImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -7,13 +7,13 @@
 import org.teiid.connector.language.IQueryCommand;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 import com.metamatrix.connector.xml.base.XMLConnectionImpl;
 
 public class SOAPConnectionImpl extends XMLConnectionImpl {
 
-	public SOAPConnectionImpl(CachingConnector connector, XMLBaseManagedConnectionFactory connectorEnv)
+	public SOAPConnectionImpl(StatefulConnector connector, XMLBaseManagedConnectionFactory connectorEnv)
 			throws ConnectorException {
 		super(connector, connectorEnv);
 	}

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectorState.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectorState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPConnectorState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,11 +25,10 @@
 package com.metamatrix.connector.xml.soap;
 
 import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ConnectorLogger;
 
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
 import com.metamatrix.connector.xml.http.HTTPConnectorState;
 
@@ -85,7 +84,7 @@
 		return soapState.isExceptionOnFault();
 	}
 	
-    public Connection getConnection(CachingConnector connector)
+    public Connection getConnection(StatefulConnector connector)
             throws ConnectorException {
         return new SOAPConnectionImpl(connector, this.config);
     }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -7,9 +7,6 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
@@ -17,7 +14,6 @@
 
 import org.jdom.Document;
 import org.jdom.output.XMLOutputter;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 
 import com.metamatrix.connector.xml.Constants;
@@ -28,7 +24,6 @@
 import com.metamatrix.connector.xml.base.DocumentBuilder;
 import com.metamatrix.connector.xml.base.ExecutionInfo;
 import com.metamatrix.connector.xml.base.RequestGenerator;
-import com.metamatrix.connector.xml.cache.CachingOutputStream;
 import com.metamatrix.connector.xml.http.HTTPConnectorState;
 import com.metamatrix.connector.xmlsource.soap.SecurityManagedConnectionFactory;
 import com.metamatrix.connector.xmlsource.soap.SecurityToken;
@@ -87,13 +82,8 @@
             Source input = new StreamSource(reader);
             // Invoke the operation.
             Source output = dispatch.invoke(input);
-            
-            // Process the response.
-            CachingOutputStream out = new CachingOutputStream(execution.getExeContext(), getCacheKey());
-            StreamResult result = new StreamResult(out);
-            Transformer trans = TransformerFactory.newInstance().newTransformer();
-            trans.transform(output, result);
-            return out.getCachedXMLStream();
+            createSQLXML(output);
+            return response.getBinaryStream();
 		} catch (Exception e) {
 			throw new ConnectorException(e);
 		}
@@ -118,16 +108,6 @@
 		doc = builder.createXMLRequestDoc(bodyParams, (SOAPConnectorState)state, namespacePrefixes, inputParmsXPath);
 	}
 
-	protected String getCacheKey() throws ConnectorException {
-        StringBuffer cacheKey = new StringBuffer();
-        cacheKey.append("|");
-        cacheKey.append(execution.getExeContext().getRequestIdentifier());
-        cacheKey.append("|");
-        cacheKey.append(getUriString());
-        cacheKey.append(requestNumber);
-        return cacheKey.toString();
-	}
-
 	public int getDocumentCount() throws ConnectorException {
 		return 1;
 	}

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,14 +26,14 @@
 	
 	protected StreamingResultsProducer rowProducer;
 	
-	protected List<Object[]> results;
+	protected List<Object[]> results = new ArrayList<Object[]>();
 	private int resultIndex;
 	private Iterator<Document> streamIter;
 	
 	// A single query can result in multiple requests to an XML source.
 	// Each request is abstracted by a result producer.
 	// TODO: Do I really need more than one of theses?
-	protected List<ResultProducer> resultProducers;
+	protected List<ResultProducer> resultProducers = new ArrayList<ResultProducer>();
 	private Iterator<ResultProducer> producerIter;
 	
 	protected ExecutionInfo exeInfo;
@@ -53,8 +53,6 @@
 		exeContext = context;
 		connEnv = env;
 		logger = connection.getConnectorEnv().getLogger();
-		resultProducers = new ArrayList<ResultProducer>();
-		results = new ArrayList<Object[]>();
 	}
 
 	public void cancel() throws ConnectorException {
@@ -62,7 +60,9 @@
 	}
 
 	public void close() throws ConnectorException {
-		// nothing to do
+		for (ResultProducer resultProducer : resultProducers) {
+			resultProducer.closeStreams();
+		}
 	}
 
 	/**

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -45,6 +45,7 @@
     // Connector environment
     protected ConnectorEnvironment env;
     private boolean returnedResult;
+    protected Source returnValue;
     
     /**
      * ctor 
@@ -65,14 +66,12 @@
     	}
     	return (SQLXML)result;
     }
-    
-    protected abstract Source getReturnValue();
 
     @Override
     public List<?> next() throws ConnectorException, DataNotAvailableException {
     	if (!returnedResult) {
     		returnedResult = true;
-    		return Arrays.asList(convertToXMLType(getReturnValue()));
+    		return Arrays.asList(convertToXMLType(returnValue));
     	}
     	return null;
     }  

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/file/FileExecution.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/file/FileExecution.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/file/FileExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,20 +22,19 @@
 
 package com.metamatrix.connector.xmlsource.file;
 
+import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.InputStream;
 
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.language.IProcedure;
 import org.teiid.connector.metadata.runtime.MetadataObject;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
+import com.metamatrix.common.types.InputStreamFactory;
 import com.metamatrix.connector.xmlsource.XMLSourceExecution;
 import com.metamatrix.connector.xmlsource.XMLSourcePlugin;
 
@@ -46,7 +45,6 @@
 public class FileExecution extends XMLSourceExecution {
     
     RuntimeMetadata metadata = null;
-    Source returnValue = null;
     ExecutionContext context;
     File rootFolder;
     private IProcedure procedure;
@@ -86,25 +84,22 @@
         }
         
         // try to open the file and read.        
-        File xmlFile = new File(this.rootFolder, fileName);
+        final File xmlFile = new File(this.rootFolder, fileName);
         if (!xmlFile.exists()) {
             throw new ConnectorException(XMLSourcePlugin.Util.getString("XML_file_not_found", new Object[] {fileName, this.rootFolder.getAbsolutePath()})); //$NON-NLS-1$            
         }        
         
         String encoding = this.config.getCharacterEncodingScheme();
         
-        try {
-			this.returnValue = new StreamSource(new InputStreamReader(new FileInputStream(xmlFile), encoding));
-		} catch (IOException e) {
-			throw new ConnectorException(e);
-		} 
-		
+        returnValue = new InputStreamFactory(encoding) {
+			
+			@Override
+			public InputStream getInputStream() throws IOException {
+				return new BufferedInputStream(new FileInputStream(xmlFile));
+			}
+		};
+        
         XMLSourcePlugin.logDetail(this.env.getLogger(), "executing_procedure", new Object[] {procedure.getProcedureName()}); //$NON-NLS-1$
     }
     
-    @Override
-	public Source getReturnValue() {
-		return returnValue;
-	}
-
 }

Modified: branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -52,7 +52,6 @@
     // Connection object.
     SoapConnection connection;
     Map outputValues = null; 
-    Source returnValue = null;   
     RuntimeMetadata metadata = null;
     ExecutionContext context;
     private IProcedure procedure;
@@ -121,9 +120,4 @@
         }
     }
     
-    @Override
-	public Source getReturnValue() {
-		return returnValue;
-	}
-    
 }

Modified: branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java
===================================================================
--- branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -31,7 +31,7 @@
 
 import com.metamatrix.cdk.api.SysLogger;
 import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.connector.xml.CachingConnector;
+import com.metamatrix.connector.xml.StatefulConnector;
 import com.metamatrix.connector.xml.XMLConnectorState;
 
 /**
@@ -84,7 +84,7 @@
     		super();
     	}
 
-		public Connection getConnection(CachingConnector connector) throws ConnectorException {
+		public Connection getConnection(StatefulConnector connector) throws ConnectorException {
 			return null;
 		}
     }

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/ChildRelationship.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/ChildRelationship.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/ChildRelationship.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,224 +1,256 @@
-/**
- * ChildRelationship.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class ChildRelationship  implements java.io.Serializable {
-    private boolean cascadeDelete;
-
-    private java.lang.String childSObject;
-
-    private java.lang.String field;
-
-    private java.lang.String relationshipName;
-
-    public ChildRelationship() {
-    }
-
-    public ChildRelationship(
-           boolean cascadeDelete,
-           java.lang.String childSObject,
-           java.lang.String field,
-           java.lang.String relationshipName) {
-           this.cascadeDelete = cascadeDelete;
-           this.childSObject = childSObject;
-           this.field = field;
-           this.relationshipName = relationshipName;
-    }
-
-
-    /**
-     * Gets the cascadeDelete value for this ChildRelationship.
-     * 
-     * @return cascadeDelete
-     */
-    public boolean isCascadeDelete() {
-        return cascadeDelete;
-    }
-
-
-    /**
-     * Sets the cascadeDelete value for this ChildRelationship.
-     * 
-     * @param cascadeDelete
-     */
-    public void setCascadeDelete(boolean cascadeDelete) {
-        this.cascadeDelete = cascadeDelete;
-    }
-
-
-    /**
-     * Gets the childSObject value for this ChildRelationship.
-     * 
-     * @return childSObject
-     */
-    public java.lang.String getChildSObject() {
-        return childSObject;
-    }
-
-
-    /**
-     * Sets the childSObject value for this ChildRelationship.
-     * 
-     * @param childSObject
-     */
-    public void setChildSObject(java.lang.String childSObject) {
-        this.childSObject = childSObject;
-    }
-
-
-    /**
-     * Gets the field value for this ChildRelationship.
-     * 
-     * @return field
-     */
-    public java.lang.String getField() {
-        return field;
-    }
-
-
-    /**
-     * Sets the field value for this ChildRelationship.
-     * 
-     * @param field
-     */
-    public void setField(java.lang.String field) {
-        this.field = field;
-    }
-
-
-    /**
-     * Gets the relationshipName value for this ChildRelationship.
-     * 
-     * @return relationshipName
-     */
-    public java.lang.String getRelationshipName() {
-        return relationshipName;
-    }
-
-
-    /**
-     * Sets the relationshipName value for this ChildRelationship.
-     * 
-     * @param relationshipName
-     */
-    public void setRelationshipName(java.lang.String relationshipName) {
-        this.relationshipName = relationshipName;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof ChildRelationship)) return false;
-        ChildRelationship other = (ChildRelationship) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            this.cascadeDelete == other.isCascadeDelete() &&
-            ((this.childSObject==null && other.getChildSObject()==null) || 
-             (this.childSObject!=null &&
-              this.childSObject.equals(other.getChildSObject()))) &&
-            ((this.field==null && other.getField()==null) || 
-             (this.field!=null &&
-              this.field.equals(other.getField()))) &&
-            ((this.relationshipName==null && other.getRelationshipName()==null) || 
-             (this.relationshipName!=null &&
-              this.relationshipName.equals(other.getRelationshipName())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isCascadeDelete() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getChildSObject() != null) {
-            _hashCode += getChildSObject().hashCode();
-        }
-        if (getField() != null) {
-            _hashCode += getField().hashCode();
-        }
-        if (getRelationshipName() != null) {
-            _hashCode += getRelationshipName().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(ChildRelationship.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("cascadeDelete");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "cascadeDelete"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("childSObject");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "childSObject"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("field");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "field"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("relationshipName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * ChildRelationship.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class ChildRelationship  implements java.io.Serializable {
+    private boolean cascadeDelete;
+
+    private java.lang.String childSObject;
+
+    private boolean deprecatedAndHidden;
+
+    private java.lang.String field;
+
+    private java.lang.String relationshipName;
+
+    public ChildRelationship() {
+    }
+
+    public ChildRelationship(
+           boolean cascadeDelete,
+           java.lang.String childSObject,
+           boolean deprecatedAndHidden,
+           java.lang.String field,
+           java.lang.String relationshipName) {
+           this.cascadeDelete = cascadeDelete;
+           this.childSObject = childSObject;
+           this.deprecatedAndHidden = deprecatedAndHidden;
+           this.field = field;
+           this.relationshipName = relationshipName;
+    }
+
+
+    /**
+     * Gets the cascadeDelete value for this ChildRelationship.
+     * 
+     * @return cascadeDelete
+     */
+    public boolean isCascadeDelete() {
+        return cascadeDelete;
+    }
+
+
+    /**
+     * Sets the cascadeDelete value for this ChildRelationship.
+     * 
+     * @param cascadeDelete
+     */
+    public void setCascadeDelete(boolean cascadeDelete) {
+        this.cascadeDelete = cascadeDelete;
+    }
+
+
+    /**
+     * Gets the childSObject value for this ChildRelationship.
+     * 
+     * @return childSObject
+     */
+    public java.lang.String getChildSObject() {
+        return childSObject;
+    }
+
+
+    /**
+     * Sets the childSObject value for this ChildRelationship.
+     * 
+     * @param childSObject
+     */
+    public void setChildSObject(java.lang.String childSObject) {
+        this.childSObject = childSObject;
+    }
+
+
+    /**
+     * Gets the deprecatedAndHidden value for this ChildRelationship.
+     * 
+     * @return deprecatedAndHidden
+     */
+    public boolean isDeprecatedAndHidden() {
+        return deprecatedAndHidden;
+    }
+
+
+    /**
+     * Sets the deprecatedAndHidden value for this ChildRelationship.
+     * 
+     * @param deprecatedAndHidden
+     */
+    public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
+        this.deprecatedAndHidden = deprecatedAndHidden;
+    }
+
+
+    /**
+     * Gets the field value for this ChildRelationship.
+     * 
+     * @return field
+     */
+    public java.lang.String getField() {
+        return field;
+    }
+
+
+    /**
+     * Sets the field value for this ChildRelationship.
+     * 
+     * @param field
+     */
+    public void setField(java.lang.String field) {
+        this.field = field;
+    }
+
+
+    /**
+     * Gets the relationshipName value for this ChildRelationship.
+     * 
+     * @return relationshipName
+     */
+    public java.lang.String getRelationshipName() {
+        return relationshipName;
+    }
+
+
+    /**
+     * Sets the relationshipName value for this ChildRelationship.
+     * 
+     * @param relationshipName
+     */
+    public void setRelationshipName(java.lang.String relationshipName) {
+        this.relationshipName = relationshipName;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof ChildRelationship)) return false;
+        ChildRelationship other = (ChildRelationship) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.cascadeDelete == other.isCascadeDelete() &&
+            ((this.childSObject==null && other.getChildSObject()==null) || 
+             (this.childSObject!=null &&
+              this.childSObject.equals(other.getChildSObject()))) &&
+            this.deprecatedAndHidden == other.isDeprecatedAndHidden() &&
+            ((this.field==null && other.getField()==null) || 
+             (this.field!=null &&
+              this.field.equals(other.getField()))) &&
+            ((this.relationshipName==null && other.getRelationshipName()==null) || 
+             (this.relationshipName!=null &&
+              this.relationshipName.equals(other.getRelationshipName())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += (isCascadeDelete() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getChildSObject() != null) {
+            _hashCode += getChildSObject().hashCode();
+        }
+        _hashCode += (isDeprecatedAndHidden() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getField() != null) {
+            _hashCode += getField().hashCode();
+        }
+        if (getRelationshipName() != null) {
+            _hashCode += getRelationshipName().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(ChildRelationship.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("cascadeDelete");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "cascadeDelete"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("childSObject");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "childSObject"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deprecatedAndHidden");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deprecatedAndHidden"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("field");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "field"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("relationshipName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalResult.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalResult.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalResult.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,205 +1,205 @@
-/**
- * DescribeGlobalResult.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class DescribeGlobalResult  implements java.io.Serializable {
-    private java.lang.String encoding;
-
-    private int maxBatchSize;
-
-    private java.lang.String[] types;
-
-    public DescribeGlobalResult() {
-    }
-
-    public DescribeGlobalResult(
-           java.lang.String encoding,
-           int maxBatchSize,
-           java.lang.String[] types) {
-           this.encoding = encoding;
-           this.maxBatchSize = maxBatchSize;
-           this.types = types;
-    }
-
-
-    /**
-     * Gets the encoding value for this DescribeGlobalResult.
-     * 
-     * @return encoding
-     */
-    public java.lang.String getEncoding() {
-        return encoding;
-    }
-
-
-    /**
-     * Sets the encoding value for this DescribeGlobalResult.
-     * 
-     * @param encoding
-     */
-    public void setEncoding(java.lang.String encoding) {
-        this.encoding = encoding;
-    }
-
-
-    /**
-     * Gets the maxBatchSize value for this DescribeGlobalResult.
-     * 
-     * @return maxBatchSize
-     */
-    public int getMaxBatchSize() {
-        return maxBatchSize;
-    }
-
-
-    /**
-     * Sets the maxBatchSize value for this DescribeGlobalResult.
-     * 
-     * @param maxBatchSize
-     */
-    public void setMaxBatchSize(int maxBatchSize) {
-        this.maxBatchSize = maxBatchSize;
-    }
-
-
-    /**
-     * Gets the types value for this DescribeGlobalResult.
-     * 
-     * @return types
-     */
-    public java.lang.String[] getTypes() {
-        return types;
-    }
-
-
-    /**
-     * Sets the types value for this DescribeGlobalResult.
-     * 
-     * @param types
-     */
-    public void setTypes(java.lang.String[] types) {
-        this.types = types;
-    }
-
-    public java.lang.String getTypes(int i) {
-        return this.types[i];
-    }
-
-    public void setTypes(int i, java.lang.String _value) {
-        this.types[i] = _value;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof DescribeGlobalResult)) return false;
-        DescribeGlobalResult other = (DescribeGlobalResult) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            ((this.encoding==null && other.getEncoding()==null) || 
-             (this.encoding!=null &&
-              this.encoding.equals(other.getEncoding()))) &&
-            this.maxBatchSize == other.getMaxBatchSize() &&
-            ((this.types==null && other.getTypes()==null) || 
-             (this.types!=null &&
-              java.util.Arrays.equals(this.types, other.getTypes())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getEncoding() != null) {
-            _hashCode += getEncoding().hashCode();
-        }
-        _hashCode += getMaxBatchSize();
-        if (getTypes() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getTypes());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getTypes(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(DescribeGlobalResult.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("encoding");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "encoding"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("maxBatchSize");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "maxBatchSize"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("types");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "types"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * DescribeGlobalResult.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class DescribeGlobalResult  implements java.io.Serializable {
+    private java.lang.String encoding;
+
+    private int maxBatchSize;
+
+    private com.sforce.soap.partner.DescribeGlobalSObjectResult[] sobjects;
+
+    public DescribeGlobalResult() {
+    }
+
+    public DescribeGlobalResult(
+           java.lang.String encoding,
+           int maxBatchSize,
+           com.sforce.soap.partner.DescribeGlobalSObjectResult[] sobjects) {
+           this.encoding = encoding;
+           this.maxBatchSize = maxBatchSize;
+           this.sobjects = sobjects;
+    }
+
+
+    /**
+     * Gets the encoding value for this DescribeGlobalResult.
+     * 
+     * @return encoding
+     */
+    public java.lang.String getEncoding() {
+        return encoding;
+    }
+
+
+    /**
+     * Sets the encoding value for this DescribeGlobalResult.
+     * 
+     * @param encoding
+     */
+    public void setEncoding(java.lang.String encoding) {
+        this.encoding = encoding;
+    }
+
+
+    /**
+     * Gets the maxBatchSize value for this DescribeGlobalResult.
+     * 
+     * @return maxBatchSize
+     */
+    public int getMaxBatchSize() {
+        return maxBatchSize;
+    }
+
+
+    /**
+     * Sets the maxBatchSize value for this DescribeGlobalResult.
+     * 
+     * @param maxBatchSize
+     */
+    public void setMaxBatchSize(int maxBatchSize) {
+        this.maxBatchSize = maxBatchSize;
+    }
+
+
+    /**
+     * Gets the sobjects value for this DescribeGlobalResult.
+     * 
+     * @return sobjects
+     */
+    public com.sforce.soap.partner.DescribeGlobalSObjectResult[] getSobjects() {
+        return sobjects;
+    }
+
+
+    /**
+     * Sets the sobjects value for this DescribeGlobalResult.
+     * 
+     * @param sobjects
+     */
+    public void setSobjects(com.sforce.soap.partner.DescribeGlobalSObjectResult[] sobjects) {
+        this.sobjects = sobjects;
+    }
+
+    public com.sforce.soap.partner.DescribeGlobalSObjectResult getSobjects(int i) {
+        return this.sobjects[i];
+    }
+
+    public void setSobjects(int i, com.sforce.soap.partner.DescribeGlobalSObjectResult _value) {
+        this.sobjects[i] = _value;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof DescribeGlobalResult)) return false;
+        DescribeGlobalResult other = (DescribeGlobalResult) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            ((this.encoding==null && other.getEncoding()==null) || 
+             (this.encoding!=null &&
+              this.encoding.equals(other.getEncoding()))) &&
+            this.maxBatchSize == other.getMaxBatchSize() &&
+            ((this.sobjects==null && other.getSobjects()==null) || 
+             (this.sobjects!=null &&
+              java.util.Arrays.equals(this.sobjects, other.getSobjects())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        if (getEncoding() != null) {
+            _hashCode += getEncoding().hashCode();
+        }
+        _hashCode += getMaxBatchSize();
+        if (getSobjects() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getSobjects());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getSobjects(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(DescribeGlobalResult.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("encoding");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "encoding"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("maxBatchSize");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "maxBatchSize"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("sobjects");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sobjects"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalSObjectResult"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Copied: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalSObjectResult.java (from rev 1724, trunk/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalSObjectResult.java)
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalSObjectResult.java	                        (rev 0)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeGlobalSObjectResult.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,707 @@
+/**
+ * DescribeGlobalSObjectResult.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class DescribeGlobalSObjectResult  implements java.io.Serializable {
+    private boolean activateable;
+
+    private boolean createable;
+
+    private boolean custom;
+
+    private boolean customSetting;
+
+    private boolean deletable;
+
+    private boolean deprecatedAndHidden;
+
+    private java.lang.String keyPrefix;
+
+    private java.lang.String label;
+
+    private java.lang.String labelPlural;
+
+    private boolean layoutable;
+
+    private boolean mergeable;
+
+    private java.lang.String name;
+
+    private boolean queryable;
+
+    private boolean replicateable;
+
+    private boolean retrieveable;
+
+    private boolean searchable;
+
+    private boolean triggerable;
+
+    private boolean undeletable;
+
+    private boolean updateable;
+
+    public DescribeGlobalSObjectResult() {
+    }
+
+    public DescribeGlobalSObjectResult(
+           boolean activateable,
+           boolean createable,
+           boolean custom,
+           boolean customSetting,
+           boolean deletable,
+           boolean deprecatedAndHidden,
+           java.lang.String keyPrefix,
+           java.lang.String label,
+           java.lang.String labelPlural,
+           boolean layoutable,
+           boolean mergeable,
+           java.lang.String name,
+           boolean queryable,
+           boolean replicateable,
+           boolean retrieveable,
+           boolean searchable,
+           boolean triggerable,
+           boolean undeletable,
+           boolean updateable) {
+           this.activateable = activateable;
+           this.createable = createable;
+           this.custom = custom;
+           this.customSetting = customSetting;
+           this.deletable = deletable;
+           this.deprecatedAndHidden = deprecatedAndHidden;
+           this.keyPrefix = keyPrefix;
+           this.label = label;
+           this.labelPlural = labelPlural;
+           this.layoutable = layoutable;
+           this.mergeable = mergeable;
+           this.name = name;
+           this.queryable = queryable;
+           this.replicateable = replicateable;
+           this.retrieveable = retrieveable;
+           this.searchable = searchable;
+           this.triggerable = triggerable;
+           this.undeletable = undeletable;
+           this.updateable = updateable;
+    }
+
+
+    /**
+     * Gets the activateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return activateable
+     */
+    public boolean isActivateable() {
+        return activateable;
+    }
+
+
+    /**
+     * Sets the activateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param activateable
+     */
+    public void setActivateable(boolean activateable) {
+        this.activateable = activateable;
+    }
+
+
+    /**
+     * Gets the createable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return createable
+     */
+    public boolean isCreateable() {
+        return createable;
+    }
+
+
+    /**
+     * Sets the createable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param createable
+     */
+    public void setCreateable(boolean createable) {
+        this.createable = createable;
+    }
+
+
+    /**
+     * Gets the custom value for this DescribeGlobalSObjectResult.
+     * 
+     * @return custom
+     */
+    public boolean isCustom() {
+        return custom;
+    }
+
+
+    /**
+     * Sets the custom value for this DescribeGlobalSObjectResult.
+     * 
+     * @param custom
+     */
+    public void setCustom(boolean custom) {
+        this.custom = custom;
+    }
+
+
+    /**
+     * Gets the customSetting value for this DescribeGlobalSObjectResult.
+     * 
+     * @return customSetting
+     */
+    public boolean isCustomSetting() {
+        return customSetting;
+    }
+
+
+    /**
+     * Sets the customSetting value for this DescribeGlobalSObjectResult.
+     * 
+     * @param customSetting
+     */
+    public void setCustomSetting(boolean customSetting) {
+        this.customSetting = customSetting;
+    }
+
+
+    /**
+     * Gets the deletable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return deletable
+     */
+    public boolean isDeletable() {
+        return deletable;
+    }
+
+
+    /**
+     * Sets the deletable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param deletable
+     */
+    public void setDeletable(boolean deletable) {
+        this.deletable = deletable;
+    }
+
+
+    /**
+     * Gets the deprecatedAndHidden value for this DescribeGlobalSObjectResult.
+     * 
+     * @return deprecatedAndHidden
+     */
+    public boolean isDeprecatedAndHidden() {
+        return deprecatedAndHidden;
+    }
+
+
+    /**
+     * Sets the deprecatedAndHidden value for this DescribeGlobalSObjectResult.
+     * 
+     * @param deprecatedAndHidden
+     */
+    public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
+        this.deprecatedAndHidden = deprecatedAndHidden;
+    }
+
+
+    /**
+     * Gets the keyPrefix value for this DescribeGlobalSObjectResult.
+     * 
+     * @return keyPrefix
+     */
+    public java.lang.String getKeyPrefix() {
+        return keyPrefix;
+    }
+
+
+    /**
+     * Sets the keyPrefix value for this DescribeGlobalSObjectResult.
+     * 
+     * @param keyPrefix
+     */
+    public void setKeyPrefix(java.lang.String keyPrefix) {
+        this.keyPrefix = keyPrefix;
+    }
+
+
+    /**
+     * Gets the label value for this DescribeGlobalSObjectResult.
+     * 
+     * @return label
+     */
+    public java.lang.String getLabel() {
+        return label;
+    }
+
+
+    /**
+     * Sets the label value for this DescribeGlobalSObjectResult.
+     * 
+     * @param label
+     */
+    public void setLabel(java.lang.String label) {
+        this.label = label;
+    }
+
+
+    /**
+     * Gets the labelPlural value for this DescribeGlobalSObjectResult.
+     * 
+     * @return labelPlural
+     */
+    public java.lang.String getLabelPlural() {
+        return labelPlural;
+    }
+
+
+    /**
+     * Sets the labelPlural value for this DescribeGlobalSObjectResult.
+     * 
+     * @param labelPlural
+     */
+    public void setLabelPlural(java.lang.String labelPlural) {
+        this.labelPlural = labelPlural;
+    }
+
+
+    /**
+     * Gets the layoutable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return layoutable
+     */
+    public boolean isLayoutable() {
+        return layoutable;
+    }
+
+
+    /**
+     * Sets the layoutable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param layoutable
+     */
+    public void setLayoutable(boolean layoutable) {
+        this.layoutable = layoutable;
+    }
+
+
+    /**
+     * Gets the mergeable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return mergeable
+     */
+    public boolean isMergeable() {
+        return mergeable;
+    }
+
+
+    /**
+     * Sets the mergeable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param mergeable
+     */
+    public void setMergeable(boolean mergeable) {
+        this.mergeable = mergeable;
+    }
+
+
+    /**
+     * Gets the name value for this DescribeGlobalSObjectResult.
+     * 
+     * @return name
+     */
+    public java.lang.String getName() {
+        return name;
+    }
+
+
+    /**
+     * Sets the name value for this DescribeGlobalSObjectResult.
+     * 
+     * @param name
+     */
+    public void setName(java.lang.String name) {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the queryable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return queryable
+     */
+    public boolean isQueryable() {
+        return queryable;
+    }
+
+
+    /**
+     * Sets the queryable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param queryable
+     */
+    public void setQueryable(boolean queryable) {
+        this.queryable = queryable;
+    }
+
+
+    /**
+     * Gets the replicateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return replicateable
+     */
+    public boolean isReplicateable() {
+        return replicateable;
+    }
+
+
+    /**
+     * Sets the replicateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param replicateable
+     */
+    public void setReplicateable(boolean replicateable) {
+        this.replicateable = replicateable;
+    }
+
+
+    /**
+     * Gets the retrieveable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return retrieveable
+     */
+    public boolean isRetrieveable() {
+        return retrieveable;
+    }
+
+
+    /**
+     * Sets the retrieveable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param retrieveable
+     */
+    public void setRetrieveable(boolean retrieveable) {
+        this.retrieveable = retrieveable;
+    }
+
+
+    /**
+     * Gets the searchable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return searchable
+     */
+    public boolean isSearchable() {
+        return searchable;
+    }
+
+
+    /**
+     * Sets the searchable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param searchable
+     */
+    public void setSearchable(boolean searchable) {
+        this.searchable = searchable;
+    }
+
+
+    /**
+     * Gets the triggerable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return triggerable
+     */
+    public boolean isTriggerable() {
+        return triggerable;
+    }
+
+
+    /**
+     * Sets the triggerable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param triggerable
+     */
+    public void setTriggerable(boolean triggerable) {
+        this.triggerable = triggerable;
+    }
+
+
+    /**
+     * Gets the undeletable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return undeletable
+     */
+    public boolean isUndeletable() {
+        return undeletable;
+    }
+
+
+    /**
+     * Sets the undeletable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param undeletable
+     */
+    public void setUndeletable(boolean undeletable) {
+        this.undeletable = undeletable;
+    }
+
+
+    /**
+     * Gets the updateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @return updateable
+     */
+    public boolean isUpdateable() {
+        return updateable;
+    }
+
+
+    /**
+     * Sets the updateable value for this DescribeGlobalSObjectResult.
+     * 
+     * @param updateable
+     */
+    public void setUpdateable(boolean updateable) {
+        this.updateable = updateable;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof DescribeGlobalSObjectResult)) return false;
+        DescribeGlobalSObjectResult other = (DescribeGlobalSObjectResult) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.activateable == other.isActivateable() &&
+            this.createable == other.isCreateable() &&
+            this.custom == other.isCustom() &&
+            this.customSetting == other.isCustomSetting() &&
+            this.deletable == other.isDeletable() &&
+            this.deprecatedAndHidden == other.isDeprecatedAndHidden() &&
+            ((this.keyPrefix==null && other.getKeyPrefix()==null) || 
+             (this.keyPrefix!=null &&
+              this.keyPrefix.equals(other.getKeyPrefix()))) &&
+            ((this.label==null && other.getLabel()==null) || 
+             (this.label!=null &&
+              this.label.equals(other.getLabel()))) &&
+            ((this.labelPlural==null && other.getLabelPlural()==null) || 
+             (this.labelPlural!=null &&
+              this.labelPlural.equals(other.getLabelPlural()))) &&
+            this.layoutable == other.isLayoutable() &&
+            this.mergeable == other.isMergeable() &&
+            ((this.name==null && other.getName()==null) || 
+             (this.name!=null &&
+              this.name.equals(other.getName()))) &&
+            this.queryable == other.isQueryable() &&
+            this.replicateable == other.isReplicateable() &&
+            this.retrieveable == other.isRetrieveable() &&
+            this.searchable == other.isSearchable() &&
+            this.triggerable == other.isTriggerable() &&
+            this.undeletable == other.isUndeletable() &&
+            this.updateable == other.isUpdateable();
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += (isActivateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCreateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCustom() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCustomSetting() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isDeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isDeprecatedAndHidden() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getKeyPrefix() != null) {
+            _hashCode += getKeyPrefix().hashCode();
+        }
+        if (getLabel() != null) {
+            _hashCode += getLabel().hashCode();
+        }
+        if (getLabelPlural() != null) {
+            _hashCode += getLabelPlural().hashCode();
+        }
+        _hashCode += (isLayoutable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isMergeable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getName() != null) {
+            _hashCode += getName().hashCode();
+        }
+        _hashCode += (isQueryable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isReplicateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isRetrieveable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isSearchable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isTriggerable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isUndeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isUpdateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(DescribeGlobalSObjectResult.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalSObjectResult"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("activateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "activateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("createable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "createable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("custom");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "custom"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("customSetting");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "customSetting"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deletable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deletable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deprecatedAndHidden");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deprecatedAndHidden"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("keyPrefix");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "keyPrefix"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("label");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "label"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("labelPlural");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "labelPlural"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("layoutable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "layoutable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("mergeable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "mergeable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("name");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("queryable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("replicateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "replicateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("retrieveable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "retrieveable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("searchable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "searchable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("triggerable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "triggerable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("undeletable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "undeletable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("updateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "updateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeSObjectResult.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeSObjectResult.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/DescribeSObjectResult.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,918 +1,982 @@
-/**
- * DescribeSObjectResult.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class DescribeSObjectResult  implements java.io.Serializable {
-    private boolean activateable;
-
-    private com.sforce.soap.partner.ChildRelationship[] childRelationships;
-
-    private boolean createable;
-
-    private boolean custom;
-
-    private boolean deletable;
-
-    private com.sforce.soap.partner.Field[] fields;
-
-    private java.lang.String keyPrefix;
-
-    private java.lang.String label;
-
-    private java.lang.String labelPlural;
-
-    private boolean layoutable;
-
-    private boolean mergeable;
-
-    private java.lang.String name;
-
-    private boolean queryable;
-
-    private com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos;
-
-    private boolean replicateable;
-
-    private boolean retrieveable;
-
-    private boolean searchable;
-
-    private java.lang.Boolean triggerable;
-
-    private boolean undeletable;
-
-    private boolean updateable;
-
-    private java.lang.String urlDetail;
-
-    private java.lang.String urlEdit;
-
-    private java.lang.String urlNew;
-
-    public DescribeSObjectResult() {
-    }
-
-    public DescribeSObjectResult(
-           boolean activateable,
-           com.sforce.soap.partner.ChildRelationship[] childRelationships,
-           boolean createable,
-           boolean custom,
-           boolean deletable,
-           com.sforce.soap.partner.Field[] fields,
-           java.lang.String keyPrefix,
-           java.lang.String label,
-           java.lang.String labelPlural,
-           boolean layoutable,
-           boolean mergeable,
-           java.lang.String name,
-           boolean queryable,
-           com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos,
-           boolean replicateable,
-           boolean retrieveable,
-           boolean searchable,
-           java.lang.Boolean triggerable,
-           boolean undeletable,
-           boolean updateable,
-           java.lang.String urlDetail,
-           java.lang.String urlEdit,
-           java.lang.String urlNew) {
-           this.activateable = activateable;
-           this.childRelationships = childRelationships;
-           this.createable = createable;
-           this.custom = custom;
-           this.deletable = deletable;
-           this.fields = fields;
-           this.keyPrefix = keyPrefix;
-           this.label = label;
-           this.labelPlural = labelPlural;
-           this.layoutable = layoutable;
-           this.mergeable = mergeable;
-           this.name = name;
-           this.queryable = queryable;
-           this.recordTypeInfos = recordTypeInfos;
-           this.replicateable = replicateable;
-           this.retrieveable = retrieveable;
-           this.searchable = searchable;
-           this.triggerable = triggerable;
-           this.undeletable = undeletable;
-           this.updateable = updateable;
-           this.urlDetail = urlDetail;
-           this.urlEdit = urlEdit;
-           this.urlNew = urlNew;
-    }
-
-
-    /**
-     * Gets the activateable value for this DescribeSObjectResult.
-     * 
-     * @return activateable
-     */
-    public boolean isActivateable() {
-        return activateable;
-    }
-
-
-    /**
-     * Sets the activateable value for this DescribeSObjectResult.
-     * 
-     * @param activateable
-     */
-    public void setActivateable(boolean activateable) {
-        this.activateable = activateable;
-    }
-
-
-    /**
-     * Gets the childRelationships value for this DescribeSObjectResult.
-     * 
-     * @return childRelationships
-     */
-    public com.sforce.soap.partner.ChildRelationship[] getChildRelationships() {
-        return childRelationships;
-    }
-
-
-    /**
-     * Sets the childRelationships value for this DescribeSObjectResult.
-     * 
-     * @param childRelationships
-     */
-    public void setChildRelationships(com.sforce.soap.partner.ChildRelationship[] childRelationships) {
-        this.childRelationships = childRelationships;
-    }
-
-    public com.sforce.soap.partner.ChildRelationship getChildRelationships(int i) {
-        return this.childRelationships[i];
-    }
-
-    public void setChildRelationships(int i, com.sforce.soap.partner.ChildRelationship _value) {
-        this.childRelationships[i] = _value;
-    }
-
-
-    /**
-     * Gets the createable value for this DescribeSObjectResult.
-     * 
-     * @return createable
-     */
-    public boolean isCreateable() {
-        return createable;
-    }
-
-
-    /**
-     * Sets the createable value for this DescribeSObjectResult.
-     * 
-     * @param createable
-     */
-    public void setCreateable(boolean createable) {
-        this.createable = createable;
-    }
-
-
-    /**
-     * Gets the custom value for this DescribeSObjectResult.
-     * 
-     * @return custom
-     */
-    public boolean isCustom() {
-        return custom;
-    }
-
-
-    /**
-     * Sets the custom value for this DescribeSObjectResult.
-     * 
-     * @param custom
-     */
-    public void setCustom(boolean custom) {
-        this.custom = custom;
-    }
-
-
-    /**
-     * Gets the deletable value for this DescribeSObjectResult.
-     * 
-     * @return deletable
-     */
-    public boolean isDeletable() {
-        return deletable;
-    }
-
-
-    /**
-     * Sets the deletable value for this DescribeSObjectResult.
-     * 
-     * @param deletable
-     */
-    public void setDeletable(boolean deletable) {
-        this.deletable = deletable;
-    }
-
-
-    /**
-     * Gets the fields value for this DescribeSObjectResult.
-     * 
-     * @return fields
-     */
-    public com.sforce.soap.partner.Field[] getFields() {
-        return fields;
-    }
-
-
-    /**
-     * Sets the fields value for this DescribeSObjectResult.
-     * 
-     * @param fields
-     */
-    public void setFields(com.sforce.soap.partner.Field[] fields) {
-        this.fields = fields;
-    }
-
-    public com.sforce.soap.partner.Field getFields(int i) {
-        return this.fields[i];
-    }
-
-    public void setFields(int i, com.sforce.soap.partner.Field _value) {
-        this.fields[i] = _value;
-    }
-
-
-    /**
-     * Gets the keyPrefix value for this DescribeSObjectResult.
-     * 
-     * @return keyPrefix
-     */
-    public java.lang.String getKeyPrefix() {
-        return keyPrefix;
-    }
-
-
-    /**
-     * Sets the keyPrefix value for this DescribeSObjectResult.
-     * 
-     * @param keyPrefix
-     */
-    public void setKeyPrefix(java.lang.String keyPrefix) {
-        this.keyPrefix = keyPrefix;
-    }
-
-
-    /**
-     * Gets the label value for this DescribeSObjectResult.
-     * 
-     * @return label
-     */
-    public java.lang.String getLabel() {
-        return label;
-    }
-
-
-    /**
-     * Sets the label value for this DescribeSObjectResult.
-     * 
-     * @param label
-     */
-    public void setLabel(java.lang.String label) {
-        this.label = label;
-    }
-
-
-    /**
-     * Gets the labelPlural value for this DescribeSObjectResult.
-     * 
-     * @return labelPlural
-     */
-    public java.lang.String getLabelPlural() {
-        return labelPlural;
-    }
-
-
-    /**
-     * Sets the labelPlural value for this DescribeSObjectResult.
-     * 
-     * @param labelPlural
-     */
-    public void setLabelPlural(java.lang.String labelPlural) {
-        this.labelPlural = labelPlural;
-    }
-
-
-    /**
-     * Gets the layoutable value for this DescribeSObjectResult.
-     * 
-     * @return layoutable
-     */
-    public boolean isLayoutable() {
-        return layoutable;
-    }
-
-
-    /**
-     * Sets the layoutable value for this DescribeSObjectResult.
-     * 
-     * @param layoutable
-     */
-    public void setLayoutable(boolean layoutable) {
-        this.layoutable = layoutable;
-    }
-
-
-    /**
-     * Gets the mergeable value for this DescribeSObjectResult.
-     * 
-     * @return mergeable
-     */
-    public boolean isMergeable() {
-        return mergeable;
-    }
-
-
-    /**
-     * Sets the mergeable value for this DescribeSObjectResult.
-     * 
-     * @param mergeable
-     */
-    public void setMergeable(boolean mergeable) {
-        this.mergeable = mergeable;
-    }
-
-
-    /**
-     * Gets the name value for this DescribeSObjectResult.
-     * 
-     * @return name
-     */
-    public java.lang.String getName() {
-        return name;
-    }
-
-
-    /**
-     * Sets the name value for this DescribeSObjectResult.
-     * 
-     * @param name
-     */
-    public void setName(java.lang.String name) {
-        this.name = name;
-    }
-
-
-    /**
-     * Gets the queryable value for this DescribeSObjectResult.
-     * 
-     * @return queryable
-     */
-    public boolean isQueryable() {
-        return queryable;
-    }
-
-
-    /**
-     * Sets the queryable value for this DescribeSObjectResult.
-     * 
-     * @param queryable
-     */
-    public void setQueryable(boolean queryable) {
-        this.queryable = queryable;
-    }
-
-
-    /**
-     * Gets the recordTypeInfos value for this DescribeSObjectResult.
-     * 
-     * @return recordTypeInfos
-     */
-    public com.sforce.soap.partner.RecordTypeInfo[] getRecordTypeInfos() {
-        return recordTypeInfos;
-    }
-
-
-    /**
-     * Sets the recordTypeInfos value for this DescribeSObjectResult.
-     * 
-     * @param recordTypeInfos
-     */
-    public void setRecordTypeInfos(com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos) {
-        this.recordTypeInfos = recordTypeInfos;
-    }
-
-    public com.sforce.soap.partner.RecordTypeInfo getRecordTypeInfos(int i) {
-        return this.recordTypeInfos[i];
-    }
-
-    public void setRecordTypeInfos(int i, com.sforce.soap.partner.RecordTypeInfo _value) {
-        this.recordTypeInfos[i] = _value;
-    }
-
-
-    /**
-     * Gets the replicateable value for this DescribeSObjectResult.
-     * 
-     * @return replicateable
-     */
-    public boolean isReplicateable() {
-        return replicateable;
-    }
-
-
-    /**
-     * Sets the replicateable value for this DescribeSObjectResult.
-     * 
-     * @param replicateable
-     */
-    public void setReplicateable(boolean replicateable) {
-        this.replicateable = replicateable;
-    }
-
-
-    /**
-     * Gets the retrieveable value for this DescribeSObjectResult.
-     * 
-     * @return retrieveable
-     */
-    public boolean isRetrieveable() {
-        return retrieveable;
-    }
-
-
-    /**
-     * Sets the retrieveable value for this DescribeSObjectResult.
-     * 
-     * @param retrieveable
-     */
-    public void setRetrieveable(boolean retrieveable) {
-        this.retrieveable = retrieveable;
-    }
-
-
-    /**
-     * Gets the searchable value for this DescribeSObjectResult.
-     * 
-     * @return searchable
-     */
-    public boolean isSearchable() {
-        return searchable;
-    }
-
-
-    /**
-     * Sets the searchable value for this DescribeSObjectResult.
-     * 
-     * @param searchable
-     */
-    public void setSearchable(boolean searchable) {
-        this.searchable = searchable;
-    }
-
-
-    /**
-     * Gets the triggerable value for this DescribeSObjectResult.
-     * 
-     * @return triggerable
-     */
-    public java.lang.Boolean getTriggerable() {
-        return triggerable;
-    }
-
-
-    /**
-     * Sets the triggerable value for this DescribeSObjectResult.
-     * 
-     * @param triggerable
-     */
-    public void setTriggerable(java.lang.Boolean triggerable) {
-        this.triggerable = triggerable;
-    }
-
-
-    /**
-     * Gets the undeletable value for this DescribeSObjectResult.
-     * 
-     * @return undeletable
-     */
-    public boolean isUndeletable() {
-        return undeletable;
-    }
-
-
-    /**
-     * Sets the undeletable value for this DescribeSObjectResult.
-     * 
-     * @param undeletable
-     */
-    public void setUndeletable(boolean undeletable) {
-        this.undeletable = undeletable;
-    }
-
-
-    /**
-     * Gets the updateable value for this DescribeSObjectResult.
-     * 
-     * @return updateable
-     */
-    public boolean isUpdateable() {
-        return updateable;
-    }
-
-
-    /**
-     * Sets the updateable value for this DescribeSObjectResult.
-     * 
-     * @param updateable
-     */
-    public void setUpdateable(boolean updateable) {
-        this.updateable = updateable;
-    }
-
-
-    /**
-     * Gets the urlDetail value for this DescribeSObjectResult.
-     * 
-     * @return urlDetail
-     */
-    public java.lang.String getUrlDetail() {
-        return urlDetail;
-    }
-
-
-    /**
-     * Sets the urlDetail value for this DescribeSObjectResult.
-     * 
-     * @param urlDetail
-     */
-    public void setUrlDetail(java.lang.String urlDetail) {
-        this.urlDetail = urlDetail;
-    }
-
-
-    /**
-     * Gets the urlEdit value for this DescribeSObjectResult.
-     * 
-     * @return urlEdit
-     */
-    public java.lang.String getUrlEdit() {
-        return urlEdit;
-    }
-
-
-    /**
-     * Sets the urlEdit value for this DescribeSObjectResult.
-     * 
-     * @param urlEdit
-     */
-    public void setUrlEdit(java.lang.String urlEdit) {
-        this.urlEdit = urlEdit;
-    }
-
-
-    /**
-     * Gets the urlNew value for this DescribeSObjectResult.
-     * 
-     * @return urlNew
-     */
-    public java.lang.String getUrlNew() {
-        return urlNew;
-    }
-
-
-    /**
-     * Sets the urlNew value for this DescribeSObjectResult.
-     * 
-     * @param urlNew
-     */
-    public void setUrlNew(java.lang.String urlNew) {
-        this.urlNew = urlNew;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof DescribeSObjectResult)) return false;
-        DescribeSObjectResult other = (DescribeSObjectResult) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            this.activateable == other.isActivateable() &&
-            ((this.childRelationships==null && other.getChildRelationships()==null) || 
-             (this.childRelationships!=null &&
-              java.util.Arrays.equals(this.childRelationships, other.getChildRelationships()))) &&
-            this.createable == other.isCreateable() &&
-            this.custom == other.isCustom() &&
-            this.deletable == other.isDeletable() &&
-            ((this.fields==null && other.getFields()==null) || 
-             (this.fields!=null &&
-              java.util.Arrays.equals(this.fields, other.getFields()))) &&
-            ((this.keyPrefix==null && other.getKeyPrefix()==null) || 
-             (this.keyPrefix!=null &&
-              this.keyPrefix.equals(other.getKeyPrefix()))) &&
-            ((this.label==null && other.getLabel()==null) || 
-             (this.label!=null &&
-              this.label.equals(other.getLabel()))) &&
-            ((this.labelPlural==null && other.getLabelPlural()==null) || 
-             (this.labelPlural!=null &&
-              this.labelPlural.equals(other.getLabelPlural()))) &&
-            this.layoutable == other.isLayoutable() &&
-            this.mergeable == other.isMergeable() &&
-            ((this.name==null && other.getName()==null) || 
-             (this.name!=null &&
-              this.name.equals(other.getName()))) &&
-            this.queryable == other.isQueryable() &&
-            ((this.recordTypeInfos==null && other.getRecordTypeInfos()==null) || 
-             (this.recordTypeInfos!=null &&
-              java.util.Arrays.equals(this.recordTypeInfos, other.getRecordTypeInfos()))) &&
-            this.replicateable == other.isReplicateable() &&
-            this.retrieveable == other.isRetrieveable() &&
-            this.searchable == other.isSearchable() &&
-            ((this.triggerable==null && other.getTriggerable()==null) || 
-             (this.triggerable!=null &&
-              this.triggerable.equals(other.getTriggerable()))) &&
-            this.undeletable == other.isUndeletable() &&
-            this.updateable == other.isUpdateable() &&
-            ((this.urlDetail==null && other.getUrlDetail()==null) || 
-             (this.urlDetail!=null &&
-              this.urlDetail.equals(other.getUrlDetail()))) &&
-            ((this.urlEdit==null && other.getUrlEdit()==null) || 
-             (this.urlEdit!=null &&
-              this.urlEdit.equals(other.getUrlEdit()))) &&
-            ((this.urlNew==null && other.getUrlNew()==null) || 
-             (this.urlNew!=null &&
-              this.urlNew.equals(other.getUrlNew())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isActivateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getChildRelationships() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getChildRelationships());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getChildRelationships(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        _hashCode += (isCreateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isCustom() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isDeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getFields() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getFields());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getFields(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getKeyPrefix() != null) {
-            _hashCode += getKeyPrefix().hashCode();
-        }
-        if (getLabel() != null) {
-            _hashCode += getLabel().hashCode();
-        }
-        if (getLabelPlural() != null) {
-            _hashCode += getLabelPlural().hashCode();
-        }
-        _hashCode += (isLayoutable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isMergeable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getName() != null) {
-            _hashCode += getName().hashCode();
-        }
-        _hashCode += (isQueryable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getRecordTypeInfos() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getRecordTypeInfos());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getRecordTypeInfos(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        _hashCode += (isReplicateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isRetrieveable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isSearchable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getTriggerable() != null) {
-            _hashCode += getTriggerable().hashCode();
-        }
-        _hashCode += (isUndeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isUpdateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getUrlDetail() != null) {
-            _hashCode += getUrlDetail().hashCode();
-        }
-        if (getUrlEdit() != null) {
-            _hashCode += getUrlEdit().hashCode();
-        }
-        if (getUrlNew() != null) {
-            _hashCode += getUrlNew().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(DescribeSObjectResult.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("activateable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "activateable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("childRelationships");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "childRelationships"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("createable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "createable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("custom");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "custom"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("deletable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deletable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("fields");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fields"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("keyPrefix");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "keyPrefix"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("label");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "label"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("labelPlural");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "labelPlural"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("layoutable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "layoutable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("mergeable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "mergeable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("name");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("queryable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("recordTypeInfos");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "recordTypeInfos"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeInfo"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("replicateable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "replicateable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("retrieveable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "retrieveable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("searchable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "searchable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("triggerable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "triggerable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("undeletable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "undeletable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("updateable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "updateable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("urlDetail");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlDetail"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("urlEdit");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlEdit"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("urlNew");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlNew"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * DescribeSObjectResult.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class DescribeSObjectResult  implements java.io.Serializable {
+    private boolean activateable;
+
+    private com.sforce.soap.partner.ChildRelationship[] childRelationships;
+
+    private boolean createable;
+
+    private boolean custom;
+
+    private boolean customSetting;
+
+    private boolean deletable;
+
+    private boolean deprecatedAndHidden;
+
+    private com.sforce.soap.partner.Field[] fields;
+
+    private java.lang.String keyPrefix;
+
+    private java.lang.String label;
+
+    private java.lang.String labelPlural;
+
+    private boolean layoutable;
+
+    private boolean mergeable;
+
+    private java.lang.String name;
+
+    private boolean queryable;
+
+    private com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos;
+
+    private boolean replicateable;
+
+    private boolean retrieveable;
+
+    private boolean searchable;
+
+    private java.lang.Boolean triggerable;
+
+    private boolean undeletable;
+
+    private boolean updateable;
+
+    private java.lang.String urlDetail;
+
+    private java.lang.String urlEdit;
+
+    private java.lang.String urlNew;
+
+    public DescribeSObjectResult() {
+    }
+
+    public DescribeSObjectResult(
+           boolean activateable,
+           com.sforce.soap.partner.ChildRelationship[] childRelationships,
+           boolean createable,
+           boolean custom,
+           boolean customSetting,
+           boolean deletable,
+           boolean deprecatedAndHidden,
+           com.sforce.soap.partner.Field[] fields,
+           java.lang.String keyPrefix,
+           java.lang.String label,
+           java.lang.String labelPlural,
+           boolean layoutable,
+           boolean mergeable,
+           java.lang.String name,
+           boolean queryable,
+           com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos,
+           boolean replicateable,
+           boolean retrieveable,
+           boolean searchable,
+           java.lang.Boolean triggerable,
+           boolean undeletable,
+           boolean updateable,
+           java.lang.String urlDetail,
+           java.lang.String urlEdit,
+           java.lang.String urlNew) {
+           this.activateable = activateable;
+           this.childRelationships = childRelationships;
+           this.createable = createable;
+           this.custom = custom;
+           this.customSetting = customSetting;
+           this.deletable = deletable;
+           this.deprecatedAndHidden = deprecatedAndHidden;
+           this.fields = fields;
+           this.keyPrefix = keyPrefix;
+           this.label = label;
+           this.labelPlural = labelPlural;
+           this.layoutable = layoutable;
+           this.mergeable = mergeable;
+           this.name = name;
+           this.queryable = queryable;
+           this.recordTypeInfos = recordTypeInfos;
+           this.replicateable = replicateable;
+           this.retrieveable = retrieveable;
+           this.searchable = searchable;
+           this.triggerable = triggerable;
+           this.undeletable = undeletable;
+           this.updateable = updateable;
+           this.urlDetail = urlDetail;
+           this.urlEdit = urlEdit;
+           this.urlNew = urlNew;
+    }
+
+
+    /**
+     * Gets the activateable value for this DescribeSObjectResult.
+     * 
+     * @return activateable
+     */
+    public boolean isActivateable() {
+        return activateable;
+    }
+
+
+    /**
+     * Sets the activateable value for this DescribeSObjectResult.
+     * 
+     * @param activateable
+     */
+    public void setActivateable(boolean activateable) {
+        this.activateable = activateable;
+    }
+
+
+    /**
+     * Gets the childRelationships value for this DescribeSObjectResult.
+     * 
+     * @return childRelationships
+     */
+    public com.sforce.soap.partner.ChildRelationship[] getChildRelationships() {
+        return childRelationships;
+    }
+
+
+    /**
+     * Sets the childRelationships value for this DescribeSObjectResult.
+     * 
+     * @param childRelationships
+     */
+    public void setChildRelationships(com.sforce.soap.partner.ChildRelationship[] childRelationships) {
+        this.childRelationships = childRelationships;
+    }
+
+    public com.sforce.soap.partner.ChildRelationship getChildRelationships(int i) {
+        return this.childRelationships[i];
+    }
+
+    public void setChildRelationships(int i, com.sforce.soap.partner.ChildRelationship _value) {
+        this.childRelationships[i] = _value;
+    }
+
+
+    /**
+     * Gets the createable value for this DescribeSObjectResult.
+     * 
+     * @return createable
+     */
+    public boolean isCreateable() {
+        return createable;
+    }
+
+
+    /**
+     * Sets the createable value for this DescribeSObjectResult.
+     * 
+     * @param createable
+     */
+    public void setCreateable(boolean createable) {
+        this.createable = createable;
+    }
+
+
+    /**
+     * Gets the custom value for this DescribeSObjectResult.
+     * 
+     * @return custom
+     */
+    public boolean isCustom() {
+        return custom;
+    }
+
+
+    /**
+     * Sets the custom value for this DescribeSObjectResult.
+     * 
+     * @param custom
+     */
+    public void setCustom(boolean custom) {
+        this.custom = custom;
+    }
+
+
+    /**
+     * Gets the customSetting value for this DescribeSObjectResult.
+     * 
+     * @return customSetting
+     */
+    public boolean isCustomSetting() {
+        return customSetting;
+    }
+
+
+    /**
+     * Sets the customSetting value for this DescribeSObjectResult.
+     * 
+     * @param customSetting
+     */
+    public void setCustomSetting(boolean customSetting) {
+        this.customSetting = customSetting;
+    }
+
+
+    /**
+     * Gets the deletable value for this DescribeSObjectResult.
+     * 
+     * @return deletable
+     */
+    public boolean isDeletable() {
+        return deletable;
+    }
+
+
+    /**
+     * Sets the deletable value for this DescribeSObjectResult.
+     * 
+     * @param deletable
+     */
+    public void setDeletable(boolean deletable) {
+        this.deletable = deletable;
+    }
+
+
+    /**
+     * Gets the deprecatedAndHidden value for this DescribeSObjectResult.
+     * 
+     * @return deprecatedAndHidden
+     */
+    public boolean isDeprecatedAndHidden() {
+        return deprecatedAndHidden;
+    }
+
+
+    /**
+     * Sets the deprecatedAndHidden value for this DescribeSObjectResult.
+     * 
+     * @param deprecatedAndHidden
+     */
+    public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
+        this.deprecatedAndHidden = deprecatedAndHidden;
+    }
+
+
+    /**
+     * Gets the fields value for this DescribeSObjectResult.
+     * 
+     * @return fields
+     */
+    public com.sforce.soap.partner.Field[] getFields() {
+        return fields;
+    }
+
+
+    /**
+     * Sets the fields value for this DescribeSObjectResult.
+     * 
+     * @param fields
+     */
+    public void setFields(com.sforce.soap.partner.Field[] fields) {
+        this.fields = fields;
+    }
+
+    public com.sforce.soap.partner.Field getFields(int i) {
+        return this.fields[i];
+    }
+
+    public void setFields(int i, com.sforce.soap.partner.Field _value) {
+        this.fields[i] = _value;
+    }
+
+
+    /**
+     * Gets the keyPrefix value for this DescribeSObjectResult.
+     * 
+     * @return keyPrefix
+     */
+    public java.lang.String getKeyPrefix() {
+        return keyPrefix;
+    }
+
+
+    /**
+     * Sets the keyPrefix value for this DescribeSObjectResult.
+     * 
+     * @param keyPrefix
+     */
+    public void setKeyPrefix(java.lang.String keyPrefix) {
+        this.keyPrefix = keyPrefix;
+    }
+
+
+    /**
+     * Gets the label value for this DescribeSObjectResult.
+     * 
+     * @return label
+     */
+    public java.lang.String getLabel() {
+        return label;
+    }
+
+
+    /**
+     * Sets the label value for this DescribeSObjectResult.
+     * 
+     * @param label
+     */
+    public void setLabel(java.lang.String label) {
+        this.label = label;
+    }
+
+
+    /**
+     * Gets the labelPlural value for this DescribeSObjectResult.
+     * 
+     * @return labelPlural
+     */
+    public java.lang.String getLabelPlural() {
+        return labelPlural;
+    }
+
+
+    /**
+     * Sets the labelPlural value for this DescribeSObjectResult.
+     * 
+     * @param labelPlural
+     */
+    public void setLabelPlural(java.lang.String labelPlural) {
+        this.labelPlural = labelPlural;
+    }
+
+
+    /**
+     * Gets the layoutable value for this DescribeSObjectResult.
+     * 
+     * @return layoutable
+     */
+    public boolean isLayoutable() {
+        return layoutable;
+    }
+
+
+    /**
+     * Sets the layoutable value for this DescribeSObjectResult.
+     * 
+     * @param layoutable
+     */
+    public void setLayoutable(boolean layoutable) {
+        this.layoutable = layoutable;
+    }
+
+
+    /**
+     * Gets the mergeable value for this DescribeSObjectResult.
+     * 
+     * @return mergeable
+     */
+    public boolean isMergeable() {
+        return mergeable;
+    }
+
+
+    /**
+     * Sets the mergeable value for this DescribeSObjectResult.
+     * 
+     * @param mergeable
+     */
+    public void setMergeable(boolean mergeable) {
+        this.mergeable = mergeable;
+    }
+
+
+    /**
+     * Gets the name value for this DescribeSObjectResult.
+     * 
+     * @return name
+     */
+    public java.lang.String getName() {
+        return name;
+    }
+
+
+    /**
+     * Sets the name value for this DescribeSObjectResult.
+     * 
+     * @param name
+     */
+    public void setName(java.lang.String name) {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the queryable value for this DescribeSObjectResult.
+     * 
+     * @return queryable
+     */
+    public boolean isQueryable() {
+        return queryable;
+    }
+
+
+    /**
+     * Sets the queryable value for this DescribeSObjectResult.
+     * 
+     * @param queryable
+     */
+    public void setQueryable(boolean queryable) {
+        this.queryable = queryable;
+    }
+
+
+    /**
+     * Gets the recordTypeInfos value for this DescribeSObjectResult.
+     * 
+     * @return recordTypeInfos
+     */
+    public com.sforce.soap.partner.RecordTypeInfo[] getRecordTypeInfos() {
+        return recordTypeInfos;
+    }
+
+
+    /**
+     * Sets the recordTypeInfos value for this DescribeSObjectResult.
+     * 
+     * @param recordTypeInfos
+     */
+    public void setRecordTypeInfos(com.sforce.soap.partner.RecordTypeInfo[] recordTypeInfos) {
+        this.recordTypeInfos = recordTypeInfos;
+    }
+
+    public com.sforce.soap.partner.RecordTypeInfo getRecordTypeInfos(int i) {
+        return this.recordTypeInfos[i];
+    }
+
+    public void setRecordTypeInfos(int i, com.sforce.soap.partner.RecordTypeInfo _value) {
+        this.recordTypeInfos[i] = _value;
+    }
+
+
+    /**
+     * Gets the replicateable value for this DescribeSObjectResult.
+     * 
+     * @return replicateable
+     */
+    public boolean isReplicateable() {
+        return replicateable;
+    }
+
+
+    /**
+     * Sets the replicateable value for this DescribeSObjectResult.
+     * 
+     * @param replicateable
+     */
+    public void setReplicateable(boolean replicateable) {
+        this.replicateable = replicateable;
+    }
+
+
+    /**
+     * Gets the retrieveable value for this DescribeSObjectResult.
+     * 
+     * @return retrieveable
+     */
+    public boolean isRetrieveable() {
+        return retrieveable;
+    }
+
+
+    /**
+     * Sets the retrieveable value for this DescribeSObjectResult.
+     * 
+     * @param retrieveable
+     */
+    public void setRetrieveable(boolean retrieveable) {
+        this.retrieveable = retrieveable;
+    }
+
+
+    /**
+     * Gets the searchable value for this DescribeSObjectResult.
+     * 
+     * @return searchable
+     */
+    public boolean isSearchable() {
+        return searchable;
+    }
+
+
+    /**
+     * Sets the searchable value for this DescribeSObjectResult.
+     * 
+     * @param searchable
+     */
+    public void setSearchable(boolean searchable) {
+        this.searchable = searchable;
+    }
+
+
+    /**
+     * Gets the triggerable value for this DescribeSObjectResult.
+     * 
+     * @return triggerable
+     */
+    public java.lang.Boolean getTriggerable() {
+        return triggerable;
+    }
+
+
+    /**
+     * Sets the triggerable value for this DescribeSObjectResult.
+     * 
+     * @param triggerable
+     */
+    public void setTriggerable(java.lang.Boolean triggerable) {
+        this.triggerable = triggerable;
+    }
+
+
+    /**
+     * Gets the undeletable value for this DescribeSObjectResult.
+     * 
+     * @return undeletable
+     */
+    public boolean isUndeletable() {
+        return undeletable;
+    }
+
+
+    /**
+     * Sets the undeletable value for this DescribeSObjectResult.
+     * 
+     * @param undeletable
+     */
+    public void setUndeletable(boolean undeletable) {
+        this.undeletable = undeletable;
+    }
+
+
+    /**
+     * Gets the updateable value for this DescribeSObjectResult.
+     * 
+     * @return updateable
+     */
+    public boolean isUpdateable() {
+        return updateable;
+    }
+
+
+    /**
+     * Sets the updateable value for this DescribeSObjectResult.
+     * 
+     * @param updateable
+     */
+    public void setUpdateable(boolean updateable) {
+        this.updateable = updateable;
+    }
+
+
+    /**
+     * Gets the urlDetail value for this DescribeSObjectResult.
+     * 
+     * @return urlDetail
+     */
+    public java.lang.String getUrlDetail() {
+        return urlDetail;
+    }
+
+
+    /**
+     * Sets the urlDetail value for this DescribeSObjectResult.
+     * 
+     * @param urlDetail
+     */
+    public void setUrlDetail(java.lang.String urlDetail) {
+        this.urlDetail = urlDetail;
+    }
+
+
+    /**
+     * Gets the urlEdit value for this DescribeSObjectResult.
+     * 
+     * @return urlEdit
+     */
+    public java.lang.String getUrlEdit() {
+        return urlEdit;
+    }
+
+
+    /**
+     * Sets the urlEdit value for this DescribeSObjectResult.
+     * 
+     * @param urlEdit
+     */
+    public void setUrlEdit(java.lang.String urlEdit) {
+        this.urlEdit = urlEdit;
+    }
+
+
+    /**
+     * Gets the urlNew value for this DescribeSObjectResult.
+     * 
+     * @return urlNew
+     */
+    public java.lang.String getUrlNew() {
+        return urlNew;
+    }
+
+
+    /**
+     * Sets the urlNew value for this DescribeSObjectResult.
+     * 
+     * @param urlNew
+     */
+    public void setUrlNew(java.lang.String urlNew) {
+        this.urlNew = urlNew;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof DescribeSObjectResult)) return false;
+        DescribeSObjectResult other = (DescribeSObjectResult) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.activateable == other.isActivateable() &&
+            ((this.childRelationships==null && other.getChildRelationships()==null) || 
+             (this.childRelationships!=null &&
+              java.util.Arrays.equals(this.childRelationships, other.getChildRelationships()))) &&
+            this.createable == other.isCreateable() &&
+            this.custom == other.isCustom() &&
+            this.customSetting == other.isCustomSetting() &&
+            this.deletable == other.isDeletable() &&
+            this.deprecatedAndHidden == other.isDeprecatedAndHidden() &&
+            ((this.fields==null && other.getFields()==null) || 
+             (this.fields!=null &&
+              java.util.Arrays.equals(this.fields, other.getFields()))) &&
+            ((this.keyPrefix==null && other.getKeyPrefix()==null) || 
+             (this.keyPrefix!=null &&
+              this.keyPrefix.equals(other.getKeyPrefix()))) &&
+            ((this.label==null && other.getLabel()==null) || 
+             (this.label!=null &&
+              this.label.equals(other.getLabel()))) &&
+            ((this.labelPlural==null && other.getLabelPlural()==null) || 
+             (this.labelPlural!=null &&
+              this.labelPlural.equals(other.getLabelPlural()))) &&
+            this.layoutable == other.isLayoutable() &&
+            this.mergeable == other.isMergeable() &&
+            ((this.name==null && other.getName()==null) || 
+             (this.name!=null &&
+              this.name.equals(other.getName()))) &&
+            this.queryable == other.isQueryable() &&
+            ((this.recordTypeInfos==null && other.getRecordTypeInfos()==null) || 
+             (this.recordTypeInfos!=null &&
+              java.util.Arrays.equals(this.recordTypeInfos, other.getRecordTypeInfos()))) &&
+            this.replicateable == other.isReplicateable() &&
+            this.retrieveable == other.isRetrieveable() &&
+            this.searchable == other.isSearchable() &&
+            ((this.triggerable==null && other.getTriggerable()==null) || 
+             (this.triggerable!=null &&
+              this.triggerable.equals(other.getTriggerable()))) &&
+            this.undeletable == other.isUndeletable() &&
+            this.updateable == other.isUpdateable() &&
+            ((this.urlDetail==null && other.getUrlDetail()==null) || 
+             (this.urlDetail!=null &&
+              this.urlDetail.equals(other.getUrlDetail()))) &&
+            ((this.urlEdit==null && other.getUrlEdit()==null) || 
+             (this.urlEdit!=null &&
+              this.urlEdit.equals(other.getUrlEdit()))) &&
+            ((this.urlNew==null && other.getUrlNew()==null) || 
+             (this.urlNew!=null &&
+              this.urlNew.equals(other.getUrlNew())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += (isActivateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getChildRelationships() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getChildRelationships());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getChildRelationships(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        _hashCode += (isCreateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCustom() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCustomSetting() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isDeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isDeprecatedAndHidden() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getFields() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getFields());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getFields(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getKeyPrefix() != null) {
+            _hashCode += getKeyPrefix().hashCode();
+        }
+        if (getLabel() != null) {
+            _hashCode += getLabel().hashCode();
+        }
+        if (getLabelPlural() != null) {
+            _hashCode += getLabelPlural().hashCode();
+        }
+        _hashCode += (isLayoutable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isMergeable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getName() != null) {
+            _hashCode += getName().hashCode();
+        }
+        _hashCode += (isQueryable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getRecordTypeInfos() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getRecordTypeInfos());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getRecordTypeInfos(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        _hashCode += (isReplicateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isRetrieveable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isSearchable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getTriggerable() != null) {
+            _hashCode += getTriggerable().hashCode();
+        }
+        _hashCode += (isUndeletable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isUpdateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getUrlDetail() != null) {
+            _hashCode += getUrlDetail().hashCode();
+        }
+        if (getUrlEdit() != null) {
+            _hashCode += getUrlEdit().hashCode();
+        }
+        if (getUrlNew() != null) {
+            _hashCode += getUrlNew().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(DescribeSObjectResult.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("activateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "activateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("childRelationships");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "childRelationships"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("createable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "createable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("custom");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "custom"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("customSetting");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "customSetting"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deletable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deletable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deprecatedAndHidden");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deprecatedAndHidden"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("fields");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fields"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("keyPrefix");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "keyPrefix"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("label");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "label"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("labelPlural");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "labelPlural"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("layoutable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "layoutable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("mergeable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "mergeable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("name");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("queryable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("recordTypeInfos");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "recordTypeInfos"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeInfo"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("replicateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "replicateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("retrieveable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "retrieveable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("searchable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "searchable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("triggerable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "triggerable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("undeletable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "undeletable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("updateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "updateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("urlDetail");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlDetail"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("urlEdit");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlEdit"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("urlNew");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "urlNew"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/EmailFileAttachment.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/EmailFileAttachment.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/EmailFileAttachment.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,164 +1,238 @@
-/**
- * EmailFileAttachment.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class EmailFileAttachment  implements java.io.Serializable {
-    private byte[] body;
-
-    private java.lang.String fileName;
-
-    public EmailFileAttachment() {
-    }
-
-    public EmailFileAttachment(
-           byte[] body,
-           java.lang.String fileName) {
-           this.body = body;
-           this.fileName = fileName;
-    }
-
-
-    /**
-     * Gets the body value for this EmailFileAttachment.
-     * 
-     * @return body
-     */
-    public byte[] getBody() {
-        return body;
-    }
-
-
-    /**
-     * Sets the body value for this EmailFileAttachment.
-     * 
-     * @param body
-     */
-    public void setBody(byte[] body) {
-        this.body = body;
-    }
-
-
-    /**
-     * Gets the fileName value for this EmailFileAttachment.
-     * 
-     * @return fileName
-     */
-    public java.lang.String getFileName() {
-        return fileName;
-    }
-
-
-    /**
-     * Sets the fileName value for this EmailFileAttachment.
-     * 
-     * @param fileName
-     */
-    public void setFileName(java.lang.String fileName) {
-        this.fileName = fileName;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof EmailFileAttachment)) return false;
-        EmailFileAttachment other = (EmailFileAttachment) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            ((this.body==null && other.getBody()==null) || 
-             (this.body!=null &&
-              java.util.Arrays.equals(this.body, other.getBody()))) &&
-            ((this.fileName==null && other.getFileName()==null) || 
-             (this.fileName!=null &&
-              this.fileName.equals(other.getFileName())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getBody() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getBody());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getBody(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getFileName() != null) {
-            _hashCode += getFileName().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(EmailFileAttachment.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("body");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "body"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("fileName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fileName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * EmailFileAttachment.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class EmailFileAttachment  implements java.io.Serializable {
+    private byte[] body;
+
+    private java.lang.String contentType;
+
+    private java.lang.String fileName;
+
+    private java.lang.Boolean inline;
+
+    public EmailFileAttachment() {
+    }
+
+    public EmailFileAttachment(
+           byte[] body,
+           java.lang.String contentType,
+           java.lang.String fileName,
+           java.lang.Boolean inline) {
+           this.body = body;
+           this.contentType = contentType;
+           this.fileName = fileName;
+           this.inline = inline;
+    }
+
+
+    /**
+     * Gets the body value for this EmailFileAttachment.
+     * 
+     * @return body
+     */
+    public byte[] getBody() {
+        return body;
+    }
+
+
+    /**
+     * Sets the body value for this EmailFileAttachment.
+     * 
+     * @param body
+     */
+    public void setBody(byte[] body) {
+        this.body = body;
+    }
+
+
+    /**
+     * Gets the contentType value for this EmailFileAttachment.
+     * 
+     * @return contentType
+     */
+    public java.lang.String getContentType() {
+        return contentType;
+    }
+
+
+    /**
+     * Sets the contentType value for this EmailFileAttachment.
+     * 
+     * @param contentType
+     */
+    public void setContentType(java.lang.String contentType) {
+        this.contentType = contentType;
+    }
+
+
+    /**
+     * Gets the fileName value for this EmailFileAttachment.
+     * 
+     * @return fileName
+     */
+    public java.lang.String getFileName() {
+        return fileName;
+    }
+
+
+    /**
+     * Sets the fileName value for this EmailFileAttachment.
+     * 
+     * @param fileName
+     */
+    public void setFileName(java.lang.String fileName) {
+        this.fileName = fileName;
+    }
+
+
+    /**
+     * Gets the inline value for this EmailFileAttachment.
+     * 
+     * @return inline
+     */
+    public java.lang.Boolean getInline() {
+        return inline;
+    }
+
+
+    /**
+     * Sets the inline value for this EmailFileAttachment.
+     * 
+     * @param inline
+     */
+    public void setInline(java.lang.Boolean inline) {
+        this.inline = inline;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof EmailFileAttachment)) return false;
+        EmailFileAttachment other = (EmailFileAttachment) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            ((this.body==null && other.getBody()==null) || 
+             (this.body!=null &&
+              java.util.Arrays.equals(this.body, other.getBody()))) &&
+            ((this.contentType==null && other.getContentType()==null) || 
+             (this.contentType!=null &&
+              this.contentType.equals(other.getContentType()))) &&
+            ((this.fileName==null && other.getFileName()==null) || 
+             (this.fileName!=null &&
+              this.fileName.equals(other.getFileName()))) &&
+            ((this.inline==null && other.getInline()==null) || 
+             (this.inline!=null &&
+              this.inline.equals(other.getInline())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        if (getBody() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getBody());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getBody(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getContentType() != null) {
+            _hashCode += getContentType().hashCode();
+        }
+        if (getFileName() != null) {
+            _hashCode += getFileName().hashCode();
+        }
+        if (getInline() != null) {
+            _hashCode += getInline().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(EmailFileAttachment.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("body");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "body"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("contentType");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "contentType"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("fileName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fileName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("inline");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "inline"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Field.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Field.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Field.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,1355 +1,1387 @@
-/**
- * Field.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class Field  implements java.io.Serializable {
-    private boolean autoNumber;
-
-    private int byteLength;
-
-    private boolean calculated;
-
-    private java.lang.String calculatedFormula;
-
-    private boolean caseSensitive;
-
-    private java.lang.String controllerName;
-
-    private boolean createable;
-
-    private boolean custom;
-
-    private java.lang.String defaultValueFormula;
-
-    private boolean defaultedOnCreate;
-
-    private java.lang.Boolean dependentPicklist;
-
-    private int digits;
-
-    private java.lang.Boolean externalId;
-
-    private boolean filterable;
-
-    private java.lang.Boolean htmlFormatted;
-
-    private boolean idLookup;
-
-    private java.lang.String inlineHelpText;
-
-    private java.lang.String label;
-
-    private int length;
-
-    private java.lang.String name;
-
-    private boolean nameField;
-
-    private java.lang.Boolean namePointing;
-
-    private boolean nillable;
-
-    private com.sforce.soap.partner.PicklistEntry[] picklistValues;
-
-    private int precision;
-
-    private java.lang.String[] referenceTo;
-
-    private java.lang.String relationshipName;
-
-    private java.lang.Integer relationshipOrder;
-
-    private boolean restrictedPicklist;
-
-    private int scale;
-
-    private com.sforce.soap.partner.SoapType soapType;
-
-    private java.lang.Boolean sortable;
-
-    private com.sforce.soap.partner.FieldType type;
-
-    private boolean unique;
-
-    private boolean updateable;
-
-    private java.lang.Boolean writeRequiresMasterRead;
-
-    public Field() {
-    }
-
-    public Field(
-           boolean autoNumber,
-           int byteLength,
-           boolean calculated,
-           java.lang.String calculatedFormula,
-           boolean caseSensitive,
-           java.lang.String controllerName,
-           boolean createable,
-           boolean custom,
-           java.lang.String defaultValueFormula,
-           boolean defaultedOnCreate,
-           java.lang.Boolean dependentPicklist,
-           int digits,
-           java.lang.Boolean externalId,
-           boolean filterable,
-           java.lang.Boolean htmlFormatted,
-           boolean idLookup,
-           java.lang.String inlineHelpText,
-           java.lang.String label,
-           int length,
-           java.lang.String name,
-           boolean nameField,
-           java.lang.Boolean namePointing,
-           boolean nillable,
-           com.sforce.soap.partner.PicklistEntry[] picklistValues,
-           int precision,
-           java.lang.String[] referenceTo,
-           java.lang.String relationshipName,
-           java.lang.Integer relationshipOrder,
-           boolean restrictedPicklist,
-           int scale,
-           com.sforce.soap.partner.SoapType soapType,
-           java.lang.Boolean sortable,
-           com.sforce.soap.partner.FieldType type,
-           boolean unique,
-           boolean updateable,
-           java.lang.Boolean writeRequiresMasterRead) {
-           this.autoNumber = autoNumber;
-           this.byteLength = byteLength;
-           this.calculated = calculated;
-           this.calculatedFormula = calculatedFormula;
-           this.caseSensitive = caseSensitive;
-           this.controllerName = controllerName;
-           this.createable = createable;
-           this.custom = custom;
-           this.defaultValueFormula = defaultValueFormula;
-           this.defaultedOnCreate = defaultedOnCreate;
-           this.dependentPicklist = dependentPicklist;
-           this.digits = digits;
-           this.externalId = externalId;
-           this.filterable = filterable;
-           this.htmlFormatted = htmlFormatted;
-           this.idLookup = idLookup;
-           this.inlineHelpText = inlineHelpText;
-           this.label = label;
-           this.length = length;
-           this.name = name;
-           this.nameField = nameField;
-           this.namePointing = namePointing;
-           this.nillable = nillable;
-           this.picklistValues = picklistValues;
-           this.precision = precision;
-           this.referenceTo = referenceTo;
-           this.relationshipName = relationshipName;
-           this.relationshipOrder = relationshipOrder;
-           this.restrictedPicklist = restrictedPicklist;
-           this.scale = scale;
-           this.soapType = soapType;
-           this.sortable = sortable;
-           this.type = type;
-           this.unique = unique;
-           this.updateable = updateable;
-           this.writeRequiresMasterRead = writeRequiresMasterRead;
-    }
-
-
-    /**
-     * Gets the autoNumber value for this Field.
-     * 
-     * @return autoNumber
-     */
-    public boolean isAutoNumber() {
-        return autoNumber;
-    }
-
-
-    /**
-     * Sets the autoNumber value for this Field.
-     * 
-     * @param autoNumber
-     */
-    public void setAutoNumber(boolean autoNumber) {
-        this.autoNumber = autoNumber;
-    }
-
-
-    /**
-     * Gets the byteLength value for this Field.
-     * 
-     * @return byteLength
-     */
-    public int getByteLength() {
-        return byteLength;
-    }
-
-
-    /**
-     * Sets the byteLength value for this Field.
-     * 
-     * @param byteLength
-     */
-    public void setByteLength(int byteLength) {
-        this.byteLength = byteLength;
-    }
-
-
-    /**
-     * Gets the calculated value for this Field.
-     * 
-     * @return calculated
-     */
-    public boolean isCalculated() {
-        return calculated;
-    }
-
-
-    /**
-     * Sets the calculated value for this Field.
-     * 
-     * @param calculated
-     */
-    public void setCalculated(boolean calculated) {
-        this.calculated = calculated;
-    }
-
-
-    /**
-     * Gets the calculatedFormula value for this Field.
-     * 
-     * @return calculatedFormula
-     */
-    public java.lang.String getCalculatedFormula() {
-        return calculatedFormula;
-    }
-
-
-    /**
-     * Sets the calculatedFormula value for this Field.
-     * 
-     * @param calculatedFormula
-     */
-    public void setCalculatedFormula(java.lang.String calculatedFormula) {
-        this.calculatedFormula = calculatedFormula;
-    }
-
-
-    /**
-     * Gets the caseSensitive value for this Field.
-     * 
-     * @return caseSensitive
-     */
-    public boolean isCaseSensitive() {
-        return caseSensitive;
-    }
-
-
-    /**
-     * Sets the caseSensitive value for this Field.
-     * 
-     * @param caseSensitive
-     */
-    public void setCaseSensitive(boolean caseSensitive) {
-        this.caseSensitive = caseSensitive;
-    }
-
-
-    /**
-     * Gets the controllerName value for this Field.
-     * 
-     * @return controllerName
-     */
-    public java.lang.String getControllerName() {
-        return controllerName;
-    }
-
-
-    /**
-     * Sets the controllerName value for this Field.
-     * 
-     * @param controllerName
-     */
-    public void setControllerName(java.lang.String controllerName) {
-        this.controllerName = controllerName;
-    }
-
-
-    /**
-     * Gets the createable value for this Field.
-     * 
-     * @return createable
-     */
-    public boolean isCreateable() {
-        return createable;
-    }
-
-
-    /**
-     * Sets the createable value for this Field.
-     * 
-     * @param createable
-     */
-    public void setCreateable(boolean createable) {
-        this.createable = createable;
-    }
-
-
-    /**
-     * Gets the custom value for this Field.
-     * 
-     * @return custom
-     */
-    public boolean isCustom() {
-        return custom;
-    }
-
-
-    /**
-     * Sets the custom value for this Field.
-     * 
-     * @param custom
-     */
-    public void setCustom(boolean custom) {
-        this.custom = custom;
-    }
-
-
-    /**
-     * Gets the defaultValueFormula value for this Field.
-     * 
-     * @return defaultValueFormula
-     */
-    public java.lang.String getDefaultValueFormula() {
-        return defaultValueFormula;
-    }
-
-
-    /**
-     * Sets the defaultValueFormula value for this Field.
-     * 
-     * @param defaultValueFormula
-     */
-    public void setDefaultValueFormula(java.lang.String defaultValueFormula) {
-        this.defaultValueFormula = defaultValueFormula;
-    }
-
-
-    /**
-     * Gets the defaultedOnCreate value for this Field.
-     * 
-     * @return defaultedOnCreate
-     */
-    public boolean isDefaultedOnCreate() {
-        return defaultedOnCreate;
-    }
-
-
-    /**
-     * Sets the defaultedOnCreate value for this Field.
-     * 
-     * @param defaultedOnCreate
-     */
-    public void setDefaultedOnCreate(boolean defaultedOnCreate) {
-        this.defaultedOnCreate = defaultedOnCreate;
-    }
-
-
-    /**
-     * Gets the dependentPicklist value for this Field.
-     * 
-     * @return dependentPicklist
-     */
-    public java.lang.Boolean getDependentPicklist() {
-        return dependentPicklist;
-    }
-
-
-    /**
-     * Sets the dependentPicklist value for this Field.
-     * 
-     * @param dependentPicklist
-     */
-    public void setDependentPicklist(java.lang.Boolean dependentPicklist) {
-        this.dependentPicklist = dependentPicklist;
-    }
-
-
-    /**
-     * Gets the digits value for this Field.
-     * 
-     * @return digits
-     */
-    public int getDigits() {
-        return digits;
-    }
-
-
-    /**
-     * Sets the digits value for this Field.
-     * 
-     * @param digits
-     */
-    public void setDigits(int digits) {
-        this.digits = digits;
-    }
-
-
-    /**
-     * Gets the externalId value for this Field.
-     * 
-     * @return externalId
-     */
-    public java.lang.Boolean getExternalId() {
-        return externalId;
-    }
-
-
-    /**
-     * Sets the externalId value for this Field.
-     * 
-     * @param externalId
-     */
-    public void setExternalId(java.lang.Boolean externalId) {
-        this.externalId = externalId;
-    }
-
-
-    /**
-     * Gets the filterable value for this Field.
-     * 
-     * @return filterable
-     */
-    public boolean isFilterable() {
-        return filterable;
-    }
-
-
-    /**
-     * Sets the filterable value for this Field.
-     * 
-     * @param filterable
-     */
-    public void setFilterable(boolean filterable) {
-        this.filterable = filterable;
-    }
-
-
-    /**
-     * Gets the htmlFormatted value for this Field.
-     * 
-     * @return htmlFormatted
-     */
-    public java.lang.Boolean getHtmlFormatted() {
-        return htmlFormatted;
-    }
-
-
-    /**
-     * Sets the htmlFormatted value for this Field.
-     * 
-     * @param htmlFormatted
-     */
-    public void setHtmlFormatted(java.lang.Boolean htmlFormatted) {
-        this.htmlFormatted = htmlFormatted;
-    }
-
-
-    /**
-     * Gets the idLookup value for this Field.
-     * 
-     * @return idLookup
-     */
-    public boolean isIdLookup() {
-        return idLookup;
-    }
-
-
-    /**
-     * Sets the idLookup value for this Field.
-     * 
-     * @param idLookup
-     */
-    public void setIdLookup(boolean idLookup) {
-        this.idLookup = idLookup;
-    }
-
-
-    /**
-     * Gets the inlineHelpText value for this Field.
-     * 
-     * @return inlineHelpText
-     */
-    public java.lang.String getInlineHelpText() {
-        return inlineHelpText;
-    }
-
-
-    /**
-     * Sets the inlineHelpText value for this Field.
-     * 
-     * @param inlineHelpText
-     */
-    public void setInlineHelpText(java.lang.String inlineHelpText) {
-        this.inlineHelpText = inlineHelpText;
-    }
-
-
-    /**
-     * Gets the label value for this Field.
-     * 
-     * @return label
-     */
-    public java.lang.String getLabel() {
-        return label;
-    }
-
-
-    /**
-     * Sets the label value for this Field.
-     * 
-     * @param label
-     */
-    public void setLabel(java.lang.String label) {
-        this.label = label;
-    }
-
-
-    /**
-     * Gets the length value for this Field.
-     * 
-     * @return length
-     */
-    public int getLength() {
-        return length;
-    }
-
-
-    /**
-     * Sets the length value for this Field.
-     * 
-     * @param length
-     */
-    public void setLength(int length) {
-        this.length = length;
-    }
-
-
-    /**
-     * Gets the name value for this Field.
-     * 
-     * @return name
-     */
-    public java.lang.String getName() {
-        return name;
-    }
-
-
-    /**
-     * Sets the name value for this Field.
-     * 
-     * @param name
-     */
-    public void setName(java.lang.String name) {
-        this.name = name;
-    }
-
-
-    /**
-     * Gets the nameField value for this Field.
-     * 
-     * @return nameField
-     */
-    public boolean isNameField() {
-        return nameField;
-    }
-
-
-    /**
-     * Sets the nameField value for this Field.
-     * 
-     * @param nameField
-     */
-    public void setNameField(boolean nameField) {
-        this.nameField = nameField;
-    }
-
-
-    /**
-     * Gets the namePointing value for this Field.
-     * 
-     * @return namePointing
-     */
-    public java.lang.Boolean getNamePointing() {
-        return namePointing;
-    }
-
-
-    /**
-     * Sets the namePointing value for this Field.
-     * 
-     * @param namePointing
-     */
-    public void setNamePointing(java.lang.Boolean namePointing) {
-        this.namePointing = namePointing;
-    }
-
-
-    /**
-     * Gets the nillable value for this Field.
-     * 
-     * @return nillable
-     */
-    public boolean isNillable() {
-        return nillable;
-    }
-
-
-    /**
-     * Sets the nillable value for this Field.
-     * 
-     * @param nillable
-     */
-    public void setNillable(boolean nillable) {
-        this.nillable = nillable;
-    }
-
-
-    /**
-     * Gets the picklistValues value for this Field.
-     * 
-     * @return picklistValues
-     */
-    public com.sforce.soap.partner.PicklistEntry[] getPicklistValues() {
-        return picklistValues;
-    }
-
-
-    /**
-     * Sets the picklistValues value for this Field.
-     * 
-     * @param picklistValues
-     */
-    public void setPicklistValues(com.sforce.soap.partner.PicklistEntry[] picklistValues) {
-        this.picklistValues = picklistValues;
-    }
-
-    public com.sforce.soap.partner.PicklistEntry getPicklistValues(int i) {
-        return this.picklistValues[i];
-    }
-
-    public void setPicklistValues(int i, com.sforce.soap.partner.PicklistEntry _value) {
-        this.picklistValues[i] = _value;
-    }
-
-
-    /**
-     * Gets the precision value for this Field.
-     * 
-     * @return precision
-     */
-    public int getPrecision() {
-        return precision;
-    }
-
-
-    /**
-     * Sets the precision value for this Field.
-     * 
-     * @param precision
-     */
-    public void setPrecision(int precision) {
-        this.precision = precision;
-    }
-
-
-    /**
-     * Gets the referenceTo value for this Field.
-     * 
-     * @return referenceTo
-     */
-    public java.lang.String[] getReferenceTo() {
-        return referenceTo;
-    }
-
-
-    /**
-     * Sets the referenceTo value for this Field.
-     * 
-     * @param referenceTo
-     */
-    public void setReferenceTo(java.lang.String[] referenceTo) {
-        this.referenceTo = referenceTo;
-    }
-
-    public java.lang.String getReferenceTo(int i) {
-        return this.referenceTo[i];
-    }
-
-    public void setReferenceTo(int i, java.lang.String _value) {
-        this.referenceTo[i] = _value;
-    }
-
-
-    /**
-     * Gets the relationshipName value for this Field.
-     * 
-     * @return relationshipName
-     */
-    public java.lang.String getRelationshipName() {
-        return relationshipName;
-    }
-
-
-    /**
-     * Sets the relationshipName value for this Field.
-     * 
-     * @param relationshipName
-     */
-    public void setRelationshipName(java.lang.String relationshipName) {
-        this.relationshipName = relationshipName;
-    }
-
-
-    /**
-     * Gets the relationshipOrder value for this Field.
-     * 
-     * @return relationshipOrder
-     */
-    public java.lang.Integer getRelationshipOrder() {
-        return relationshipOrder;
-    }
-
-
-    /**
-     * Sets the relationshipOrder value for this Field.
-     * 
-     * @param relationshipOrder
-     */
-    public void setRelationshipOrder(java.lang.Integer relationshipOrder) {
-        this.relationshipOrder = relationshipOrder;
-    }
-
-
-    /**
-     * Gets the restrictedPicklist value for this Field.
-     * 
-     * @return restrictedPicklist
-     */
-    public boolean isRestrictedPicklist() {
-        return restrictedPicklist;
-    }
-
-
-    /**
-     * Sets the restrictedPicklist value for this Field.
-     * 
-     * @param restrictedPicklist
-     */
-    public void setRestrictedPicklist(boolean restrictedPicklist) {
-        this.restrictedPicklist = restrictedPicklist;
-    }
-
-
-    /**
-     * Gets the scale value for this Field.
-     * 
-     * @return scale
-     */
-    public int getScale() {
-        return scale;
-    }
-
-
-    /**
-     * Sets the scale value for this Field.
-     * 
-     * @param scale
-     */
-    public void setScale(int scale) {
-        this.scale = scale;
-    }
-
-
-    /**
-     * Gets the soapType value for this Field.
-     * 
-     * @return soapType
-     */
-    public com.sforce.soap.partner.SoapType getSoapType() {
-        return soapType;
-    }
-
-
-    /**
-     * Sets the soapType value for this Field.
-     * 
-     * @param soapType
-     */
-    public void setSoapType(com.sforce.soap.partner.SoapType soapType) {
-        this.soapType = soapType;
-    }
-
-
-    /**
-     * Gets the sortable value for this Field.
-     * 
-     * @return sortable
-     */
-    public java.lang.Boolean getSortable() {
-        return sortable;
-    }
-
-
-    /**
-     * Sets the sortable value for this Field.
-     * 
-     * @param sortable
-     */
-    public void setSortable(java.lang.Boolean sortable) {
-        this.sortable = sortable;
-    }
-
-
-    /**
-     * Gets the type value for this Field.
-     * 
-     * @return type
-     */
-    public com.sforce.soap.partner.FieldType getType() {
-        return type;
-    }
-
-
-    /**
-     * Sets the type value for this Field.
-     * 
-     * @param type
-     */
-    public void setType(com.sforce.soap.partner.FieldType type) {
-        this.type = type;
-    }
-
-
-    /**
-     * Gets the unique value for this Field.
-     * 
-     * @return unique
-     */
-    public boolean isUnique() {
-        return unique;
-    }
-
-
-    /**
-     * Sets the unique value for this Field.
-     * 
-     * @param unique
-     */
-    public void setUnique(boolean unique) {
-        this.unique = unique;
-    }
-
-
-    /**
-     * Gets the updateable value for this Field.
-     * 
-     * @return updateable
-     */
-    public boolean isUpdateable() {
-        return updateable;
-    }
-
-
-    /**
-     * Sets the updateable value for this Field.
-     * 
-     * @param updateable
-     */
-    public void setUpdateable(boolean updateable) {
-        this.updateable = updateable;
-    }
-
-
-    /**
-     * Gets the writeRequiresMasterRead value for this Field.
-     * 
-     * @return writeRequiresMasterRead
-     */
-    public java.lang.Boolean getWriteRequiresMasterRead() {
-        return writeRequiresMasterRead;
-    }
-
-
-    /**
-     * Sets the writeRequiresMasterRead value for this Field.
-     * 
-     * @param writeRequiresMasterRead
-     */
-    public void setWriteRequiresMasterRead(java.lang.Boolean writeRequiresMasterRead) {
-        this.writeRequiresMasterRead = writeRequiresMasterRead;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Field)) return false;
-        Field other = (Field) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            this.autoNumber == other.isAutoNumber() &&
-            this.byteLength == other.getByteLength() &&
-            this.calculated == other.isCalculated() &&
-            ((this.calculatedFormula==null && other.getCalculatedFormula()==null) || 
-             (this.calculatedFormula!=null &&
-              this.calculatedFormula.equals(other.getCalculatedFormula()))) &&
-            this.caseSensitive == other.isCaseSensitive() &&
-            ((this.controllerName==null && other.getControllerName()==null) || 
-             (this.controllerName!=null &&
-              this.controllerName.equals(other.getControllerName()))) &&
-            this.createable == other.isCreateable() &&
-            this.custom == other.isCustom() &&
-            ((this.defaultValueFormula==null && other.getDefaultValueFormula()==null) || 
-             (this.defaultValueFormula!=null &&
-              this.defaultValueFormula.equals(other.getDefaultValueFormula()))) &&
-            this.defaultedOnCreate == other.isDefaultedOnCreate() &&
-            ((this.dependentPicklist==null && other.getDependentPicklist()==null) || 
-             (this.dependentPicklist!=null &&
-              this.dependentPicklist.equals(other.getDependentPicklist()))) &&
-            this.digits == other.getDigits() &&
-            ((this.externalId==null && other.getExternalId()==null) || 
-             (this.externalId!=null &&
-              this.externalId.equals(other.getExternalId()))) &&
-            this.filterable == other.isFilterable() &&
-            ((this.htmlFormatted==null && other.getHtmlFormatted()==null) || 
-             (this.htmlFormatted!=null &&
-              this.htmlFormatted.equals(other.getHtmlFormatted()))) &&
-            this.idLookup == other.isIdLookup() &&
-            ((this.inlineHelpText==null && other.getInlineHelpText()==null) || 
-             (this.inlineHelpText!=null &&
-              this.inlineHelpText.equals(other.getInlineHelpText()))) &&
-            ((this.label==null && other.getLabel()==null) || 
-             (this.label!=null &&
-              this.label.equals(other.getLabel()))) &&
-            this.length == other.getLength() &&
-            ((this.name==null && other.getName()==null) || 
-             (this.name!=null &&
-              this.name.equals(other.getName()))) &&
-            this.nameField == other.isNameField() &&
-            ((this.namePointing==null && other.getNamePointing()==null) || 
-             (this.namePointing!=null &&
-              this.namePointing.equals(other.getNamePointing()))) &&
-            this.nillable == other.isNillable() &&
-            ((this.picklistValues==null && other.getPicklistValues()==null) || 
-             (this.picklistValues!=null &&
-              java.util.Arrays.equals(this.picklistValues, other.getPicklistValues()))) &&
-            this.precision == other.getPrecision() &&
-            ((this.referenceTo==null && other.getReferenceTo()==null) || 
-             (this.referenceTo!=null &&
-              java.util.Arrays.equals(this.referenceTo, other.getReferenceTo()))) &&
-            ((this.relationshipName==null && other.getRelationshipName()==null) || 
-             (this.relationshipName!=null &&
-              this.relationshipName.equals(other.getRelationshipName()))) &&
-            ((this.relationshipOrder==null && other.getRelationshipOrder()==null) || 
-             (this.relationshipOrder!=null &&
-              this.relationshipOrder.equals(other.getRelationshipOrder()))) &&
-            this.restrictedPicklist == other.isRestrictedPicklist() &&
-            this.scale == other.getScale() &&
-            ((this.soapType==null && other.getSoapType()==null) || 
-             (this.soapType!=null &&
-              this.soapType.equals(other.getSoapType()))) &&
-            ((this.sortable==null && other.getSortable()==null) || 
-             (this.sortable!=null &&
-              this.sortable.equals(other.getSortable()))) &&
-            ((this.type==null && other.getType()==null) || 
-             (this.type!=null &&
-              this.type.equals(other.getType()))) &&
-            this.unique == other.isUnique() &&
-            this.updateable == other.isUpdateable() &&
-            ((this.writeRequiresMasterRead==null && other.getWriteRequiresMasterRead()==null) || 
-             (this.writeRequiresMasterRead!=null &&
-              this.writeRequiresMasterRead.equals(other.getWriteRequiresMasterRead())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isAutoNumber() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += getByteLength();
-        _hashCode += (isCalculated() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getCalculatedFormula() != null) {
-            _hashCode += getCalculatedFormula().hashCode();
-        }
-        _hashCode += (isCaseSensitive() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getControllerName() != null) {
-            _hashCode += getControllerName().hashCode();
-        }
-        _hashCode += (isCreateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isCustom() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getDefaultValueFormula() != null) {
-            _hashCode += getDefaultValueFormula().hashCode();
-        }
-        _hashCode += (isDefaultedOnCreate() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getDependentPicklist() != null) {
-            _hashCode += getDependentPicklist().hashCode();
-        }
-        _hashCode += getDigits();
-        if (getExternalId() != null) {
-            _hashCode += getExternalId().hashCode();
-        }
-        _hashCode += (isFilterable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getHtmlFormatted() != null) {
-            _hashCode += getHtmlFormatted().hashCode();
-        }
-        _hashCode += (isIdLookup() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getInlineHelpText() != null) {
-            _hashCode += getInlineHelpText().hashCode();
-        }
-        if (getLabel() != null) {
-            _hashCode += getLabel().hashCode();
-        }
-        _hashCode += getLength();
-        if (getName() != null) {
-            _hashCode += getName().hashCode();
-        }
-        _hashCode += (isNameField() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getNamePointing() != null) {
-            _hashCode += getNamePointing().hashCode();
-        }
-        _hashCode += (isNillable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getPicklistValues() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getPicklistValues());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getPicklistValues(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        _hashCode += getPrecision();
-        if (getReferenceTo() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getReferenceTo());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getReferenceTo(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getRelationshipName() != null) {
-            _hashCode += getRelationshipName().hashCode();
-        }
-        if (getRelationshipOrder() != null) {
-            _hashCode += getRelationshipOrder().hashCode();
-        }
-        _hashCode += (isRestrictedPicklist() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += getScale();
-        if (getSoapType() != null) {
-            _hashCode += getSoapType().hashCode();
-        }
-        if (getSortable() != null) {
-            _hashCode += getSortable().hashCode();
-        }
-        if (getType() != null) {
-            _hashCode += getType().hashCode();
-        }
-        _hashCode += (isUnique() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isUpdateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getWriteRequiresMasterRead() != null) {
-            _hashCode += getWriteRequiresMasterRead().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Field.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("autoNumber");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "autoNumber"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("byteLength");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "byteLength"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("calculated");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "calculated"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("calculatedFormula");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "calculatedFormula"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("caseSensitive");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "caseSensitive"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("controllerName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "controllerName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("createable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "createable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("custom");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "custom"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("defaultValueFormula");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "defaultValueFormula"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("defaultedOnCreate");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "defaultedOnCreate"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("dependentPicklist");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "dependentPicklist"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("digits");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "digits"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("externalId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "externalId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("filterable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "filterable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("htmlFormatted");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "htmlFormatted"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("idLookup");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "idLookup"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("inlineHelpText");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "inlineHelpText"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("label");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "label"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("length");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "length"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("name");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("nameField");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "nameField"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("namePointing");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "namePointing"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("nillable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "nillable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("picklistValues");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "picklistValues"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistEntry"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("precision");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "precision"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("referenceTo");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "referenceTo"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("relationshipName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("relationshipOrder");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipOrder"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("restrictedPicklist");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "restrictedPicklist"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("scale");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "scale"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("soapType");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("sortable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sortable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("type");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "type"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldType"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("unique");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "unique"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("updateable");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "updateable"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("writeRequiresMasterRead");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "writeRequiresMasterRead"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * Field.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class Field  implements java.io.Serializable {
+    private boolean autoNumber;
+
+    private int byteLength;
+
+    private boolean calculated;
+
+    private java.lang.String calculatedFormula;
+
+    private boolean caseSensitive;
+
+    private java.lang.String controllerName;
+
+    private boolean createable;
+
+    private boolean custom;
+
+    private java.lang.String defaultValueFormula;
+
+    private boolean defaultedOnCreate;
+
+    private java.lang.Boolean dependentPicklist;
+
+    private boolean deprecatedAndHidden;
+
+    private int digits;
+
+    private java.lang.Boolean externalId;
+
+    private boolean filterable;
+
+    private java.lang.Boolean htmlFormatted;
+
+    private boolean idLookup;
+
+    private java.lang.String inlineHelpText;
+
+    private java.lang.String label;
+
+    private int length;
+
+    private java.lang.String name;
+
+    private boolean nameField;
+
+    private java.lang.Boolean namePointing;
+
+    private boolean nillable;
+
+    private com.sforce.soap.partner.PicklistEntry[] picklistValues;
+
+    private int precision;
+
+    private java.lang.String[] referenceTo;
+
+    private java.lang.String relationshipName;
+
+    private java.lang.Integer relationshipOrder;
+
+    private boolean restrictedPicklist;
+
+    private int scale;
+
+    private com.sforce.soap.partner.SoapType soapType;
+
+    private java.lang.Boolean sortable;
+
+    private com.sforce.soap.partner.FieldType type;
+
+    private boolean unique;
+
+    private boolean updateable;
+
+    private java.lang.Boolean writeRequiresMasterRead;
+
+    public Field() {
+    }
+
+    public Field(
+           boolean autoNumber,
+           int byteLength,
+           boolean calculated,
+           java.lang.String calculatedFormula,
+           boolean caseSensitive,
+           java.lang.String controllerName,
+           boolean createable,
+           boolean custom,
+           java.lang.String defaultValueFormula,
+           boolean defaultedOnCreate,
+           java.lang.Boolean dependentPicklist,
+           boolean deprecatedAndHidden,
+           int digits,
+           java.lang.Boolean externalId,
+           boolean filterable,
+           java.lang.Boolean htmlFormatted,
+           boolean idLookup,
+           java.lang.String inlineHelpText,
+           java.lang.String label,
+           int length,
+           java.lang.String name,
+           boolean nameField,
+           java.lang.Boolean namePointing,
+           boolean nillable,
+           com.sforce.soap.partner.PicklistEntry[] picklistValues,
+           int precision,
+           java.lang.String[] referenceTo,
+           java.lang.String relationshipName,
+           java.lang.Integer relationshipOrder,
+           boolean restrictedPicklist,
+           int scale,
+           com.sforce.soap.partner.SoapType soapType,
+           java.lang.Boolean sortable,
+           com.sforce.soap.partner.FieldType type,
+           boolean unique,
+           boolean updateable,
+           java.lang.Boolean writeRequiresMasterRead) {
+           this.autoNumber = autoNumber;
+           this.byteLength = byteLength;
+           this.calculated = calculated;
+           this.calculatedFormula = calculatedFormula;
+           this.caseSensitive = caseSensitive;
+           this.controllerName = controllerName;
+           this.createable = createable;
+           this.custom = custom;
+           this.defaultValueFormula = defaultValueFormula;
+           this.defaultedOnCreate = defaultedOnCreate;
+           this.dependentPicklist = dependentPicklist;
+           this.deprecatedAndHidden = deprecatedAndHidden;
+           this.digits = digits;
+           this.externalId = externalId;
+           this.filterable = filterable;
+           this.htmlFormatted = htmlFormatted;
+           this.idLookup = idLookup;
+           this.inlineHelpText = inlineHelpText;
+           this.label = label;
+           this.length = length;
+           this.name = name;
+           this.nameField = nameField;
+           this.namePointing = namePointing;
+           this.nillable = nillable;
+           this.picklistValues = picklistValues;
+           this.precision = precision;
+           this.referenceTo = referenceTo;
+           this.relationshipName = relationshipName;
+           this.relationshipOrder = relationshipOrder;
+           this.restrictedPicklist = restrictedPicklist;
+           this.scale = scale;
+           this.soapType = soapType;
+           this.sortable = sortable;
+           this.type = type;
+           this.unique = unique;
+           this.updateable = updateable;
+           this.writeRequiresMasterRead = writeRequiresMasterRead;
+    }
+
+
+    /**
+     * Gets the autoNumber value for this Field.
+     * 
+     * @return autoNumber
+     */
+    public boolean isAutoNumber() {
+        return autoNumber;
+    }
+
+
+    /**
+     * Sets the autoNumber value for this Field.
+     * 
+     * @param autoNumber
+     */
+    public void setAutoNumber(boolean autoNumber) {
+        this.autoNumber = autoNumber;
+    }
+
+
+    /**
+     * Gets the byteLength value for this Field.
+     * 
+     * @return byteLength
+     */
+    public int getByteLength() {
+        return byteLength;
+    }
+
+
+    /**
+     * Sets the byteLength value for this Field.
+     * 
+     * @param byteLength
+     */
+    public void setByteLength(int byteLength) {
+        this.byteLength = byteLength;
+    }
+
+
+    /**
+     * Gets the calculated value for this Field.
+     * 
+     * @return calculated
+     */
+    public boolean isCalculated() {
+        return calculated;
+    }
+
+
+    /**
+     * Sets the calculated value for this Field.
+     * 
+     * @param calculated
+     */
+    public void setCalculated(boolean calculated) {
+        this.calculated = calculated;
+    }
+
+
+    /**
+     * Gets the calculatedFormula value for this Field.
+     * 
+     * @return calculatedFormula
+     */
+    public java.lang.String getCalculatedFormula() {
+        return calculatedFormula;
+    }
+
+
+    /**
+     * Sets the calculatedFormula value for this Field.
+     * 
+     * @param calculatedFormula
+     */
+    public void setCalculatedFormula(java.lang.String calculatedFormula) {
+        this.calculatedFormula = calculatedFormula;
+    }
+
+
+    /**
+     * Gets the caseSensitive value for this Field.
+     * 
+     * @return caseSensitive
+     */
+    public boolean isCaseSensitive() {
+        return caseSensitive;
+    }
+
+
+    /**
+     * Sets the caseSensitive value for this Field.
+     * 
+     * @param caseSensitive
+     */
+    public void setCaseSensitive(boolean caseSensitive) {
+        this.caseSensitive = caseSensitive;
+    }
+
+
+    /**
+     * Gets the controllerName value for this Field.
+     * 
+     * @return controllerName
+     */
+    public java.lang.String getControllerName() {
+        return controllerName;
+    }
+
+
+    /**
+     * Sets the controllerName value for this Field.
+     * 
+     * @param controllerName
+     */
+    public void setControllerName(java.lang.String controllerName) {
+        this.controllerName = controllerName;
+    }
+
+
+    /**
+     * Gets the createable value for this Field.
+     * 
+     * @return createable
+     */
+    public boolean isCreateable() {
+        return createable;
+    }
+
+
+    /**
+     * Sets the createable value for this Field.
+     * 
+     * @param createable
+     */
+    public void setCreateable(boolean createable) {
+        this.createable = createable;
+    }
+
+
+    /**
+     * Gets the custom value for this Field.
+     * 
+     * @return custom
+     */
+    public boolean isCustom() {
+        return custom;
+    }
+
+
+    /**
+     * Sets the custom value for this Field.
+     * 
+     * @param custom
+     */
+    public void setCustom(boolean custom) {
+        this.custom = custom;
+    }
+
+
+    /**
+     * Gets the defaultValueFormula value for this Field.
+     * 
+     * @return defaultValueFormula
+     */
+    public java.lang.String getDefaultValueFormula() {
+        return defaultValueFormula;
+    }
+
+
+    /**
+     * Sets the defaultValueFormula value for this Field.
+     * 
+     * @param defaultValueFormula
+     */
+    public void setDefaultValueFormula(java.lang.String defaultValueFormula) {
+        this.defaultValueFormula = defaultValueFormula;
+    }
+
+
+    /**
+     * Gets the defaultedOnCreate value for this Field.
+     * 
+     * @return defaultedOnCreate
+     */
+    public boolean isDefaultedOnCreate() {
+        return defaultedOnCreate;
+    }
+
+
+    /**
+     * Sets the defaultedOnCreate value for this Field.
+     * 
+     * @param defaultedOnCreate
+     */
+    public void setDefaultedOnCreate(boolean defaultedOnCreate) {
+        this.defaultedOnCreate = defaultedOnCreate;
+    }
+
+
+    /**
+     * Gets the dependentPicklist value for this Field.
+     * 
+     * @return dependentPicklist
+     */
+    public java.lang.Boolean getDependentPicklist() {
+        return dependentPicklist;
+    }
+
+
+    /**
+     * Sets the dependentPicklist value for this Field.
+     * 
+     * @param dependentPicklist
+     */
+    public void setDependentPicklist(java.lang.Boolean dependentPicklist) {
+        this.dependentPicklist = dependentPicklist;
+    }
+
+
+    /**
+     * Gets the deprecatedAndHidden value for this Field.
+     * 
+     * @return deprecatedAndHidden
+     */
+    public boolean isDeprecatedAndHidden() {
+        return deprecatedAndHidden;
+    }
+
+
+    /**
+     * Sets the deprecatedAndHidden value for this Field.
+     * 
+     * @param deprecatedAndHidden
+     */
+    public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
+        this.deprecatedAndHidden = deprecatedAndHidden;
+    }
+
+
+    /**
+     * Gets the digits value for this Field.
+     * 
+     * @return digits
+     */
+    public int getDigits() {
+        return digits;
+    }
+
+
+    /**
+     * Sets the digits value for this Field.
+     * 
+     * @param digits
+     */
+    public void setDigits(int digits) {
+        this.digits = digits;
+    }
+
+
+    /**
+     * Gets the externalId value for this Field.
+     * 
+     * @return externalId
+     */
+    public java.lang.Boolean getExternalId() {
+        return externalId;
+    }
+
+
+    /**
+     * Sets the externalId value for this Field.
+     * 
+     * @param externalId
+     */
+    public void setExternalId(java.lang.Boolean externalId) {
+        this.externalId = externalId;
+    }
+
+
+    /**
+     * Gets the filterable value for this Field.
+     * 
+     * @return filterable
+     */
+    public boolean isFilterable() {
+        return filterable;
+    }
+
+
+    /**
+     * Sets the filterable value for this Field.
+     * 
+     * @param filterable
+     */
+    public void setFilterable(boolean filterable) {
+        this.filterable = filterable;
+    }
+
+
+    /**
+     * Gets the htmlFormatted value for this Field.
+     * 
+     * @return htmlFormatted
+     */
+    public java.lang.Boolean getHtmlFormatted() {
+        return htmlFormatted;
+    }
+
+
+    /**
+     * Sets the htmlFormatted value for this Field.
+     * 
+     * @param htmlFormatted
+     */
+    public void setHtmlFormatted(java.lang.Boolean htmlFormatted) {
+        this.htmlFormatted = htmlFormatted;
+    }
+
+
+    /**
+     * Gets the idLookup value for this Field.
+     * 
+     * @return idLookup
+     */
+    public boolean isIdLookup() {
+        return idLookup;
+    }
+
+
+    /**
+     * Sets the idLookup value for this Field.
+     * 
+     * @param idLookup
+     */
+    public void setIdLookup(boolean idLookup) {
+        this.idLookup = idLookup;
+    }
+
+
+    /**
+     * Gets the inlineHelpText value for this Field.
+     * 
+     * @return inlineHelpText
+     */
+    public java.lang.String getInlineHelpText() {
+        return inlineHelpText;
+    }
+
+
+    /**
+     * Sets the inlineHelpText value for this Field.
+     * 
+     * @param inlineHelpText
+     */
+    public void setInlineHelpText(java.lang.String inlineHelpText) {
+        this.inlineHelpText = inlineHelpText;
+    }
+
+
+    /**
+     * Gets the label value for this Field.
+     * 
+     * @return label
+     */
+    public java.lang.String getLabel() {
+        return label;
+    }
+
+
+    /**
+     * Sets the label value for this Field.
+     * 
+     * @param label
+     */
+    public void setLabel(java.lang.String label) {
+        this.label = label;
+    }
+
+
+    /**
+     * Gets the length value for this Field.
+     * 
+     * @return length
+     */
+    public int getLength() {
+        return length;
+    }
+
+
+    /**
+     * Sets the length value for this Field.
+     * 
+     * @param length
+     */
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+
+    /**
+     * Gets the name value for this Field.
+     * 
+     * @return name
+     */
+    public java.lang.String getName() {
+        return name;
+    }
+
+
+    /**
+     * Sets the name value for this Field.
+     * 
+     * @param name
+     */
+    public void setName(java.lang.String name) {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the nameField value for this Field.
+     * 
+     * @return nameField
+     */
+    public boolean isNameField() {
+        return nameField;
+    }
+
+
+    /**
+     * Sets the nameField value for this Field.
+     * 
+     * @param nameField
+     */
+    public void setNameField(boolean nameField) {
+        this.nameField = nameField;
+    }
+
+
+    /**
+     * Gets the namePointing value for this Field.
+     * 
+     * @return namePointing
+     */
+    public java.lang.Boolean getNamePointing() {
+        return namePointing;
+    }
+
+
+    /**
+     * Sets the namePointing value for this Field.
+     * 
+     * @param namePointing
+     */
+    public void setNamePointing(java.lang.Boolean namePointing) {
+        this.namePointing = namePointing;
+    }
+
+
+    /**
+     * Gets the nillable value for this Field.
+     * 
+     * @return nillable
+     */
+    public boolean isNillable() {
+        return nillable;
+    }
+
+
+    /**
+     * Sets the nillable value for this Field.
+     * 
+     * @param nillable
+     */
+    public void setNillable(boolean nillable) {
+        this.nillable = nillable;
+    }
+
+
+    /**
+     * Gets the picklistValues value for this Field.
+     * 
+     * @return picklistValues
+     */
+    public com.sforce.soap.partner.PicklistEntry[] getPicklistValues() {
+        return picklistValues;
+    }
+
+
+    /**
+     * Sets the picklistValues value for this Field.
+     * 
+     * @param picklistValues
+     */
+    public void setPicklistValues(com.sforce.soap.partner.PicklistEntry[] picklistValues) {
+        this.picklistValues = picklistValues;
+    }
+
+    public com.sforce.soap.partner.PicklistEntry getPicklistValues(int i) {
+        return this.picklistValues[i];
+    }
+
+    public void setPicklistValues(int i, com.sforce.soap.partner.PicklistEntry _value) {
+        this.picklistValues[i] = _value;
+    }
+
+
+    /**
+     * Gets the precision value for this Field.
+     * 
+     * @return precision
+     */
+    public int getPrecision() {
+        return precision;
+    }
+
+
+    /**
+     * Sets the precision value for this Field.
+     * 
+     * @param precision
+     */
+    public void setPrecision(int precision) {
+        this.precision = precision;
+    }
+
+
+    /**
+     * Gets the referenceTo value for this Field.
+     * 
+     * @return referenceTo
+     */
+    public java.lang.String[] getReferenceTo() {
+        return referenceTo;
+    }
+
+
+    /**
+     * Sets the referenceTo value for this Field.
+     * 
+     * @param referenceTo
+     */
+    public void setReferenceTo(java.lang.String[] referenceTo) {
+        this.referenceTo = referenceTo;
+    }
+
+    public java.lang.String getReferenceTo(int i) {
+        return this.referenceTo[i];
+    }
+
+    public void setReferenceTo(int i, java.lang.String _value) {
+        this.referenceTo[i] = _value;
+    }
+
+
+    /**
+     * Gets the relationshipName value for this Field.
+     * 
+     * @return relationshipName
+     */
+    public java.lang.String getRelationshipName() {
+        return relationshipName;
+    }
+
+
+    /**
+     * Sets the relationshipName value for this Field.
+     * 
+     * @param relationshipName
+     */
+    public void setRelationshipName(java.lang.String relationshipName) {
+        this.relationshipName = relationshipName;
+    }
+
+
+    /**
+     * Gets the relationshipOrder value for this Field.
+     * 
+     * @return relationshipOrder
+     */
+    public java.lang.Integer getRelationshipOrder() {
+        return relationshipOrder;
+    }
+
+
+    /**
+     * Sets the relationshipOrder value for this Field.
+     * 
+     * @param relationshipOrder
+     */
+    public void setRelationshipOrder(java.lang.Integer relationshipOrder) {
+        this.relationshipOrder = relationshipOrder;
+    }
+
+
+    /**
+     * Gets the restrictedPicklist value for this Field.
+     * 
+     * @return restrictedPicklist
+     */
+    public boolean isRestrictedPicklist() {
+        return restrictedPicklist;
+    }
+
+
+    /**
+     * Sets the restrictedPicklist value for this Field.
+     * 
+     * @param restrictedPicklist
+     */
+    public void setRestrictedPicklist(boolean restrictedPicklist) {
+        this.restrictedPicklist = restrictedPicklist;
+    }
+
+
+    /**
+     * Gets the scale value for this Field.
+     * 
+     * @return scale
+     */
+    public int getScale() {
+        return scale;
+    }
+
+
+    /**
+     * Sets the scale value for this Field.
+     * 
+     * @param scale
+     */
+    public void setScale(int scale) {
+        this.scale = scale;
+    }
+
+
+    /**
+     * Gets the soapType value for this Field.
+     * 
+     * @return soapType
+     */
+    public com.sforce.soap.partner.SoapType getSoapType() {
+        return soapType;
+    }
+
+
+    /**
+     * Sets the soapType value for this Field.
+     * 
+     * @param soapType
+     */
+    public void setSoapType(com.sforce.soap.partner.SoapType soapType) {
+        this.soapType = soapType;
+    }
+
+
+    /**
+     * Gets the sortable value for this Field.
+     * 
+     * @return sortable
+     */
+    public java.lang.Boolean getSortable() {
+        return sortable;
+    }
+
+
+    /**
+     * Sets the sortable value for this Field.
+     * 
+     * @param sortable
+     */
+    public void setSortable(java.lang.Boolean sortable) {
+        this.sortable = sortable;
+    }
+
+
+    /**
+     * Gets the type value for this Field.
+     * 
+     * @return type
+     */
+    public com.sforce.soap.partner.FieldType getType() {
+        return type;
+    }
+
+
+    /**
+     * Sets the type value for this Field.
+     * 
+     * @param type
+     */
+    public void setType(com.sforce.soap.partner.FieldType type) {
+        this.type = type;
+    }
+
+
+    /**
+     * Gets the unique value for this Field.
+     * 
+     * @return unique
+     */
+    public boolean isUnique() {
+        return unique;
+    }
+
+
+    /**
+     * Sets the unique value for this Field.
+     * 
+     * @param unique
+     */
+    public void setUnique(boolean unique) {
+        this.unique = unique;
+    }
+
+
+    /**
+     * Gets the updateable value for this Field.
+     * 
+     * @return updateable
+     */
+    public boolean isUpdateable() {
+        return updateable;
+    }
+
+
+    /**
+     * Sets the updateable value for this Field.
+     * 
+     * @param updateable
+     */
+    public void setUpdateable(boolean updateable) {
+        this.updateable = updateable;
+    }
+
+
+    /**
+     * Gets the writeRequiresMasterRead value for this Field.
+     * 
+     * @return writeRequiresMasterRead
+     */
+    public java.lang.Boolean getWriteRequiresMasterRead() {
+        return writeRequiresMasterRead;
+    }
+
+
+    /**
+     * Sets the writeRequiresMasterRead value for this Field.
+     * 
+     * @param writeRequiresMasterRead
+     */
+    public void setWriteRequiresMasterRead(java.lang.Boolean writeRequiresMasterRead) {
+        this.writeRequiresMasterRead = writeRequiresMasterRead;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof Field)) return false;
+        Field other = (Field) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.autoNumber == other.isAutoNumber() &&
+            this.byteLength == other.getByteLength() &&
+            this.calculated == other.isCalculated() &&
+            ((this.calculatedFormula==null && other.getCalculatedFormula()==null) || 
+             (this.calculatedFormula!=null &&
+              this.calculatedFormula.equals(other.getCalculatedFormula()))) &&
+            this.caseSensitive == other.isCaseSensitive() &&
+            ((this.controllerName==null && other.getControllerName()==null) || 
+             (this.controllerName!=null &&
+              this.controllerName.equals(other.getControllerName()))) &&
+            this.createable == other.isCreateable() &&
+            this.custom == other.isCustom() &&
+            ((this.defaultValueFormula==null && other.getDefaultValueFormula()==null) || 
+             (this.defaultValueFormula!=null &&
+              this.defaultValueFormula.equals(other.getDefaultValueFormula()))) &&
+            this.defaultedOnCreate == other.isDefaultedOnCreate() &&
+            ((this.dependentPicklist==null && other.getDependentPicklist()==null) || 
+             (this.dependentPicklist!=null &&
+              this.dependentPicklist.equals(other.getDependentPicklist()))) &&
+            this.deprecatedAndHidden == other.isDeprecatedAndHidden() &&
+            this.digits == other.getDigits() &&
+            ((this.externalId==null && other.getExternalId()==null) || 
+             (this.externalId!=null &&
+              this.externalId.equals(other.getExternalId()))) &&
+            this.filterable == other.isFilterable() &&
+            ((this.htmlFormatted==null && other.getHtmlFormatted()==null) || 
+             (this.htmlFormatted!=null &&
+              this.htmlFormatted.equals(other.getHtmlFormatted()))) &&
+            this.idLookup == other.isIdLookup() &&
+            ((this.inlineHelpText==null && other.getInlineHelpText()==null) || 
+             (this.inlineHelpText!=null &&
+              this.inlineHelpText.equals(other.getInlineHelpText()))) &&
+            ((this.label==null && other.getLabel()==null) || 
+             (this.label!=null &&
+              this.label.equals(other.getLabel()))) &&
+            this.length == other.getLength() &&
+            ((this.name==null && other.getName()==null) || 
+             (this.name!=null &&
+              this.name.equals(other.getName()))) &&
+            this.nameField == other.isNameField() &&
+            ((this.namePointing==null && other.getNamePointing()==null) || 
+             (this.namePointing!=null &&
+              this.namePointing.equals(other.getNamePointing()))) &&
+            this.nillable == other.isNillable() &&
+            ((this.picklistValues==null && other.getPicklistValues()==null) || 
+             (this.picklistValues!=null &&
+              java.util.Arrays.equals(this.picklistValues, other.getPicklistValues()))) &&
+            this.precision == other.getPrecision() &&
+            ((this.referenceTo==null && other.getReferenceTo()==null) || 
+             (this.referenceTo!=null &&
+              java.util.Arrays.equals(this.referenceTo, other.getReferenceTo()))) &&
+            ((this.relationshipName==null && other.getRelationshipName()==null) || 
+             (this.relationshipName!=null &&
+              this.relationshipName.equals(other.getRelationshipName()))) &&
+            ((this.relationshipOrder==null && other.getRelationshipOrder()==null) || 
+             (this.relationshipOrder!=null &&
+              this.relationshipOrder.equals(other.getRelationshipOrder()))) &&
+            this.restrictedPicklist == other.isRestrictedPicklist() &&
+            this.scale == other.getScale() &&
+            ((this.soapType==null && other.getSoapType()==null) || 
+             (this.soapType!=null &&
+              this.soapType.equals(other.getSoapType()))) &&
+            ((this.sortable==null && other.getSortable()==null) || 
+             (this.sortable!=null &&
+              this.sortable.equals(other.getSortable()))) &&
+            ((this.type==null && other.getType()==null) || 
+             (this.type!=null &&
+              this.type.equals(other.getType()))) &&
+            this.unique == other.isUnique() &&
+            this.updateable == other.isUpdateable() &&
+            ((this.writeRequiresMasterRead==null && other.getWriteRequiresMasterRead()==null) || 
+             (this.writeRequiresMasterRead!=null &&
+              this.writeRequiresMasterRead.equals(other.getWriteRequiresMasterRead())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += (isAutoNumber() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += getByteLength();
+        _hashCode += (isCalculated() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getCalculatedFormula() != null) {
+            _hashCode += getCalculatedFormula().hashCode();
+        }
+        _hashCode += (isCaseSensitive() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getControllerName() != null) {
+            _hashCode += getControllerName().hashCode();
+        }
+        _hashCode += (isCreateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isCustom() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getDefaultValueFormula() != null) {
+            _hashCode += getDefaultValueFormula().hashCode();
+        }
+        _hashCode += (isDefaultedOnCreate() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getDependentPicklist() != null) {
+            _hashCode += getDependentPicklist().hashCode();
+        }
+        _hashCode += (isDeprecatedAndHidden() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += getDigits();
+        if (getExternalId() != null) {
+            _hashCode += getExternalId().hashCode();
+        }
+        _hashCode += (isFilterable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getHtmlFormatted() != null) {
+            _hashCode += getHtmlFormatted().hashCode();
+        }
+        _hashCode += (isIdLookup() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getInlineHelpText() != null) {
+            _hashCode += getInlineHelpText().hashCode();
+        }
+        if (getLabel() != null) {
+            _hashCode += getLabel().hashCode();
+        }
+        _hashCode += getLength();
+        if (getName() != null) {
+            _hashCode += getName().hashCode();
+        }
+        _hashCode += (isNameField() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getNamePointing() != null) {
+            _hashCode += getNamePointing().hashCode();
+        }
+        _hashCode += (isNillable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getPicklistValues() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getPicklistValues());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getPicklistValues(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        _hashCode += getPrecision();
+        if (getReferenceTo() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getReferenceTo());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getReferenceTo(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getRelationshipName() != null) {
+            _hashCode += getRelationshipName().hashCode();
+        }
+        if (getRelationshipOrder() != null) {
+            _hashCode += getRelationshipOrder().hashCode();
+        }
+        _hashCode += (isRestrictedPicklist() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += getScale();
+        if (getSoapType() != null) {
+            _hashCode += getSoapType().hashCode();
+        }
+        if (getSortable() != null) {
+            _hashCode += getSortable().hashCode();
+        }
+        if (getType() != null) {
+            _hashCode += getType().hashCode();
+        }
+        _hashCode += (isUnique() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isUpdateable() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getWriteRequiresMasterRead() != null) {
+            _hashCode += getWriteRequiresMasterRead().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(Field.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("autoNumber");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "autoNumber"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("byteLength");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "byteLength"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("calculated");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "calculated"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("calculatedFormula");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "calculatedFormula"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("caseSensitive");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "caseSensitive"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("controllerName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "controllerName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("createable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "createable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("custom");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "custom"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("defaultValueFormula");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "defaultValueFormula"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("defaultedOnCreate");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "defaultedOnCreate"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("dependentPicklist");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "dependentPicklist"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("deprecatedAndHidden");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "deprecatedAndHidden"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("digits");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "digits"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("externalId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "externalId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("filterable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "filterable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("htmlFormatted");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "htmlFormatted"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("idLookup");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "idLookup"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("inlineHelpText");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "inlineHelpText"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("label");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "label"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("length");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "length"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("name");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("nameField");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "nameField"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("namePointing");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "namePointing"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("nillable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "nillable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("picklistValues");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "picklistValues"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistEntry"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("precision");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "precision"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("referenceTo");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "referenceTo"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("relationshipName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("relationshipOrder");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "relationshipOrder"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("restrictedPicklist");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "restrictedPicklist"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("scale");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "scale"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("soapType");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("sortable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sortable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("type");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "type"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldType"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("unique");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "unique"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("updateable");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "updateable"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("writeRequiresMasterRead");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "writeRequiresMasterRead"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/GetUserInfoResult.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/GetUserInfoResult.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/GetUserInfoResult.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,755 +1,787 @@
-/**
- * GetUserInfoResult.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class GetUserInfoResult  implements java.io.Serializable {
-    private boolean accessibilityMode;
-
-    private java.lang.String currencySymbol;
-
-    private java.lang.String orgDefaultCurrencyIsoCode;
-
-    private boolean orgHasPersonAccounts;
-
-    private java.lang.String organizationId;
-
-    private boolean organizationMultiCurrency;
-
-    private java.lang.String organizationName;
-
-    private java.lang.String profileId;
-
-    private java.lang.String roleId;
-
-    private java.lang.String userDefaultCurrencyIsoCode;
-
-    private java.lang.String userEmail;
-
-    private java.lang.String userFullName;
-
-    private java.lang.String userId;
-
-    private java.lang.String userLanguage;
-
-    private java.lang.String userLocale;
-
-    private java.lang.String userName;
-
-    private java.lang.String userTimeZone;
-
-    private java.lang.String userType;
-
-    private java.lang.String userUiSkin;
-
-    public GetUserInfoResult() {
-    }
-
-    public GetUserInfoResult(
-           boolean accessibilityMode,
-           java.lang.String currencySymbol,
-           java.lang.String orgDefaultCurrencyIsoCode,
-           boolean orgHasPersonAccounts,
-           java.lang.String organizationId,
-           boolean organizationMultiCurrency,
-           java.lang.String organizationName,
-           java.lang.String profileId,
-           java.lang.String roleId,
-           java.lang.String userDefaultCurrencyIsoCode,
-           java.lang.String userEmail,
-           java.lang.String userFullName,
-           java.lang.String userId,
-           java.lang.String userLanguage,
-           java.lang.String userLocale,
-           java.lang.String userName,
-           java.lang.String userTimeZone,
-           java.lang.String userType,
-           java.lang.String userUiSkin) {
-           this.accessibilityMode = accessibilityMode;
-           this.currencySymbol = currencySymbol;
-           this.orgDefaultCurrencyIsoCode = orgDefaultCurrencyIsoCode;
-           this.orgHasPersonAccounts = orgHasPersonAccounts;
-           this.organizationId = organizationId;
-           this.organizationMultiCurrency = organizationMultiCurrency;
-           this.organizationName = organizationName;
-           this.profileId = profileId;
-           this.roleId = roleId;
-           this.userDefaultCurrencyIsoCode = userDefaultCurrencyIsoCode;
-           this.userEmail = userEmail;
-           this.userFullName = userFullName;
-           this.userId = userId;
-           this.userLanguage = userLanguage;
-           this.userLocale = userLocale;
-           this.userName = userName;
-           this.userTimeZone = userTimeZone;
-           this.userType = userType;
-           this.userUiSkin = userUiSkin;
-    }
-
-
-    /**
-     * Gets the accessibilityMode value for this GetUserInfoResult.
-     * 
-     * @return accessibilityMode
-     */
-    public boolean isAccessibilityMode() {
-        return accessibilityMode;
-    }
-
-
-    /**
-     * Sets the accessibilityMode value for this GetUserInfoResult.
-     * 
-     * @param accessibilityMode
-     */
-    public void setAccessibilityMode(boolean accessibilityMode) {
-        this.accessibilityMode = accessibilityMode;
-    }
-
-
-    /**
-     * Gets the currencySymbol value for this GetUserInfoResult.
-     * 
-     * @return currencySymbol
-     */
-    public java.lang.String getCurrencySymbol() {
-        return currencySymbol;
-    }
-
-
-    /**
-     * Sets the currencySymbol value for this GetUserInfoResult.
-     * 
-     * @param currencySymbol
-     */
-    public void setCurrencySymbol(java.lang.String currencySymbol) {
-        this.currencySymbol = currencySymbol;
-    }
-
-
-    /**
-     * Gets the orgDefaultCurrencyIsoCode value for this GetUserInfoResult.
-     * 
-     * @return orgDefaultCurrencyIsoCode
-     */
-    public java.lang.String getOrgDefaultCurrencyIsoCode() {
-        return orgDefaultCurrencyIsoCode;
-    }
-
-
-    /**
-     * Sets the orgDefaultCurrencyIsoCode value for this GetUserInfoResult.
-     * 
-     * @param orgDefaultCurrencyIsoCode
-     */
-    public void setOrgDefaultCurrencyIsoCode(java.lang.String orgDefaultCurrencyIsoCode) {
-        this.orgDefaultCurrencyIsoCode = orgDefaultCurrencyIsoCode;
-    }
-
-
-    /**
-     * Gets the orgHasPersonAccounts value for this GetUserInfoResult.
-     * 
-     * @return orgHasPersonAccounts
-     */
-    public boolean isOrgHasPersonAccounts() {
-        return orgHasPersonAccounts;
-    }
-
-
-    /**
-     * Sets the orgHasPersonAccounts value for this GetUserInfoResult.
-     * 
-     * @param orgHasPersonAccounts
-     */
-    public void setOrgHasPersonAccounts(boolean orgHasPersonAccounts) {
-        this.orgHasPersonAccounts = orgHasPersonAccounts;
-    }
-
-
-    /**
-     * Gets the organizationId value for this GetUserInfoResult.
-     * 
-     * @return organizationId
-     */
-    public java.lang.String getOrganizationId() {
-        return organizationId;
-    }
-
-
-    /**
-     * Sets the organizationId value for this GetUserInfoResult.
-     * 
-     * @param organizationId
-     */
-    public void setOrganizationId(java.lang.String organizationId) {
-        this.organizationId = organizationId;
-    }
-
-
-    /**
-     * Gets the organizationMultiCurrency value for this GetUserInfoResult.
-     * 
-     * @return organizationMultiCurrency
-     */
-    public boolean isOrganizationMultiCurrency() {
-        return organizationMultiCurrency;
-    }
-
-
-    /**
-     * Sets the organizationMultiCurrency value for this GetUserInfoResult.
-     * 
-     * @param organizationMultiCurrency
-     */
-    public void setOrganizationMultiCurrency(boolean organizationMultiCurrency) {
-        this.organizationMultiCurrency = organizationMultiCurrency;
-    }
-
-
-    /**
-     * Gets the organizationName value for this GetUserInfoResult.
-     * 
-     * @return organizationName
-     */
-    public java.lang.String getOrganizationName() {
-        return organizationName;
-    }
-
-
-    /**
-     * Sets the organizationName value for this GetUserInfoResult.
-     * 
-     * @param organizationName
-     */
-    public void setOrganizationName(java.lang.String organizationName) {
-        this.organizationName = organizationName;
-    }
-
-
-    /**
-     * Gets the profileId value for this GetUserInfoResult.
-     * 
-     * @return profileId
-     */
-    public java.lang.String getProfileId() {
-        return profileId;
-    }
-
-
-    /**
-     * Sets the profileId value for this GetUserInfoResult.
-     * 
-     * @param profileId
-     */
-    public void setProfileId(java.lang.String profileId) {
-        this.profileId = profileId;
-    }
-
-
-    /**
-     * Gets the roleId value for this GetUserInfoResult.
-     * 
-     * @return roleId
-     */
-    public java.lang.String getRoleId() {
-        return roleId;
-    }
-
-
-    /**
-     * Sets the roleId value for this GetUserInfoResult.
-     * 
-     * @param roleId
-     */
-    public void setRoleId(java.lang.String roleId) {
-        this.roleId = roleId;
-    }
-
-
-    /**
-     * Gets the userDefaultCurrencyIsoCode value for this GetUserInfoResult.
-     * 
-     * @return userDefaultCurrencyIsoCode
-     */
-    public java.lang.String getUserDefaultCurrencyIsoCode() {
-        return userDefaultCurrencyIsoCode;
-    }
-
-
-    /**
-     * Sets the userDefaultCurrencyIsoCode value for this GetUserInfoResult.
-     * 
-     * @param userDefaultCurrencyIsoCode
-     */
-    public void setUserDefaultCurrencyIsoCode(java.lang.String userDefaultCurrencyIsoCode) {
-        this.userDefaultCurrencyIsoCode = userDefaultCurrencyIsoCode;
-    }
-
-
-    /**
-     * Gets the userEmail value for this GetUserInfoResult.
-     * 
-     * @return userEmail
-     */
-    public java.lang.String getUserEmail() {
-        return userEmail;
-    }
-
-
-    /**
-     * Sets the userEmail value for this GetUserInfoResult.
-     * 
-     * @param userEmail
-     */
-    public void setUserEmail(java.lang.String userEmail) {
-        this.userEmail = userEmail;
-    }
-
-
-    /**
-     * Gets the userFullName value for this GetUserInfoResult.
-     * 
-     * @return userFullName
-     */
-    public java.lang.String getUserFullName() {
-        return userFullName;
-    }
-
-
-    /**
-     * Sets the userFullName value for this GetUserInfoResult.
-     * 
-     * @param userFullName
-     */
-    public void setUserFullName(java.lang.String userFullName) {
-        this.userFullName = userFullName;
-    }
-
-
-    /**
-     * Gets the userId value for this GetUserInfoResult.
-     * 
-     * @return userId
-     */
-    public java.lang.String getUserId() {
-        return userId;
-    }
-
-
-    /**
-     * Sets the userId value for this GetUserInfoResult.
-     * 
-     * @param userId
-     */
-    public void setUserId(java.lang.String userId) {
-        this.userId = userId;
-    }
-
-
-    /**
-     * Gets the userLanguage value for this GetUserInfoResult.
-     * 
-     * @return userLanguage
-     */
-    public java.lang.String getUserLanguage() {
-        return userLanguage;
-    }
-
-
-    /**
-     * Sets the userLanguage value for this GetUserInfoResult.
-     * 
-     * @param userLanguage
-     */
-    public void setUserLanguage(java.lang.String userLanguage) {
-        this.userLanguage = userLanguage;
-    }
-
-
-    /**
-     * Gets the userLocale value for this GetUserInfoResult.
-     * 
-     * @return userLocale
-     */
-    public java.lang.String getUserLocale() {
-        return userLocale;
-    }
-
-
-    /**
-     * Sets the userLocale value for this GetUserInfoResult.
-     * 
-     * @param userLocale
-     */
-    public void setUserLocale(java.lang.String userLocale) {
-        this.userLocale = userLocale;
-    }
-
-
-    /**
-     * Gets the userName value for this GetUserInfoResult.
-     * 
-     * @return userName
-     */
-    public java.lang.String getUserName() {
-        return userName;
-    }
-
-
-    /**
-     * Sets the userName value for this GetUserInfoResult.
-     * 
-     * @param userName
-     */
-    public void setUserName(java.lang.String userName) {
-        this.userName = userName;
-    }
-
-
-    /**
-     * Gets the userTimeZone value for this GetUserInfoResult.
-     * 
-     * @return userTimeZone
-     */
-    public java.lang.String getUserTimeZone() {
-        return userTimeZone;
-    }
-
-
-    /**
-     * Sets the userTimeZone value for this GetUserInfoResult.
-     * 
-     * @param userTimeZone
-     */
-    public void setUserTimeZone(java.lang.String userTimeZone) {
-        this.userTimeZone = userTimeZone;
-    }
-
-
-    /**
-     * Gets the userType value for this GetUserInfoResult.
-     * 
-     * @return userType
-     */
-    public java.lang.String getUserType() {
-        return userType;
-    }
-
-
-    /**
-     * Sets the userType value for this GetUserInfoResult.
-     * 
-     * @param userType
-     */
-    public void setUserType(java.lang.String userType) {
-        this.userType = userType;
-    }
-
-
-    /**
-     * Gets the userUiSkin value for this GetUserInfoResult.
-     * 
-     * @return userUiSkin
-     */
-    public java.lang.String getUserUiSkin() {
-        return userUiSkin;
-    }
-
-
-    /**
-     * Sets the userUiSkin value for this GetUserInfoResult.
-     * 
-     * @param userUiSkin
-     */
-    public void setUserUiSkin(java.lang.String userUiSkin) {
-        this.userUiSkin = userUiSkin;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof GetUserInfoResult)) return false;
-        GetUserInfoResult other = (GetUserInfoResult) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true && 
-            this.accessibilityMode == other.isAccessibilityMode() &&
-            ((this.currencySymbol==null && other.getCurrencySymbol()==null) || 
-             (this.currencySymbol!=null &&
-              this.currencySymbol.equals(other.getCurrencySymbol()))) &&
-            ((this.orgDefaultCurrencyIsoCode==null && other.getOrgDefaultCurrencyIsoCode()==null) || 
-             (this.orgDefaultCurrencyIsoCode!=null &&
-              this.orgDefaultCurrencyIsoCode.equals(other.getOrgDefaultCurrencyIsoCode()))) &&
-            this.orgHasPersonAccounts == other.isOrgHasPersonAccounts() &&
-            ((this.organizationId==null && other.getOrganizationId()==null) || 
-             (this.organizationId!=null &&
-              this.organizationId.equals(other.getOrganizationId()))) &&
-            this.organizationMultiCurrency == other.isOrganizationMultiCurrency() &&
-            ((this.organizationName==null && other.getOrganizationName()==null) || 
-             (this.organizationName!=null &&
-              this.organizationName.equals(other.getOrganizationName()))) &&
-            ((this.profileId==null && other.getProfileId()==null) || 
-             (this.profileId!=null &&
-              this.profileId.equals(other.getProfileId()))) &&
-            ((this.roleId==null && other.getRoleId()==null) || 
-             (this.roleId!=null &&
-              this.roleId.equals(other.getRoleId()))) &&
-            ((this.userDefaultCurrencyIsoCode==null && other.getUserDefaultCurrencyIsoCode()==null) || 
-             (this.userDefaultCurrencyIsoCode!=null &&
-              this.userDefaultCurrencyIsoCode.equals(other.getUserDefaultCurrencyIsoCode()))) &&
-            ((this.userEmail==null && other.getUserEmail()==null) || 
-             (this.userEmail!=null &&
-              this.userEmail.equals(other.getUserEmail()))) &&
-            ((this.userFullName==null && other.getUserFullName()==null) || 
-             (this.userFullName!=null &&
-              this.userFullName.equals(other.getUserFullName()))) &&
-            ((this.userId==null && other.getUserId()==null) || 
-             (this.userId!=null &&
-              this.userId.equals(other.getUserId()))) &&
-            ((this.userLanguage==null && other.getUserLanguage()==null) || 
-             (this.userLanguage!=null &&
-              this.userLanguage.equals(other.getUserLanguage()))) &&
-            ((this.userLocale==null && other.getUserLocale()==null) || 
-             (this.userLocale!=null &&
-              this.userLocale.equals(other.getUserLocale()))) &&
-            ((this.userName==null && other.getUserName()==null) || 
-             (this.userName!=null &&
-              this.userName.equals(other.getUserName()))) &&
-            ((this.userTimeZone==null && other.getUserTimeZone()==null) || 
-             (this.userTimeZone!=null &&
-              this.userTimeZone.equals(other.getUserTimeZone()))) &&
-            ((this.userType==null && other.getUserType()==null) || 
-             (this.userType!=null &&
-              this.userType.equals(other.getUserType()))) &&
-            ((this.userUiSkin==null && other.getUserUiSkin()==null) || 
-             (this.userUiSkin!=null &&
-              this.userUiSkin.equals(other.getUserUiSkin())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isAccessibilityMode() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getCurrencySymbol() != null) {
-            _hashCode += getCurrencySymbol().hashCode();
-        }
-        if (getOrgDefaultCurrencyIsoCode() != null) {
-            _hashCode += getOrgDefaultCurrencyIsoCode().hashCode();
-        }
-        _hashCode += (isOrgHasPersonAccounts() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getOrganizationId() != null) {
-            _hashCode += getOrganizationId().hashCode();
-        }
-        _hashCode += (isOrganizationMultiCurrency() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        if (getOrganizationName() != null) {
-            _hashCode += getOrganizationName().hashCode();
-        }
-        if (getProfileId() != null) {
-            _hashCode += getProfileId().hashCode();
-        }
-        if (getRoleId() != null) {
-            _hashCode += getRoleId().hashCode();
-        }
-        if (getUserDefaultCurrencyIsoCode() != null) {
-            _hashCode += getUserDefaultCurrencyIsoCode().hashCode();
-        }
-        if (getUserEmail() != null) {
-            _hashCode += getUserEmail().hashCode();
-        }
-        if (getUserFullName() != null) {
-            _hashCode += getUserFullName().hashCode();
-        }
-        if (getUserId() != null) {
-            _hashCode += getUserId().hashCode();
-        }
-        if (getUserLanguage() != null) {
-            _hashCode += getUserLanguage().hashCode();
-        }
-        if (getUserLocale() != null) {
-            _hashCode += getUserLocale().hashCode();
-        }
-        if (getUserName() != null) {
-            _hashCode += getUserName().hashCode();
-        }
-        if (getUserTimeZone() != null) {
-            _hashCode += getUserTimeZone().hashCode();
-        }
-        if (getUserType() != null) {
-            _hashCode += getUserType().hashCode();
-        }
-        if (getUserUiSkin() != null) {
-            _hashCode += getUserUiSkin().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(GetUserInfoResult.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("accessibilityMode");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "accessibilityMode"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("currencySymbol");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "currencySymbol"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("orgDefaultCurrencyIsoCode");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgDefaultCurrencyIsoCode"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("orgHasPersonAccounts");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgHasPersonAccounts"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("organizationId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("organizationMultiCurrency");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationMultiCurrency"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("organizationName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("profileId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "profileId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("roleId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "roleId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userDefaultCurrencyIsoCode");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userDefaultCurrencyIsoCode"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userEmail");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userEmail"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userFullName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userFullName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userLanguage");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userLanguage"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userLocale");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userLocale"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userName");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userName"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userTimeZone");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userTimeZone"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userType");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userType"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("userUiSkin");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userUiSkin"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(false);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * GetUserInfoResult.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class GetUserInfoResult  implements java.io.Serializable {
+    private boolean accessibilityMode;
+
+    private java.lang.String currencySymbol;
+
+    private java.lang.String orgDefaultCurrencyIsoCode;
+
+    private boolean orgDisallowHtmlAttachments;
+
+    private boolean orgHasPersonAccounts;
+
+    private java.lang.String organizationId;
+
+    private boolean organizationMultiCurrency;
+
+    private java.lang.String organizationName;
+
+    private java.lang.String profileId;
+
+    private java.lang.String roleId;
+
+    private java.lang.String userDefaultCurrencyIsoCode;
+
+    private java.lang.String userEmail;
+
+    private java.lang.String userFullName;
+
+    private java.lang.String userId;
+
+    private java.lang.String userLanguage;
+
+    private java.lang.String userLocale;
+
+    private java.lang.String userName;
+
+    private java.lang.String userTimeZone;
+
+    private java.lang.String userType;
+
+    private java.lang.String userUiSkin;
+
+    public GetUserInfoResult() {
+    }
+
+    public GetUserInfoResult(
+           boolean accessibilityMode,
+           java.lang.String currencySymbol,
+           java.lang.String orgDefaultCurrencyIsoCode,
+           boolean orgDisallowHtmlAttachments,
+           boolean orgHasPersonAccounts,
+           java.lang.String organizationId,
+           boolean organizationMultiCurrency,
+           java.lang.String organizationName,
+           java.lang.String profileId,
+           java.lang.String roleId,
+           java.lang.String userDefaultCurrencyIsoCode,
+           java.lang.String userEmail,
+           java.lang.String userFullName,
+           java.lang.String userId,
+           java.lang.String userLanguage,
+           java.lang.String userLocale,
+           java.lang.String userName,
+           java.lang.String userTimeZone,
+           java.lang.String userType,
+           java.lang.String userUiSkin) {
+           this.accessibilityMode = accessibilityMode;
+           this.currencySymbol = currencySymbol;
+           this.orgDefaultCurrencyIsoCode = orgDefaultCurrencyIsoCode;
+           this.orgDisallowHtmlAttachments = orgDisallowHtmlAttachments;
+           this.orgHasPersonAccounts = orgHasPersonAccounts;
+           this.organizationId = organizationId;
+           this.organizationMultiCurrency = organizationMultiCurrency;
+           this.organizationName = organizationName;
+           this.profileId = profileId;
+           this.roleId = roleId;
+           this.userDefaultCurrencyIsoCode = userDefaultCurrencyIsoCode;
+           this.userEmail = userEmail;
+           this.userFullName = userFullName;
+           this.userId = userId;
+           this.userLanguage = userLanguage;
+           this.userLocale = userLocale;
+           this.userName = userName;
+           this.userTimeZone = userTimeZone;
+           this.userType = userType;
+           this.userUiSkin = userUiSkin;
+    }
+
+
+    /**
+     * Gets the accessibilityMode value for this GetUserInfoResult.
+     * 
+     * @return accessibilityMode
+     */
+    public boolean isAccessibilityMode() {
+        return accessibilityMode;
+    }
+
+
+    /**
+     * Sets the accessibilityMode value for this GetUserInfoResult.
+     * 
+     * @param accessibilityMode
+     */
+    public void setAccessibilityMode(boolean accessibilityMode) {
+        this.accessibilityMode = accessibilityMode;
+    }
+
+
+    /**
+     * Gets the currencySymbol value for this GetUserInfoResult.
+     * 
+     * @return currencySymbol
+     */
+    public java.lang.String getCurrencySymbol() {
+        return currencySymbol;
+    }
+
+
+    /**
+     * Sets the currencySymbol value for this GetUserInfoResult.
+     * 
+     * @param currencySymbol
+     */
+    public void setCurrencySymbol(java.lang.String currencySymbol) {
+        this.currencySymbol = currencySymbol;
+    }
+
+
+    /**
+     * Gets the orgDefaultCurrencyIsoCode value for this GetUserInfoResult.
+     * 
+     * @return orgDefaultCurrencyIsoCode
+     */
+    public java.lang.String getOrgDefaultCurrencyIsoCode() {
+        return orgDefaultCurrencyIsoCode;
+    }
+
+
+    /**
+     * Sets the orgDefaultCurrencyIsoCode value for this GetUserInfoResult.
+     * 
+     * @param orgDefaultCurrencyIsoCode
+     */
+    public void setOrgDefaultCurrencyIsoCode(java.lang.String orgDefaultCurrencyIsoCode) {
+        this.orgDefaultCurrencyIsoCode = orgDefaultCurrencyIsoCode;
+    }
+
+
+    /**
+     * Gets the orgDisallowHtmlAttachments value for this GetUserInfoResult.
+     * 
+     * @return orgDisallowHtmlAttachments
+     */
+    public boolean isOrgDisallowHtmlAttachments() {
+        return orgDisallowHtmlAttachments;
+    }
+
+
+    /**
+     * Sets the orgDisallowHtmlAttachments value for this GetUserInfoResult.
+     * 
+     * @param orgDisallowHtmlAttachments
+     */
+    public void setOrgDisallowHtmlAttachments(boolean orgDisallowHtmlAttachments) {
+        this.orgDisallowHtmlAttachments = orgDisallowHtmlAttachments;
+    }
+
+
+    /**
+     * Gets the orgHasPersonAccounts value for this GetUserInfoResult.
+     * 
+     * @return orgHasPersonAccounts
+     */
+    public boolean isOrgHasPersonAccounts() {
+        return orgHasPersonAccounts;
+    }
+
+
+    /**
+     * Sets the orgHasPersonAccounts value for this GetUserInfoResult.
+     * 
+     * @param orgHasPersonAccounts
+     */
+    public void setOrgHasPersonAccounts(boolean orgHasPersonAccounts) {
+        this.orgHasPersonAccounts = orgHasPersonAccounts;
+    }
+
+
+    /**
+     * Gets the organizationId value for this GetUserInfoResult.
+     * 
+     * @return organizationId
+     */
+    public java.lang.String getOrganizationId() {
+        return organizationId;
+    }
+
+
+    /**
+     * Sets the organizationId value for this GetUserInfoResult.
+     * 
+     * @param organizationId
+     */
+    public void setOrganizationId(java.lang.String organizationId) {
+        this.organizationId = organizationId;
+    }
+
+
+    /**
+     * Gets the organizationMultiCurrency value for this GetUserInfoResult.
+     * 
+     * @return organizationMultiCurrency
+     */
+    public boolean isOrganizationMultiCurrency() {
+        return organizationMultiCurrency;
+    }
+
+
+    /**
+     * Sets the organizationMultiCurrency value for this GetUserInfoResult.
+     * 
+     * @param organizationMultiCurrency
+     */
+    public void setOrganizationMultiCurrency(boolean organizationMultiCurrency) {
+        this.organizationMultiCurrency = organizationMultiCurrency;
+    }
+
+
+    /**
+     * Gets the organizationName value for this GetUserInfoResult.
+     * 
+     * @return organizationName
+     */
+    public java.lang.String getOrganizationName() {
+        return organizationName;
+    }
+
+
+    /**
+     * Sets the organizationName value for this GetUserInfoResult.
+     * 
+     * @param organizationName
+     */
+    public void setOrganizationName(java.lang.String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+
+    /**
+     * Gets the profileId value for this GetUserInfoResult.
+     * 
+     * @return profileId
+     */
+    public java.lang.String getProfileId() {
+        return profileId;
+    }
+
+
+    /**
+     * Sets the profileId value for this GetUserInfoResult.
+     * 
+     * @param profileId
+     */
+    public void setProfileId(java.lang.String profileId) {
+        this.profileId = profileId;
+    }
+
+
+    /**
+     * Gets the roleId value for this GetUserInfoResult.
+     * 
+     * @return roleId
+     */
+    public java.lang.String getRoleId() {
+        return roleId;
+    }
+
+
+    /**
+     * Sets the roleId value for this GetUserInfoResult.
+     * 
+     * @param roleId
+     */
+    public void setRoleId(java.lang.String roleId) {
+        this.roleId = roleId;
+    }
+
+
+    /**
+     * Gets the userDefaultCurrencyIsoCode value for this GetUserInfoResult.
+     * 
+     * @return userDefaultCurrencyIsoCode
+     */
+    public java.lang.String getUserDefaultCurrencyIsoCode() {
+        return userDefaultCurrencyIsoCode;
+    }
+
+
+    /**
+     * Sets the userDefaultCurrencyIsoCode value for this GetUserInfoResult.
+     * 
+     * @param userDefaultCurrencyIsoCode
+     */
+    public void setUserDefaultCurrencyIsoCode(java.lang.String userDefaultCurrencyIsoCode) {
+        this.userDefaultCurrencyIsoCode = userDefaultCurrencyIsoCode;
+    }
+
+
+    /**
+     * Gets the userEmail value for this GetUserInfoResult.
+     * 
+     * @return userEmail
+     */
+    public java.lang.String getUserEmail() {
+        return userEmail;
+    }
+
+
+    /**
+     * Sets the userEmail value for this GetUserInfoResult.
+     * 
+     * @param userEmail
+     */
+    public void setUserEmail(java.lang.String userEmail) {
+        this.userEmail = userEmail;
+    }
+
+
+    /**
+     * Gets the userFullName value for this GetUserInfoResult.
+     * 
+     * @return userFullName
+     */
+    public java.lang.String getUserFullName() {
+        return userFullName;
+    }
+
+
+    /**
+     * Sets the userFullName value for this GetUserInfoResult.
+     * 
+     * @param userFullName
+     */
+    public void setUserFullName(java.lang.String userFullName) {
+        this.userFullName = userFullName;
+    }
+
+
+    /**
+     * Gets the userId value for this GetUserInfoResult.
+     * 
+     * @return userId
+     */
+    public java.lang.String getUserId() {
+        return userId;
+    }
+
+
+    /**
+     * Sets the userId value for this GetUserInfoResult.
+     * 
+     * @param userId
+     */
+    public void setUserId(java.lang.String userId) {
+        this.userId = userId;
+    }
+
+
+    /**
+     * Gets the userLanguage value for this GetUserInfoResult.
+     * 
+     * @return userLanguage
+     */
+    public java.lang.String getUserLanguage() {
+        return userLanguage;
+    }
+
+
+    /**
+     * Sets the userLanguage value for this GetUserInfoResult.
+     * 
+     * @param userLanguage
+     */
+    public void setUserLanguage(java.lang.String userLanguage) {
+        this.userLanguage = userLanguage;
+    }
+
+
+    /**
+     * Gets the userLocale value for this GetUserInfoResult.
+     * 
+     * @return userLocale
+     */
+    public java.lang.String getUserLocale() {
+        return userLocale;
+    }
+
+
+    /**
+     * Sets the userLocale value for this GetUserInfoResult.
+     * 
+     * @param userLocale
+     */
+    public void setUserLocale(java.lang.String userLocale) {
+        this.userLocale = userLocale;
+    }
+
+
+    /**
+     * Gets the userName value for this GetUserInfoResult.
+     * 
+     * @return userName
+     */
+    public java.lang.String getUserName() {
+        return userName;
+    }
+
+
+    /**
+     * Sets the userName value for this GetUserInfoResult.
+     * 
+     * @param userName
+     */
+    public void setUserName(java.lang.String userName) {
+        this.userName = userName;
+    }
+
+
+    /**
+     * Gets the userTimeZone value for this GetUserInfoResult.
+     * 
+     * @return userTimeZone
+     */
+    public java.lang.String getUserTimeZone() {
+        return userTimeZone;
+    }
+
+
+    /**
+     * Sets the userTimeZone value for this GetUserInfoResult.
+     * 
+     * @param userTimeZone
+     */
+    public void setUserTimeZone(java.lang.String userTimeZone) {
+        this.userTimeZone = userTimeZone;
+    }
+
+
+    /**
+     * Gets the userType value for this GetUserInfoResult.
+     * 
+     * @return userType
+     */
+    public java.lang.String getUserType() {
+        return userType;
+    }
+
+
+    /**
+     * Sets the userType value for this GetUserInfoResult.
+     * 
+     * @param userType
+     */
+    public void setUserType(java.lang.String userType) {
+        this.userType = userType;
+    }
+
+
+    /**
+     * Gets the userUiSkin value for this GetUserInfoResult.
+     * 
+     * @return userUiSkin
+     */
+    public java.lang.String getUserUiSkin() {
+        return userUiSkin;
+    }
+
+
+    /**
+     * Sets the userUiSkin value for this GetUserInfoResult.
+     * 
+     * @param userUiSkin
+     */
+    public void setUserUiSkin(java.lang.String userUiSkin) {
+        this.userUiSkin = userUiSkin;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof GetUserInfoResult)) return false;
+        GetUserInfoResult other = (GetUserInfoResult) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.accessibilityMode == other.isAccessibilityMode() &&
+            ((this.currencySymbol==null && other.getCurrencySymbol()==null) || 
+             (this.currencySymbol!=null &&
+              this.currencySymbol.equals(other.getCurrencySymbol()))) &&
+            ((this.orgDefaultCurrencyIsoCode==null && other.getOrgDefaultCurrencyIsoCode()==null) || 
+             (this.orgDefaultCurrencyIsoCode!=null &&
+              this.orgDefaultCurrencyIsoCode.equals(other.getOrgDefaultCurrencyIsoCode()))) &&
+            this.orgDisallowHtmlAttachments == other.isOrgDisallowHtmlAttachments() &&
+            this.orgHasPersonAccounts == other.isOrgHasPersonAccounts() &&
+            ((this.organizationId==null && other.getOrganizationId()==null) || 
+             (this.organizationId!=null &&
+              this.organizationId.equals(other.getOrganizationId()))) &&
+            this.organizationMultiCurrency == other.isOrganizationMultiCurrency() &&
+            ((this.organizationName==null && other.getOrganizationName()==null) || 
+             (this.organizationName!=null &&
+              this.organizationName.equals(other.getOrganizationName()))) &&
+            ((this.profileId==null && other.getProfileId()==null) || 
+             (this.profileId!=null &&
+              this.profileId.equals(other.getProfileId()))) &&
+            ((this.roleId==null && other.getRoleId()==null) || 
+             (this.roleId!=null &&
+              this.roleId.equals(other.getRoleId()))) &&
+            ((this.userDefaultCurrencyIsoCode==null && other.getUserDefaultCurrencyIsoCode()==null) || 
+             (this.userDefaultCurrencyIsoCode!=null &&
+              this.userDefaultCurrencyIsoCode.equals(other.getUserDefaultCurrencyIsoCode()))) &&
+            ((this.userEmail==null && other.getUserEmail()==null) || 
+             (this.userEmail!=null &&
+              this.userEmail.equals(other.getUserEmail()))) &&
+            ((this.userFullName==null && other.getUserFullName()==null) || 
+             (this.userFullName!=null &&
+              this.userFullName.equals(other.getUserFullName()))) &&
+            ((this.userId==null && other.getUserId()==null) || 
+             (this.userId!=null &&
+              this.userId.equals(other.getUserId()))) &&
+            ((this.userLanguage==null && other.getUserLanguage()==null) || 
+             (this.userLanguage!=null &&
+              this.userLanguage.equals(other.getUserLanguage()))) &&
+            ((this.userLocale==null && other.getUserLocale()==null) || 
+             (this.userLocale!=null &&
+              this.userLocale.equals(other.getUserLocale()))) &&
+            ((this.userName==null && other.getUserName()==null) || 
+             (this.userName!=null &&
+              this.userName.equals(other.getUserName()))) &&
+            ((this.userTimeZone==null && other.getUserTimeZone()==null) || 
+             (this.userTimeZone!=null &&
+              this.userTimeZone.equals(other.getUserTimeZone()))) &&
+            ((this.userType==null && other.getUserType()==null) || 
+             (this.userType!=null &&
+              this.userType.equals(other.getUserType()))) &&
+            ((this.userUiSkin==null && other.getUserUiSkin()==null) || 
+             (this.userUiSkin!=null &&
+              this.userUiSkin.equals(other.getUserUiSkin())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += (isAccessibilityMode() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getCurrencySymbol() != null) {
+            _hashCode += getCurrencySymbol().hashCode();
+        }
+        if (getOrgDefaultCurrencyIsoCode() != null) {
+            _hashCode += getOrgDefaultCurrencyIsoCode().hashCode();
+        }
+        _hashCode += (isOrgDisallowHtmlAttachments() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        _hashCode += (isOrgHasPersonAccounts() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getOrganizationId() != null) {
+            _hashCode += getOrganizationId().hashCode();
+        }
+        _hashCode += (isOrganizationMultiCurrency() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+        if (getOrganizationName() != null) {
+            _hashCode += getOrganizationName().hashCode();
+        }
+        if (getProfileId() != null) {
+            _hashCode += getProfileId().hashCode();
+        }
+        if (getRoleId() != null) {
+            _hashCode += getRoleId().hashCode();
+        }
+        if (getUserDefaultCurrencyIsoCode() != null) {
+            _hashCode += getUserDefaultCurrencyIsoCode().hashCode();
+        }
+        if (getUserEmail() != null) {
+            _hashCode += getUserEmail().hashCode();
+        }
+        if (getUserFullName() != null) {
+            _hashCode += getUserFullName().hashCode();
+        }
+        if (getUserId() != null) {
+            _hashCode += getUserId().hashCode();
+        }
+        if (getUserLanguage() != null) {
+            _hashCode += getUserLanguage().hashCode();
+        }
+        if (getUserLocale() != null) {
+            _hashCode += getUserLocale().hashCode();
+        }
+        if (getUserName() != null) {
+            _hashCode += getUserName().hashCode();
+        }
+        if (getUserTimeZone() != null) {
+            _hashCode += getUserTimeZone().hashCode();
+        }
+        if (getUserType() != null) {
+            _hashCode += getUserType().hashCode();
+        }
+        if (getUserUiSkin() != null) {
+            _hashCode += getUserUiSkin().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(GetUserInfoResult.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("accessibilityMode");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "accessibilityMode"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("currencySymbol");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "currencySymbol"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("orgDefaultCurrencyIsoCode");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgDefaultCurrencyIsoCode"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("orgDisallowHtmlAttachments");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgDisallowHtmlAttachments"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("orgHasPersonAccounts");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgHasPersonAccounts"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("organizationId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("organizationMultiCurrency");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationMultiCurrency"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("organizationName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "organizationName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("profileId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "profileId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("roleId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "roleId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userDefaultCurrencyIsoCode");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userDefaultCurrencyIsoCode"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userEmail");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userEmail"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userFullName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userFullName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userLanguage");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userLanguage"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userLocale");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userLocale"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userName");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userName"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userTimeZone");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userTimeZone"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userType");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userType"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("userUiSkin");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userUiSkin"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Copied: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/PackageVersion.java (from rev 1724, trunk/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/PackageVersion.java)
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/PackageVersion.java	                        (rev 0)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/PackageVersion.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,183 @@
+/**
+ * PackageVersion.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class PackageVersion  implements java.io.Serializable {
+    private int majorNumber;
+
+    private int minorNumber;
+
+    private java.lang.String namespace;
+
+    public PackageVersion() {
+    }
+
+    public PackageVersion(
+           int majorNumber,
+           int minorNumber,
+           java.lang.String namespace) {
+           this.majorNumber = majorNumber;
+           this.minorNumber = minorNumber;
+           this.namespace = namespace;
+    }
+
+
+    /**
+     * Gets the majorNumber value for this PackageVersion.
+     * 
+     * @return majorNumber
+     */
+    public int getMajorNumber() {
+        return majorNumber;
+    }
+
+
+    /**
+     * Sets the majorNumber value for this PackageVersion.
+     * 
+     * @param majorNumber
+     */
+    public void setMajorNumber(int majorNumber) {
+        this.majorNumber = majorNumber;
+    }
+
+
+    /**
+     * Gets the minorNumber value for this PackageVersion.
+     * 
+     * @return minorNumber
+     */
+    public int getMinorNumber() {
+        return minorNumber;
+    }
+
+
+    /**
+     * Sets the minorNumber value for this PackageVersion.
+     * 
+     * @param minorNumber
+     */
+    public void setMinorNumber(int minorNumber) {
+        this.minorNumber = minorNumber;
+    }
+
+
+    /**
+     * Gets the namespace value for this PackageVersion.
+     * 
+     * @return namespace
+     */
+    public java.lang.String getNamespace() {
+        return namespace;
+    }
+
+
+    /**
+     * Sets the namespace value for this PackageVersion.
+     * 
+     * @param namespace
+     */
+    public void setNamespace(java.lang.String namespace) {
+        this.namespace = namespace;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof PackageVersion)) return false;
+        PackageVersion other = (PackageVersion) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = true && 
+            this.majorNumber == other.getMajorNumber() &&
+            this.minorNumber == other.getMinorNumber() &&
+            ((this.namespace==null && other.getNamespace()==null) || 
+             (this.namespace!=null &&
+              this.namespace.equals(other.getNamespace())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = 1;
+        _hashCode += getMajorNumber();
+        _hashCode += getMinorNumber();
+        if (getNamespace() != null) {
+            _hashCode += getNamespace().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(PackageVersion.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PackageVersion"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("majorNumber");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "majorNumber"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("minorNumber");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "minorNumber"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("namespace");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "namespace"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(false);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SforceServiceLocator.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SforceServiceLocator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SforceServiceLocator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,7 +26,7 @@
     }
 
     // Use to get a proxy class for Soap
-    private java.lang.String Soap_address = "https://www.salesforce.com/services/Soap/u/15.0";
+    private java.lang.String Soap_address = "https://www.salesforce.com/services/Soap/u/17.0";
 
     public java.lang.String getSoapAddress() {
         return Soap_address;

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SingleEmailMessage.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SingleEmailMessage.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SingleEmailMessage.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,581 +1,692 @@
-/**
- * SingleEmailMessage.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class SingleEmailMessage  extends com.sforce.soap.partner.Email  implements java.io.Serializable {
-    private java.lang.String[] bccAddresses;
-
-    private java.lang.String[] ccAddresses;
-
-    private java.lang.String charset;
-
-    private java.lang.String[] documentAttachments;
-
-    private java.lang.String htmlBody;
-
-    private com.sforce.soap.partner.EmailFileAttachment[] fileAttachments;
-
-    private java.lang.String plainTextBody;
-
-    private java.lang.String targetObjectId;
-
-    private java.lang.String templateId;
-
-    private java.lang.String[] toAddresses;
-
-    private java.lang.String whatId;
-
-    public SingleEmailMessage() {
-    }
-
-    public SingleEmailMessage(
-           java.lang.Boolean bccSender,
-           com.sforce.soap.partner.EmailPriority emailPriority,
-           java.lang.String replyTo,
-           java.lang.Boolean saveAsActivity,
-           java.lang.String senderDisplayName,
-           java.lang.String subject,
-           java.lang.Boolean useSignature,
-           java.lang.String[] bccAddresses,
-           java.lang.String[] ccAddresses,
-           java.lang.String charset,
-           java.lang.String[] documentAttachments,
-           java.lang.String htmlBody,
-           com.sforce.soap.partner.EmailFileAttachment[] fileAttachments,
-           java.lang.String plainTextBody,
-           java.lang.String targetObjectId,
-           java.lang.String templateId,
-           java.lang.String[] toAddresses,
-           java.lang.String whatId) {
-        super(
-            bccSender,
-            emailPriority,
-            replyTo,
-            saveAsActivity,
-            senderDisplayName,
-            subject,
-            useSignature);
-        this.bccAddresses = bccAddresses;
-        this.ccAddresses = ccAddresses;
-        this.charset = charset;
-        this.documentAttachments = documentAttachments;
-        this.htmlBody = htmlBody;
-        this.fileAttachments = fileAttachments;
-        this.plainTextBody = plainTextBody;
-        this.targetObjectId = targetObjectId;
-        this.templateId = templateId;
-        this.toAddresses = toAddresses;
-        this.whatId = whatId;
-    }
-
-
-    /**
-     * Gets the bccAddresses value for this SingleEmailMessage.
-     * 
-     * @return bccAddresses
-     */
-    public java.lang.String[] getBccAddresses() {
-        return bccAddresses;
-    }
-
-
-    /**
-     * Sets the bccAddresses value for this SingleEmailMessage.
-     * 
-     * @param bccAddresses
-     */
-    public void setBccAddresses(java.lang.String[] bccAddresses) {
-        this.bccAddresses = bccAddresses;
-    }
-
-    public java.lang.String getBccAddresses(int i) {
-        return this.bccAddresses[i];
-    }
-
-    public void setBccAddresses(int i, java.lang.String _value) {
-        this.bccAddresses[i] = _value;
-    }
-
-
-    /**
-     * Gets the ccAddresses value for this SingleEmailMessage.
-     * 
-     * @return ccAddresses
-     */
-    public java.lang.String[] getCcAddresses() {
-        return ccAddresses;
-    }
-
-
-    /**
-     * Sets the ccAddresses value for this SingleEmailMessage.
-     * 
-     * @param ccAddresses
-     */
-    public void setCcAddresses(java.lang.String[] ccAddresses) {
-        this.ccAddresses = ccAddresses;
-    }
-
-    public java.lang.String getCcAddresses(int i) {
-        return this.ccAddresses[i];
-    }
-
-    public void setCcAddresses(int i, java.lang.String _value) {
-        this.ccAddresses[i] = _value;
-    }
-
-
-    /**
-     * Gets the charset value for this SingleEmailMessage.
-     * 
-     * @return charset
-     */
-    public java.lang.String getCharset() {
-        return charset;
-    }
-
-
-    /**
-     * Sets the charset value for this SingleEmailMessage.
-     * 
-     * @param charset
-     */
-    public void setCharset(java.lang.String charset) {
-        this.charset = charset;
-    }
-
-
-    /**
-     * Gets the documentAttachments value for this SingleEmailMessage.
-     * 
-     * @return documentAttachments
-     */
-    public java.lang.String[] getDocumentAttachments() {
-        return documentAttachments;
-    }
-
-
-    /**
-     * Sets the documentAttachments value for this SingleEmailMessage.
-     * 
-     * @param documentAttachments
-     */
-    public void setDocumentAttachments(java.lang.String[] documentAttachments) {
-        this.documentAttachments = documentAttachments;
-    }
-
-    public java.lang.String getDocumentAttachments(int i) {
-        return this.documentAttachments[i];
-    }
-
-    public void setDocumentAttachments(int i, java.lang.String _value) {
-        this.documentAttachments[i] = _value;
-    }
-
-
-    /**
-     * Gets the htmlBody value for this SingleEmailMessage.
-     * 
-     * @return htmlBody
-     */
-    public java.lang.String getHtmlBody() {
-        return htmlBody;
-    }
-
-
-    /**
-     * Sets the htmlBody value for this SingleEmailMessage.
-     * 
-     * @param htmlBody
-     */
-    public void setHtmlBody(java.lang.String htmlBody) {
-        this.htmlBody = htmlBody;
-    }
-
-
-    /**
-     * Gets the fileAttachments value for this SingleEmailMessage.
-     * 
-     * @return fileAttachments
-     */
-    public com.sforce.soap.partner.EmailFileAttachment[] getFileAttachments() {
-        return fileAttachments;
-    }
-
-
-    /**
-     * Sets the fileAttachments value for this SingleEmailMessage.
-     * 
-     * @param fileAttachments
-     */
-    public void setFileAttachments(com.sforce.soap.partner.EmailFileAttachment[] fileAttachments) {
-        this.fileAttachments = fileAttachments;
-    }
-
-    public com.sforce.soap.partner.EmailFileAttachment getFileAttachments(int i) {
-        return this.fileAttachments[i];
-    }
-
-    public void setFileAttachments(int i, com.sforce.soap.partner.EmailFileAttachment _value) {
-        this.fileAttachments[i] = _value;
-    }
-
-
-    /**
-     * Gets the plainTextBody value for this SingleEmailMessage.
-     * 
-     * @return plainTextBody
-     */
-    public java.lang.String getPlainTextBody() {
-        return plainTextBody;
-    }
-
-
-    /**
-     * Sets the plainTextBody value for this SingleEmailMessage.
-     * 
-     * @param plainTextBody
-     */
-    public void setPlainTextBody(java.lang.String plainTextBody) {
-        this.plainTextBody = plainTextBody;
-    }
-
-
-    /**
-     * Gets the targetObjectId value for this SingleEmailMessage.
-     * 
-     * @return targetObjectId
-     */
-    public java.lang.String getTargetObjectId() {
-        return targetObjectId;
-    }
-
-
-    /**
-     * Sets the targetObjectId value for this SingleEmailMessage.
-     * 
-     * @param targetObjectId
-     */
-    public void setTargetObjectId(java.lang.String targetObjectId) {
-        this.targetObjectId = targetObjectId;
-    }
-
-
-    /**
-     * Gets the templateId value for this SingleEmailMessage.
-     * 
-     * @return templateId
-     */
-    public java.lang.String getTemplateId() {
-        return templateId;
-    }
-
-
-    /**
-     * Sets the templateId value for this SingleEmailMessage.
-     * 
-     * @param templateId
-     */
-    public void setTemplateId(java.lang.String templateId) {
-        this.templateId = templateId;
-    }
-
-
-    /**
-     * Gets the toAddresses value for this SingleEmailMessage.
-     * 
-     * @return toAddresses
-     */
-    public java.lang.String[] getToAddresses() {
-        return toAddresses;
-    }
-
-
-    /**
-     * Sets the toAddresses value for this SingleEmailMessage.
-     * 
-     * @param toAddresses
-     */
-    public void setToAddresses(java.lang.String[] toAddresses) {
-        this.toAddresses = toAddresses;
-    }
-
-    public java.lang.String getToAddresses(int i) {
-        return this.toAddresses[i];
-    }
-
-    public void setToAddresses(int i, java.lang.String _value) {
-        this.toAddresses[i] = _value;
-    }
-
-
-    /**
-     * Gets the whatId value for this SingleEmailMessage.
-     * 
-     * @return whatId
-     */
-    public java.lang.String getWhatId() {
-        return whatId;
-    }
-
-
-    /**
-     * Sets the whatId value for this SingleEmailMessage.
-     * 
-     * @param whatId
-     */
-    public void setWhatId(java.lang.String whatId) {
-        this.whatId = whatId;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof SingleEmailMessage)) return false;
-        SingleEmailMessage other = (SingleEmailMessage) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = super.equals(obj) && 
-            ((this.bccAddresses==null && other.getBccAddresses()==null) || 
-             (this.bccAddresses!=null &&
-              java.util.Arrays.equals(this.bccAddresses, other.getBccAddresses()))) &&
-            ((this.ccAddresses==null && other.getCcAddresses()==null) || 
-             (this.ccAddresses!=null &&
-              java.util.Arrays.equals(this.ccAddresses, other.getCcAddresses()))) &&
-            ((this.charset==null && other.getCharset()==null) || 
-             (this.charset!=null &&
-              this.charset.equals(other.getCharset()))) &&
-            ((this.documentAttachments==null && other.getDocumentAttachments()==null) || 
-             (this.documentAttachments!=null &&
-              java.util.Arrays.equals(this.documentAttachments, other.getDocumentAttachments()))) &&
-            ((this.htmlBody==null && other.getHtmlBody()==null) || 
-             (this.htmlBody!=null &&
-              this.htmlBody.equals(other.getHtmlBody()))) &&
-            ((this.fileAttachments==null && other.getFileAttachments()==null) || 
-             (this.fileAttachments!=null &&
-              java.util.Arrays.equals(this.fileAttachments, other.getFileAttachments()))) &&
-            ((this.plainTextBody==null && other.getPlainTextBody()==null) || 
-             (this.plainTextBody!=null &&
-              this.plainTextBody.equals(other.getPlainTextBody()))) &&
-            ((this.targetObjectId==null && other.getTargetObjectId()==null) || 
-             (this.targetObjectId!=null &&
-              this.targetObjectId.equals(other.getTargetObjectId()))) &&
-            ((this.templateId==null && other.getTemplateId()==null) || 
-             (this.templateId!=null &&
-              this.templateId.equals(other.getTemplateId()))) &&
-            ((this.toAddresses==null && other.getToAddresses()==null) || 
-             (this.toAddresses!=null &&
-              java.util.Arrays.equals(this.toAddresses, other.getToAddresses()))) &&
-            ((this.whatId==null && other.getWhatId()==null) || 
-             (this.whatId!=null &&
-              this.whatId.equals(other.getWhatId())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = super.hashCode();
-        if (getBccAddresses() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getBccAddresses());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getBccAddresses(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getCcAddresses() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getCcAddresses());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getCcAddresses(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getCharset() != null) {
-            _hashCode += getCharset().hashCode();
-        }
-        if (getDocumentAttachments() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getDocumentAttachments());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getDocumentAttachments(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getHtmlBody() != null) {
-            _hashCode += getHtmlBody().hashCode();
-        }
-        if (getFileAttachments() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getFileAttachments());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getFileAttachments(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getPlainTextBody() != null) {
-            _hashCode += getPlainTextBody().hashCode();
-        }
-        if (getTargetObjectId() != null) {
-            _hashCode += getTargetObjectId().hashCode();
-        }
-        if (getTemplateId() != null) {
-            _hashCode += getTemplateId().hashCode();
-        }
-        if (getToAddresses() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getToAddresses());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getToAddresses(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getWhatId() != null) {
-            _hashCode += getWhatId().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(SingleEmailMessage.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SingleEmailMessage"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("bccAddresses");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "bccAddresses"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("ccAddresses");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ccAddresses"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("charset");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "charset"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("documentAttachments");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "documentAttachments"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("htmlBody");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "htmlBody"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("fileAttachments");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fileAttachments"));
-        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(false);
-        elemField.setMaxOccursUnbounded(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("plainTextBody");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "plainTextBody"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("targetObjectId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "targetObjectId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("templateId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "templateId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("toAddresses");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "toAddresses"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setMinOccurs(0);
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("whatId");
-        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "whatId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        elemField.setNillable(true);
-        typeDesc.addFieldDesc(elemField);
-    }
-
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-    /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-    /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+/**
+ * SingleEmailMessage.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class SingleEmailMessage  extends com.sforce.soap.partner.Email  implements java.io.Serializable {
+    private java.lang.String[] bccAddresses;
+
+    private java.lang.String[] ccAddresses;
+
+    private java.lang.String charset;
+
+    private java.lang.String[] documentAttachments;
+
+    private java.lang.String htmlBody;
+
+    private java.lang.String inReplyTo;
+
+    private com.sforce.soap.partner.EmailFileAttachment[] fileAttachments;
+
+    private java.lang.String orgWideEmailAddressId;
+
+    private java.lang.String plainTextBody;
+
+    private java.lang.String references;
+
+    private java.lang.String targetObjectId;
+
+    private java.lang.String templateId;
+
+    private java.lang.String[] toAddresses;
+
+    private java.lang.String whatId;
+
+    public SingleEmailMessage() {
+    }
+
+    public SingleEmailMessage(
+           java.lang.Boolean bccSender,
+           com.sforce.soap.partner.EmailPriority emailPriority,
+           java.lang.String replyTo,
+           java.lang.Boolean saveAsActivity,
+           java.lang.String senderDisplayName,
+           java.lang.String subject,
+           java.lang.Boolean useSignature,
+           java.lang.String[] bccAddresses,
+           java.lang.String[] ccAddresses,
+           java.lang.String charset,
+           java.lang.String[] documentAttachments,
+           java.lang.String htmlBody,
+           java.lang.String inReplyTo,
+           com.sforce.soap.partner.EmailFileAttachment[] fileAttachments,
+           java.lang.String orgWideEmailAddressId,
+           java.lang.String plainTextBody,
+           java.lang.String references,
+           java.lang.String targetObjectId,
+           java.lang.String templateId,
+           java.lang.String[] toAddresses,
+           java.lang.String whatId) {
+        super(
+            bccSender,
+            emailPriority,
+            replyTo,
+            saveAsActivity,
+            senderDisplayName,
+            subject,
+            useSignature);
+        this.bccAddresses = bccAddresses;
+        this.ccAddresses = ccAddresses;
+        this.charset = charset;
+        this.documentAttachments = documentAttachments;
+        this.htmlBody = htmlBody;
+        this.inReplyTo = inReplyTo;
+        this.fileAttachments = fileAttachments;
+        this.orgWideEmailAddressId = orgWideEmailAddressId;
+        this.plainTextBody = plainTextBody;
+        this.references = references;
+        this.targetObjectId = targetObjectId;
+        this.templateId = templateId;
+        this.toAddresses = toAddresses;
+        this.whatId = whatId;
+    }
+
+
+    /**
+     * Gets the bccAddresses value for this SingleEmailMessage.
+     * 
+     * @return bccAddresses
+     */
+    public java.lang.String[] getBccAddresses() {
+        return bccAddresses;
+    }
+
+
+    /**
+     * Sets the bccAddresses value for this SingleEmailMessage.
+     * 
+     * @param bccAddresses
+     */
+    public void setBccAddresses(java.lang.String[] bccAddresses) {
+        this.bccAddresses = bccAddresses;
+    }
+
+    public java.lang.String getBccAddresses(int i) {
+        return this.bccAddresses[i];
+    }
+
+    public void setBccAddresses(int i, java.lang.String _value) {
+        this.bccAddresses[i] = _value;
+    }
+
+
+    /**
+     * Gets the ccAddresses value for this SingleEmailMessage.
+     * 
+     * @return ccAddresses
+     */
+    public java.lang.String[] getCcAddresses() {
+        return ccAddresses;
+    }
+
+
+    /**
+     * Sets the ccAddresses value for this SingleEmailMessage.
+     * 
+     * @param ccAddresses
+     */
+    public void setCcAddresses(java.lang.String[] ccAddresses) {
+        this.ccAddresses = ccAddresses;
+    }
+
+    public java.lang.String getCcAddresses(int i) {
+        return this.ccAddresses[i];
+    }
+
+    public void setCcAddresses(int i, java.lang.String _value) {
+        this.ccAddresses[i] = _value;
+    }
+
+
+    /**
+     * Gets the charset value for this SingleEmailMessage.
+     * 
+     * @return charset
+     */
+    public java.lang.String getCharset() {
+        return charset;
+    }
+
+
+    /**
+     * Sets the charset value for this SingleEmailMessage.
+     * 
+     * @param charset
+     */
+    public void setCharset(java.lang.String charset) {
+        this.charset = charset;
+    }
+
+
+    /**
+     * Gets the documentAttachments value for this SingleEmailMessage.
+     * 
+     * @return documentAttachments
+     */
+    public java.lang.String[] getDocumentAttachments() {
+        return documentAttachments;
+    }
+
+
+    /**
+     * Sets the documentAttachments value for this SingleEmailMessage.
+     * 
+     * @param documentAttachments
+     */
+    public void setDocumentAttachments(java.lang.String[] documentAttachments) {
+        this.documentAttachments = documentAttachments;
+    }
+
+    public java.lang.String getDocumentAttachments(int i) {
+        return this.documentAttachments[i];
+    }
+
+    public void setDocumentAttachments(int i, java.lang.String _value) {
+        this.documentAttachments[i] = _value;
+    }
+
+
+    /**
+     * Gets the htmlBody value for this SingleEmailMessage.
+     * 
+     * @return htmlBody
+     */
+    public java.lang.String getHtmlBody() {
+        return htmlBody;
+    }
+
+
+    /**
+     * Sets the htmlBody value for this SingleEmailMessage.
+     * 
+     * @param htmlBody
+     */
+    public void setHtmlBody(java.lang.String htmlBody) {
+        this.htmlBody = htmlBody;
+    }
+
+
+    /**
+     * Gets the inReplyTo value for this SingleEmailMessage.
+     * 
+     * @return inReplyTo
+     */
+    public java.lang.String getInReplyTo() {
+        return inReplyTo;
+    }
+
+
+    /**
+     * Sets the inReplyTo value for this SingleEmailMessage.
+     * 
+     * @param inReplyTo
+     */
+    public void setInReplyTo(java.lang.String inReplyTo) {
+        this.inReplyTo = inReplyTo;
+    }
+
+
+    /**
+     * Gets the fileAttachments value for this SingleEmailMessage.
+     * 
+     * @return fileAttachments
+     */
+    public com.sforce.soap.partner.EmailFileAttachment[] getFileAttachments() {
+        return fileAttachments;
+    }
+
+
+    /**
+     * Sets the fileAttachments value for this SingleEmailMessage.
+     * 
+     * @param fileAttachments
+     */
+    public void setFileAttachments(com.sforce.soap.partner.EmailFileAttachment[] fileAttachments) {
+        this.fileAttachments = fileAttachments;
+    }
+
+    public com.sforce.soap.partner.EmailFileAttachment getFileAttachments(int i) {
+        return this.fileAttachments[i];
+    }
+
+    public void setFileAttachments(int i, com.sforce.soap.partner.EmailFileAttachment _value) {
+        this.fileAttachments[i] = _value;
+    }
+
+
+    /**
+     * Gets the orgWideEmailAddressId value for this SingleEmailMessage.
+     * 
+     * @return orgWideEmailAddressId
+     */
+    public java.lang.String getOrgWideEmailAddressId() {
+        return orgWideEmailAddressId;
+    }
+
+
+    /**
+     * Sets the orgWideEmailAddressId value for this SingleEmailMessage.
+     * 
+     * @param orgWideEmailAddressId
+     */
+    public void setOrgWideEmailAddressId(java.lang.String orgWideEmailAddressId) {
+        this.orgWideEmailAddressId = orgWideEmailAddressId;
+    }
+
+
+    /**
+     * Gets the plainTextBody value for this SingleEmailMessage.
+     * 
+     * @return plainTextBody
+     */
+    public java.lang.String getPlainTextBody() {
+        return plainTextBody;
+    }
+
+
+    /**
+     * Sets the plainTextBody value for this SingleEmailMessage.
+     * 
+     * @param plainTextBody
+     */
+    public void setPlainTextBody(java.lang.String plainTextBody) {
+        this.plainTextBody = plainTextBody;
+    }
+
+
+    /**
+     * Gets the references value for this SingleEmailMessage.
+     * 
+     * @return references
+     */
+    public java.lang.String getReferences() {
+        return references;
+    }
+
+
+    /**
+     * Sets the references value for this SingleEmailMessage.
+     * 
+     * @param references
+     */
+    public void setReferences(java.lang.String references) {
+        this.references = references;
+    }
+
+
+    /**
+     * Gets the targetObjectId value for this SingleEmailMessage.
+     * 
+     * @return targetObjectId
+     */
+    public java.lang.String getTargetObjectId() {
+        return targetObjectId;
+    }
+
+
+    /**
+     * Sets the targetObjectId value for this SingleEmailMessage.
+     * 
+     * @param targetObjectId
+     */
+    public void setTargetObjectId(java.lang.String targetObjectId) {
+        this.targetObjectId = targetObjectId;
+    }
+
+
+    /**
+     * Gets the templateId value for this SingleEmailMessage.
+     * 
+     * @return templateId
+     */
+    public java.lang.String getTemplateId() {
+        return templateId;
+    }
+
+
+    /**
+     * Sets the templateId value for this SingleEmailMessage.
+     * 
+     * @param templateId
+     */
+    public void setTemplateId(java.lang.String templateId) {
+        this.templateId = templateId;
+    }
+
+
+    /**
+     * Gets the toAddresses value for this SingleEmailMessage.
+     * 
+     * @return toAddresses
+     */
+    public java.lang.String[] getToAddresses() {
+        return toAddresses;
+    }
+
+
+    /**
+     * Sets the toAddresses value for this SingleEmailMessage.
+     * 
+     * @param toAddresses
+     */
+    public void setToAddresses(java.lang.String[] toAddresses) {
+        this.toAddresses = toAddresses;
+    }
+
+    public java.lang.String getToAddresses(int i) {
+        return this.toAddresses[i];
+    }
+
+    public void setToAddresses(int i, java.lang.String _value) {
+        this.toAddresses[i] = _value;
+    }
+
+
+    /**
+     * Gets the whatId value for this SingleEmailMessage.
+     * 
+     * @return whatId
+     */
+    public java.lang.String getWhatId() {
+        return whatId;
+    }
+
+
+    /**
+     * Sets the whatId value for this SingleEmailMessage.
+     * 
+     * @param whatId
+     */
+    public void setWhatId(java.lang.String whatId) {
+        this.whatId = whatId;
+    }
+
+    private java.lang.Object __equalsCalc = null;
+    public synchronized boolean equals(java.lang.Object obj) {
+        if (!(obj instanceof SingleEmailMessage)) return false;
+        SingleEmailMessage other = (SingleEmailMessage) obj;
+        if (obj == null) return false;
+        if (this == obj) return true;
+        if (__equalsCalc != null) {
+            return (__equalsCalc == obj);
+        }
+        __equalsCalc = obj;
+        boolean _equals;
+        _equals = super.equals(obj) && 
+            ((this.bccAddresses==null && other.getBccAddresses()==null) || 
+             (this.bccAddresses!=null &&
+              java.util.Arrays.equals(this.bccAddresses, other.getBccAddresses()))) &&
+            ((this.ccAddresses==null && other.getCcAddresses()==null) || 
+             (this.ccAddresses!=null &&
+              java.util.Arrays.equals(this.ccAddresses, other.getCcAddresses()))) &&
+            ((this.charset==null && other.getCharset()==null) || 
+             (this.charset!=null &&
+              this.charset.equals(other.getCharset()))) &&
+            ((this.documentAttachments==null && other.getDocumentAttachments()==null) || 
+             (this.documentAttachments!=null &&
+              java.util.Arrays.equals(this.documentAttachments, other.getDocumentAttachments()))) &&
+            ((this.htmlBody==null && other.getHtmlBody()==null) || 
+             (this.htmlBody!=null &&
+              this.htmlBody.equals(other.getHtmlBody()))) &&
+            ((this.inReplyTo==null && other.getInReplyTo()==null) || 
+             (this.inReplyTo!=null &&
+              this.inReplyTo.equals(other.getInReplyTo()))) &&
+            ((this.fileAttachments==null && other.getFileAttachments()==null) || 
+             (this.fileAttachments!=null &&
+              java.util.Arrays.equals(this.fileAttachments, other.getFileAttachments()))) &&
+            ((this.orgWideEmailAddressId==null && other.getOrgWideEmailAddressId()==null) || 
+             (this.orgWideEmailAddressId!=null &&
+              this.orgWideEmailAddressId.equals(other.getOrgWideEmailAddressId()))) &&
+            ((this.plainTextBody==null && other.getPlainTextBody()==null) || 
+             (this.plainTextBody!=null &&
+              this.plainTextBody.equals(other.getPlainTextBody()))) &&
+            ((this.references==null && other.getReferences()==null) || 
+             (this.references!=null &&
+              this.references.equals(other.getReferences()))) &&
+            ((this.targetObjectId==null && other.getTargetObjectId()==null) || 
+             (this.targetObjectId!=null &&
+              this.targetObjectId.equals(other.getTargetObjectId()))) &&
+            ((this.templateId==null && other.getTemplateId()==null) || 
+             (this.templateId!=null &&
+              this.templateId.equals(other.getTemplateId()))) &&
+            ((this.toAddresses==null && other.getToAddresses()==null) || 
+             (this.toAddresses!=null &&
+              java.util.Arrays.equals(this.toAddresses, other.getToAddresses()))) &&
+            ((this.whatId==null && other.getWhatId()==null) || 
+             (this.whatId!=null &&
+              this.whatId.equals(other.getWhatId())));
+        __equalsCalc = null;
+        return _equals;
+    }
+
+    private boolean __hashCodeCalc = false;
+    public synchronized int hashCode() {
+        if (__hashCodeCalc) {
+            return 0;
+        }
+        __hashCodeCalc = true;
+        int _hashCode = super.hashCode();
+        if (getBccAddresses() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getBccAddresses());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getBccAddresses(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getCcAddresses() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getCcAddresses());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getCcAddresses(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getCharset() != null) {
+            _hashCode += getCharset().hashCode();
+        }
+        if (getDocumentAttachments() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getDocumentAttachments());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getDocumentAttachments(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getHtmlBody() != null) {
+            _hashCode += getHtmlBody().hashCode();
+        }
+        if (getInReplyTo() != null) {
+            _hashCode += getInReplyTo().hashCode();
+        }
+        if (getFileAttachments() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getFileAttachments());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getFileAttachments(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getOrgWideEmailAddressId() != null) {
+            _hashCode += getOrgWideEmailAddressId().hashCode();
+        }
+        if (getPlainTextBody() != null) {
+            _hashCode += getPlainTextBody().hashCode();
+        }
+        if (getReferences() != null) {
+            _hashCode += getReferences().hashCode();
+        }
+        if (getTargetObjectId() != null) {
+            _hashCode += getTargetObjectId().hashCode();
+        }
+        if (getTemplateId() != null) {
+            _hashCode += getTemplateId().hashCode();
+        }
+        if (getToAddresses() != null) {
+            for (int i=0;
+                 i<java.lang.reflect.Array.getLength(getToAddresses());
+                 i++) {
+                java.lang.Object obj = java.lang.reflect.Array.get(getToAddresses(), i);
+                if (obj != null &&
+                    !obj.getClass().isArray()) {
+                    _hashCode += obj.hashCode();
+                }
+            }
+        }
+        if (getWhatId() != null) {
+            _hashCode += getWhatId().hashCode();
+        }
+        __hashCodeCalc = false;
+        return _hashCode;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(SingleEmailMessage.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SingleEmailMessage"));
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("bccAddresses");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "bccAddresses"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("ccAddresses");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ccAddresses"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("charset");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "charset"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("documentAttachments");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "documentAttachments"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("htmlBody");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "htmlBody"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("inReplyTo");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "inReplyTo"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("fileAttachments");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fileAttachments"));
+        elemField.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(false);
+        elemField.setMaxOccursUnbounded(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("orgWideEmailAddressId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "orgWideEmailAddressId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("plainTextBody");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "plainTextBody"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("references");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "references"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("targetObjectId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "targetObjectId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("templateId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "templateId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("toAddresses");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "toAddresses"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setMinOccurs(0);
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+        elemField = new org.apache.axis.description.ElementDesc();
+        elemField.setFieldName("whatId");
+        elemField.setXmlName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "whatId"));
+        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
+        elemField.setNillable(true);
+        typeDesc.addFieldDesc(elemField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+    /**
+     * Get Custom Serializer
+     */
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanSerializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+    /**
+     * Get Custom Deserializer
+     */
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new  org.apache.axis.encoding.ser.BeanDeserializer(
+            _javaType, _xmlType, typeDesc);
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Soap.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Soap.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/Soap.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,161 +1,161 @@
-/**
- * Soap.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public interface Soap extends java.rmi.Remote {
-
-    /**
-     * Login to the Salesforce.com SOAP Api
-     */
-    public com.sforce.soap.partner.LoginResult login(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.LoginFault;
-
-    /**
-     * Describe an sObject
-     */
-    public com.sforce.soap.partner.DescribeSObjectResult describeSObject(java.lang.String sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault;
-
-    /**
-     * Describe a number sObjects
-     */
-    public com.sforce.soap.partner.DescribeSObjectResult[] describeSObjects(java.lang.String[] sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault;
-
-    /**
-     * Describe the Global state
-     */
-    public com.sforce.soap.partner.DescribeGlobalResult describeGlobal() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Describe the layout of an sObject
-     */
-    public com.sforce.soap.partner.DescribeLayoutResult describeLayout(java.lang.String sObjectType, java.lang.String[] recordTypeIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault;
-
-    /**
-     * Describe the layout of the SoftPhone
-     */
-    public com.sforce.soap.partner.DescribeSoftphoneLayoutResult describeSoftphoneLayout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Describe the tabs that appear on a users page
-     */
-    public com.sforce.soap.partner.DescribeTabSetResult[] describeTabs() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Create a set of new sObjects
-     */
-    public com.sforce.soap.partner.SaveResult[] create(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Update a set of sObjects
-     */
-    public com.sforce.soap.partner.SaveResult[] update(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Update or insert a set of sObjects based on object id
-     */
-    public com.sforce.soap.partner.UpsertResult[] upsert(java.lang.String externalIDFieldName, com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Merge and update a set of sObjects based on object id
-     */
-    public com.sforce.soap.partner.MergeResult[] merge(com.sforce.soap.partner.MergeRequest[] request) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Delete a set of sObjects
-     */
-    public com.sforce.soap.partner.DeleteResult[] delete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Undelete a set of sObjects
-     */
-    public com.sforce.soap.partner.UndeleteResult[] undelete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Empty a set of sObjects from the recycle bin
-     */
-    public com.sforce.soap.partner.EmptyRecycleBinResult[] emptyRecycleBin(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Get a set of sObjects
-     */
-    public com.sforce.soap.partner.sobject.SObject[] retrieve(java.lang.String fieldList, java.lang.String sObjectType, java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Submit an entity to a workflow process or process a workitem
-     */
-    public com.sforce.soap.partner.ProcessResult[] process(com.sforce.soap.partner.ProcessRequest[] actions) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault;
-
-    /**
-     * convert a set of leads
-     */
-    public com.sforce.soap.partner.LeadConvertResult[] convertLead(com.sforce.soap.partner.LeadConvert[] leadConverts) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Logout the current user, invalidating the current session.
-     */
-    public void logout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Logs out and invalidates session ids
-     */
-    public com.sforce.soap.partner.InvalidateSessionsResult[] invalidateSessions(java.lang.String[] sessionIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Get the IDs for deleted sObjects
-     */
-    public com.sforce.soap.partner.GetDeletedResult getDeleted(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault;
-
-    /**
-     * Get the IDs for updated sObjects
-     */
-    public com.sforce.soap.partner.GetUpdatedResult getUpdated(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault;
-
-    /**
-     * Create a Query Cursor
-     */
-    public com.sforce.soap.partner.QueryResult query(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Create a Query Cursor, including deleted sObjects
-     */
-    public com.sforce.soap.partner.QueryResult queryAll(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Gets the next batch of sObjects from a query
-     */
-    public com.sforce.soap.partner.QueryResult queryMore(java.lang.String queryLocator) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Search for sObjects
-     */
-    public com.sforce.soap.partner.SearchResult search(java.lang.String searchString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.MalformedSearchFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidFieldFault;
-
-    /**
-     * Gets server timestamp
-     */
-    public com.sforce.soap.partner.GetServerTimestampResult getServerTimestamp() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Set a user's password
-     */
-    public com.sforce.soap.partner.SetPasswordResult setPassword(java.lang.String userId, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidNewPasswordFault;
-
-    /**
-     * Reset a user's password
-     */
-    public com.sforce.soap.partner.ResetPasswordResult resetPassword(java.lang.String userId) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault;
-
-    /**
-     * Returns standard information relevant to the current user
-     */
-    public com.sforce.soap.partner.GetUserInfoResult getUserInfo() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-
-    /**
-     * Send outbound email
-     */
-    public com.sforce.soap.partner.SendEmailResult[] sendEmail(com.sforce.soap.partner.Email[] messages) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
-}
+/**
+ * Soap.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public interface Soap extends java.rmi.Remote {
+
+    /**
+     * Login to the Salesforce.com SOAP Api
+     */
+    public com.sforce.soap.partner.LoginResult login(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.LoginFault;
+
+    /**
+     * Describe an sObject
+     */
+    public com.sforce.soap.partner.DescribeSObjectResult describeSObject(java.lang.String sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Describe a number sObjects
+     */
+    public com.sforce.soap.partner.DescribeSObjectResult[] describeSObjects(java.lang.String[] sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Describe the Global state
+     */
+    public com.sforce.soap.partner.DescribeGlobalResult describeGlobal() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Describe the layout of an sObject
+     */
+    public com.sforce.soap.partner.DescribeLayoutResult describeLayout(java.lang.String sObjectType, java.lang.String[] recordTypeIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Describe the layout of the SoftPhone
+     */
+    public com.sforce.soap.partner.DescribeSoftphoneLayoutResult describeSoftphoneLayout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Describe the tabs that appear on a users page
+     */
+    public com.sforce.soap.partner.DescribeTabSetResult[] describeTabs() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Create a set of new sObjects
+     */
+    public com.sforce.soap.partner.SaveResult[] create(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Update a set of sObjects
+     */
+    public com.sforce.soap.partner.SaveResult[] update(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Update or insert a set of sObjects based on object id
+     */
+    public com.sforce.soap.partner.UpsertResult[] upsert(java.lang.String externalIDFieldName, com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Merge and update a set of sObjects based on object id
+     */
+    public com.sforce.soap.partner.MergeResult[] merge(com.sforce.soap.partner.MergeRequest[] request) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Delete a set of sObjects
+     */
+    public com.sforce.soap.partner.DeleteResult[] delete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Undelete a set of sObjects
+     */
+    public com.sforce.soap.partner.UndeleteResult[] undelete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Empty a set of sObjects from the recycle bin
+     */
+    public com.sforce.soap.partner.EmptyRecycleBinResult[] emptyRecycleBin(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Get a set of sObjects
+     */
+    public com.sforce.soap.partner.sobject.SObject[] retrieve(java.lang.String fieldList, java.lang.String sObjectType, java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Submit an entity to a workflow process or process a workitem
+     */
+    public com.sforce.soap.partner.ProcessResult[] process(com.sforce.soap.partner.ProcessRequest[] actions) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * convert a set of leads
+     */
+    public com.sforce.soap.partner.LeadConvertResult[] convertLead(com.sforce.soap.partner.LeadConvert[] leadConverts) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Logout the current user, invalidating the current session.
+     */
+    public void logout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Logs out and invalidates session ids
+     */
+    public com.sforce.soap.partner.InvalidateSessionsResult[] invalidateSessions(java.lang.String[] sessionIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Get the IDs for deleted sObjects
+     */
+    public com.sforce.soap.partner.GetDeletedResult getDeleted(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Get the IDs for updated sObjects
+     */
+    public com.sforce.soap.partner.GetUpdatedResult getUpdated(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Create a Query Cursor
+     */
+    public com.sforce.soap.partner.QueryResult query(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault;
+
+    /**
+     * Create a Query Cursor, including deleted sObjects
+     */
+    public com.sforce.soap.partner.QueryResult queryAll(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault;
+
+    /**
+     * Gets the next batch of sObjects from a query
+     */
+    public com.sforce.soap.partner.QueryResult queryMore(java.lang.String queryLocator) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault;
+
+    /**
+     * Search for sObjects
+     */
+    public com.sforce.soap.partner.SearchResult search(java.lang.String searchString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedSearchFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Gets server timestamp
+     */
+    public com.sforce.soap.partner.GetServerTimestampResult getServerTimestamp() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Set a user's password
+     */
+    public com.sforce.soap.partner.SetPasswordResult setPassword(java.lang.String userId, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidNewPasswordFault;
+
+    /**
+     * Reset a user's password
+     */
+    public com.sforce.soap.partner.ResetPasswordResult resetPassword(java.lang.String userId) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Returns standard information relevant to the current user
+     */
+    public com.sforce.soap.partner.GetUserInfoResult getUserInfo() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+
+    /**
+     * Send outbound email
+     */
+    public com.sforce.soap.partner.SendEmailResult[] sendEmail(com.sforce.soap.partner.Email[] messages) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault;
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SoapBindingStub.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SoapBindingStub.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/SoapBindingStub.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,966 +1,966 @@
-/**
- * SoapBindingStub.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class SoapBindingStub extends org.apache.axis.client.Stub implements com.sforce.soap.partner.Soap {
-    private java.util.Vector cachedSerClasses = new java.util.Vector();
-    private java.util.Vector cachedSerQNames = new java.util.Vector();
-    private java.util.Vector cachedSerFactories = new java.util.Vector();
-    private java.util.Vector cachedDeserFactories = new java.util.Vector();
-
-    static org.apache.axis.description.OperationDesc [] _operations;
-
-    static {
-        _operations = new org.apache.axis.description.OperationDesc[30];
-        _initOperationDesc1();
-        _initOperationDesc2();
-        _initOperationDesc3();
+/**
+ * SoapBindingStub.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class SoapBindingStub extends org.apache.axis.client.Stub implements com.sforce.soap.partner.Soap {
+    private java.util.Vector cachedSerClasses = new java.util.Vector();
+    private java.util.Vector cachedSerQNames = new java.util.Vector();
+    private java.util.Vector cachedSerFactories = new java.util.Vector();
+    private java.util.Vector cachedDeserFactories = new java.util.Vector();
+
+    static org.apache.axis.description.OperationDesc [] _operations;
+
+    static {
+        _operations = new org.apache.axis.description.OperationDesc[30];
+        _initOperationDesc1();
+        _initOperationDesc2();
+        _initOperationDesc3();
     }
-
-    private static void _initOperationDesc1(){
-        org.apache.axis.description.OperationDesc oper;
-        org.apache.axis.description.ParameterDesc param;
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("login");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "password"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LoginResult"));
-        oper.setReturnClass(com.sforce.soap.partner.LoginResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault"),
-                      "com.sforce.soap.partner.fault.LoginFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault"), 
-                      true
-                     ));
-        _operations[0] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeSObject");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeSObjectResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        _operations[1] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeSObjects");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeSObjectResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        _operations[2] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeGlobal");
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeGlobalResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[3] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeLayout");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "recordTypeIds"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeLayoutResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        _operations[4] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeSoftphoneLayout");
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[5] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("describeTabs");
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DescribeTabSetResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[6] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("create");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult"));
-        oper.setReturnClass(com.sforce.soap.partner.SaveResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[7] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("update");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult"));
-        oper.setReturnClass(com.sforce.soap.partner.SaveResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[8] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("upsert");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "externalIDFieldName"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult"));
-        oper.setReturnClass(com.sforce.soap.partner.UpsertResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[9] = oper;
-
+
+    private static void _initOperationDesc1(){
+        org.apache.axis.description.OperationDesc oper;
+        org.apache.axis.description.ParameterDesc param;
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("login");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "password"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LoginResult"));
+        oper.setReturnClass(com.sforce.soap.partner.LoginResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault"),
+                      "com.sforce.soap.partner.fault.LoginFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault"), 
+                      true
+                     ));
+        _operations[0] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeSObject");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeSObjectResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[1] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeSObjects");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeSObjectResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[2] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeGlobal");
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeGlobalResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[3] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeLayout");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "recordTypeIds"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeLayoutResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[4] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeSoftphoneLayout");
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[5] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("describeTabs");
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DescribeTabSetResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[6] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("create");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult"));
+        oper.setReturnClass(com.sforce.soap.partner.SaveResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[7] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("update");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult"));
+        oper.setReturnClass(com.sforce.soap.partner.SaveResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[8] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("upsert");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "externalIDFieldName"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"), com.sforce.soap.partner.sobject.SObject[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult"));
+        oper.setReturnClass(com.sforce.soap.partner.UpsertResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[9] = oper;
+
     }
-
-    private static void _initOperationDesc2(){
-        org.apache.axis.description.OperationDesc oper;
-        org.apache.axis.description.ParameterDesc param;
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("merge");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "request"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest"), com.sforce.soap.partner.MergeRequest[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult"));
-        oper.setReturnClass(com.sforce.soap.partner.MergeResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[10] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("delete");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult"));
-        oper.setReturnClass(com.sforce.soap.partner.DeleteResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[11] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("undelete");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult"));
-        oper.setReturnClass(com.sforce.soap.partner.UndeleteResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[12] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("emptyRecycleBin");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult"));
-        oper.setReturnClass(com.sforce.soap.partner.EmptyRecycleBinResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[13] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("retrieve");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldList"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"));
-        oper.setReturnClass(com.sforce.soap.partner.sobject.SObject[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
-                      "com.sforce.soap.partner.fault.MalformedQueryFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[14] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("process");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "actions"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest"), com.sforce.soap.partner.ProcessRequest[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult"));
-        oper.setReturnClass(com.sforce.soap.partner.ProcessResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        _operations[15] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("convertLead");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "leadConverts"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert"), com.sforce.soap.partner.LeadConvert[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult"));
-        oper.setReturnClass(com.sforce.soap.partner.LeadConvertResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[16] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("logout");
-        oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[17] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("invalidateSessions");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sessionIds"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult"));
-        oper.setReturnClass(com.sforce.soap.partner.InvalidateSessionsResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[18] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getDeleted");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "startDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "endDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetDeletedResult"));
-        oper.setReturnClass(com.sforce.soap.partner.GetDeletedResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        _operations[19] = oper;
-
+
+    private static void _initOperationDesc2(){
+        org.apache.axis.description.OperationDesc oper;
+        org.apache.axis.description.ParameterDesc param;
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("merge");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "request"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest"), com.sforce.soap.partner.MergeRequest[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult"));
+        oper.setReturnClass(com.sforce.soap.partner.MergeResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[10] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("delete");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult"));
+        oper.setReturnClass(com.sforce.soap.partner.DeleteResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[11] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("undelete");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult"));
+        oper.setReturnClass(com.sforce.soap.partner.UndeleteResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[12] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("emptyRecycleBin");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult"));
+        oper.setReturnClass(com.sforce.soap.partner.EmptyRecycleBinResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[13] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("retrieve");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldList"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject"));
+        oper.setReturnClass(com.sforce.soap.partner.sobject.SObject[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
+                      "com.sforce.soap.partner.fault.MalformedQueryFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[14] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("process");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "actions"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest"), com.sforce.soap.partner.ProcessRequest[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult"));
+        oper.setReturnClass(com.sforce.soap.partner.ProcessResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[15] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("convertLead");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "leadConverts"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert"), com.sforce.soap.partner.LeadConvert[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult"));
+        oper.setReturnClass(com.sforce.soap.partner.LeadConvertResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[16] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("logout");
+        oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[17] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("invalidateSessions");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sessionIds"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult"));
+        oper.setReturnClass(com.sforce.soap.partner.InvalidateSessionsResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[18] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("getDeleted");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "startDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "endDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetDeletedResult"));
+        oper.setReturnClass(com.sforce.soap.partner.GetDeletedResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[19] = oper;
+
     }
-
-    private static void _initOperationDesc3(){
-        org.apache.axis.description.OperationDesc oper;
-        org.apache.axis.description.ParameterDesc param;
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getUpdated");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "startDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "endDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUpdatedResult"));
-        oper.setReturnClass(com.sforce.soap.partner.GetUpdatedResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        _operations[20] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("query");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
-        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
-                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
-                      "com.sforce.soap.partner.fault.MalformedQueryFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[21] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("queryAll");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
-        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
-                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
-                      "com.sforce.soap.partner.fault.MalformedQueryFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[22] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("queryMore");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryLocator"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryLocator"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
-        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
-                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[23] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("search");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "searchString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchResult"));
-        oper.setReturnClass(com.sforce.soap.partner.SearchResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"),
-                      "com.sforce.soap.partner.fault.MalformedSearchFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
-                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
-                      "com.sforce.soap.partner.fault.InvalidFieldFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
-                      true
-                     ));
-        _operations[24] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getServerTimestamp");
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetServerTimestampResult"));
-        oper.setReturnClass(com.sforce.soap.partner.GetServerTimestampResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[25] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("setPassword");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "password"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SetPasswordResult"));
-        oper.setReturnClass(com.sforce.soap.partner.SetPasswordResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"),
-                      "com.sforce.soap.partner.fault.InvalidNewPasswordFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"), 
-                      true
-                     ));
-        _operations[26] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("resetPassword");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String.class, false, false);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ResetPasswordResult"));
-        oper.setReturnClass(com.sforce.soap.partner.ResetPasswordResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
-                      "com.sforce.soap.partner.fault.InvalidIdFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
-                      true
-                     ));
-        _operations[27] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getUserInfo");
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult"));
-        oper.setReturnClass(com.sforce.soap.partner.GetUserInfoResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[28] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("sendEmail");
-        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "messages"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email"), com.sforce.soap.partner.Email[].class, false, false);
-        param.setOmittable(true);
-        oper.addParameter(param);
-        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult"));
-        oper.setReturnClass(com.sforce.soap.partner.SendEmailResult[].class);
-        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        oper.addFault(new org.apache.axis.description.FaultDesc(
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
-                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
-                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
-                      true
-                     ));
-        _operations[29] = oper;
-
-    }
-
-    public SoapBindingStub() throws org.apache.axis.AxisFault {
-         this(null);
-    }
-
-    public SoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-         this(service);
-         super.cachedEndpoint = endpointURL;
-    }
-
-    public SoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-        if (service == null) {
-            super.service = new org.apache.axis.client.Service();
-        } else {
-            super.service = service;
-        }
-        ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
-            java.lang.Class cls;
-            javax.xml.namespace.QName qName;
-            javax.xml.namespace.QName qName2;
-            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
-            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
-            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
-            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
-            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
-            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
-            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
-            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
-            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
-            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
-        addBindings0();
-        addBindings1();
-    }
-
-    private void addBindings0() {
-            java.lang.Class cls;
-            javax.xml.namespace.QName qName;
-            javax.xml.namespace.QName qName2;
-            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
-            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
-            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
-            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
-            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
-            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
-            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
-            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
-            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
-            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ApiFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.ApiFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ApiQueryFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.ApiQueryFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ExceptionCode");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.ExceptionCode.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "FaultCode");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.FaultCode.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.InvalidFieldFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.InvalidIdFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.InvalidNewPasswordFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.InvalidQueryLocatorFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.InvalidSObjectFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.LoginFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.MalformedQueryFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.MalformedSearchFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.fault.UnexpectedErrorFault.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
+
+    private static void _initOperationDesc3(){
+        org.apache.axis.description.OperationDesc oper;
+        org.apache.axis.description.ParameterDesc param;
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("getUpdated");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "startDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "endDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"), java.util.Calendar.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUpdatedResult"));
+        oper.setReturnClass(com.sforce.soap.partner.GetUpdatedResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[20] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("query");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
+        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
+                      "com.sforce.soap.partner.fault.MalformedQueryFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
+                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
+                      true
+                     ));
+        _operations[21] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("queryAll");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
+        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"),
+                      "com.sforce.soap.partner.fault.MalformedQueryFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
+                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
+                      true
+                     ));
+        _operations[22] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("queryMore");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryLocator"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryLocator"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult"));
+        oper.setReturnClass(com.sforce.soap.partner.QueryResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"),
+                      "com.sforce.soap.partner.fault.InvalidQueryLocatorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"), 
+                      true
+                     ));
+        _operations[23] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("search");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "searchString"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchResult"));
+        oper.setReturnClass(com.sforce.soap.partner.SearchResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"),
+                      "com.sforce.soap.partner.fault.InvalidSObjectFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"),
+                      "com.sforce.soap.partner.fault.MalformedSearchFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"),
+                      "com.sforce.soap.partner.fault.InvalidFieldFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[24] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("getServerTimestamp");
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetServerTimestampResult"));
+        oper.setReturnClass(com.sforce.soap.partner.GetServerTimestampResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[25] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("setPassword");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "password"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SetPasswordResult"));
+        oper.setReturnClass(com.sforce.soap.partner.SetPasswordResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"),
+                      "com.sforce.soap.partner.fault.InvalidNewPasswordFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"), 
+                      true
+                     ));
+        _operations[26] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("resetPassword");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "userId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID"), java.lang.String.class, false, false);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ResetPasswordResult"));
+        oper.setReturnClass(com.sforce.soap.partner.ResetPasswordResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"),
+                      "com.sforce.soap.partner.fault.InvalidIdFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"), 
+                      true
+                     ));
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[27] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("getUserInfo");
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult"));
+        oper.setReturnClass(com.sforce.soap.partner.GetUserInfoResult.class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[28] = oper;
+
+        oper = new org.apache.axis.description.OperationDesc();
+        oper.setName("sendEmail");
+        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "messages"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email"), com.sforce.soap.partner.Email[].class, false, false);
+        param.setOmittable(true);
+        oper.addParameter(param);
+        oper.setReturnType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult"));
+        oper.setReturnClass(com.sforce.soap.partner.SendEmailResult[].class);
+        oper.setReturnQName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result"));
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);
+        oper.addFault(new org.apache.axis.description.FaultDesc(
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"),
+                      "com.sforce.soap.partner.fault.UnexpectedErrorFault",
+                      new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"), 
+                      true
+                     ));
+        _operations[29] = oper;
+
+    }
+
+    public SoapBindingStub() throws org.apache.axis.AxisFault {
+         this(null);
+    }
+
+    public SoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
+         this(service);
+         super.cachedEndpoint = endpointURL;
+    }
+
+    public SoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
+        if (service == null) {
+            super.service = new org.apache.axis.client.Service();
+        } else {
+            super.service = service;
+        }
+        ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
+            java.lang.Class cls;
+            javax.xml.namespace.QName qName;
+            javax.xml.namespace.QName qName2;
+            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
+            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
+            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
+            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+        addBindings0();
+        addBindings1();
+    }
+
+    private void addBindings0() {
+            java.lang.Class cls;
+            javax.xml.namespace.QName qName;
+            javax.xml.namespace.QName qName2;
+            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
+            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
+            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
+            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ApiFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.ApiFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ApiQueryFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.ApiQueryFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "ExceptionCode");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.ExceptionCode.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "FaultCode");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.FaultCode.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.InvalidFieldFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.InvalidIdFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.InvalidNewPasswordFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.InvalidQueryLocatorFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.InvalidSObjectFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "LoginFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.LoginFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.MalformedQueryFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.MalformedSearchFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.fault.UnexpectedErrorFault.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
             qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">AllowFieldTruncationHeader");
             cachedSerQNames.add(qName);
             cls = com.sforce.soap.partner.AllowFieldTruncationHeader.class;
@@ -968,675 +968,691 @@
             cachedSerFactories.add(beansf);
             cachedDeserFactories.add(beandf);
 
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">AssignmentRuleHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.AssignmentRuleHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">CallOptions");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.CallOptions.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">convertLead");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LeadConvert[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "leadConverts");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">convertLeadResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LeadConvertResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">create");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.sobject.SObject[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">createResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SaveResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">DebuggingHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DebuggingHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">DebuggingInfo");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DebuggingInfo.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">delete");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">deleteResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DeleteResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeGlobal");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeGlobal.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeGlobalResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeGlobalResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeLayout");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutType0.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeLayoutResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObject");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSObject.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjectResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSObjectResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjects");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjectsResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSObjectResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSoftphoneLayout");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayout.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSoftphoneLayoutResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeTabs");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeTabs.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeTabsResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeTabSetResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">EmailHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.EmailHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">emptyRecycleBin");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">emptyRecycleBinResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.EmptyRecycleBinResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getDeleted");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetDeleted.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getDeletedResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetDeletedResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getServerTimestamp");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetServerTimestamp.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getServerTimestampResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetServerTimestampResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUpdated");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUpdated.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUpdatedResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUpdatedResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUserInfo");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUserInfo.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUserInfoResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUserInfoResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">invalidateSessions");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sessionIds");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">invalidateSessionsResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.InvalidateSessionsResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">LocaleOptions");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LocaleOptions.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">login");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Login.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">loginResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LoginResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">LoginScopeHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LoginScopeHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">logout");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Logout.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">logoutResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LogoutResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">merge");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MergeRequest[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "request");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">mergeResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MergeResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">MruHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MruHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">process");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessRequest[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "actions");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">processResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">query");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Query.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryAll");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryAll.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryAllResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryAllResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryMore");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryMore.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryMoreResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryMoreResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">QueryOptions");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryOptions.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">resetPassword");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ResetPassword.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">resetPasswordResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ResetPasswordResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">retrieve");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Retrieve.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">retrieveResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.sobject.SObject[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">search");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Search.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">searchResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SearchResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">sendEmail");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Email[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "messages");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">sendEmailResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SendEmailResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">SessionHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SessionHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">setPassword");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SetPassword.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">setPasswordResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SetPasswordResponse.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">undelete");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">undeleteResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.UndeleteResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">update");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.sobject.SObject[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">updateResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SaveResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">upsert");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Upsert.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">upsertResponse");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.UpsertResult[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">UserTerritoryDeleteHeader");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.UserTerritoryDeleteHeader.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ChildRelationship.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DebugLevel");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DebugLevel.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeletedRecord");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DeletedRecord.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DeleteResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeGlobalResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayout");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayout.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButton");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutButton.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButtonSection");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutButton[].class;
-            cachedSerClasses.add(cls);
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButton");
-            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "detailButtons");
-            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
-            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutComponent");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutComponent.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutItem");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutItem.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutRow");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutRow.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutSection");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeLayoutSection.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSObjectResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutCallType");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutCallType.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-    }
-    private void addBindings1() {
-            java.lang.Class cls;
-            javax.xml.namespace.QName qName;
-            javax.xml.namespace.QName qName2;
-            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
-            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
-            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
-            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
-            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
-            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
-            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
-            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
-            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
-            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">AssignmentRuleHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.AssignmentRuleHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">CallOptions");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.CallOptions.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">convertLead");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LeadConvert[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "leadConverts");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">convertLeadResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LeadConvertResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">create");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.sobject.SObject[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">createResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SaveResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">DebuggingHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DebuggingHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">DebuggingInfo");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DebuggingInfo.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">delete");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">deleteResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DeleteResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeGlobal");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeGlobal.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeGlobalResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeGlobalResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeLayout");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutType0.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeLayoutResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObject");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSObject.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjectResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSObjectResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjects");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjectType");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSObjectsResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSObjectResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSoftphoneLayout");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayout.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeSoftphoneLayoutResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeTabs");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeTabs.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">describeTabsResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeTabSetResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">EmailHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.EmailHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">emptyRecycleBin");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">emptyRecycleBinResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.EmptyRecycleBinResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getDeleted");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetDeleted.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getDeletedResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetDeletedResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getServerTimestamp");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetServerTimestamp.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getServerTimestampResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetServerTimestampResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUpdated");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUpdated.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUpdatedResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUpdatedResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUserInfo");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUserInfo.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">getUserInfoResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUserInfoResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">invalidateSessions");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sessionIds");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">invalidateSessionsResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.InvalidateSessionsResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">LocaleOptions");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LocaleOptions.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">login");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Login.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">loginResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LoginResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">LoginScopeHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LoginScopeHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">logout");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Logout.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">logoutResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LogoutResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">merge");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MergeRequest[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "request");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">mergeResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MergeResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">MruHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MruHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">PackageVersionHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.PackageVersion[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PackageVersion");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "packageVersions");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">process");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessRequest[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "actions");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">processResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">query");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Query.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryAll");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryAll.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryAllResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryAllResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryMore");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryMore.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryMoreResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryMoreResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">QueryOptions");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryOptions.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">queryResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">resetPassword");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ResetPassword.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">resetPasswordResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ResetPasswordResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">retrieve");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Retrieve.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">retrieveResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.sobject.SObject[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">search");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Search.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">searchResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SearchResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">sendEmail");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Email[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "messages");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">sendEmailResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SendEmailResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">SessionHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SessionHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">setPassword");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SetPassword.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">setPasswordResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SetPasswordResponse.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">undelete");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ids");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">undeleteResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.UndeleteResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">update");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.sobject.SObject[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sObjects");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">updateResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SaveResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">upsert");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Upsert.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">upsertResponse");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.UpsertResult[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "result");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", ">UserTerritoryDeleteHeader");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.UserTerritoryDeleteHeader.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ChildRelationship");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ChildRelationship.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DebugLevel");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DebugLevel.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeletedRecord");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DeletedRecord.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DeleteResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DeleteResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeGlobalResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeGlobalSObjectResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeGlobalSObjectResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayout");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayout.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButton");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutButton.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButtonSection");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutButton[].class;
+            cachedSerClasses.add(cls);
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutButton");
+            qName2 = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "detailButtons");
+            cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
+            cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutComponent");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutComponent.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutItem");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutItem.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutRow");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutRow.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeLayoutSection");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeLayoutSection.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+    }
+    private void addBindings1() {
+            java.lang.Class cls;
+            javax.xml.namespace.QName qName;
+            javax.xml.namespace.QName qName2;
+            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
+            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
+            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
+            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSObjectResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSObjectResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutCallType");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutCallType.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
             qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutInfoField");
             cachedSerQNames.add(qName);
             cls = com.sforce.soap.partner.DescribeSoftphoneLayoutInfoField.class;
@@ -1644,1809 +1660,1816 @@
             cachedSerFactories.add(beansf);
             cachedDeserFactories.add(beandf);
 
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutItem");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutItem.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutSection");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutSection.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTab");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeTab.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.DescribeTabSetResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Email.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.EmailFileAttachment.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailPriority");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.EmailPriority.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.EmptyRecycleBinResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Error");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Error.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.Field.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldType");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.FieldType.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetDeletedResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetDeletedResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetServerTimestampResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetServerTimestampResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUpdatedResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUpdatedResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.GetUserInfoResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory.class, cls, qName));
-            cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, cls, qName));
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.InvalidateSessionsResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "layoutComponentType");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LayoutComponentType.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LeadConvert.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LeadConvertResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LoginResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.LoginResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MassEmailMessage");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MassEmailMessage.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MergeRequest.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.MergeResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistEntry");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.PicklistEntry.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistForRecordType");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.PicklistForRecordType.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessRequest.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessSubmitRequest");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessSubmitRequest.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessWorkitemRequest");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ProcessWorkitemRequest.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryLocator");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory.class, cls, qName));
-            cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, cls, qName));
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.QueryResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeInfo");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.RecordTypeInfo.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeMapping");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.RecordTypeMapping.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedList");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.RelatedList.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedListColumn");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.RelatedListColumn.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedListSort");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.RelatedListSort.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ResetPasswordResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.ResetPasswordResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SaveResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchRecord");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SearchRecord.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SearchResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailError");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SendEmailError.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SendEmailResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SetPasswordResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SetPasswordResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SingleEmailMessage");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SingleEmailMessage.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.SoapType.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "StatusCode");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.StatusCode.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(enumsf);
-            cachedDeserFactories.add(enumdf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.UndeleteResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.UpsertResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
-            cachedSerQNames.add(qName);
-            cls = com.sforce.soap.partner.sobject.SObject.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-    }
-
-    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
-        try {
-            org.apache.axis.client.Call _call = super._createCall();
-            if (super.maintainSessionSet) {
-                _call.setMaintainSession(super.maintainSession);
-            }
-            if (super.cachedUsername != null) {
-                _call.setUsername(super.cachedUsername);
-            }
-            if (super.cachedPassword != null) {
-                _call.setPassword(super.cachedPassword);
-            }
-            if (super.cachedEndpoint != null) {
-                _call.setTargetEndpointAddress(super.cachedEndpoint);
-            }
-            if (super.cachedTimeout != null) {
-                _call.setTimeout(super.cachedTimeout);
-            }
-            if (super.cachedPortName != null) {
-                _call.setPortName(super.cachedPortName);
-            }
-            java.util.Enumeration keys = super.cachedProperties.keys();
-            while (keys.hasMoreElements()) {
-                java.lang.String key = (java.lang.String) keys.nextElement();
-                _call.setProperty(key, super.cachedProperties.get(key));
-            }
-            // All the type mapping information is registered
-            // when the first call is made.
-            // The type mapping information is actually registered in
-            // the TypeMappingRegistry of the service, which
-            // is the reason why registration is only needed for the first call.
-            synchronized (this) {
-                if (firstCall()) {
-                    // must set encoding style before registering serializers
-                    _call.setEncodingStyle(null);
-                    for (int i = 0; i < cachedSerFactories.size(); ++i) {
-                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
-                        javax.xml.namespace.QName qName =
-                                (javax.xml.namespace.QName) cachedSerQNames.get(i);
-                        java.lang.Object x = cachedSerFactories.get(i);
-                        if (x instanceof Class) {
-                            java.lang.Class sf = (java.lang.Class)
-                                 cachedSerFactories.get(i);
-                            java.lang.Class df = (java.lang.Class)
-                                 cachedDeserFactories.get(i);
-                            _call.registerTypeMapping(cls, qName, sf, df, false);
-                        }
-                        else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) {
-                            org.apache.axis.encoding.SerializerFactory sf = (org.apache.axis.encoding.SerializerFactory)
-                                 cachedSerFactories.get(i);
-                            org.apache.axis.encoding.DeserializerFactory df = (org.apache.axis.encoding.DeserializerFactory)
-                                 cachedDeserFactories.get(i);
-                            _call.registerTypeMapping(cls, qName, sf, df, false);
-                        }
-                    }
-                }
-            }
-            return _call;
-        }
-        catch (java.lang.Throwable _t) {
-            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
-        }
-    }
-
-    public com.sforce.soap.partner.LoginResult login(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.LoginFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[0]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "login"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {username, password});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.LoginResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.LoginResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.LoginResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.LoginFault) {
-              throw (com.sforce.soap.partner.fault.LoginFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeSObjectResult describeSObject(java.lang.String sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[1]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSObject"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeSObjectResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeSObjectResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSObjectResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeSObjectResult[] describeSObjects(java.lang.String[] sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[2]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSObjects"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeSObjectResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeSObjectResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSObjectResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeGlobalResult describeGlobal() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[3]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeGlobal"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeGlobalResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeGlobalResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeGlobalResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeLayoutResult describeLayout(java.lang.String sObjectType, java.lang.String[] recordTypeIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[4]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeLayout"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, recordTypeIds});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeLayoutResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeLayoutResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeLayoutResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeSoftphoneLayoutResult describeSoftphoneLayout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[5]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSoftphoneLayout"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeSoftphoneLayoutResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeSoftphoneLayoutResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DescribeTabSetResult[] describeTabs() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[6]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeTabs"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DescribeTabSetResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DescribeTabSetResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeTabSetResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.SaveResult[] create(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[7]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "create"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjects});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.SaveResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.SaveResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SaveResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.SaveResult[] update(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[8]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "update"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjects});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.SaveResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.SaveResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SaveResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.UpsertResult[] upsert(java.lang.String externalIDFieldName, com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[9]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "upsert"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {externalIDFieldName, sObjects});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.UpsertResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.UpsertResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.UpsertResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.MergeResult[] merge(com.sforce.soap.partner.MergeRequest[] request) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[10]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "merge"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {request});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.MergeResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.MergeResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.MergeResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.DeleteResult[] delete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[11]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "delete"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.DeleteResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.DeleteResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DeleteResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.UndeleteResult[] undelete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[12]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "undelete"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.UndeleteResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.UndeleteResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.UndeleteResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.EmptyRecycleBinResult[] emptyRecycleBin(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[13]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "emptyRecycleBin"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.EmptyRecycleBinResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.EmptyRecycleBinResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.EmptyRecycleBinResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.sobject.SObject[] retrieve(java.lang.String fieldList, java.lang.String sObjectType, java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[14]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "retrieve"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {fieldList, sObjectType, ids});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.sobject.SObject[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.sobject.SObject[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.sobject.SObject[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
-              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.ProcessResult[] process(com.sforce.soap.partner.ProcessRequest[] actions) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[15]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "process"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {actions});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.ProcessResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.ProcessResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.ProcessResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.LeadConvertResult[] convertLead(com.sforce.soap.partner.LeadConvert[] leadConverts) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[16]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "convertLead"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {leadConverts});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.LeadConvertResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.LeadConvertResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.LeadConvertResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public void logout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[17]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "logout"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        extractAttachments(_call);
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.InvalidateSessionsResult[] invalidateSessions(java.lang.String[] sessionIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[18]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "invalidateSessions"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sessionIds});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.InvalidateSessionsResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.InvalidateSessionsResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.InvalidateSessionsResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.GetDeletedResult getDeleted(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[19]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getDeleted"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, startDate, endDate});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.GetDeletedResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.GetDeletedResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetDeletedResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.GetUpdatedResult getUpdated(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[20]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getUpdated"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, startDate, endDate});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.GetUpdatedResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.GetUpdatedResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetUpdatedResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.QueryResult query(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[21]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "query"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryString});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.QueryResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
-              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
-              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.QueryResult queryAll(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[22]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryAll"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryString});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.QueryResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
-              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
-              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.QueryResult queryMore(java.lang.String queryLocator) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[23]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryMore"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryLocator});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.QueryResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
-              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.SearchResult search(java.lang.String searchString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.MalformedSearchFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidFieldFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[24]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "search"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {searchString});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.SearchResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.SearchResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SearchResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedSearchFault) {
-              throw (com.sforce.soap.partner.fault.MalformedSearchFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
-              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
-              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.GetServerTimestampResult getServerTimestamp() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[25]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getServerTimestamp"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.GetServerTimestampResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.GetServerTimestampResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetServerTimestampResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.SetPasswordResult setPassword(java.lang.String userId, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidNewPasswordFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[26]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "setPassword"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {userId, password});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.SetPasswordResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.SetPasswordResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SetPasswordResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidNewPasswordFault) {
-              throw (com.sforce.soap.partner.fault.InvalidNewPasswordFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.ResetPasswordResult resetPassword(java.lang.String userId) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidIdFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[27]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "resetPassword"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {userId});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.ResetPasswordResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.ResetPasswordResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.ResetPasswordResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
-              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.GetUserInfoResult getUserInfo() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[28]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getUserInfo"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.GetUserInfoResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.GetUserInfoResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetUserInfoResult.class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-    public com.sforce.soap.partner.SendEmailResult[] sendEmail(com.sforce.soap.partner.Email[] messages) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[29]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sendEmail"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
- try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {messages});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (com.sforce.soap.partner.SendEmailResult[]) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (com.sforce.soap.partner.SendEmailResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SendEmailResult[].class);
-            }
-        }
-  } catch (org.apache.axis.AxisFault axisFaultException) {
-    if (axisFaultException.detail != null) {
-        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
-              throw (java.rmi.RemoteException) axisFaultException.detail;
-         }
-        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
-              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
-         }
-   }
-  throw axisFaultException;
-}
-    }
-
-}
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutItem");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutItem.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeSoftphoneLayoutSection");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeSoftphoneLayoutSection.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTab");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeTab.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "DescribeTabSetResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.DescribeTabSetResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Email");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Email.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailFileAttachment");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.EmailFileAttachment.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmailPriority");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.EmailPriority.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "EmptyRecycleBinResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.EmptyRecycleBinResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Error");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Error.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "Field");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.Field.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "fieldType");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.FieldType.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetDeletedResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetDeletedResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetServerTimestampResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetServerTimestampResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUpdatedResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUpdatedResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "GetUserInfoResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.GetUserInfoResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ID");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory.class, cls, qName));
+            cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, cls, qName));
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "InvalidateSessionsResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.InvalidateSessionsResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "layoutComponentType");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LayoutComponentType.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvert");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LeadConvert.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LeadConvertResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LeadConvertResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "LoginResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.LoginResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MassEmailMessage");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MassEmailMessage.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeRequest");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MergeRequest.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "MergeResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.MergeResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PackageVersion");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.PackageVersion.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistEntry");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.PicklistEntry.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "PicklistForRecordType");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.PicklistForRecordType.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessRequest");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessRequest.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessSubmitRequest");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessSubmitRequest.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ProcessWorkitemRequest");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ProcessWorkitemRequest.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryLocator");
+            cachedSerQNames.add(qName);
+            cls = java.lang.String.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory.class, cls, qName));
+            cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, cls, qName));
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "QueryResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.QueryResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeInfo");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.RecordTypeInfo.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RecordTypeMapping");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.RecordTypeMapping.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedList");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.RelatedList.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedListColumn");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.RelatedListColumn.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "RelatedListSort");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.RelatedListSort.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "ResetPasswordResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.ResetPasswordResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SaveResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SaveResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchRecord");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SearchRecord.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SearchResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SearchResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailError");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SendEmailError.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SendEmailResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SendEmailResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SetPasswordResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SetPasswordResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "SingleEmailMessage");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SingleEmailMessage.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "soapType");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.SoapType.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "StatusCode");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.StatusCode.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(enumsf);
+            cachedDeserFactories.add(enumdf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UndeleteResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.UndeleteResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "UpsertResult");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.UpsertResult.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+            qName = new javax.xml.namespace.QName("urn:sobject.partner.soap.sforce.com", "sObject");
+            cachedSerQNames.add(qName);
+            cls = com.sforce.soap.partner.sobject.SObject.class;
+            cachedSerClasses.add(cls);
+            cachedSerFactories.add(beansf);
+            cachedDeserFactories.add(beandf);
+
+    }
+
+    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
+        try {
+            org.apache.axis.client.Call _call = super._createCall();
+            if (super.maintainSessionSet) {
+                _call.setMaintainSession(super.maintainSession);
+            }
+            if (super.cachedUsername != null) {
+                _call.setUsername(super.cachedUsername);
+            }
+            if (super.cachedPassword != null) {
+                _call.setPassword(super.cachedPassword);
+            }
+            if (super.cachedEndpoint != null) {
+                _call.setTargetEndpointAddress(super.cachedEndpoint);
+            }
+            if (super.cachedTimeout != null) {
+                _call.setTimeout(super.cachedTimeout);
+            }
+            if (super.cachedPortName != null) {
+                _call.setPortName(super.cachedPortName);
+            }
+            java.util.Enumeration keys = super.cachedProperties.keys();
+            while (keys.hasMoreElements()) {
+                java.lang.String key = (java.lang.String) keys.nextElement();
+                _call.setProperty(key, super.cachedProperties.get(key));
+            }
+            // All the type mapping information is registered
+            // when the first call is made.
+            // The type mapping information is actually registered in
+            // the TypeMappingRegistry of the service, which
+            // is the reason why registration is only needed for the first call.
+            synchronized (this) {
+                if (firstCall()) {
+                    // must set encoding style before registering serializers
+                    _call.setEncodingStyle(null);
+                    for (int i = 0; i < cachedSerFactories.size(); ++i) {
+                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
+                        javax.xml.namespace.QName qName =
+                                (javax.xml.namespace.QName) cachedSerQNames.get(i);
+                        java.lang.Object x = cachedSerFactories.get(i);
+                        if (x instanceof Class) {
+                            java.lang.Class sf = (java.lang.Class)
+                                 cachedSerFactories.get(i);
+                            java.lang.Class df = (java.lang.Class)
+                                 cachedDeserFactories.get(i);
+                            _call.registerTypeMapping(cls, qName, sf, df, false);
+                        }
+                        else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) {
+                            org.apache.axis.encoding.SerializerFactory sf = (org.apache.axis.encoding.SerializerFactory)
+                                 cachedSerFactories.get(i);
+                            org.apache.axis.encoding.DeserializerFactory df = (org.apache.axis.encoding.DeserializerFactory)
+                                 cachedDeserFactories.get(i);
+                            _call.registerTypeMapping(cls, qName, sf, df, false);
+                        }
+                    }
+                }
+            }
+            return _call;
+        }
+        catch (java.lang.Throwable _t) {
+            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
+        }
+    }
+
+    public com.sforce.soap.partner.LoginResult login(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.LoginFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[0]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "login"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {username, password});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.LoginResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.LoginResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.LoginResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.LoginFault) {
+              throw (com.sforce.soap.partner.fault.LoginFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeSObjectResult describeSObject(java.lang.String sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[1]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSObject"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeSObjectResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeSObjectResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSObjectResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeSObjectResult[] describeSObjects(java.lang.String[] sObjectType) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[2]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSObjects"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeSObjectResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeSObjectResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSObjectResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeGlobalResult describeGlobal() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[3]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeGlobal"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeGlobalResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeGlobalResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeGlobalResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeLayoutResult describeLayout(java.lang.String sObjectType, java.lang.String[] recordTypeIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[4]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeLayout"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, recordTypeIds});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeLayoutResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeLayoutResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeLayoutResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeSoftphoneLayoutResult describeSoftphoneLayout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[5]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSoftphoneLayout"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeSoftphoneLayoutResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeSoftphoneLayoutResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeSoftphoneLayoutResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DescribeTabSetResult[] describeTabs() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[6]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeTabs"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DescribeTabSetResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DescribeTabSetResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DescribeTabSetResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.SaveResult[] create(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[7]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "create"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjects});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.SaveResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.SaveResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SaveResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.SaveResult[] update(com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[8]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "update"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjects});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.SaveResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.SaveResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SaveResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.UpsertResult[] upsert(java.lang.String externalIDFieldName, com.sforce.soap.partner.sobject.SObject[] sObjects) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[9]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "upsert"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {externalIDFieldName, sObjects});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.UpsertResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.UpsertResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.UpsertResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.MergeResult[] merge(com.sforce.soap.partner.MergeRequest[] request) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[10]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "merge"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {request});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.MergeResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.MergeResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.MergeResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.DeleteResult[] delete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[11]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "delete"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.DeleteResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.DeleteResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.DeleteResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.UndeleteResult[] undelete(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[12]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "undelete"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.UndeleteResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.UndeleteResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.UndeleteResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.EmptyRecycleBinResult[] emptyRecycleBin(java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[13]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "emptyRecycleBin"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {ids});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.EmptyRecycleBinResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.EmptyRecycleBinResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.EmptyRecycleBinResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.sobject.SObject[] retrieve(java.lang.String fieldList, java.lang.String sObjectType, java.lang.String[] ids) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[14]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "retrieve"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {fieldList, sObjectType, ids});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.sobject.SObject[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.sobject.SObject[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.sobject.SObject[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
+              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.ProcessResult[] process(com.sforce.soap.partner.ProcessRequest[] actions) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[15]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "process"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {actions});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.ProcessResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.ProcessResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.ProcessResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.LeadConvertResult[] convertLead(com.sforce.soap.partner.LeadConvert[] leadConverts) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[16]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "convertLead"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {leadConverts});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.LeadConvertResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.LeadConvertResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.LeadConvertResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public void logout() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[17]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "logout"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        extractAttachments(_call);
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.InvalidateSessionsResult[] invalidateSessions(java.lang.String[] sessionIds) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[18]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "invalidateSessions"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sessionIds});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.InvalidateSessionsResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.InvalidateSessionsResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.InvalidateSessionsResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.GetDeletedResult getDeleted(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[19]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getDeleted"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, startDate, endDate});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.GetDeletedResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.GetDeletedResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetDeletedResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.GetUpdatedResult getUpdated(java.lang.String sObjectType, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[20]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getUpdated"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {sObjectType, startDate, endDate});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.GetUpdatedResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.GetUpdatedResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetUpdatedResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.QueryResult query(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[21]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "query"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryString});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.QueryResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
+              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
+              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.QueryResult queryAll(java.lang.String queryString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedQueryFault, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[22]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryAll"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryString});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.QueryResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedQueryFault) {
+              throw (com.sforce.soap.partner.fault.MalformedQueryFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
+              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.QueryResult queryMore(java.lang.String queryLocator) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidQueryLocatorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[23]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "queryMore"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {queryLocator});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.QueryResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.QueryResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.QueryResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidQueryLocatorFault) {
+              throw (com.sforce.soap.partner.fault.InvalidQueryLocatorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.SearchResult search(java.lang.String searchString) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidSObjectFault, com.sforce.soap.partner.fault.MalformedSearchFault, com.sforce.soap.partner.fault.InvalidFieldFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[24]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "search"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {searchString});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.SearchResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.SearchResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SearchResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidSObjectFault) {
+              throw (com.sforce.soap.partner.fault.InvalidSObjectFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.MalformedSearchFault) {
+              throw (com.sforce.soap.partner.fault.MalformedSearchFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidFieldFault) {
+              throw (com.sforce.soap.partner.fault.InvalidFieldFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.GetServerTimestampResult getServerTimestamp() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[25]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getServerTimestamp"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.GetServerTimestampResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.GetServerTimestampResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetServerTimestampResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.SetPasswordResult setPassword(java.lang.String userId, java.lang.String password) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault, com.sforce.soap.partner.fault.InvalidNewPasswordFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[26]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "setPassword"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {userId, password});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.SetPasswordResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.SetPasswordResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SetPasswordResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidNewPasswordFault) {
+              throw (com.sforce.soap.partner.fault.InvalidNewPasswordFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.ResetPasswordResult resetPassword(java.lang.String userId) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.InvalidIdFault, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[27]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "resetPassword"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {userId});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.ResetPasswordResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.ResetPasswordResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.ResetPasswordResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.InvalidIdFault) {
+              throw (com.sforce.soap.partner.fault.InvalidIdFault) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.GetUserInfoResult getUserInfo() throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[28]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "getUserInfo"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.GetUserInfoResult) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.GetUserInfoResult) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.GetUserInfoResult.class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+    public com.sforce.soap.partner.SendEmailResult[] sendEmail(com.sforce.soap.partner.Email[] messages) throws java.rmi.RemoteException, com.sforce.soap.partner.fault.UnexpectedErrorFault {
+        if (super.cachedEndpoint == null) {
+            throw new org.apache.axis.NoEndPointException();
+        }
+        org.apache.axis.client.Call _call = createCall();
+        _call.setOperation(_operations[29]);
+        _call.setUseSOAPAction(true);
+        _call.setSOAPActionURI("");
+        _call.setEncodingStyle(null);
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+        _call.setOperationName(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "sendEmail"));
+
+        setRequestHeaders(_call);
+        setAttachments(_call);
+ try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {messages});
+
+        if (_resp instanceof java.rmi.RemoteException) {
+            throw (java.rmi.RemoteException)_resp;
+        }
+        else {
+            extractAttachments(_call);
+            try {
+                return (com.sforce.soap.partner.SendEmailResult[]) _resp;
+            } catch (java.lang.Exception _exception) {
+                return (com.sforce.soap.partner.SendEmailResult[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.sforce.soap.partner.SendEmailResult[].class);
+            }
+        }
+  } catch (org.apache.axis.AxisFault axisFaultException) {
+    if (axisFaultException.detail != null) {
+        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
+              throw (java.rmi.RemoteException) axisFaultException.detail;
+         }
+        if (axisFaultException.detail instanceof com.sforce.soap.partner.fault.UnexpectedErrorFault) {
+              throw (com.sforce.soap.partner.fault.UnexpectedErrorFault) axisFaultException.detail;
+         }
+   }
+  throw axisFaultException;
+}
+    }
+
+}

Modified: branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/StatusCode.java
===================================================================
--- branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/StatusCode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/connectors/salesforce-api/src/main/java/com/sforce/soap/partner/StatusCode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,358 +1,374 @@
-/**
- * StatusCode.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
- */
-
-package com.sforce.soap.partner;
-
-public class StatusCode implements java.io.Serializable {
-    private java.lang.String _value_;
-    private static java.util.HashMap _table_ = new java.util.HashMap();
-
-    // Constructor
-    protected StatusCode(java.lang.String value) {
-        _value_ = value;
-        _table_.put(_value_,this);
-    }
-
-    public static final java.lang.String _ALREADY_IN_PROCESS = "ALREADY_IN_PROCESS";
-    public static final java.lang.String _ASSIGNEE_TYPE_REQUIRED = "ASSIGNEE_TYPE_REQUIRED";
-    public static final java.lang.String _BAD_CUSTOM_ENTITY_PARENT_DOMAIN = "BAD_CUSTOM_ENTITY_PARENT_DOMAIN";
-    public static final java.lang.String _BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED = "BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED";
-    public static final java.lang.String _CANNOT_CASCADE_PRODUCT_ACTIVE = "CANNOT_CASCADE_PRODUCT_ACTIVE";
-    public static final java.lang.String _CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD = "CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD";
-    public static final java.lang.String _CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE = "CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE";
-    public static final java.lang.String _CANNOT_DEACTIVATE_DIVISION = "CANNOT_DEACTIVATE_DIVISION";
-    public static final java.lang.String _CANNOT_DELETE_LAST_DATED_CONVERSION_RATE = "CANNOT_DELETE_LAST_DATED_CONVERSION_RATE";
-    public static final java.lang.String _CANNOT_DELETE_MANAGED_OBJECT = "CANNOT_DELETE_MANAGED_OBJECT";
-    public static final java.lang.String _CANNOT_DISABLE_LAST_ADMIN = "CANNOT_DISABLE_LAST_ADMIN";
-    public static final java.lang.String _CANNOT_ENABLE_IP_RESTRICT_REQUESTS = "CANNOT_ENABLE_IP_RESTRICT_REQUESTS";
-    public static final java.lang.String _CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY = "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY";
-    public static final java.lang.String _CANNOT_MODIFY_MANAGED_OBJECT = "CANNOT_MODIFY_MANAGED_OBJECT";
-    public static final java.lang.String _CANNOT_RENAME_APEX_REFERENCED_FIELD = "CANNOT_RENAME_APEX_REFERENCED_FIELD";
-    public static final java.lang.String _CANNOT_RENAME_APEX_REFERENCED_OBJECT = "CANNOT_RENAME_APEX_REFERENCED_OBJECT";
-    public static final java.lang.String _CANNOT_REPARENT_RECORD = "CANNOT_REPARENT_RECORD";
-    public static final java.lang.String _CANNOT_UPDATE_CONVERTED_LEAD = "CANNOT_UPDATE_CONVERTED_LEAD";
-    public static final java.lang.String _CANT_DISABLE_CORP_CURRENCY = "CANT_DISABLE_CORP_CURRENCY";
-    public static final java.lang.String _CANT_UNSET_CORP_CURRENCY = "CANT_UNSET_CORP_CURRENCY";
-    public static final java.lang.String _CHILD_SHARE_FAILS_PARENT = "CHILD_SHARE_FAILS_PARENT";
-    public static final java.lang.String _CIRCULAR_DEPENDENCY = "CIRCULAR_DEPENDENCY";
-    public static final java.lang.String _CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED = "CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED";
-    public static final java.lang.String _CUSTOM_ENTITY_OR_FIELD_LIMIT = "CUSTOM_ENTITY_OR_FIELD_LIMIT";
-    public static final java.lang.String _CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED = "CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED";
-    public static final java.lang.String _CUSTOM_INDEX_EXISTS = "CUSTOM_INDEX_EXISTS";
-    public static final java.lang.String _CUSTOM_LINK_LIMIT_EXCEEDED = "CUSTOM_LINK_LIMIT_EXCEEDED";
-    public static final java.lang.String _CUSTOM_TAB_LIMIT_EXCEEDED = "CUSTOM_TAB_LIMIT_EXCEEDED";
-    public static final java.lang.String _DELETE_FAILED = "DELETE_FAILED";
-    public static final java.lang.String _DELETE_REQUIRED_ON_CASCADE = "DELETE_REQUIRED_ON_CASCADE";
-    public static final java.lang.String _DEPENDENCY_EXISTS = "DEPENDENCY_EXISTS";
-    public static final java.lang.String _DUPLICATE_CASE_SOLUTION = "DUPLICATE_CASE_SOLUTION";
-    public static final java.lang.String _DUPLICATE_COMM_NICKNAME = "DUPLICATE_COMM_NICKNAME";
-    public static final java.lang.String _DUPLICATE_CUSTOM_ENTITY_DEFINITION = "DUPLICATE_CUSTOM_ENTITY_DEFINITION";
-    public static final java.lang.String _DUPLICATE_CUSTOM_TAB_MOTIF = "DUPLICATE_CUSTOM_TAB_MOTIF";
-    public static final java.lang.String _DUPLICATE_DEVELOPER_NAME = "DUPLICATE_DEVELOPER_NAME";
-    public static final java.lang.String _DUPLICATE_EXTERNAL_ID = "DUPLICATE_EXTERNAL_ID";
-    public static final java.lang.String _DUPLICATE_MASTER_LABEL = "DUPLICATE_MASTER_LABEL";
-    public static final java.lang.String _DUPLICATE_USERNAME = "DUPLICATE_USERNAME";
-    public static final java.lang.String _DUPLICATE_VALUE = "DUPLICATE_VALUE";
-    public static final java.lang.String _EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR = "EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR";
-    public static final java.lang.String _EMPTY_SCONTROL_FILE_NAME = "EMPTY_SCONTROL_FILE_NAME";
-    public static final java.lang.String _ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE = "ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE";
-    public static final java.lang.String _ENTITY_IS_ARCHIVED = "ENTITY_IS_ARCHIVED";
-    public static final java.lang.String _ENTITY_IS_DELETED = "ENTITY_IS_DELETED";
-    public static final java.lang.String _ENTITY_IS_LOCKED = "ENTITY_IS_LOCKED";
-    public static final java.lang.String _ERROR_IN_MAILER = "ERROR_IN_MAILER";
-    public static final java.lang.String _FAILED_ACTIVATION = "FAILED_ACTIVATION";
-    public static final java.lang.String _FIELD_CUSTOM_VALIDATION_EXCEPTION = "FIELD_CUSTOM_VALIDATION_EXCEPTION";
-    public static final java.lang.String _FIELD_INTEGRITY_EXCEPTION = "FIELD_INTEGRITY_EXCEPTION";
-    public static final java.lang.String _HTML_FILE_UPLOAD_NOT_ALLOWED = "HTML_FILE_UPLOAD_NOT_ALLOWED";
-    public static final java.lang.String _IMAGE_TOO_LARGE = "IMAGE_TOO_LARGE";
-    public static final java.lang.String _INACTIVE_OWNER_OR_USER = "INACTIVE_OWNER_OR_USER";
-    public static final java.lang.String _INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY = "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY";
-    public static final java.lang.String _INSUFFICIENT_ACCESS_OR_READONLY = "INSUFFICIENT_ACCESS_OR_READONLY";
-    public static final java.lang.String _INVALID_ACCESS_LEVEL = "INVALID_ACCESS_LEVEL";
-    public static final java.lang.String _INVALID_ARGUMENT_TYPE = "INVALID_ARGUMENT_TYPE";
-    public static final java.lang.String _INVALID_ASSIGNEE_TYPE = "INVALID_ASSIGNEE_TYPE";
-    public static final java.lang.String _INVALID_ASSIGNMENT_RULE = "INVALID_ASSIGNMENT_RULE";
-    public static final java.lang.String _INVALID_BATCH_OPERATION = "INVALID_BATCH_OPERATION";
-    public static final java.lang.String _INVALID_CREDIT_CARD_INFO = "INVALID_CREDIT_CARD_INFO";
-    public static final java.lang.String _INVALID_CROSS_REFERENCE_KEY = "INVALID_CROSS_REFERENCE_KEY";
-    public static final java.lang.String _INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD = "INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD";
-    public static final java.lang.String _INVALID_CURRENCY_CONV_RATE = "INVALID_CURRENCY_CONV_RATE";
-    public static final java.lang.String _INVALID_CURRENCY_CORP_RATE = "INVALID_CURRENCY_CORP_RATE";
-    public static final java.lang.String _INVALID_CURRENCY_ISO = "INVALID_CURRENCY_ISO";
-    public static final java.lang.String _INVALID_EMAIL_ADDRESS = "INVALID_EMAIL_ADDRESS";
-    public static final java.lang.String _INVALID_EMPTY_KEY_OWNER = "INVALID_EMPTY_KEY_OWNER";
-    public static final java.lang.String _INVALID_FIELD = "INVALID_FIELD";
-    public static final java.lang.String _INVALID_FIELD_FOR_INSERT_UPDATE = "INVALID_FIELD_FOR_INSERT_UPDATE";
-    public static final java.lang.String _INVALID_FIELD_WHEN_USING_TEMPLATE = "INVALID_FIELD_WHEN_USING_TEMPLATE";
-    public static final java.lang.String _INVALID_FILTER_ACTION = "INVALID_FILTER_ACTION";
-    public static final java.lang.String _INVALID_GOOGLE_DOCS_URL = "INVALID_GOOGLE_DOCS_URL";
-    public static final java.lang.String _INVALID_ID_FIELD = "INVALID_ID_FIELD";
-    public static final java.lang.String _INVALID_INET_ADDRESS = "INVALID_INET_ADDRESS";
-    public static final java.lang.String _INVALID_LINEITEM_CLONE_STATE = "INVALID_LINEITEM_CLONE_STATE";
-    public static final java.lang.String _INVALID_MASTER_OR_TRANSLATED_SOLUTION = "INVALID_MASTER_OR_TRANSLATED_SOLUTION";
-    public static final java.lang.String _INVALID_OPERATION = "INVALID_OPERATION";
-    public static final java.lang.String _INVALID_OPERATOR = "INVALID_OPERATOR";
-    public static final java.lang.String _INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST = "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST";
-    public static final java.lang.String _INVALID_PARTNER_NETWORK_STATUS = "INVALID_PARTNER_NETWORK_STATUS";
-    public static final java.lang.String _INVALID_PERSON_ACCOUNT_OPERATION = "INVALID_PERSON_ACCOUNT_OPERATION";
-    public static final java.lang.String _INVALID_SAVE_AS_ACTIVITY_FLAG = "INVALID_SAVE_AS_ACTIVITY_FLAG";
-    public static final java.lang.String _INVALID_SESSION_ID = "INVALID_SESSION_ID";
-    public static final java.lang.String _INVALID_SETUP_OWNER = "INVALID_SETUP_OWNER";
-    public static final java.lang.String _INVALID_STATUS = "INVALID_STATUS";
-    public static final java.lang.String _INVALID_TYPE = "INVALID_TYPE";
-    public static final java.lang.String _INVALID_TYPE_FOR_OPERATION = "INVALID_TYPE_FOR_OPERATION";
-    public static final java.lang.String _INVALID_TYPE_ON_FIELD_IN_RECORD = "INVALID_TYPE_ON_FIELD_IN_RECORD";
-    public static final java.lang.String _IP_RANGE_LIMIT_EXCEEDED = "IP_RANGE_LIMIT_EXCEEDED";
-    public static final java.lang.String _LICENSE_LIMIT_EXCEEDED = "LICENSE_LIMIT_EXCEEDED";
-    public static final java.lang.String _LIMIT_EXCEEDED = "LIMIT_EXCEEDED";
-    public static final java.lang.String _MALFORMED_ID = "MALFORMED_ID";
-    public static final java.lang.String _MANAGER_NOT_DEFINED = "MANAGER_NOT_DEFINED";
-    public static final java.lang.String _MASSMAIL_RETRY_LIMIT_EXCEEDED = "MASSMAIL_RETRY_LIMIT_EXCEEDED";
-    public static final java.lang.String _MASS_MAIL_LIMIT_EXCEEDED = "MASS_MAIL_LIMIT_EXCEEDED";
-    public static final java.lang.String _MAXIMUM_CCEMAILS_EXCEEDED = "MAXIMUM_CCEMAILS_EXCEEDED";
-    public static final java.lang.String _MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED = "MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED";
-    public static final java.lang.String _MAXIMUM_HIERARCHY_LEVELS_REACHED = "MAXIMUM_HIERARCHY_LEVELS_REACHED";
-    public static final java.lang.String _MAXIMUM_SIZE_OF_ATTACHMENT = "MAXIMUM_SIZE_OF_ATTACHMENT";
-    public static final java.lang.String _MAXIMUM_SIZE_OF_DOCUMENT = "MAXIMUM_SIZE_OF_DOCUMENT";
-    public static final java.lang.String _MAX_ACTIONS_PER_RULE_EXCEEDED = "MAX_ACTIONS_PER_RULE_EXCEEDED";
-    public static final java.lang.String _MAX_ACTIVE_RULES_EXCEEDED = "MAX_ACTIVE_RULES_EXCEEDED";
-    public static final java.lang.String _MAX_APPROVAL_STEPS_EXCEEDED = "MAX_APPROVAL_STEPS_EXCEEDED";
-    public static final java.lang.String _MAX_FORMULAS_PER_RULE_EXCEEDED = "MAX_FORMULAS_PER_RULE_EXCEEDED";
-    public static final java.lang.String _MAX_RULES_EXCEEDED = "MAX_RULES_EXCEEDED";
-    public static final java.lang.String _MAX_RULE_ENTRIES_EXCEEDED = "MAX_RULE_ENTRIES_EXCEEDED";
-    public static final java.lang.String _MAX_TASK_DESCRIPTION_EXCEEEDED = "MAX_TASK_DESCRIPTION_EXCEEEDED";
-    public static final java.lang.String _MAX_TM_RULES_EXCEEDED = "MAX_TM_RULES_EXCEEDED";
-    public static final java.lang.String _MAX_TM_RULE_ITEMS_EXCEEDED = "MAX_TM_RULE_ITEMS_EXCEEDED";
-    public static final java.lang.String _MERGE_FAILED = "MERGE_FAILED";
-    public static final java.lang.String _MISSING_ARGUMENT = "MISSING_ARGUMENT";
-    public static final java.lang.String _MIXED_DML_OPERATION = "MIXED_DML_OPERATION";
-    public static final java.lang.String _NONUNIQUE_SHIPPING_ADDRESS = "NONUNIQUE_SHIPPING_ADDRESS";
-    public static final java.lang.String _NO_APPLICABLE_PROCESS = "NO_APPLICABLE_PROCESS";
-    public static final java.lang.String _NO_ATTACHMENT_PERMISSION = "NO_ATTACHMENT_PERMISSION";
-    public static final java.lang.String _NO_MASS_MAIL_PERMISSION = "NO_MASS_MAIL_PERMISSION";
-    public static final java.lang.String _NUMBER_OUTSIDE_VALID_RANGE = "NUMBER_OUTSIDE_VALID_RANGE";
-    public static final java.lang.String _NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED = "NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED";
-    public static final java.lang.String _OPTED_OUT_OF_MASS_MAIL = "OPTED_OUT_OF_MASS_MAIL";
-    public static final java.lang.String _PACKAGE_LICENSE_REQUIRED = "PACKAGE_LICENSE_REQUIRED";
-    public static final java.lang.String _PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT = "PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT";
-    public static final java.lang.String _PRIVATE_CONTACT_ON_ASSET = "PRIVATE_CONTACT_ON_ASSET";
-    public static final java.lang.String _RECORD_IN_USE_BY_WORKFLOW = "RECORD_IN_USE_BY_WORKFLOW";
-    public static final java.lang.String _REQUEST_RUNNING_TOO_LONG = "REQUEST_RUNNING_TOO_LONG";
-    public static final java.lang.String _REQUIRED_FIELD_MISSING = "REQUIRED_FIELD_MISSING";
-    public static final java.lang.String _SELF_REFERENCE_FROM_TRIGGER = "SELF_REFERENCE_FROM_TRIGGER";
-    public static final java.lang.String _SHARE_NEEDED_FOR_CHILD_OWNER = "SHARE_NEEDED_FOR_CHILD_OWNER";
-    public static final java.lang.String _STANDARD_PRICE_NOT_DEFINED = "STANDARD_PRICE_NOT_DEFINED";
-    public static final java.lang.String _STORAGE_LIMIT_EXCEEDED = "STORAGE_LIMIT_EXCEEDED";
-    public static final java.lang.String _STRING_TOO_LONG = "STRING_TOO_LONG";
-    public static final java.lang.String _TABSET_LIMIT_EXCEEDED = "TABSET_LIMIT_EXCEEDED";
-    public static final java.lang.String _TEMPLATE_NOT_ACTIVE = "TEMPLATE_NOT_ACTIVE";
-    public static final java.lang.String _TERRITORY_REALIGN_IN_PROGRESS = "TERRITORY_REALIGN_IN_PROGRESS";
-    public static final java.lang.String _TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET = "TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET";
-    public static final java.lang.String _TOO_MANY_APEX_REQUESTS = "TOO_MANY_APEX_REQUESTS";
-    public static final java.lang.String _TOO_MANY_ENUM_VALUE = "TOO_MANY_ENUM_VALUE";
-    public static final java.lang.String _TRANSFER_REQUIRES_READ = "TRANSFER_REQUIRES_READ";
-    public static final java.lang.String _UNABLE_TO_LOCK_ROW = "UNABLE_TO_LOCK_ROW";
-    public static final java.lang.String _UNAVAILABLE_RECORDTYPE_EXCEPTION = "UNAVAILABLE_RECORDTYPE_EXCEPTION";
-    public static final java.lang.String _UNDELETE_FAILED = "UNDELETE_FAILED";
-    public static final java.lang.String _UNKNOWN_EXCEPTION = "UNKNOWN_EXCEPTION";
-    public static final java.lang.String _UNSPECIFIED_EMAIL_ADDRESS = "UNSPECIFIED_EMAIL_ADDRESS";
-    public static final java.lang.String _UNSUPPORTED_APEX_TRIGGER_OPERATON = "UNSUPPORTED_APEX_TRIGGER_OPERATON";
-    public static final java.lang.String _WEBLINK_SIZE_LIMIT_EXCEEDED = "WEBLINK_SIZE_LIMIT_EXCEEDED";
-    public static final java.lang.String _WRONG_CONTROLLER_TYPE = "WRONG_CONTROLLER_TYPE";
-    public static final StatusCode ALREADY_IN_PROCESS = new StatusCode(_ALREADY_IN_PROCESS);
-    public static final StatusCode ASSIGNEE_TYPE_REQUIRED = new StatusCode(_ASSIGNEE_TYPE_REQUIRED);
-    public static final StatusCode BAD_CUSTOM_ENTITY_PARENT_DOMAIN = new StatusCode(_BAD_CUSTOM_ENTITY_PARENT_DOMAIN);
-    public static final StatusCode BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED = new StatusCode(_BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED);
-    public static final StatusCode CANNOT_CASCADE_PRODUCT_ACTIVE = new StatusCode(_CANNOT_CASCADE_PRODUCT_ACTIVE);
-    public static final StatusCode CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD = new StatusCode(_CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD);
-    public static final StatusCode CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE = new StatusCode(_CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE);
-    public static final StatusCode CANNOT_DEACTIVATE_DIVISION = new StatusCode(_CANNOT_DEACTIVATE_DIVISION);
-    public static final StatusCode CANNOT_DELETE_LAST_DATED_CONVERSION_RATE = new StatusCode(_CANNOT_DELETE_LAST_DATED_CONVERSION_RATE);
-    public static final StatusCode CANNOT_DELETE_MANAGED_OBJECT = new StatusCode(_CANNOT_DELETE_MANAGED_OBJECT);
-    public static final StatusCode CANNOT_DISABLE_LAST_ADMIN = new StatusCode(_CANNOT_DISABLE_LAST_ADMIN);
-    public static final StatusCode CANNOT_ENABLE_IP_RESTRICT_REQUESTS = new StatusCode(_CANNOT_ENABLE_IP_RESTRICT_REQUESTS);
-    public static final StatusCode CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY = new StatusCode(_CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY);
-    public static final StatusCode CANNOT_MODIFY_MANAGED_OBJECT = new StatusCode(_CANNOT_MODIFY_MANAGED_OBJECT);
-    public static final StatusCode CANNOT_RENAME_APEX_REFERENCED_FIELD = new StatusCode(_CANNOT_RENAME_APEX_REFERENCED_FIELD);
-    public static final StatusCode CANNOT_RENAME_APEX_REFERENCED_OBJECT = new StatusCode(_CANNOT_RENAME_APEX_REFERENCED_OBJECT);
-    public static final StatusCode CANNOT_REPARENT_RECORD = new StatusCode(_CANNOT_REPARENT_RECORD);
-    public static final StatusCode CANNOT_UPDATE_CONVERTED_LEAD = new StatusCode(_CANNOT_UPDATE_CONVERTED_LEAD);
-    public static final StatusCode CANT_DISABLE_CORP_CURRENCY = new StatusCode(_CANT_DISABLE_CORP_CURRENCY);
-    public static final StatusCode CANT_UNSET_CORP_CURRENCY = new StatusCode(_CANT_UNSET_CORP_CURRENCY);
-    public static final StatusCode CHILD_SHARE_FAILS_PARENT = new StatusCode(_CHILD_SHARE_FAILS_PARENT);
-    public static final StatusCode CIRCULAR_DEPENDENCY = new StatusCode(_CIRCULAR_DEPENDENCY);
-    public static final StatusCode CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED);
-    public static final StatusCode CUSTOM_ENTITY_OR_FIELD_LIMIT = new StatusCode(_CUSTOM_ENTITY_OR_FIELD_LIMIT);
-    public static final StatusCode CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED);
-    public static final StatusCode CUSTOM_INDEX_EXISTS = new StatusCode(_CUSTOM_INDEX_EXISTS);
-    public static final StatusCode CUSTOM_LINK_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_LINK_LIMIT_EXCEEDED);
-    public static final StatusCode CUSTOM_TAB_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_TAB_LIMIT_EXCEEDED);
-    public static final StatusCode DELETE_FAILED = new StatusCode(_DELETE_FAILED);
-    public static final StatusCode DELETE_REQUIRED_ON_CASCADE = new StatusCode(_DELETE_REQUIRED_ON_CASCADE);
-    public static final StatusCode DEPENDENCY_EXISTS = new StatusCode(_DEPENDENCY_EXISTS);
-    public static final StatusCode DUPLICATE_CASE_SOLUTION = new StatusCode(_DUPLICATE_CASE_SOLUTION);
-    public static final StatusCode DUPLICATE_COMM_NICKNAME = new StatusCode(_DUPLICATE_COMM_NICKNAME);
-    public static final StatusCode DUPLICATE_CUSTOM_ENTITY_DEFINITION = new StatusCode(_DUPLICATE_CUSTOM_ENTITY_DEFINITION);
-    public static final StatusCode DUPLICATE_CUSTOM_TAB_MOTIF = new StatusCode(_DUPLICATE_CUSTOM_TAB_MOTIF);
-    public static final StatusCode DUPLICATE_DEVELOPER_NAME = new StatusCode(_DUPLICATE_DEVELOPER_NAME);
-    public static final StatusCode DUPLICATE_EXTERNAL_ID = new StatusCode(_DUPLICATE_EXTERNAL_ID);
-    public static final StatusCode DUPLICATE_MASTER_LABEL = new StatusCode(_DUPLICATE_MASTER_LABEL);
-    public static final StatusCode DUPLICATE_USERNAME = new StatusCode(_DUPLICATE_USERNAME);
-    public static final StatusCode DUPLICATE_VALUE = new StatusCode(_DUPLICATE_VALUE);
-    public static final StatusCode EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR = new StatusCode(_EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR);
-    public static final StatusCode EMPTY_SCONTROL_FILE_NAME = new StatusCode(_EMPTY_SCONTROL_FILE_NAME);
-    public static final StatusCode ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE = new StatusCode(_ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE);
-    public static final StatusCode ENTITY_IS_ARCHIVED = new StatusCode(_ENTITY_IS_ARCHIVED);
-    public static final StatusCode ENTITY_IS_DELETED = new StatusCode(_ENTITY_IS_DELETED);
-    public static final StatusCode ENTITY_IS_LOCKED = new StatusCode(_ENTITY_IS_LOCKED);
-    public static final StatusCode ERROR_IN_MAILER = new StatusCode(_ERROR_IN_MAILER);
-    public static final StatusCode FAILED_ACTIVATION = new StatusCode(_FAILED_ACTIVATION);
-    public static final StatusCode FIELD_CUSTOM_VALIDATION_EXCEPTION = new StatusCode(_FIELD_CUSTOM_VALIDATION_EXCEPTION);
-    public static final StatusCode FIELD_INTEGRITY_EXCEPTION = new StatusCode(_FIELD_INTEGRITY_EXCEPTION);
-    public static final StatusCode HTML_FILE_UPLOAD_NOT_ALLOWED = new StatusCode(_HTML_FILE_UPLOAD_NOT_ALLOWED);
-    public static final StatusCode IMAGE_TOO_LARGE = new StatusCode(_IMAGE_TOO_LARGE);
-    public static final StatusCode INACTIVE_OWNER_OR_USER = new StatusCode(_INACTIVE_OWNER_OR_USER);
-    public static final StatusCode INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY = new StatusCode(_INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY);
-    public static final StatusCode INSUFFICIENT_ACCESS_OR_READONLY = new StatusCode(_INSUFFICIENT_ACCESS_OR_READONLY);
-    public static final StatusCode INVALID_ACCESS_LEVEL = new StatusCode(_INVALID_ACCESS_LEVEL);
-    public static final StatusCode INVALID_ARGUMENT_TYPE = new StatusCode(_INVALID_ARGUMENT_TYPE);
-    public static final StatusCode INVALID_ASSIGNEE_TYPE = new StatusCode(_INVALID_ASSIGNEE_TYPE);
-    public static final StatusCode INVALID_ASSIGNMENT_RULE = new StatusCode(_INVALID_ASSIGNMENT_RULE);
-    public static final StatusCode INVALID_BATCH_OPERATION = new StatusCode(_INVALID_BATCH_OPERATION);
-    public static final StatusCode INVALID_CREDIT_CARD_INFO = new StatusCode(_INVALID_CREDIT_CARD_INFO);
-    public static final StatusCode INVALID_CROSS_REFERENCE_KEY = new StatusCode(_INVALID_CROSS_REFERENCE_KEY);
-    public static final StatusCode INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD = new StatusCode(_INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD);
-    public static final StatusCode INVALID_CURRENCY_CONV_RATE = new StatusCode(_INVALID_CURRENCY_CONV_RATE);
-    public static final StatusCode INVALID_CURRENCY_CORP_RATE = new StatusCode(_INVALID_CURRENCY_CORP_RATE);
-    public static final StatusCode INVALID_CURRENCY_ISO = new StatusCode(_INVALID_CURRENCY_ISO);
-    public static final StatusCode INVALID_EMAIL_ADDRESS = new StatusCode(_INVALID_EMAIL_ADDRESS);
-    public static final StatusCode INVALID_EMPTY_KEY_OWNER = new StatusCode(_INVALID_EMPTY_KEY_OWNER);
-    public static final StatusCode INVALID_FIELD = new StatusCode(_INVALID_FIELD);
-    public static final StatusCode INVALID_FIELD_FOR_INSERT_UPDATE = new StatusCode(_INVALID_FIELD_FOR_INSERT_UPDATE);
-    public static final StatusCode INVALID_FIELD_WHEN_USING_TEMPLATE = new StatusCode(_INVALID_FIELD_WHEN_USING_TEMPLATE);
-    public static final StatusCode INVALID_FILTER_ACTION = new StatusCode(_INVALID_FILTER_ACTION);
-    public static final StatusCode INVALID_GOOGLE_DOCS_URL = new StatusCode(_INVALID_GOOGLE_DOCS_URL);
-    public static final StatusCode INVALID_ID_FIELD = new StatusCode(_INVALID_ID_FIELD);
-    public static final StatusCode INVALID_INET_ADDRESS = new StatusCode(_INVALID_INET_ADDRESS);
-    public static final StatusCode INVALID_LINEITEM_CLONE_STATE = new StatusCode(_INVALID_LINEITEM_CLONE_STATE);
-    public static final StatusCode INVALID_MASTER_OR_TRANSLATED_SOLUTION = new StatusCode(_INVALID_MASTER_OR_TRANSLATED_SOLUTION);
-    public static final StatusCode INVALID_OPERATION = new StatusCode(_INVALID_OPERATION);
-    public static final StatusCode INVALID_OPERATOR = new StatusCode(_INVALID_OPERATOR);
-    public static final StatusCode INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST = new StatusCode(_INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST);
-    public static final StatusCode INVALID_PARTNER_NETWORK_STATUS = new StatusCode(_INVALID_PARTNER_NETWORK_STATUS);
-    public static final StatusCode INVALID_PERSON_ACCOUNT_OPERATION = new StatusCode(_INVALID_PERSON_ACCOUNT_OPERATION);
-    public static final StatusCode INVALID_SAVE_AS_ACTIVITY_FLAG = new StatusCode(_INVALID_SAVE_AS_ACTIVITY_FLAG);
-    public static final StatusCode INVALID_SESSION_ID = new StatusCode(_INVALID_SESSION_ID);
-    public static final StatusCode INVALID_SETUP_OWNER = new StatusCode(_INVALID_SETUP_OWNER);
-    public static final StatusCode INVALID_STATUS = new StatusCode(_INVALID_STATUS);
-    public static final StatusCode INVALID_TYPE = new StatusCode(_INVALID_TYPE);
-    public static final StatusCode INVALID_TYPE_FOR_OPERATION = new StatusCode(_INVALID_TYPE_FOR_OPERATION);
-    public static final StatusCode INVALID_TYPE_ON_FIELD_IN_RECORD = new StatusCode(_INVALID_TYPE_ON_FIELD_IN_RECORD);
-    public static final StatusCode IP_RANGE_LIMIT_EXCEEDED = new StatusCode(_IP_RANGE_LIMIT_EXCEEDED);
-    public static final StatusCode LICENSE_LIMIT_EXCEEDED = new StatusCode(_LICENSE_LIMIT_EXCEEDED);
-    public static final StatusCode LIMIT_EXCEEDED = new StatusCode(_LIMIT_EXCEEDED);
-    public static final StatusCode MALFORMED_ID = new StatusCode(_MALFORMED_ID);
-    public static final StatusCode MANAGER_NOT_DEFINED = new StatusCode(_MANAGER_NOT_DEFINED);
-    public static final StatusCode MASSMAIL_RETRY_LIMIT_EXCEEDED = new StatusCode(_MASSMAIL_RETRY_LIMIT_EXCEEDED);
-    public static final StatusCode MASS_MAIL_LIMIT_EXCEEDED = new StatusCode(_MASS_MAIL_LIMIT_EXCEEDED);
-    public static final StatusCode MAXIMUM_CCEMAILS_EXCEEDED = new StatusCode(_MAXIMUM_CCEMAILS_EXCEEDED);
-    public static final StatusCode MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED = new StatusCode(_MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED);
-    public static final StatusCode MAXIMUM_HIERARCHY_LEVELS_REACHED = new StatusCode(_MAXIMUM_HIERARCHY_LEVELS_REACHED);
-    public static final StatusCode MAXIMUM_SIZE_OF_ATTACHMENT = new StatusCode(_MAXIMUM_SIZE_OF_ATTACHMENT);
-    public static final StatusCode MAXIMUM_SIZE_OF_DOCUMENT = new StatusCode(_MAXIMUM_SIZE_OF_DOCUMENT);
-    public static final StatusCode MAX_ACTIONS_PER_RULE_EXCEEDED = new StatusCode(_MAX_ACTIONS_PER_RULE_EXCEEDED);
-    public static final StatusCode MAX_ACTIVE_RULES_EXCEEDED = new StatusCode(_MAX_ACTIVE_RULES_EXCEEDED);
-    public static final StatusCode MAX_APPROVAL_STEPS_EXCEEDED = new StatusCode(_MAX_APPROVAL_STEPS_EXCEEDED);
-    public static final StatusCode MAX_FORMULAS_PER_RULE_EXCEEDED = new StatusCode(_MAX_FORMULAS_PER_RULE_EXCEEDED);
-    public static final StatusCode MAX_RULES_EXCEEDED = new StatusCode(_MAX_RULES_EXCEEDED);
-    public static final StatusCode MAX_RULE_ENTRIES_EXCEEDED = new StatusCode(_MAX_RULE_ENTRIES_EXCEEDED);
-    public static final StatusCode MAX_TASK_DESCRIPTION_EXCEEEDED = new StatusCode(_MAX_TASK_DESCRIPTION_EXCEEEDED);
-    public static final StatusCode MAX_TM_RULES_EXCEEDED = new StatusCode(_MAX_TM_RULES_EXCEEDED);
-    public static final StatusCode MAX_TM_RULE_ITEMS_EXCEEDED = new StatusCode(_MAX_TM_RULE_ITEMS_EXCEEDED);
-    public static final StatusCode MERGE_FAILED = new StatusCode(_MERGE_FAILED);
-    public static final StatusCode MISSING_ARGUMENT = new StatusCode(_MISSING_ARGUMENT);
-    public static final StatusCode MIXED_DML_OPERATION = new StatusCode(_MIXED_DML_OPERATION);
-    public static final StatusCode NONUNIQUE_SHIPPING_ADDRESS = new StatusCode(_NONUNIQUE_SHIPPING_ADDRESS);
-    public static final StatusCode NO_APPLICABLE_PROCESS = new StatusCode(_NO_APPLICABLE_PROCESS);
-    public static final StatusCode NO_ATTACHMENT_PERMISSION = new StatusCode(_NO_ATTACHMENT_PERMISSION);
-    public static final StatusCode NO_MASS_MAIL_PERMISSION = new StatusCode(_NO_MASS_MAIL_PERMISSION);
-    public static final StatusCode NUMBER_OUTSIDE_VALID_RANGE = new StatusCode(_NUMBER_OUTSIDE_VALID_RANGE);
-    public static final StatusCode NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED = new StatusCode(_NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED);
-    public static final StatusCode OPTED_OUT_OF_MASS_MAIL = new StatusCode(_OPTED_OUT_OF_MASS_MAIL);
-    public static final StatusCode PACKAGE_LICENSE_REQUIRED = new StatusCode(_PACKAGE_LICENSE_REQUIRED);
-    public static final StatusCode PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT = new StatusCode(_PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT);
-    public static final StatusCode PRIVATE_CONTACT_ON_ASSET = new StatusCode(_PRIVATE_CONTACT_ON_ASSET);
-    public static final StatusCode RECORD_IN_USE_BY_WORKFLOW = new StatusCode(_RECORD_IN_USE_BY_WORKFLOW);
-    public static final StatusCode REQUEST_RUNNING_TOO_LONG = new StatusCode(_REQUEST_RUNNING_TOO_LONG);
-    public static final StatusCode REQUIRED_FIELD_MISSING = new StatusCode(_REQUIRED_FIELD_MISSING);
-    public static final StatusCode SELF_REFERENCE_FROM_TRIGGER = new StatusCode(_SELF_REFERENCE_FROM_TRIGGER);
-    public static final StatusCode SHARE_NEEDED_FOR_CHILD_OWNER = new StatusCode(_SHARE_NEEDED_FOR_CHILD_OWNER);
-    public static final StatusCode STANDARD_PRICE_NOT_DEFINED = new StatusCode(_STANDARD_PRICE_NOT_DEFINED);
-    public static final StatusCode STORAGE_LIMIT_EXCEEDED = new StatusCode(_STORAGE_LIMIT_EXCEEDED);
-    public static final StatusCode STRING_TOO_LONG = new StatusCode(_STRING_TOO_LONG);
-    public static final StatusCode TABSET_LIMIT_EXCEEDED = new StatusCode(_TABSET_LIMIT_EXCEEDED);
-    public static final StatusCode TEMPLATE_NOT_ACTIVE = new StatusCode(_TEMPLATE_NOT_ACTIVE);
-    public static final StatusCode TERRITORY_REALIGN_IN_PROGRESS = new StatusCode(_TERRITORY_REALIGN_IN_PROGRESS);
-    public static final StatusCode TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET = new StatusCode(_TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET);
-    public static final StatusCode TOO_MANY_APEX_REQUESTS = new StatusCode(_TOO_MANY_APEX_REQUESTS);
-    public static final StatusCode TOO_MANY_ENUM_VALUE = new StatusCode(_TOO_MANY_ENUM_VALUE);
-    public static final StatusCode TRANSFER_REQUIRES_READ = new StatusCode(_TRANSFER_REQUIRES_READ);
-    public static final StatusCode UNABLE_TO_LOCK_ROW = new StatusCode(_UNABLE_TO_LOCK_ROW);
-    public static final StatusCode UNAVAILABLE_RECORDTYPE_EXCEPTION = new StatusCode(_UNAVAILABLE_RECORDTYPE_EXCEPTION);
-    public static final StatusCode UNDELETE_FAILED = new StatusCode(_UNDELETE_FAILED);
-    public static final StatusCode UNKNOWN_EXCEPTION = new StatusCode(_UNKNOWN_EXCEPTION);
-    public static final StatusCode UNSPECIFIED_EMAIL_ADDRESS = new StatusCode(_UNSPECIFIED_EMAIL_ADDRESS);
-    public static final StatusCode UNSUPPORTED_APEX_TRIGGER_OPERATON = new StatusCode(_UNSUPPORTED_APEX_TRIGGER_OPERATON);
-    public static final StatusCode WEBLINK_SIZE_LIMIT_EXCEEDED = new StatusCode(_WEBLINK_SIZE_LIMIT_EXCEEDED);
-    public static final StatusCode WRONG_CONTROLLER_TYPE = new StatusCode(_WRONG_CONTROLLER_TYPE);
-    public java.lang.String getValue() { return _value_;}
-    public static StatusCode fromValue(java.lang.String value)
-          throws java.lang.IllegalArgumentException {
-        StatusCode enumeration = (StatusCode)
-            _table_.get(value);
-        if (enumeration==null) throw new java.lang.IllegalArgumentException();
-        return enumeration;
-    }
-    public static StatusCode fromString(java.lang.String value)
-          throws java.lang.IllegalArgumentException {
-        return fromValue(value);
-    }
-    public boolean equals(java.lang.Object obj) {return (obj == this);}
-    public int hashCode() { return toString().hashCode();}
-    public java.lang.String toString() { return _value_;}
-    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new org.apache.axis.encoding.ser.EnumSerializer(
-            _javaType, _xmlType);
-    }
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
-           javax.xml.namespace.QName _xmlType) {
-        return 
-          new org.apache.axis.encoding.ser.EnumDeserializer(
-            _javaType, _xmlType);
-    }
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(StatusCode.class);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "StatusCode"));
-    }
-    /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
-}
+/**
+ * StatusCode.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
+
+package com.sforce.soap.partner;
+
+public class StatusCode implements java.io.Serializable {
+    private java.lang.String _value_;
+    private static java.util.HashMap _table_ = new java.util.HashMap();
+
+    // Constructor
+    protected StatusCode(java.lang.String value) {
+        _value_ = value;
+        _table_.put(_value_,this);
+    }
+
+    public static final java.lang.String _ALREADY_IN_PROCESS = "ALREADY_IN_PROCESS";
+    public static final java.lang.String _ASSIGNEE_TYPE_REQUIRED = "ASSIGNEE_TYPE_REQUIRED";
+    public static final java.lang.String _BAD_CUSTOM_ENTITY_PARENT_DOMAIN = "BAD_CUSTOM_ENTITY_PARENT_DOMAIN";
+    public static final java.lang.String _BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED = "BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED";
+    public static final java.lang.String _CANNOT_CASCADE_PRODUCT_ACTIVE = "CANNOT_CASCADE_PRODUCT_ACTIVE";
+    public static final java.lang.String _CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD = "CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD";
+    public static final java.lang.String _CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE = "CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE";
+    public static final java.lang.String _CANNOT_DEACTIVATE_DIVISION = "CANNOT_DEACTIVATE_DIVISION";
+    public static final java.lang.String _CANNOT_DELETE_LAST_DATED_CONVERSION_RATE = "CANNOT_DELETE_LAST_DATED_CONVERSION_RATE";
+    public static final java.lang.String _CANNOT_DELETE_MANAGED_OBJECT = "CANNOT_DELETE_MANAGED_OBJECT";
+    public static final java.lang.String _CANNOT_DISABLE_LAST_ADMIN = "CANNOT_DISABLE_LAST_ADMIN";
+    public static final java.lang.String _CANNOT_ENABLE_IP_RESTRICT_REQUESTS = "CANNOT_ENABLE_IP_RESTRICT_REQUESTS";
+    public static final java.lang.String _CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY = "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY";
+    public static final java.lang.String _CANNOT_MODIFY_MANAGED_OBJECT = "CANNOT_MODIFY_MANAGED_OBJECT";
+    public static final java.lang.String _CANNOT_RENAME_APEX_REFERENCED_FIELD = "CANNOT_RENAME_APEX_REFERENCED_FIELD";
+    public static final java.lang.String _CANNOT_RENAME_APEX_REFERENCED_OBJECT = "CANNOT_RENAME_APEX_REFERENCED_OBJECT";
+    public static final java.lang.String _CANNOT_REPARENT_RECORD = "CANNOT_REPARENT_RECORD";
+    public static final java.lang.String _CANNOT_UPDATE_CONVERTED_LEAD = "CANNOT_UPDATE_CONVERTED_LEAD";
+    public static final java.lang.String _CANT_DISABLE_CORP_CURRENCY = "CANT_DISABLE_CORP_CURRENCY";
+    public static final java.lang.String _CANT_UNSET_CORP_CURRENCY = "CANT_UNSET_CORP_CURRENCY";
+    public static final java.lang.String _CHILD_SHARE_FAILS_PARENT = "CHILD_SHARE_FAILS_PARENT";
+    public static final java.lang.String _CIRCULAR_DEPENDENCY = "CIRCULAR_DEPENDENCY";
+    public static final java.lang.String _COMMUNITY_NOT_ACCESSIBLE = "COMMUNITY_NOT_ACCESSIBLE";
+    public static final java.lang.String _CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED = "CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED";
+    public static final java.lang.String _CUSTOM_ENTITY_OR_FIELD_LIMIT = "CUSTOM_ENTITY_OR_FIELD_LIMIT";
+    public static final java.lang.String _CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED = "CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED";
+    public static final java.lang.String _CUSTOM_INDEX_EXISTS = "CUSTOM_INDEX_EXISTS";
+    public static final java.lang.String _CUSTOM_LINK_LIMIT_EXCEEDED = "CUSTOM_LINK_LIMIT_EXCEEDED";
+    public static final java.lang.String _CUSTOM_TAB_LIMIT_EXCEEDED = "CUSTOM_TAB_LIMIT_EXCEEDED";
+    public static final java.lang.String _DELETE_FAILED = "DELETE_FAILED";
+    public static final java.lang.String _DELETE_REQUIRED_ON_CASCADE = "DELETE_REQUIRED_ON_CASCADE";
+    public static final java.lang.String _DEPENDENCY_EXISTS = "DEPENDENCY_EXISTS";
+    public static final java.lang.String _DUPLICATE_CASE_SOLUTION = "DUPLICATE_CASE_SOLUTION";
+    public static final java.lang.String _DUPLICATE_COMM_NICKNAME = "DUPLICATE_COMM_NICKNAME";
+    public static final java.lang.String _DUPLICATE_CUSTOM_ENTITY_DEFINITION = "DUPLICATE_CUSTOM_ENTITY_DEFINITION";
+    public static final java.lang.String _DUPLICATE_CUSTOM_TAB_MOTIF = "DUPLICATE_CUSTOM_TAB_MOTIF";
+    public static final java.lang.String _DUPLICATE_DEVELOPER_NAME = "DUPLICATE_DEVELOPER_NAME";
+    public static final java.lang.String _DUPLICATE_EXTERNAL_ID = "DUPLICATE_EXTERNAL_ID";
+    public static final java.lang.String _DUPLICATE_MASTER_LABEL = "DUPLICATE_MASTER_LABEL";
+    public static final java.lang.String _DUPLICATE_SENDER_DISPLAY_NAME = "DUPLICATE_SENDER_DISPLAY_NAME";
+    public static final java.lang.String _DUPLICATE_USERNAME = "DUPLICATE_USERNAME";
+    public static final java.lang.String _DUPLICATE_VALUE = "DUPLICATE_VALUE";
+    public static final java.lang.String _EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR = "EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR";
+    public static final java.lang.String _EMPTY_SCONTROL_FILE_NAME = "EMPTY_SCONTROL_FILE_NAME";
+    public static final java.lang.String _ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE = "ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE";
+    public static final java.lang.String _ENTITY_IS_ARCHIVED = "ENTITY_IS_ARCHIVED";
+    public static final java.lang.String _ENTITY_IS_DELETED = "ENTITY_IS_DELETED";
+    public static final java.lang.String _ENTITY_IS_LOCKED = "ENTITY_IS_LOCKED";
+    public static final java.lang.String _ERROR_IN_MAILER = "ERROR_IN_MAILER";
+    public static final java.lang.String _FAILED_ACTIVATION = "FAILED_ACTIVATION";
+    public static final java.lang.String _FIELD_CUSTOM_VALIDATION_EXCEPTION = "FIELD_CUSTOM_VALIDATION_EXCEPTION";
+    public static final java.lang.String _FIELD_INTEGRITY_EXCEPTION = "FIELD_INTEGRITY_EXCEPTION";
+    public static final java.lang.String _FILTERED_LOOKUP_LIMIT_EXCEEDED = "FILTERED_LOOKUP_LIMIT_EXCEEDED";
+    public static final java.lang.String _HTML_FILE_UPLOAD_NOT_ALLOWED = "HTML_FILE_UPLOAD_NOT_ALLOWED";
+    public static final java.lang.String _IMAGE_TOO_LARGE = "IMAGE_TOO_LARGE";
+    public static final java.lang.String _INACTIVE_OWNER_OR_USER = "INACTIVE_OWNER_OR_USER";
+    public static final java.lang.String _INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY = "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY";
+    public static final java.lang.String _INSUFFICIENT_ACCESS_OR_READONLY = "INSUFFICIENT_ACCESS_OR_READONLY";
+    public static final java.lang.String _INVALID_ACCESS_LEVEL = "INVALID_ACCESS_LEVEL";
+    public static final java.lang.String _INVALID_ARGUMENT_TYPE = "INVALID_ARGUMENT_TYPE";
+    public static final java.lang.String _INVALID_ASSIGNEE_TYPE = "INVALID_ASSIGNEE_TYPE";
+    public static final java.lang.String _INVALID_ASSIGNMENT_RULE = "INVALID_ASSIGNMENT_RULE";
+    public static final java.lang.String _INVALID_BATCH_OPERATION = "INVALID_BATCH_OPERATION";
+    public static final java.lang.String _INVALID_CONTENT_TYPE = "INVALID_CONTENT_TYPE";
+    public static final java.lang.String _INVALID_CREDIT_CARD_INFO = "INVALID_CREDIT_CARD_INFO";
+    public static final java.lang.String _INVALID_CROSS_REFERENCE_KEY = "INVALID_CROSS_REFERENCE_KEY";
+    public static final java.lang.String _INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD = "INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD";
+    public static final java.lang.String _INVALID_CURRENCY_CONV_RATE = "INVALID_CURRENCY_CONV_RATE";
+    public static final java.lang.String _INVALID_CURRENCY_CORP_RATE = "INVALID_CURRENCY_CORP_RATE";
+    public static final java.lang.String _INVALID_CURRENCY_ISO = "INVALID_CURRENCY_ISO";
+    public static final java.lang.String _INVALID_EMAIL_ADDRESS = "INVALID_EMAIL_ADDRESS";
+    public static final java.lang.String _INVALID_EMPTY_KEY_OWNER = "INVALID_EMPTY_KEY_OWNER";
+    public static final java.lang.String _INVALID_FIELD = "INVALID_FIELD";
+    public static final java.lang.String _INVALID_FIELD_FOR_INSERT_UPDATE = "INVALID_FIELD_FOR_INSERT_UPDATE";
+    public static final java.lang.String _INVALID_FIELD_WHEN_USING_TEMPLATE = "INVALID_FIELD_WHEN_USING_TEMPLATE";
+    public static final java.lang.String _INVALID_FILTER_ACTION = "INVALID_FILTER_ACTION";
+    public static final java.lang.String _INVALID_GOOGLE_DOCS_URL = "INVALID_GOOGLE_DOCS_URL";
+    public static final java.lang.String _INVALID_ID_FIELD = "INVALID_ID_FIELD";
+    public static final java.lang.String _INVALID_INET_ADDRESS = "INVALID_INET_ADDRESS";
+    public static final java.lang.String _INVALID_LINEITEM_CLONE_STATE = "INVALID_LINEITEM_CLONE_STATE";
+    public static final java.lang.String _INVALID_MASTER_OR_TRANSLATED_SOLUTION = "INVALID_MASTER_OR_TRANSLATED_SOLUTION";
+    public static final java.lang.String _INVALID_MESSAGE_ID_REFERENCE = "INVALID_MESSAGE_ID_REFERENCE";
+    public static final java.lang.String _INVALID_OPERATION = "INVALID_OPERATION";
+    public static final java.lang.String _INVALID_OPERATOR = "INVALID_OPERATOR";
+    public static final java.lang.String _INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST = "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST";
+    public static final java.lang.String _INVALID_PARTNER_NETWORK_STATUS = "INVALID_PARTNER_NETWORK_STATUS";
+    public static final java.lang.String _INVALID_PERSON_ACCOUNT_OPERATION = "INVALID_PERSON_ACCOUNT_OPERATION";
+    public static final java.lang.String _INVALID_SAVE_AS_ACTIVITY_FLAG = "INVALID_SAVE_AS_ACTIVITY_FLAG";
+    public static final java.lang.String _INVALID_SESSION_ID = "INVALID_SESSION_ID";
+    public static final java.lang.String _INVALID_SETUP_OWNER = "INVALID_SETUP_OWNER";
+    public static final java.lang.String _INVALID_STATUS = "INVALID_STATUS";
+    public static final java.lang.String _INVALID_TYPE = "INVALID_TYPE";
+    public static final java.lang.String _INVALID_TYPE_FOR_OPERATION = "INVALID_TYPE_FOR_OPERATION";
+    public static final java.lang.String _INVALID_TYPE_ON_FIELD_IN_RECORD = "INVALID_TYPE_ON_FIELD_IN_RECORD";
+    public static final java.lang.String _IP_RANGE_LIMIT_EXCEEDED = "IP_RANGE_LIMIT_EXCEEDED";
+    public static final java.lang.String _LICENSE_LIMIT_EXCEEDED = "LICENSE_LIMIT_EXCEEDED";
+    public static final java.lang.String _LIGHT_PORTAL_USER_EXCEPTION = "LIGHT_PORTAL_USER_EXCEPTION";
+    public static final java.lang.String _LIMIT_EXCEEDED = "LIMIT_EXCEEDED";
+    public static final java.lang.String _MALFORMED_ID = "MALFORMED_ID";
+    public static final java.lang.String _MANAGER_NOT_DEFINED = "MANAGER_NOT_DEFINED";
+    public static final java.lang.String _MASSMAIL_RETRY_LIMIT_EXCEEDED = "MASSMAIL_RETRY_LIMIT_EXCEEDED";
+    public static final java.lang.String _MASS_MAIL_LIMIT_EXCEEDED = "MASS_MAIL_LIMIT_EXCEEDED";
+    public static final java.lang.String _MAXIMUM_CCEMAILS_EXCEEDED = "MAXIMUM_CCEMAILS_EXCEEDED";
+    public static final java.lang.String _MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED = "MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED";
+    public static final java.lang.String _MAXIMUM_HIERARCHY_LEVELS_REACHED = "MAXIMUM_HIERARCHY_LEVELS_REACHED";
+    public static final java.lang.String _MAXIMUM_SIZE_OF_ATTACHMENT = "MAXIMUM_SIZE_OF_ATTACHMENT";
+    public static final java.lang.String _MAXIMUM_SIZE_OF_DOCUMENT = "MAXIMUM_SIZE_OF_DOCUMENT";
+    public static final java.lang.String _MAX_ACTIONS_PER_RULE_EXCEEDED = "MAX_ACTIONS_PER_RULE_EXCEEDED";
+    public static final java.lang.String _MAX_ACTIVE_RULES_EXCEEDED = "MAX_ACTIVE_RULES_EXCEEDED";
+    public static final java.lang.String _MAX_APPROVAL_STEPS_EXCEEDED = "MAX_APPROVAL_STEPS_EXCEEDED";
+    public static final java.lang.String _MAX_FORMULAS_PER_RULE_EXCEEDED = "MAX_FORMULAS_PER_RULE_EXCEEDED";
+    public static final java.lang.String _MAX_RULES_EXCEEDED = "MAX_RULES_EXCEEDED";
+    public static final java.lang.String _MAX_RULE_ENTRIES_EXCEEDED = "MAX_RULE_ENTRIES_EXCEEDED";
+    public static final java.lang.String _MAX_TASK_DESCRIPTION_EXCEEEDED = "MAX_TASK_DESCRIPTION_EXCEEEDED";
+    public static final java.lang.String _MAX_TM_RULES_EXCEEDED = "MAX_TM_RULES_EXCEEDED";
+    public static final java.lang.String _MAX_TM_RULE_ITEMS_EXCEEDED = "MAX_TM_RULE_ITEMS_EXCEEDED";
+    public static final java.lang.String _MERGE_FAILED = "MERGE_FAILED";
+    public static final java.lang.String _MISSING_ARGUMENT = "MISSING_ARGUMENT";
+    public static final java.lang.String _MIXED_DML_OPERATION = "MIXED_DML_OPERATION";
+    public static final java.lang.String _NONUNIQUE_SHIPPING_ADDRESS = "NONUNIQUE_SHIPPING_ADDRESS";
+    public static final java.lang.String _NO_APPLICABLE_PROCESS = "NO_APPLICABLE_PROCESS";
+    public static final java.lang.String _NO_ATTACHMENT_PERMISSION = "NO_ATTACHMENT_PERMISSION";
+    public static final java.lang.String _NO_INACTIVE_DIVISION_MEMBERS = "NO_INACTIVE_DIVISION_MEMBERS";
+    public static final java.lang.String _NO_MASS_MAIL_PERMISSION = "NO_MASS_MAIL_PERMISSION";
+    public static final java.lang.String _NUMBER_OUTSIDE_VALID_RANGE = "NUMBER_OUTSIDE_VALID_RANGE";
+    public static final java.lang.String _NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED = "NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED";
+    public static final java.lang.String _OPTED_OUT_OF_MASS_MAIL = "OPTED_OUT_OF_MASS_MAIL";
+    public static final java.lang.String _PACKAGE_LICENSE_REQUIRED = "PACKAGE_LICENSE_REQUIRED";
+    public static final java.lang.String _PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT = "PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT";
+    public static final java.lang.String _PRIVATE_CONTACT_ON_ASSET = "PRIVATE_CONTACT_ON_ASSET";
+    public static final java.lang.String _RECORD_IN_USE_BY_WORKFLOW = "RECORD_IN_USE_BY_WORKFLOW";
+    public static final java.lang.String _REQUEST_RUNNING_TOO_LONG = "REQUEST_RUNNING_TOO_LONG";
+    public static final java.lang.String _REQUIRED_FIELD_MISSING = "REQUIRED_FIELD_MISSING";
+    public static final java.lang.String _SELF_REFERENCE_FROM_TRIGGER = "SELF_REFERENCE_FROM_TRIGGER";
+    public static final java.lang.String _SHARE_NEEDED_FOR_CHILD_OWNER = "SHARE_NEEDED_FOR_CHILD_OWNER";
+    public static final java.lang.String _STANDARD_PRICE_NOT_DEFINED = "STANDARD_PRICE_NOT_DEFINED";
+    public static final java.lang.String _STORAGE_LIMIT_EXCEEDED = "STORAGE_LIMIT_EXCEEDED";
+    public static final java.lang.String _STRING_TOO_LONG = "STRING_TOO_LONG";
+    public static final java.lang.String _TABSET_LIMIT_EXCEEDED = "TABSET_LIMIT_EXCEEDED";
+    public static final java.lang.String _TEMPLATE_NOT_ACTIVE = "TEMPLATE_NOT_ACTIVE";
+    public static final java.lang.String _TERRITORY_REALIGN_IN_PROGRESS = "TERRITORY_REALIGN_IN_PROGRESS";
+    public static final java.lang.String _TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET = "TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET";
+    public static final java.lang.String _TOO_MANY_APEX_REQUESTS = "TOO_MANY_APEX_REQUESTS";
+    public static final java.lang.String _TOO_MANY_ENUM_VALUE = "TOO_MANY_ENUM_VALUE";
+    public static final java.lang.String _TRANSFER_REQUIRES_READ = "TRANSFER_REQUIRES_READ";
+    public static final java.lang.String _UNABLE_TO_LOCK_ROW = "UNABLE_TO_LOCK_ROW";
+    public static final java.lang.String _UNAVAILABLE_RECORDTYPE_EXCEPTION = "UNAVAILABLE_RECORDTYPE_EXCEPTION";
+    public static final java.lang.String _UNDELETE_FAILED = "UNDELETE_FAILED";
+    public static final java.lang.String _UNKNOWN_EXCEPTION = "UNKNOWN_EXCEPTION";
+    public static final java.lang.String _UNSPECIFIED_EMAIL_ADDRESS = "UNSPECIFIED_EMAIL_ADDRESS";
+    public static final java.lang.String _UNSUPPORTED_APEX_TRIGGER_OPERATON = "UNSUPPORTED_APEX_TRIGGER_OPERATON";
+    public static final java.lang.String _UNVERIFIED_SENDER_ADDRESS = "UNVERIFIED_SENDER_ADDRESS";
+    public static final java.lang.String _WEBLINK_SIZE_LIMIT_EXCEEDED = "WEBLINK_SIZE_LIMIT_EXCEEDED";
+    public static final java.lang.String _WRONG_CONTROLLER_TYPE = "WRONG_CONTROLLER_TYPE";
+    public static final StatusCode ALREADY_IN_PROCESS = new StatusCode(_ALREADY_IN_PROCESS);
+    public static final StatusCode ASSIGNEE_TYPE_REQUIRED = new StatusCode(_ASSIGNEE_TYPE_REQUIRED);
+    public static final StatusCode BAD_CUSTOM_ENTITY_PARENT_DOMAIN = new StatusCode(_BAD_CUSTOM_ENTITY_PARENT_DOMAIN);
+    public static final StatusCode BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED = new StatusCode(_BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED);
+    public static final StatusCode CANNOT_CASCADE_PRODUCT_ACTIVE = new StatusCode(_CANNOT_CASCADE_PRODUCT_ACTIVE);
+    public static final StatusCode CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD = new StatusCode(_CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD);
+    public static final StatusCode CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE = new StatusCode(_CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE);
+    public static final StatusCode CANNOT_DEACTIVATE_DIVISION = new StatusCode(_CANNOT_DEACTIVATE_DIVISION);
+    public static final StatusCode CANNOT_DELETE_LAST_DATED_CONVERSION_RATE = new StatusCode(_CANNOT_DELETE_LAST_DATED_CONVERSION_RATE);
+    public static final StatusCode CANNOT_DELETE_MANAGED_OBJECT = new StatusCode(_CANNOT_DELETE_MANAGED_OBJECT);
+    public static final StatusCode CANNOT_DISABLE_LAST_ADMIN = new StatusCode(_CANNOT_DISABLE_LAST_ADMIN);
+    public static final StatusCode CANNOT_ENABLE_IP_RESTRICT_REQUESTS = new StatusCode(_CANNOT_ENABLE_IP_RESTRICT_REQUESTS);
+    public static final StatusCode CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY = new StatusCode(_CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY);
+    public static final StatusCode CANNOT_MODIFY_MANAGED_OBJECT = new StatusCode(_CANNOT_MODIFY_MANAGED_OBJECT);
+    public static final StatusCode CANNOT_RENAME_APEX_REFERENCED_FIELD = new StatusCode(_CANNOT_RENAME_APEX_REFERENCED_FIELD);
+    public static final StatusCode CANNOT_RENAME_APEX_REFERENCED_OBJECT = new StatusCode(_CANNOT_RENAME_APEX_REFERENCED_OBJECT);
+    public static final StatusCode CANNOT_REPARENT_RECORD = new StatusCode(_CANNOT_REPARENT_RECORD);
+    public static final StatusCode CANNOT_UPDATE_CONVERTED_LEAD = new StatusCode(_CANNOT_UPDATE_CONVERTED_LEAD);
+    public static final StatusCode CANT_DISABLE_CORP_CURRENCY = new StatusCode(_CANT_DISABLE_CORP_CURRENCY);
+    public static final StatusCode CANT_UNSET_CORP_CURRENCY = new StatusCode(_CANT_UNSET_CORP_CURRENCY);
+    public static final StatusCode CHILD_SHARE_FAILS_PARENT = new StatusCode(_CHILD_SHARE_FAILS_PARENT);
+    public static final StatusCode CIRCULAR_DEPENDENCY = new StatusCode(_CIRCULAR_DEPENDENCY);
+    public static final StatusCode COMMUNITY_NOT_ACCESSIBLE = new StatusCode(_COMMUNITY_NOT_ACCESSIBLE);
+    public static final StatusCode CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED);
+    public static final StatusCode CUSTOM_ENTITY_OR_FIELD_LIMIT = new StatusCode(_CUSTOM_ENTITY_OR_FIELD_LIMIT);
+    public static final StatusCode CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED);
+    public static final StatusCode CUSTOM_INDEX_EXISTS = new StatusCode(_CUSTOM_INDEX_EXISTS);
+    public static final StatusCode CUSTOM_LINK_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_LINK_LIMIT_EXCEEDED);
+    public static final StatusCode CUSTOM_TAB_LIMIT_EXCEEDED = new StatusCode(_CUSTOM_TAB_LIMIT_EXCEEDED);
+    public static final StatusCode DELETE_FAILED = new StatusCode(_DELETE_FAILED);
+    public static final StatusCode DELETE_REQUIRED_ON_CASCADE = new StatusCode(_DELETE_REQUIRED_ON_CASCADE);
+    public static final StatusCode DEPENDENCY_EXISTS = new StatusCode(_DEPENDENCY_EXISTS);
+    public static final StatusCode DUPLICATE_CASE_SOLUTION = new StatusCode(_DUPLICATE_CASE_SOLUTION);
+    public static final StatusCode DUPLICATE_COMM_NICKNAME = new StatusCode(_DUPLICATE_COMM_NICKNAME);
+    public static final StatusCode DUPLICATE_CUSTOM_ENTITY_DEFINITION = new StatusCode(_DUPLICATE_CUSTOM_ENTITY_DEFINITION);
+    public static final StatusCode DUPLICATE_CUSTOM_TAB_MOTIF = new StatusCode(_DUPLICATE_CUSTOM_TAB_MOTIF);
+    public static final StatusCode DUPLICATE_DEVELOPER_NAME = new StatusCode(_DUPLICATE_DEVELOPER_NAME);
+    public static final StatusCode DUPLICATE_EXTERNAL_ID = new StatusCode(_DUPLICATE_EXTERNAL_ID);
+    public static final StatusCode DUPLICATE_MASTER_LABEL = new StatusCode(_DUPLICATE_MASTER_LABEL);
+    public static final StatusCode DUPLICATE_SENDER_DISPLAY_NAME = new StatusCode(_DUPLICATE_SENDER_DISPLAY_NAME);
+    public static final StatusCode DUPLICATE_USERNAME = new StatusCode(_DUPLICATE_USERNAME);
+    public static final StatusCode DUPLICATE_VALUE = new StatusCode(_DUPLICATE_VALUE);
+    public static final StatusCode EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR = new StatusCode(_EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR);
+    public static final StatusCode EMPTY_SCONTROL_FILE_NAME = new StatusCode(_EMPTY_SCONTROL_FILE_NAME);
+    public static final StatusCode ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE = new StatusCode(_ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE);
+    public static final StatusCode ENTITY_IS_ARCHIVED = new StatusCode(_ENTITY_IS_ARCHIVED);
+    public static final StatusCode ENTITY_IS_DELETED = new StatusCode(_ENTITY_IS_DELETED);
+    public static final StatusCode ENTITY_IS_LOCKED = new StatusCode(_ENTITY_IS_LOCKED);
+    public static final StatusCode ERROR_IN_MAILER = new StatusCode(_ERROR_IN_MAILER);
+    public static final StatusCode FAILED_ACTIVATION = new StatusCode(_FAILED_ACTIVATION);
+    public static final StatusCode FIELD_CUSTOM_VALIDATION_EXCEPTION = new StatusCode(_FIELD_CUSTOM_VALIDATION_EXCEPTION);
+    public static final StatusCode FIELD_INTEGRITY_EXCEPTION = new StatusCode(_FIELD_INTEGRITY_EXCEPTION);
+    public static final StatusCode FILTERED_LOOKUP_LIMIT_EXCEEDED = new StatusCode(_FILTERED_LOOKUP_LIMIT_EXCEEDED);
+    public static final StatusCode HTML_FILE_UPLOAD_NOT_ALLOWED = new StatusCode(_HTML_FILE_UPLOAD_NOT_ALLOWED);
+    public static final StatusCode IMAGE_TOO_LARGE = new StatusCode(_IMAGE_TOO_LARGE);
+    public static final StatusCode INACTIVE_OWNER_OR_USER = new StatusCode(_INACTIVE_OWNER_OR_USER);
+    public static final StatusCode INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY = new StatusCode(_INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY);
+    public static final StatusCode INSUFFICIENT_ACCESS_OR_READONLY = new StatusCode(_INSUFFICIENT_ACCESS_OR_READONLY);
+    public static final StatusCode INVALID_ACCESS_LEVEL = new StatusCode(_INVALID_ACCESS_LEVEL);
+    public static final StatusCode INVALID_ARGUMENT_TYPE = new StatusCode(_INVALID_ARGUMENT_TYPE);
+    public static final StatusCode INVALID_ASSIGNEE_TYPE = new StatusCode(_INVALID_ASSIGNEE_TYPE);
+    public static final StatusCode INVALID_ASSIGNMENT_RULE = new StatusCode(_INVALID_ASSIGNMENT_RULE);
+    public static final StatusCode INVALID_BATCH_OPERATION = new StatusCode(_INVALID_BATCH_OPERATION);
+    public static final StatusCode INVALID_CONTENT_TYPE = new StatusCode(_INVALID_CONTENT_TYPE);
+    public static final StatusCode INVALID_CREDIT_CARD_INFO = new StatusCode(_INVALID_CREDIT_CARD_INFO);
+    public static final StatusCode INVALID_CROSS_REFERENCE_KEY = new StatusCode(_INVALID_CROSS_REFERENCE_KEY);
+    public static final StatusCode INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD = new StatusCode(_INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD);
+    public static final StatusCode INVALID_CURRENCY_CONV_RATE = new StatusCode(_INVALID_CURRENCY_CONV_RATE);
+    public static final StatusCode INVALID_CURRENCY_CORP_RATE = new StatusCode(_INVALID_CURRENCY_CORP_RATE);
+    public static final StatusCode INVALID_CURRENCY_ISO = new StatusCode(_INVALID_CURRENCY_ISO);
+    public static final StatusCode INVALID_EMAIL_ADDRESS = new StatusCode(_INVALID_EMAIL_ADDRESS);
+    public static final StatusCode INVALID_EMPTY_KEY_OWNER = new StatusCode(_INVALID_EMPTY_KEY_OWNER);
+    public static final StatusCode INVALID_FIELD = new StatusCode(_INVALID_FIELD);
+    public static final StatusCode INVALID_FIELD_FOR_INSERT_UPDATE = new StatusCode(_INVALID_FIELD_FOR_INSERT_UPDATE);
+    public static final StatusCode INVALID_FIELD_WHEN_USING_TEMPLATE = new StatusCode(_INVALID_FIELD_WHEN_USING_TEMPLATE);
+    public static final StatusCode INVALID_FILTER_ACTION = new StatusCode(_INVALID_FILTER_ACTION);
+    public static final StatusCode INVALID_GOOGLE_DOCS_URL = new StatusCode(_INVALID_GOOGLE_DOCS_URL);
+    public static final StatusCode INVALID_ID_FIELD = new StatusCode(_INVALID_ID_FIELD);
+    public static final StatusCode INVALID_INET_ADDRESS = new StatusCode(_INVALID_INET_ADDRESS);
+    public static final StatusCode INVALID_LINEITEM_CLONE_STATE = new StatusCode(_INVALID_LINEITEM_CLONE_STATE);
+    public static final StatusCode INVALID_MASTER_OR_TRANSLATED_SOLUTION = new StatusCode(_INVALID_MASTER_OR_TRANSLATED_SOLUTION);
+    public static final StatusCode INVALID_MESSAGE_ID_REFERENCE = new StatusCode(_INVALID_MESSAGE_ID_REFERENCE);
+    public static final StatusCode INVALID_OPERATION = new StatusCode(_INVALID_OPERATION);
+    public static final StatusCode INVALID_OPERATOR = new StatusCode(_INVALID_OPERATOR);
+    public static final StatusCode INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST = new StatusCode(_INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST);
+    public static final StatusCode INVALID_PARTNER_NETWORK_STATUS = new StatusCode(_INVALID_PARTNER_NETWORK_STATUS);
+    public static final StatusCode INVALID_PERSON_ACCOUNT_OPERATION = new StatusCode(_INVALID_PERSON_ACCOUNT_OPERATION);
+    public static final StatusCode INVALID_SAVE_AS_ACTIVITY_FLAG = new StatusCode(_INVALID_SAVE_AS_ACTIVITY_FLAG);
+    public static final StatusCode INVALID_SESSION_ID = new StatusCode(_INVALID_SESSION_ID);
+    public static final StatusCode INVALID_SETUP_OWNER = new StatusCode(_INVALID_SETUP_OWNER);
+    public static final StatusCode INVALID_STATUS = new StatusCode(_INVALID_STATUS);
+    public static final StatusCode INVALID_TYPE = new StatusCode(_INVALID_TYPE);
+    public static final StatusCode INVALID_TYPE_FOR_OPERATION = new StatusCode(_INVALID_TYPE_FOR_OPERATION);
+    public static final StatusCode INVALID_TYPE_ON_FIELD_IN_RECORD = new StatusCode(_INVALID_TYPE_ON_FIELD_IN_RECORD);
+    public static final StatusCode IP_RANGE_LIMIT_EXCEEDED = new StatusCode(_IP_RANGE_LIMIT_EXCEEDED);
+    public static final StatusCode LICENSE_LIMIT_EXCEEDED = new StatusCode(_LICENSE_LIMIT_EXCEEDED);
+    public static final StatusCode LIGHT_PORTAL_USER_EXCEPTION = new StatusCode(_LIGHT_PORTAL_USER_EXCEPTION);
+    public static final StatusCode LIMIT_EXCEEDED = new StatusCode(_LIMIT_EXCEEDED);
+    public static final StatusCode MALFORMED_ID = new StatusCode(_MALFORMED_ID);
+    public static final StatusCode MANAGER_NOT_DEFINED = new StatusCode(_MANAGER_NOT_DEFINED);
+    public static final StatusCode MASSMAIL_RETRY_LIMIT_EXCEEDED = new StatusCode(_MASSMAIL_RETRY_LIMIT_EXCEEDED);
+    public static final StatusCode MASS_MAIL_LIMIT_EXCEEDED = new StatusCode(_MASS_MAIL_LIMIT_EXCEEDED);
+    public static final StatusCode MAXIMUM_CCEMAILS_EXCEEDED = new StatusCode(_MAXIMUM_CCEMAILS_EXCEEDED);
+    public static final StatusCode MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED = new StatusCode(_MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED);
+    public static final StatusCode MAXIMUM_HIERARCHY_LEVELS_REACHED = new StatusCode(_MAXIMUM_HIERARCHY_LEVELS_REACHED);
+    public static final StatusCode MAXIMUM_SIZE_OF_ATTACHMENT = new StatusCode(_MAXIMUM_SIZE_OF_ATTACHMENT);
+    public static final StatusCode MAXIMUM_SIZE_OF_DOCUMENT = new StatusCode(_MAXIMUM_SIZE_OF_DOCUMENT);
+    public static final StatusCode MAX_ACTIONS_PER_RULE_EXCEEDED = new StatusCode(_MAX_ACTIONS_PER_RULE_EXCEEDED);
+    public static final StatusCode MAX_ACTIVE_RULES_EXCEEDED = new StatusCode(_MAX_ACTIVE_RULES_EXCEEDED);
+    public static final StatusCode MAX_APPROVAL_STEPS_EXCEEDED = new StatusCode(_MAX_APPROVAL_STEPS_EXCEEDED);
+    public static final StatusCode MAX_FORMULAS_PER_RULE_EXCEEDED = new StatusCode(_MAX_FORMULAS_PER_RULE_EXCEEDED);
+    public static final StatusCode MAX_RULES_EXCEEDED = new StatusCode(_MAX_RULES_EXCEEDED);
+    public static final StatusCode MAX_RULE_ENTRIES_EXCEEDED = new StatusCode(_MAX_RULE_ENTRIES_EXCEEDED);
+    public static final StatusCode MAX_TASK_DESCRIPTION_EXCEEEDED = new StatusCode(_MAX_TASK_DESCRIPTION_EXCEEEDED);
+    public static final StatusCode MAX_TM_RULES_EXCEEDED = new StatusCode(_MAX_TM_RULES_EXCEEDED);
+    public static final StatusCode MAX_TM_RULE_ITEMS_EXCEEDED = new StatusCode(_MAX_TM_RULE_ITEMS_EXCEEDED);
+    public static final StatusCode MERGE_FAILED = new StatusCode(_MERGE_FAILED);
+    public static final StatusCode MISSING_ARGUMENT = new StatusCode(_MISSING_ARGUMENT);
+    public static final StatusCode MIXED_DML_OPERATION = new StatusCode(_MIXED_DML_OPERATION);
+    public static final StatusCode NONUNIQUE_SHIPPING_ADDRESS = new StatusCode(_NONUNIQUE_SHIPPING_ADDRESS);
+    public static final StatusCode NO_APPLICABLE_PROCESS = new StatusCode(_NO_APPLICABLE_PROCESS);
+    public static final StatusCode NO_ATTACHMENT_PERMISSION = new StatusCode(_NO_ATTACHMENT_PERMISSION);
+    public static final StatusCode NO_INACTIVE_DIVISION_MEMBERS = new StatusCode(_NO_INACTIVE_DIVISION_MEMBERS);
+    public static final StatusCode NO_MASS_MAIL_PERMISSION = new StatusCode(_NO_MASS_MAIL_PERMISSION);
+    public static final StatusCode NUMBER_OUTSIDE_VALID_RANGE = new StatusCode(_NUMBER_OUTSIDE_VALID_RANGE);
+    public static final StatusCode NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED = new StatusCode(_NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED);
+    public static final StatusCode OPTED_OUT_OF_MASS_MAIL = new StatusCode(_OPTED_OUT_OF_MASS_MAIL);
+    public static final StatusCode PACKAGE_LICENSE_REQUIRED = new StatusCode(_PACKAGE_LICENSE_REQUIRED);
+    public static final StatusCode PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT = new StatusCode(_PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT);
+    public static final StatusCode PRIVATE_CONTACT_ON_ASSET = new StatusCode(_PRIVATE_CONTACT_ON_ASSET);
+    public static final StatusCode RECORD_IN_USE_BY_WORKFLOW = new StatusCode(_RECORD_IN_USE_BY_WORKFLOW);
+    public static final StatusCode REQUEST_RUNNING_TOO_LONG = new StatusCode(_REQUEST_RUNNING_TOO_LONG);
+    public static final StatusCode REQUIRED_FIELD_MISSING = new StatusCode(_REQUIRED_FIELD_MISSING);
+    public static final StatusCode SELF_REFERENCE_FROM_TRIGGER = new StatusCode(_SELF_REFERENCE_FROM_TRIGGER);
+    public static final StatusCode SHARE_NEEDED_FOR_CHILD_OWNER = new StatusCode(_SHARE_NEEDED_FOR_CHILD_OWNER);
+    public static final StatusCode STANDARD_PRICE_NOT_DEFINED = new StatusCode(_STANDARD_PRICE_NOT_DEFINED);
+    public static final StatusCode STORAGE_LIMIT_EXCEEDED = new StatusCode(_STORAGE_LIMIT_EXCEEDED);
+    public static final StatusCode STRING_TOO_LONG = new StatusCode(_STRING_TOO_LONG);
+    public static final StatusCode TABSET_LIMIT_EXCEEDED = new StatusCode(_TABSET_LIMIT_EXCEEDED);
+    public static final StatusCode TEMPLATE_NOT_ACTIVE = new StatusCode(_TEMPLATE_NOT_ACTIVE);
+    public static final StatusCode TERRITORY_REALIGN_IN_PROGRESS = new StatusCode(_TERRITORY_REALIGN_IN_PROGRESS);
+    public static final StatusCode TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET = new StatusCode(_TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET);
+    public static final StatusCode TOO_MANY_APEX_REQUESTS = new StatusCode(_TOO_MANY_APEX_REQUESTS);
+    public static final StatusCode TOO_MANY_ENUM_VALUE = new StatusCode(_TOO_MANY_ENUM_VALUE);
+    public static final StatusCode TRANSFER_REQUIRES_READ = new StatusCode(_TRANSFER_REQUIRES_READ);
+    public static final StatusCode UNABLE_TO_LOCK_ROW = new StatusCode(_UNABLE_TO_LOCK_ROW);
+    public static final StatusCode UNAVAILABLE_RECORDTYPE_EXCEPTION = new StatusCode(_UNAVAILABLE_RECORDTYPE_EXCEPTION);
+    public static final StatusCode UNDELETE_FAILED = new StatusCode(_UNDELETE_FAILED);
+    public static final StatusCode UNKNOWN_EXCEPTION = new StatusCode(_UNKNOWN_EXCEPTION);
+    public static final StatusCode UNSPECIFIED_EMAIL_ADDRESS = new StatusCode(_UNSPECIFIED_EMAIL_ADDRESS);
+    public static final StatusCode UNSUPPORTED_APEX_TRIGGER_OPERATON = new StatusCode(_UNSUPPORTED_APEX_TRIGGER_OPERATON);
+    public static final StatusCode UNVERIFIED_SENDER_ADDRESS = new StatusCode(_UNVERIFIED_SENDER_ADDRESS);
+    public static final StatusCode WEBLINK_SIZE_LIMIT_EXCEEDED = new StatusCode(_WEBLINK_SIZE_LIMIT_EXCEEDED);
+    public static final StatusCode WRONG_CONTROLLER_TYPE = new StatusCode(_WRONG_CONTROLLER_TYPE);
+    public java.lang.String getValue() { return _value_;}
+    public static StatusCode fromValue(java.lang.String value)
+          throws java.lang.IllegalArgumentException {
+        StatusCode enumeration = (StatusCode)
+            _table_.get(value);
+        if (enumeration==null) throw new java.lang.IllegalArgumentException();
+        return enumeration;
+    }
+    public static StatusCode fromString(java.lang.String value)
+          throws java.lang.IllegalArgumentException {
+        return fromValue(value);
+    }
+    public boolean equals(java.lang.Object obj) {return (obj == this);}
+    public int hashCode() { return toString().hashCode();}
+    public java.lang.String toString() { return _value_;}
+    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
+    public static org.apache.axis.encoding.Serializer getSerializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new org.apache.axis.encoding.ser.EnumSerializer(
+            _javaType, _xmlType);
+    }
+    public static org.apache.axis.encoding.Deserializer getDeserializer(
+           java.lang.String mechType, 
+           java.lang.Class _javaType,  
+           javax.xml.namespace.QName _xmlType) {
+        return 
+          new org.apache.axis.encoding.ser.EnumDeserializer(
+            _javaType, _xmlType);
+    }
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(StatusCode.class);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "StatusCode"));
+    }
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+}

Modified: branches/JCA/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
===================================================================
--- branches/JCA/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2010-01-10 00:19:53 UTC (rev 1727)
@@ -53,15 +53,17 @@
       <listitem>
         <para> Because different data sources organize tables in different
           ways, some prepending catalog or schema or user information,
-          Teiid allows table specification to be a dot-delimited construct.  
+          Teiid allows table specification to be a dot-delimited construct.
+          <note>
+	        <para> When a table specification contains a dot resolving will allow for the match of
+	        a partial name against any number of the end segments in the name.  e.g. a table with the 
+	        fully-qualified name vdbname."sourcescema.sourcetable" would match the partial name
+	        sourcetable.
+	        </para>
+          </note>
         </para>
       </listitem>
       <listitem>
-        <para> When a table specification contains a dot resolving will allow for the match of
-        a partial name against any number of the end segments in the name.  
-        </para>
-      </listitem>
-      <listitem>
         <para> Columns, schemas, and aliases identifiers cannot contain a dot.  
         </para>
       </listitem>

Modified: branches/JCA/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml
===================================================================
--- branches/JCA/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,7 +26,7 @@
 					<entry>
 						Treats the user command as if all source commands are executed
 						within the scope of the same transaction. The
-						<link linkend="autowrap">AutoWrap</link>
+						<link linkend="autowrap">AutoCommitTxn</link>
 						execution property controls the behavior of command level
 						transactions.
 					</entry>
@@ -45,13 +45,13 @@
 		</tgroup>
 	</table>
 	<sect1 id="autowrap">
-		<title>AutoWrap Execution Property</title>
+		<title>AutoCommitTxn Execution Property</title>
 		<para>Since user level commands may execute multiple source
-			commands, users can specify the AutoWrap execution property to
+			commands, users can specify the AutoCommitTxn execution property to
 			control the transactional behavior of a user command when not in a
 			local or global transaction.</para>
 		<table>
-			<title>AutoWrap Settings</title>
+			<title>AutoCommitTxn Settings</title>
 			<tgroup cols="2">
 				<colspec colwidth="1*" />
 				<colspec colwidth="3*" />
@@ -74,19 +74,9 @@
 							safest, but may be burdonsome on performance.</entry>
 					</row>
 					<row>
-						<entry>OPTIMISTIC</entry>
+						<entry>AUTO</entry>
 						<entry>
-							<emphasis>This is the default setting.</emphasis>
-							Will not automatically wrap a command in a transaction, instead
-							throw an exception if the command executed is
-							<link linkend="updating_model_count">transactionally unsafe.</link>
-							to execute outside of a transaction.
-						</entry>
-					</row>
-					<row>
-						<entry>PESSIMISTIC</entry>
-						<entry>
-							Will automatically wrap commands in a transaction, but only if
+						    This is the default setting. Will automatically wrap commands in a transaction, but only if
 							the command seems to be
 							<link linkend="updating_model_count">transactionally unsafe.</link>
 						</entry>

Modified: branches/JCA/engine/src/main/java/com/metamatrix/cache/CacheConfiguration.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/cache/CacheConfiguration.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/cache/CacheConfiguration.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,11 +24,10 @@
 
 public class CacheConfiguration {
 	
-	public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.MRU, 60*60, 100); // 1 hours with 100 nodes.
+	public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
 		
 	public enum Policy {
 		LRU,  // Least Recently Used
-		MRU,  // Most Recently Used
 		FIFO, // First in First Out
 		LFU;  // Least frequently Used
 	}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedException.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedException.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedException.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -31,7 +31,7 @@
  */
 public class BlockedException extends MetaMatrixComponentException {
 
-    public static final BlockedException INSTANCE = new BlockedException(""); //$NON-NLS-1$
+    public static final BlockedException INSTANCE = new BlockedException();
 
     /**
      * No-arg costructor required by Externalizable semantics
@@ -40,44 +40,4 @@
         super();
     }
     
-    /**
-     * Construct an instance with the message specified.
-     *
-     * @param message A message describing the exception
-     */
-    public BlockedException( String message ) {
-        super( message );
-    }
-
-    /**
-     * Construct an instance with the message and error code specified.
-     *
-     * @param message A message describing the exception
-     * @param code The error code
-     */
-    public BlockedException( String code, String message ) {
-        super( code, message );
-    }
-
-    /**
-     * Construct an instance from a message and an exception to chain to this one.
-     *
-     * @param message A message describing the exception
-     * @param e An exception to nest within this one
-     */
-    public BlockedException( Throwable e, String message ) {
-        super( e, message );
-    }
-
-    /**
-     * Construct an instance from a message and a code and an exception to
-     * chain to this one.
-     *
-     * @param e An exception to nest within this one
-     * @param message A message describing the exception
-     * @param code A code denoting the exception
-     */
-    public BlockedException( Throwable e, String code, String message ) {
-        super( e, code, message );
-    }
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedOnMemoryException.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedOnMemoryException.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BlockedOnMemoryException.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-/**
- * This exception is thrown by the plan if it receives a MemoryNotAvailableException while
- * attempting to pin a batch in the BufferManager.
- */
-public class BlockedOnMemoryException extends BlockedException {
-
-    public static final BlockedOnMemoryException INSTANCE = new BlockedOnMemoryException(""); //$NON-NLS-1$
-
-    /**
-     * No-arg costructor required by Externalizable semantics
-     */
-    public BlockedOnMemoryException() {
-        super();
-    }
-    
-    /**
-     * Construct an instance with the message specified.
-     *
-     * @param message A message describing the exception
-     */
-    public BlockedOnMemoryException( String message ) {
-        super( message );
-    }
-
-    /**
-     * Construct an instance with the message and error code specified.
-     *
-     * @param message A message describing the exception
-     * @param code The error code
-     */
-    public BlockedOnMemoryException( String code, String message ) {
-        super( code, message );
-    }
-
-    /**
-     * Construct an instance from a message and an exception to chain to this one.
-     *
-     * @param message A message describing the exception
-     * @param e An exception to nest within this one
-     */
-    public BlockedOnMemoryException( Throwable e, String message ) {
-        super( e, message );
-    }
-
-    /**
-     * Construct an instance from a message and a code and an exception to
-     * chain to this one.
-     *
-     * @param e An exception to nest within this one
-     * @param message A message describing the exception
-     * @param code A code denoting the exception
-     */
-    public BlockedOnMemoryException( Throwable e, String code, String message ) {
-        super( e, code, message );
-    }
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,11 +23,8 @@
 package com.metamatrix.common.buffer;
 
 import java.util.List;
-import java.util.Properties;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.lob.LobChunk;
-import com.metamatrix.common.types.Streamable;
 
 /**
  * The buffer manager controls how memory is used and how data flows through 
@@ -39,23 +36,6 @@
  */
 public interface BufferManager {
 	
-	public enum TupleSourceStatus {
-		/**
-		 * Indicates the status of a {@link TupleSource} is active; the
-		 * TupleSource is itself currently still receiving data.
-		 * @see #getStatus
-		 * @see #setStatus
-		 */
-		ACTIVE,
-		/**
-		 * Indicates the status of a {@link TupleSource} is full; the
-		 * TupleSource has loaded all of its tuples.
-		 * @see #getStatus
-		 * @see #setStatus
-		 */
-		FULL
-	}
-	
 	public enum TupleSourceType {
 		/**
 		 * Indicates that a tuple source is use during query processing as a 
@@ -68,224 +48,65 @@
 		FINAL
 	}
 
-    /**
-	 * Prompts this implementation to initialize itself with the supplied
-	 * Properties.  The implementation Class should document what properties
-	 * are necessary, if any.
-     * @param lookup Class used to determine identity and lookup other managers
-     * @param properties Properties required to initialize the Buffer Manager
-     * @throws BufferException if there was a problem initializing
-	 */
-	void initialize(String location, Properties properties) throws MetaMatrixComponentException;
-	
-    /**
-     * Get the batch size to use during query processing.  
-     * @return Batch size (# of rows)
-     */
-    int getProcessorBatchSize();
-
-    /**
-     * Get the batch size to use when reading data from a connector.  
-     * @return Batch size (# of rows)
-     */
-    int getConnectorBatchSize();
-    
 	/**
-	 * Adds a {@link StorageManager} to this BufferManager instance.
-     * @param storageManager Storage manager to add
+	 * Optional property - the max size of a batch sent between connector and query service.
+	 * Making batches larger reduces communication overhead between connector and query service
+	 * but increases the granularity of memory management on those batches.  This value should 
+	 * be a positive integer and defaults to 1000.
 	 */
-	void setStorageManager(StorageManager storageManager);
-
+	public static final String CONNECTOR_BATCH_SIZE = "metamatrix.buffer.connectorBatchSize"; //$NON-NLS-1$
 	/**
-	 * Creates a tuple source based on a schema and properties describing
-	 * hints about the source
-     * @param elements Elements of the tuple source
-	 * @param groupName Tuple source group name
-	 * @param tupleSourceType Type of tuple source
-     * @return Identifier for tuple source
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+	 * Optional property - the max size of a batch sent internally within the query processor.
+	 * In general, these batches should be smaller than the connector batch size as there are 
+	 * no communication costs with these batches.  Smaller batches typically allow a user to 
+	 * get their first results quicker and allow fine-grained buffer management on intermediate
+	 * results.  This value should be a positive integer and defaults to 100.
 	 */
-	TupleSourceID createTupleSource(List elements, String groupName, TupleSourceType tupleSourceType) 
-    throws MetaMatrixComponentException;
-	
+	public static final String PROCESSOR_BATCH_SIZE = "metamatrix.buffer.processorBatchSize"; //$NON-NLS-1$
 	/**
-	 * Removes a tuple source by ID 
-     * @param tupleSourceID Tuple source identifier
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+	 * Optional property - this value specifies the location to store temporary buffers to
+	 * large to fit in memory.  Temporary buffer files will be created and destroyed in this
+	 * directory.  This value should be a string specifying an absolute directory path.
 	 */
-	void removeTupleSource(TupleSourceID tupleSourceID) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-    /**
-     * Removes all tuple sources by group name
-     * @param groupName Tuple source group name
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-    void removeTupleSources(String groupName) 
-    throws MetaMatrixComponentException;
-
+	public static final String BUFFER_STORAGE_DIRECTORY = "metamatrix.buffer.storageDirectory"; //$NON-NLS-1$
 	/**
-	 * Gets a tuple source by ID
-     * @param tupleSourceID Tuple source identifier
-     * @return Tuple source to get tuples from the specified source
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+	 * Optional property - this values specifies how many open file descriptors should be cached
+	 * in the storage directory.  Increasing this value in heavy load may improve performance
+	 * but will use more file descriptors, which are a limited system resource.  The default
+	 * is 32.
 	 */
-	IndexedTupleSource getTupleSource(TupleSourceID tupleSourceID) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-    /**
-     * Gets a tuple batch by ID and indexes.  Pins this tuple batch in memory until 
-     * it is unpinned or tuple source is removed.  If memory does not exist to pin the 
-     * batch, a MemoryNotAvailableException is thrown.
-     * 
-     * @param tupleSourceID Tuple source identifier
-     * @param beginRow First row index to return
-     * @return Batch of rows starting from beginRow and not past maxEndRow
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     * @throws MemoryNotAvailableException If memory was not available for the pin
-     */
-    TupleBatch pinTupleBatch(TupleSourceID tupleSourceID, int beginRow) 
-    throws TupleSourceNotFoundException, MemoryNotAvailableException, MetaMatrixComponentException;
-
-    /**
-     * Unpins a range of rows from the given tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @param firstRow First row to unpin
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-    void unpinTupleBatch(TupleSourceID tupleSourceID, int firstRow) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
+	public static final String MAX_OPEN_FILES = "metamatrix.buffer.maxOpenFiles"; //$NON-NLS-1$
 	/**
-	 * Gets a tuple source schema by ID 
-     * @param tupleSourceID Tuple source identifier
-     * @return List of ElementSymbol describing elements of tuple source
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+	 * Optional property - this values specifies the maximum size in MegaBytes that a buffer file can reach.
+	 * The default is 2048 MB (i.e. 2GB).
 	 */
-    List getTupleSchema(TupleSourceID tupleSourceID) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-
+	public static final String MAX_FILE_SIZE = "metamatrix.buffer.maxFileSize"; //$NON-NLS-1$
 	/**
-	 * Adds a batch of tuples for the specified tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @param tupleBatch Batch of rows to add
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+	 * Optional property - the max number of batches to process at once in algorithms such as sorting.
 	 */
-	void addTupleBatch(TupleSourceID tupleSourceID, TupleBatch tupleBatch) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
+	public static final String MAX_PROCESSING_BATCHES = "metamatrix.buffer.maxProcessingBatches"; //$NON-NLS-1$
+	
+	public static int DEFAULT_CONNECTOR_BATCH_SIZE = 2048;
+	public static int DEFAULT_PROCESSOR_BATCH_SIZE = 1024;
+	public static int DEFAULT_MAX_PROCESSING_BATCHES = 16;
 
     /**
-     * Gets the current row count 
-     * @param tupleSourceID Tuple source identifier
-     * @return Current known number of rows in tuple source 
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
+     * Get the batch size to use during query processing.  
+     * @return Batch size (# of rows)
      */
-    int getRowCount(TupleSourceID tupleSourceID)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
+    int getProcessorBatchSize();
 
-	/**
-	 * Sets the status of the tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @param status New status
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     * @see TupleSourceStatus#ACTIVE
-     * @see TupleSourceStatus#FULL
-	 */
-	void setStatus(TupleSourceID tupleSourceID, TupleSourceStatus status) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-	/**
-	 * Gets the status of the tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @return Status of tuple source
-     * @throws TupleSourceNotFoundException if tuple source could not be found
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     * @see TupleSourceStatus#ACTIVE
-     * @see TupleSourceStatus#FULL
-	 */
-	TupleSourceStatus getStatus(TupleSourceID tupleSourceID) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-	/**
-	 * Gets the final row count if tuple source is FULL, otherwise returns -1. 
-	 * @param tupleSourceID Tuple source identifier
-	 * @return Final row count if status == FULL, -1 otherwise
-	 */
-	int getFinalRowCount(TupleSourceID tupleSourceID) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-    
     /**
-     * Add a streamable object to the persistent store. The distinction is made between
-     * regular tuple sources and streamable object beacuse, streamable objects are fairly
-     * large in size can not be loaded totally into memory, as other tuple sources are done
-     * this mechanism allows to stream these objects chunk by chunk. 
-     * @param tupleSourceID
-     * @param streamGlob part of the stream
-     * @param stream
-     * @throws TupleSourceNotFoundException
-     * @throws MetaMatrixComponentException
+     * Get the batch size to use when reading data from a connector.  
+     * @return Batch size (# of rows)
      */
-    void addStreamablePart(TupleSourceID tupleSourceID, LobChunk streamGlob, int beginRow)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
+    int getConnectorBatchSize();
     
-    /**
-     * Returns the streamable batch object's part stored with specified identifier
-     * @param tupleSourceID - identifier
-     * @return LobChunk a part of the Streamable object stored.
-     * @throws TupleSourceNotFoundException
-     * @throws MetaMatrixComponentException
-     */
-    LobChunk getStreamablePart(TupleSourceID tupleSourceID, int beginRow)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-        
-    void stop();
+	TupleBuffer createTupleBuffer(List elements, String groupName, TupleSourceType tupleSourceType) 
+    throws MetaMatrixComponentException;
+	
+    int getMaxProcessingBatches();
     
-    /**
-     * Release batches that have been pinned by this thread.
-     * This method should be called when processing is terminated
-     * to ensure that the memory can be freed. 
-     */
-    void releasePinnedBatches() throws MetaMatrixComponentException;
+    FileStore createFileStore(String name);
     
-    /**
-     * Return the LOB associated with the referenceId
-     * @param id
-     * @param referenceId
-     * @return
-     * @throws TupleSourceNotFoundException
-     * @throws MetaMatrixComponentException
-     */
-    Streamable<?> getStreamable(TupleSourceID id, String referenceId) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-    
-    /**
-     * Assign the {@link TupleSource} as the persistent stream for the {@link Streamable}
-     * @param id
-     * @param s
-     * @throws TupleSourceNotFoundException 
-     */
-    void setPersistentTupleSource(TupleSourceID id, Streamable<? extends Object> s)
-    throws TupleSourceNotFoundException;
-    
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerLobChunkStream.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerLobChunkStream.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerLobChunkStream.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-
-import java.io.IOException;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.lob.LobChunk;
-import com.metamatrix.common.lob.LobChunkProducer;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.util.LogConstants;
-
-public class BufferManagerLobChunkStream  implements LobChunkProducer {
-    private TupleSourceID sourceId;
-    private BufferManager bufferMgr;
-    private int position = 0;
-    
-    public BufferManagerLobChunkStream(String persitentId, BufferManager bufferMgr) {
-        this.sourceId = new TupleSourceID(persitentId);
-        this.bufferMgr = bufferMgr;
-    }
-    
-    public LobChunk getNextChunk() throws IOException {
-        try {
-            this.position++;
-            return bufferMgr.getStreamablePart(sourceId, position);
-        } catch (TupleSourceNotFoundException e) {
-            String msg = DQPPlugin.Util.getString("BufferManagerLobChunkStream.no_tuple_source", new Object[] {sourceId}); //$NON-NLS-1$
-            LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, msg); 
-            throw new IOException(msg);
-        } catch (MetaMatrixComponentException e) {
-            String msg = DQPPlugin.Util.getString("BufferManagerLobChunkStream.error_processing", new Object[] {sourceId}); //$NON-NLS-1$
-            LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, msg); 
-            throw new IOException(msg);
-        }                
-    }
-
-    /** 
-     * @see com.metamatrix.common.lob.LobChunkProducer#close()
-     */
-    public void close() throws IOException {
-        // we could remove the buffer tuple here but, this is just a stream, so we need to delete 
-        // that when we close th eplan.
-    }
-}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerPropertyNames.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerPropertyNames.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/BufferManagerPropertyNames.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,158 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-/**
- * This class holds constants for all the buffer manager properties.
- */
-public final class BufferManagerPropertyNames {
-
-    /**
-     * Optional property - the amount of memory (in megabytes) that buffer management should use.  
-     * This value should be a positive integer (less than the the max heap size) and defaults to 
-     * 128.
-     */
-    public static final String MEMORY_AVAILABLE = "metamatrix.buffer.memoryAvailable"; //$NON-NLS-1$
-
-    /**
-     * Optional property - the percent of buffer management memory that a particular session 
-     * can use.  This property can be used to prevent a single user from consuming too many 
-     * resources.  This value should be in the range [1..100] and defaults to 50.
-     */
-    public static final String SESSION_USE_PERCENTAGE = "metamatrix.buffer.sessionUsePercentage"; //$NON-NLS-1$
-
-    /**
-     * Optional property - the percent of buffer management memory that serves as a threshold
-     * for active memory management. Below the threshold, no active memory management occurs
-     * and no data is moved between memory and persistent storage in the background.  Above
-     * the threshold, a background thread attempts to clean the in-memory buffers using an LRU
-     * algorithm.  This value should be in the range [1..100] and defaults to 75.
-     */
-    public static final String ACTIVE_MEMORY_THRESHOLD = "metamatrix.buffer.activeMemoryThreshold"; //$NON-NLS-1$
-
-    /**
-     * Optional property - the period between checking whether active memory clean up
-     * should occur, in milliseconds.  This value should be a millisecond value and defaults
-     * to 500 ms.  A value of 0 indicates that no active management should occur.
-     */
-    public static final String MANAGEMENT_INTERVAL = "metamatrix.buffer.managementInterval"; //$NON-NLS-1$
-
-    /**
-     * Optional property - the max size of a batch sent between connector and query service.
-     * Making batches larger reduces communication overhead between connector and query service
-     * but increases the granularity of memory management on those batches.  This value should 
-     * be a positive integer and defaults to 1000.
-     */
-    public static final String CONNECTOR_BATCH_SIZE = "metamatrix.buffer.connectorBatchSize"; //$NON-NLS-1$
-
-    /**
-     * Optional property - the max size of a batch sent internally within the query processor.
-     * In general, these batches should be smaller than the connector batch size as there are 
-     * no communication costs with these batches.  Smaller batches typically allow a user to 
-     * get their first results quicker and allow fine-grained buffer management on intermediate
-     * results.  This value should be a positive integer and defaults to 100.
-     */
-    public static final String PROCESSOR_BATCH_SIZE = "metamatrix.buffer.processorBatchSize"; //$NON-NLS-1$
-
-    /**
-     * Optional property - this value specifies the location to store temporary buffers to
-     * large to fit in memory.  Temporary buffer files will be created and destroyed in this
-     * directory.  This value should be a string specifying an absolute directory path.
-     */
-    public static final String BUFFER_STORAGE_DIRECTORY = "metamatrix.buffer.storageDirectory"; //$NON-NLS-1$
-
-    /**
-     * Optional property - this values specifies how many open file descriptors should be cached
-     * in the storage directory.  Increasing this value in heavy load may improve performance
-     * but will use more file descriptors, which are a limited system resource.  The default
-     * is 10.
-     */
-    public static final String MAX_OPEN_FILES = "metamatrix.buffer.maxOpenFiles"; //$NON-NLS-1$
-    /**
-     * Optional property - this values specifies the maximum size in MegaBytes that a buffer file can reach.
-     * The default is 2048 MB (i.e. 2GB).
-     */
-    public static final String MAX_FILE_SIZE = "metamatrix.buffer.maxFileSize"; //$NON-NLS-1$
-    
-    /**
-     * Optional property - this value specifies how often the buffer statistics should be 
-     * collected and logged.  This is primarily useful during debugging and defaults to a value
-     * of 0, which indicates no stats logging.  This value should be either 0 to indicate no
-     * logging or a positive integer indicating the period in milliseconds between logging.
-     */
-    public static final String LOG_STATS_INTERVAL = "metamatrix.buffer.logStatsInterval"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the class that is to be used for the MetadataConnectionFactory implementation.
-     * This property is required (there is no default).
-     */
-    public static final String CONNECTION_FACTORY = "metamatrix.buffer.connection.Factory"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the class of the driver.
-     * This property is optional.
-     */
-    public static final String CONNECTION_DRIVER = "metamatrix.buffer.connection.Driver"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the protocol for connecting to the metadata store.
-     * This property is optional.
-     */
-    public static final String CONNECTION_PROTOCOL = "metamatrix.buffer.connection.Protocol"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the name of the metadata store database.
-     * This property is optional.
-     */
-    public static final String CONNECTION_DATABASE = "metamatrix.buffer.connection.Database"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the username that is to be used for connecting to the metadata store.
-     * This property is optional.
-     */
-    public static final String CONNECTION_USERNAME = "metamatrix.buffer.connection.User"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the password that is to be used for connecting to the metadata store.
-     * This property is optional.
-     */
-    public static final String CONNECTION_PASSWORD = "metamatrix.buffer.connection.Password"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the maximum number of milliseconds that a metadata connection
-     * may remain unused before it becomes a candidate for garbage collection.
-     * This property is optional.
-     */
-    public static final String CONNECTION_POOL_MAXIMUM_AGE = "metamatrix.buffer.connection.MaximumAge"; //$NON-NLS-1$
-
-    /**
-     * The environment property name for the maximum number of concurrent users of a single metadata connection.
-     * This property is optional.
-     */
-    public static final String CONNECTION_POOL_MAXIMUM_CONCURRENT_USERS = "metamatrix.buffer.connection.MaximumConcurrentReaders"; //$NON-NLS-1$
-
-
-    // Can't construct
-    private BufferManagerPropertyNames() {
-    }
-}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,208 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.buffer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Set;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+
+public abstract class FileStore {
+	
+	private static ReferenceQueue<Object> QUEUE = new ReferenceQueue<Object>();
+	private static final Set<PhantomReference<Object>> REFERENCES = Collections.newSetFromMap(new IdentityHashMap<PhantomReference<Object>, Boolean>());
+	
+	/**
+	 * A customized buffered stream with an exposed buffer
+	 */
+	public final class FileStoreOutputStream extends OutputStream {
+		
+		private byte[] buffer;
+		private int count;
+		private boolean bytesWritten;
+		
+		public FileStoreOutputStream(int size) {
+			this.buffer = new byte[size];
+		}
+		
+		@Override
+		public void write(int b) throws IOException {
+			write(new byte[b], 0, 1);
+		}
+
+		@Override
+		public void write(byte[] b, int off, int len) throws IOException {
+			if (count + len <= buffer.length) {
+				System.arraycopy(b, off, buffer, count, len);
+				count += len;
+				return;
+			}
+			flushBuffer();
+			writeDirect(b, off, len);
+		}
+
+		private void writeDirect(byte[] b, int off, int len) throws IOException {
+			try {
+				FileStore.this.write(b, off, len);
+				bytesWritten = true;
+			} catch (MetaMatrixComponentException e) {
+				throw new IOException(e);
+			}
+		}
+
+		private void flushBuffer() throws IOException {
+			if (count > 0) {
+				writeDirect(buffer, 0, count);
+				count = 0;
+			}
+		}
+		
+		public boolean bytesWritten() {
+			return bytesWritten;
+		}
+		
+	    public byte toByteArray()[] {
+	        return Arrays.copyOf(buffer, count);
+	    }
+		
+		@Override
+		public void close() throws IOException {
+			if (bytesWritten) {
+				flushBuffer();
+			}
+		}
+		
+	}
+
+	static class CleanupReference extends PhantomReference<Object> {
+		
+		private FileStore store;
+		
+		public CleanupReference(Object referent, FileStore store) {
+			super(referent, QUEUE);
+			this.store = store;
+		}
+		
+		public void cleanup() {
+			try {
+				this.store.remove();
+			} finally {
+				this.clear();
+			}
+		}
+	}
+	
+	public void setCleanupReference(Object o) {
+		REFERENCES.add(new CleanupReference(o, this));
+		for (int i = 0; i < 10; i++) {
+			CleanupReference ref = (CleanupReference)QUEUE.poll();
+			if (ref == null) {
+				break;
+			}
+			ref.cleanup();
+			REFERENCES.remove(ref);
+		}
+	}
+	
+	private boolean removed;
+	
+	public int read(long fileOffset, byte[] b, int offSet, int length)
+			throws MetaMatrixComponentException {
+		if (removed) {
+			throw new MetaMatrixComponentException("already removed"); //$NON-NLS-1$
+		}
+		return readDirect(fileOffset, b, offSet, length);
+	}
+	
+	protected abstract int readDirect(long fileOffset, byte[] b, int offSet, int length)
+			throws MetaMatrixComponentException;
+
+	public void readFully(long fileOffset, byte[] b, int offSet, int length) throws MetaMatrixComponentException {
+        int n = 0;
+    	do {
+    	    int count = this.read(fileOffset + n, b, offSet + n, length - n);
+    	    if (count < 0) {
+    	    	throw new MetaMatrixComponentException("not enough bytes available"); //$NON-NLS-1$
+    	    }
+    	    n += count;
+    	} while (n < length);
+	}
+	
+	public long write(byte[] bytes) throws MetaMatrixComponentException {
+		return write(bytes, 0, bytes.length);
+	}
+
+	public long write(byte[] bytes, int offset, int length) throws MetaMatrixComponentException {
+		if (removed) {
+			throw new MetaMatrixComponentException("already removed"); //$NON-NLS-1$
+		}
+		return writeDirect(bytes, offset, length);
+	}
+
+	protected abstract long writeDirect(byte[] bytes, int offset, int length) throws MetaMatrixComponentException;
+
+	public void remove() {
+		if (!this.removed) {
+			this.removed = true;
+			this.removeDirect();
+		}
+	}
+	
+	protected abstract void removeDirect();
+	
+	public InputStream createInputStream() {
+		return new InputStream() {
+			private long offset;
+			
+			@Override
+			public int read() throws IOException {
+				throw new UnsupportedOperationException("buffered reading must be used"); //$NON-NLS-1$
+			}
+			
+			@Override
+			public int read(byte[] b, int off, int len) throws IOException {
+				try {
+					int bytes = FileStore.this.read(offset, b, off, len);
+					if (bytes != -1) {
+						this.offset += bytes;
+					}
+					return bytes;
+				} catch (MetaMatrixComponentException e) {
+					throw new IOException(e);
+				}
+			}
+		};
+	}
+	
+	public  FileStoreOutputStream createOutputStream(int maxMemorySize) {
+		return new FileStoreOutputStream(maxMemorySize);
+	}
+	
+}
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/IndexedTupleSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/IndexedTupleSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/IndexedTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -57,6 +57,4 @@
 	 */
 	int getCurrentIndex();
 	
-	TupleBatch getBatch()
-    throws MetaMatrixComponentException;
 }

Copied: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/ManagedBatch.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/common/buffer/ManagedBatch.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/ManagedBatch.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/ManagedBatch.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.buffer;
+
+import java.lang.ref.SoftReference;
+
+class ManagedBatch {
+
+    private int beginRow;
+    private SoftReference<TupleBatch> batchReference;
+    private long offset;
+    private int length;
+    
+    /**
+     * Constructor for ManagedBatch.
+     */
+    public ManagedBatch(TupleBatch batch) {
+        this.beginRow = batch.getBeginRow();
+        this.batchReference = new SoftReference<TupleBatch>(batch);
+    }
+    
+    /**
+     * Get the begin row, must be >= 1
+     * @return Begin row
+     */
+    public int getBeginRow() {
+        return this.beginRow;
+    }
+    
+    public String toString() {
+        return "ManagedBatch[" + beginRow + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    public TupleBatch getBatch() {
+		return this.batchReference.get();
+	}
+    
+    public void setBatchReference(TupleBatch batch) {
+		this.batchReference = new SoftReference<TupleBatch>(batch);
+	}
+    
+    public int getLength() {
+		return length;
+	}
+    
+    public long getOffset() {
+		return offset;
+	}
+    
+    public void setLength(int length) {
+		this.length = length;
+	}
+    
+    public void setOffset(long offset) {
+		this.offset = offset;
+	}
+        
+}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/MemoryNotAvailableException.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/MemoryNotAvailableException.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/MemoryNotAvailableException.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-import com.metamatrix.api.exception.MetaMatrixException;
-
-/**
- * Indicates memory was not available for the requested operation.
- */
-public class MemoryNotAvailableException extends MetaMatrixException {
-
-    /**
-     * No-arg costructor required by Externalizable semantics
-     */
-    public MemoryNotAvailableException() {
-        super();
-    }
-    
-    /**
-     * Constructor for MemoryNotAvailableException.
-     * @param message
-     */
-    public MemoryNotAvailableException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructor for MemoryNotAvailableException.
-     * @param code
-     * @param message
-     */
-    public MemoryNotAvailableException(String code, String message) {
-        super(code, message);
-    }
-
-    /**
-     * Constructor for MemoryNotAvailableException.
-     * @param e
-     * @param message
-     */
-    public MemoryNotAvailableException(Throwable e, String message) {
-        super(e, message);
-    }
-
-    /**
-     * Constructor for MemoryNotAvailableException.
-     * @param e
-     * @param code
-     * @param message
-     */
-    public MemoryNotAvailableException(Throwable e, String code, String message) {
-        super(e, code, message);
-    }
-
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/StorageManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/StorageManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/StorageManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,77 +23,13 @@
 package com.metamatrix.common.buffer;
 
 import java.util.Properties;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 
-/**
- * Basic interface for a storage manager.  The storage manager deals in 
- * terms of TupleBatch objects.  The basic contract assumed here is that 
- * batches are requested ({@link #getBatch(TupleSourceID, int)} or removed 
- * ({@link #removeBatch(TupleSourceID, int)}) <b>only</b> with the same 
- * beginning row that they were added with.  For instance, if batches 
- * from row 1-100 and row 101-200 were added to the storage manager, it 
- * would be fine to get batch with begin row 1 and 101 but getting a batch
- * with beginning row 50 would fail.  This contract was created to minimize 
- * the amount of batch manipulation required by a storage manager.
- */
 public interface StorageManager {
 
-    /**
-     * Constant for a StorageManager for database storage
-     */
-    public static final int TYPE_DATABASE = 1;
+	void initialize(Properties props) throws MetaMatrixComponentException;
 
-    /**
-     * Constant for a StorageManager for file storage
-     */
-    public static final int TYPE_FILE = 2;
+	FileStore createFileStore(String name);
 
-    /**
-     * Constant for a StorageManager for remote app storage
-     */
-    public static final int TYPE_REMOTE = 3;
-
-    /**
-     * Initialize the storage manager given the specified properties.  Properties
-     * are typically specific to the particular storage manager.
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-	void initialize(Properties props) 
-    throws MetaMatrixComponentException;
-
-    /**
-     * Add a batch to the storage manager.  
-     * @param types a hint to the StorageManager about the types of data in the batch
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-	void addBatch(TupleSourceID sourceID, TupleBatch batch, String[] types) 
-    throws MetaMatrixComponentException;
-
-    /**
-     * Returns a batch of tuples, starting at row beginRow.  The batch
-     * will only be found if the batch that was added begins at beginRow.
-     * @param types a hint to the StorageManager about the types of data in the batch
-     * @return batch of tuples starting at row beginRow
-     * @throws TupleSourceNotFoundException indicating the sourceID is unknown
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-	TupleBatch getBatch(TupleSourceID sourceID, int beginRow, String[] types) 
-    throws TupleSourceNotFoundException, MetaMatrixComponentException;
-
-    /**
-     * Remove all batches for the specified tuple source.  If no batches exist,
-     * no exception is thrown.
-     * @throws MetaMatrixComponentException indicating a non-business-related
-     * exception (such as a communication exception)
-     */
-	void removeBatches(TupleSourceID sourceID) 
-    throws MetaMatrixComponentException;
-
-    /**
-     * Shut down the Storage Manager.
-     */
-	void shutdown();
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBatch.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBatch.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBatch.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -41,14 +41,11 @@
  */
 public class TupleBatch implements Externalizable {
     
-    public static final long UNKNOWN_SIZE = -1;
-    
     private int rowOffset;    
     private List[] tuples;
     
     // Optional state
     private boolean terminationFlag = false;
-    private long size = UNKNOWN_SIZE;
     
     /**
      * Contains ordered data types of each of the columns in the batch. Although it is not serialized,
@@ -143,22 +140,6 @@
         this.terminationFlag = terminationFlag;    
     }
     
-    /**
-     * Get the size of this batch - may be constant indicating unknown.
-     * @return Size of batch in bytes or UNKNOWN_SIZE
-     */
-    public long getSize() {
-        return this.size;
-    }
-    
-    /**
-     * Set the size of this batch.
-     * @param size Size in bytes or UNKNOWN_SIZE 
-     */
-    public void setSize(long size) {
-        this.size = size;
-    }
-    
     public void setDataTypes(String[] types) {
         this.types = types;
     }
@@ -179,13 +160,11 @@
     }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        size = in.readLong();
         rowOffset = in.readInt();
         terminationFlag = in.readBoolean();
         tuples = BatchSerializer.readBatch(in, types);
     }
     public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(size);
         out.writeInt(rowOffset);
         out.writeBoolean(terminationFlag);
         BatchSerializer.writeBatch(out, types, tuples);

Copied: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBuffer.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/common/buffer/TupleBuffer.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBuffer.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleBuffer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,413 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.buffer;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Streamable;
+import com.metamatrix.core.util.Assertion;
+import com.metamatrix.dqp.DQPPlugin;
+import com.metamatrix.query.execution.QueryExecPlugin;
+
+public class TupleBuffer {
+	
+	class TupleSourceImpl implements IndexedTupleSource {
+	    private SoftReference<TupleBatch> currentBatch;
+	    private int currentRow = 1;
+	    private int mark = 1;
+		private List<?> currentTuple;
+
+	    @Override
+	    public int getCurrentIndex() {
+	    	return this.currentRow;
+	    }
+
+	    @Override
+	    public List getSchema(){
+	        return schema;
+	    }
+
+	    @Override
+	    public List<?> nextTuple()
+	    throws MetaMatrixComponentException{
+	    	List<?> result = null;
+	    	if (currentTuple != null){
+				result = currentTuple;
+				currentTuple = null;
+	    	} else {
+	    		result = getCurrentTuple();
+	    	} 
+	    	if (result != null) {
+	    		currentRow++;
+	    	}
+	        return result;
+	    }
+
+		private List<?> getCurrentTuple() throws MetaMatrixComponentException,
+				BlockedException {
+			TupleBatch batch = getBatch();
+	        if(batch.getRowCount() == 0) {
+	            // Check if last
+                if(isFinal) {
+                	currentBatch = null;
+                    return null;
+                } 
+                throw BlockedException.INSTANCE;
+	        }
+
+	        return batch.getTuple(currentRow);
+		}
+
+	    @Override
+	    public void closeSource()
+	    throws MetaMatrixComponentException{
+	    	currentBatch = null;
+	        mark = 1;
+	        reset();
+	    }
+	    
+	    // Retrieves the necessary batch based on the currentRow
+	    TupleBatch getBatch() throws MetaMatrixComponentException{
+	    	TupleBatch batch = null;
+	    	if (currentBatch != null) {
+	            batch = currentBatch.get();
+	        }
+	        if (batch != null) {
+	            if (currentRow <= batch.getEndRow() && currentRow >= batch.getBeginRow()) {
+	                return batch;
+	            }
+	            currentBatch = null;
+	        } 
+	        
+            batch = TupleBuffer.this.getBatch(currentRow);
+            if (batch != null) {
+            	currentBatch = new SoftReference<TupleBatch>(batch);
+            }
+	        return batch;
+	    }
+	    
+	    @Override
+		public boolean hasNext() throws MetaMatrixComponentException {
+	        if (this.currentTuple != null) {
+	            return true;
+	        }
+	        
+	        this.currentTuple = getCurrentTuple();
+			return this.currentTuple != null;
+		}
+
+		@Override
+		public void reset() {
+			this.setPosition(mark);
+			this.mark = 1;
+		}
+
+	    @Override
+	    public void mark() {
+	        this.mark = currentRow;
+	    }
+
+	    @Override
+	    public void setPosition(int position) {
+	        if (this.currentRow != position) {
+		        this.currentRow = position;
+		        this.currentTuple = null;
+	        }
+	    }
+	}
+
+	private static final AtomicLong LOB_ID = new AtomicLong();
+	
+	//construction state
+	private StorageManager manager;
+	private String tupleSourceID;
+	private List<?> schema;
+	private String[] types;
+	private int batchSize;
+	
+	private FileStore store;
+
+	private int rowCount;
+	private boolean isFinal;
+    private TreeMap<Integer, ManagedBatch> batches = new TreeMap<Integer, ManagedBatch>();
+	private ArrayList<List<?>> batchBuffer;
+	private AtomicInteger referenceCount = new AtomicInteger(1);
+
+    //lob management
+    private Map<String, Streamable<?>> lobReferences; //references to contained lobs
+    private boolean lobs = true;
+	
+	public TupleBuffer(StorageManager manager, String id, List<?> schema, String[] types, int batchSize) {
+		this.manager = manager;
+		this.tupleSourceID = id;
+		this.schema = schema;
+		this.types = types;
+		this.batchSize = batchSize;
+		if (types != null) {
+			int i = 0;
+		    for (i = 0; i < types.length; i++) {
+		        if (DataTypeManager.isLOB(types[i]) || types[i] == DataTypeManager.DefaultDataTypes.OBJECT) {
+		        	break;
+		        }
+		    }
+		    if (i == types.length) {
+		    	lobs = false;
+		    }
+        }
+	}
+	
+	public void addTuple(List<?> tuple) throws MetaMatrixComponentException {
+		if (lobs) {
+			correctLobReferences(new List[] {tuple});
+		}
+		this.rowCount++;
+		if (batchBuffer == null) {
+			batchBuffer = new ArrayList<List<?>>(batchSize/4);
+		}
+		batchBuffer.add(tuple);
+		if (batchBuffer.size() == batchSize) {
+			saveBatch(false);
+		}
+	}
+
+	public void saveBatch(boolean finalBatch) throws MetaMatrixComponentException {
+		Assertion.assertTrue(!this.isRemoved());
+		if (batchBuffer == null || batchBuffer.isEmpty()) {
+			return;
+		}
+		List<?> rows = batchBuffer==null?Collections.emptyList():batchBuffer;
+        TupleBatch writeBatch = new TupleBatch(rowCount - rows.size() + 1, rows);
+        if (finalBatch) {
+        	writeBatch.setTerminationFlag(true);
+        }
+		ManagedBatch mbatch = new ManagedBatch(writeBatch);
+		if (this.store == null) {
+			this.store = this.manager.createFileStore(this.tupleSourceID);
+			this.store.setCleanupReference(this);
+		}
+		byte[] bytes = convertToBytes(writeBatch);
+		mbatch.setLength(bytes.length);
+		mbatch.setOffset(this.store.write(bytes));
+		this.batches.put(mbatch.getBeginRow(), mbatch);
+        batchBuffer = null;
+	}
+	
+    /**
+     * Convert from an object to a byte array
+     * @param object Object to convert
+     * @return Byte array
+     */
+    private byte[] convertToBytes(TupleBatch batch) throws MetaMatrixComponentException {
+        ObjectOutputStream oos = null;
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            oos = new ObjectOutputStream(baos);
+
+            batch.setDataTypes(types);
+            batch.writeExternal(oos);
+            oos.flush();
+            return baos.toByteArray();
+
+        } catch(IOException e) {
+        	throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStorageManager.batch_error")); //$NON-NLS-1$
+        } finally {
+            if(oos != null) {
+                try {
+                    oos.close();
+                } catch(IOException e) {
+                }
+            }
+        }
+    }
+	
+	public void close() throws MetaMatrixComponentException {
+		//if there is only a single batch, let it stay in memory
+		if (!this.batches.isEmpty()) { 
+			saveBatch(true);
+		}
+		this.isFinal = true;
+	}
+
+	public TupleBatch getBatch(int row) throws MetaMatrixComponentException {
+		if (row > rowCount) {
+			TupleBatch batch = new TupleBatch(rowCount + 1, new List[] {});
+			if (isFinal) {
+				batch.setTerminationFlag(true);
+			}
+			return batch;
+		}
+		if (this.batchBuffer != null && row > rowCount - this.batchBuffer.size()) {
+			return new TupleBatch(rowCount - this.batchBuffer.size() + 1, batchBuffer);
+		}
+		if (this.batchBuffer != null && !this.batchBuffer.isEmpty()) {
+			saveBatch(isFinal);
+		}
+		Map.Entry<Integer, ManagedBatch> entry = batches.floorEntry(row);
+		Assertion.isNotNull(entry);
+		ManagedBatch batch = entry.getValue();
+    	TupleBatch result = batch.getBatch();
+    	if (result != null) {
+    		return result;
+    	}
+        try {
+            byte[] bytes = new byte[batch.getLength()];
+            this.store.readFully(batch.getOffset(), bytes, 0, bytes.length);
+            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+            ObjectInputStream ois = new ObjectInputStream(bais);
+
+            result = new TupleBatch();
+            result.setDataTypes(types);
+            result.readExternal(ois);
+        } catch(IOException e) {
+        	throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.error_reading", tupleSourceID)); //$NON-NLS-1$
+        } catch (ClassNotFoundException e) {
+        	throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.error_reading", tupleSourceID)); //$NON-NLS-1$
+        }
+		if (lobs) {
+			correctLobReferences(result.getAllTuples());
+		}
+		batch.setBatchReference(result);
+		return result;
+	}
+	
+	public void remove() {
+		int count = this.referenceCount.getAndDecrement();
+		if (count == 0) {
+			if (this.store != null) {
+				this.store.remove();
+				this.store = null;
+			}
+			if (this.batchBuffer != null) {
+				this.batchBuffer = null;
+			}
+			this.batches.clear();
+		}
+	}
+	
+	public boolean addReference() {
+		int count = this.referenceCount.addAndGet(1);
+		return count > 1;
+	}
+	
+	public int getRowCount() {
+		return rowCount;
+	}
+	
+	public boolean isFinal() {
+		return isFinal;
+	}
+	
+	public void setFinal(boolean isFinal) {
+		this.isFinal = isFinal;
+	}
+	
+	public List<?> getSchema() {
+		return schema;
+	}
+	
+	public int getBatchSize() {
+		return batchSize;
+	}
+	
+	public void setBatchSize(int batchSize) {
+		this.batchSize = batchSize;
+	}
+	    
+    public Streamable<?> getLobReference(String id) throws MetaMatrixComponentException {
+    	Streamable<?> lob = null;
+    	if (this.lobReferences != null) {
+    		lob = this.lobReferences.get(id);
+    	}
+    	if (lob == null) {
+    		throw new MetaMatrixComponentException(DQPPlugin.Util.getString("ProcessWorker.wrongdata")); //$NON-NLS-1$
+    	}
+    	return lob;
+    }
+    
+    /**
+     * If a tuple batch is being added with Lobs, then references to
+     * the lobs will be held on the {@link TupleSourceInfo} 
+     * @param batch
+     * @throws MetaMatrixComponentException 
+     */
+    @SuppressWarnings("unchecked")
+	private void correctLobReferences(List[] rows) throws MetaMatrixComponentException {
+        int columns = schema.size();
+        // walk through the results and find all the lobs
+        for (int row = 0; row < rows.length; row++) {
+            for (int col = 0; col < columns; col++) {                                                
+                Object anObj = rows[row].get(col);
+                
+                if (!(anObj instanceof Streamable<?>)) {
+                	continue;
+                }
+                Streamable lob = (Streamable)anObj;                  
+                String id = lob.getReferenceStreamId();
+            	if (id == null) {
+            		id = String.valueOf(LOB_ID.getAndIncrement());
+            		lob.setReferenceStreamId(id);
+            	}
+            	if (this.lobReferences == null) {
+            		this.lobReferences = Collections.synchronizedMap(new HashMap<String, Streamable<?>>());
+            	}
+            	this.lobReferences.put(id, lob);
+                if (lob.getReference() == null) {
+                	lob.setReference(getLobReference(lob.getReferenceStreamId()).getReference());
+                }
+            }
+        }
+    }
+    
+	/**
+	 * Create a new iterator for this buffer
+	 * @return
+	 */
+	public IndexedTupleSource createIndexedTupleSource() {
+		return new TupleSourceImpl();
+	}
+	
+	@Override
+	public String toString() {
+		return this.tupleSourceID.toString();
+	}
+	
+	public boolean isRemoved() {
+		return this.referenceCount.get() <= 0;
+	}
+	
+}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceID.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceID.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-import java.io.Serializable;
-
-/**
- * Identifier for a tuple source.  The tuple source ID contains two
- * pieces of information: a unique ID (unique across locations) and
- * a location.  Both must be represented by a string but different
- * systems may use different location descriptions.  The
- * {@link com.metamatrix.common.buffer.BufferManagerLookup}
- * is the only party responsible for providing and decoding the location string.
- */
-public class TupleSourceID implements Serializable {
-
-	private static final String LOCATION_SEPARATOR = ":"; //$NON-NLS-1$
-
-	private String idValue;
-	private String location;
-
-	/**
-	 * Creates a tuple source ID given a string version of the ID - the
-     * location should be encoded within the stringID, in the form
-     * <location>:<idValue>.
-     * @param stringID the String ID; may not be null (zero-length is tolerated)
-	 */
-	public TupleSourceID(String stringID){
-        if(stringID == null){
-        	throw new IllegalArgumentException("id may not be null"); //$NON-NLS-1$
-        }
-        
-		int index = stringID.indexOf(LOCATION_SEPARATOR);
-		if(index >= 0) {
-			this.location = stringID.substring(0, index);
-			this.idValue = stringID.substring(index+1);
-
-		} else {
-			this.location = null;
-			this.idValue = stringID;
-		}
-	}
-
-	/**
-	 * Creates a tuple source ID given a string version of the ID
-     * and the location.
-     * @param idValue Unique ID; may not be null (zero-length is tolerated)
-     * @param location Location string
-	 */
-	public TupleSourceID(String idValue, String location){
-        if(idValue == null){
-        	throw new IllegalArgumentException("id may not be null"); //$NON-NLS-1$
-        }
-
-		this.idValue = idValue;
-		this.location = location;
-	}
-
-    /**
-     * Get location string
-     * @return the location; may be null
-     */
-	public String getLocation() {
-		return this.location;
-	}
-
-    /**
-     * Get unique ID value, does not contain location
-     * @return ID value; never null but possibly zero-length
-     */
-	public String getIDValue() {
-		return this.idValue;
-	}
-
-    /**
-     * Get string combining the unique ID and location in the form
-     * <location>:<idValue> if a location is specified.  Otherwise,
-     * just the idValue is returned.
-     */
-    public String getStringID() {
-    	if(this.location == null) {
-    		return this.idValue;
-    	}
-	    return this.location + LOCATION_SEPARATOR + this.idValue;
-    }
-
-    /**
-     * Compares two TupleSourceIDs for equality.
-     * @param obj Other object
-     * @return True if equal
-     */
-    public boolean equals(Object obj) {
-        if(obj == this) {
-            return true;
-        }
-
-        if(! (obj instanceof TupleSourceID)) {
-            return false;
-        }
-
-        TupleSourceID other = (TupleSourceID) obj;
-        return other.getIDValue().equals(getIDValue());
-    }
-
-    /**
-     * Get hash code
-     * @return hash code
-     */
-    public int hashCode() {
-        return this.idValue.hashCode();
-    }
-
-    /**
-     * Get combined string representation of TupleSourceID
-     * @return String representation
-     */
-    public String toString() {
-    	return getStringID();
-    }
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceNotFoundException.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceNotFoundException.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/TupleSourceNotFoundException.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-
-/**
- * Indicates a TupleSource could not be found.
- */
-public class TupleSourceNotFoundException extends MetaMatrixProcessingException {
-
-    /**
-     * No-arg costructor required by Externalizable semantics
-     */
-    public TupleSourceNotFoundException() {
-        super();
-    }
-    
-    /**
-     * Constructor for TupleSourceNotFoundException.
-     * @param message
-     */
-    public TupleSourceNotFoundException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructor for TupleSourceNotFoundException.
-     * @param code
-     * @param message
-     */
-    public TupleSourceNotFoundException(String code, String message) {
-        super(code, message);
-    }
-
-    /**
-     * Constructor for TupleSourceNotFoundException.
-     * @param e
-     * @param message
-     */
-    public TupleSourceNotFoundException(Throwable e, String message) {
-        super(e, message);
-    }
-
-    /**
-     * Constructor for TupleSourceNotFoundException.
-     * @param e
-     * @param code
-     * @param message
-     */
-    public TupleSourceNotFoundException(Throwable e, String code, String message) {
-        super(e, code, message);
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferConfig.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferConfig.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferConfig.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,232 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.util.Properties;
-
-import com.metamatrix.common.buffer.BufferManagerPropertyNames;
-
-/**
- * Encapsulates all configuration information for the BufferManagerImpl, 
- * including both properties that are set and some that are derived.
- */
-public class BufferConfig {
-	
-	public static int DEFAULT_CONNECTOR_BATCH_SIZE = 2000;
-	public static int DEFAULT_PROCESSOR_BATCH_SIZE = 2000;
-
-    // Configuration 
-    private long totalAvailableMemory = 100000000;
-    private int groupUsePercentage = 80;
-    private int activeMemoryThreshold = 75;
-    private int managementInterval = 500;
-    private int connectorBatchSize = DEFAULT_CONNECTOR_BATCH_SIZE;
-    private int processorBatchSize = DEFAULT_PROCESSOR_BATCH_SIZE;
-    private String bufferStorageDirectory = "../buffer"; //$NON-NLS-1$
-    private int logStatInterval = 0;
-    
-    // Derived state 
-    private long availableSessionLevel = 0;
-    private long activeMemoryLevel = 0;
-
-    /**
-     * Constructor for BufferConfig - use all defaults
-     */
-    public BufferConfig() {
-        computeDerived();
-    }
-
-    /**
-     * Constructor for BufferConfig - set from properties.
-     * @param props Properties as defined in 
-     * {@link com.metamatrix.common.buffer.BufferManagerPropertyNames}.
-     */
-    public BufferConfig(Properties props) {
-        // Read totalAvailableMemory
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE);    
-            if(propStr != null) {
-                totalAvailableMemory = Integer.parseInt(propStr) * 1000000L;
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-
-        // Read groupUsePercentage
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.SESSION_USE_PERCENTAGE);    
-            if(propStr != null) {
-                groupUsePercentage = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-
-        // Read activeMemoryThreshold
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.ACTIVE_MEMORY_THRESHOLD);    
-            if(propStr != null) {
-                activeMemoryThreshold = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-        
-        // Read managementInterval
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.MANAGEMENT_INTERVAL);    
-            if(propStr != null) {
-                managementInterval = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-
-        // Read connectorBatchSize
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.CONNECTOR_BATCH_SIZE);    
-            if(propStr != null) {
-                connectorBatchSize = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-        
-        // Read processorBatchSize
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.PROCESSOR_BATCH_SIZE);    
-            if(propStr != null) {
-                processorBatchSize = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-
-        // Read bufferStorageDirectory
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.BUFFER_STORAGE_DIRECTORY);    
-            if(propStr != null) {
-                bufferStorageDirectory = propStr;
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-        
-        // Read logStatInterval
-        try {
-            String propStr = props.getProperty(BufferManagerPropertyNames.LOG_STATS_INTERVAL);    
-            if(propStr != null) {
-                logStatInterval = Integer.parseInt(propStr);
-            }
-        } catch(NumberFormatException e) {
-            // use default
-        }
-
-        computeDerived();
-    }
-
-    // Direct state management
-
-    public long getTotalAvailableMemory() {
-        return this.totalAvailableMemory;
-    }
-
-    public void setTotalAvailableMemory(long totalAvailableMemory) {
-        this.totalAvailableMemory = totalAvailableMemory;        
-        computeDerived();
-    }
-    
-    public int getGroupUsePercentage() {
-        return this.groupUsePercentage;
-    } 
-
-    public void setGroupUsePercentage(int groupUsePercentage) {
-        this.groupUsePercentage = groupUsePercentage;
-        computeDerived();
-    } 
-
-    public int getActiveMemoryThreshold() {
-        return this.activeMemoryThreshold;
-    } 
-    
-    public void setActiveMemoryThreshold(int activeMemoryThreshold) {
-        this.activeMemoryThreshold = activeMemoryThreshold;
-        computeDerived();
-    } 
-
-    public int getConnectorBatchSize() {
-        return this.connectorBatchSize;
-    } 
-
-    public void setConnectorBatchSize(int connectorBatchSize) {
-        this.connectorBatchSize = connectorBatchSize;
-    } 
-
-    public int getProcessorBatchSize() {
-        return this.processorBatchSize;
-    } 
-
-    public void setProcessorBatchSize(int processorBatchSize) {
-        this.processorBatchSize = processorBatchSize;
-    } 
-
-    public int getManagementInterval() {
-        return this.managementInterval;
-    } 
-    
-    public void setManagementInterval(int managementInterval) {
-        this.managementInterval = managementInterval;
-    } 
-
-    public String getBufferStorageDirectory() {
-        return this.bufferStorageDirectory;
-    } 
-    
-    public void setBufferStorageDirectory(String bufferStorageDirectory) {
-        this.bufferStorageDirectory = bufferStorageDirectory;
-    } 
-    
-    public int getLogStatInterval() {
-        return this.logStatInterval;
-    }
-    
-    public void setStatUpdateInterval(int logStatInterval) {
-        this.logStatInterval = logStatInterval;
-    }
-
-    // Derived state management
-    
-    private void computeDerived() {
-        this.availableSessionLevel = (int) (this.totalAvailableMemory * (this.groupUsePercentage / 100.0));    
-        this.activeMemoryLevel = (int) (this.totalAvailableMemory * (this.activeMemoryThreshold / 100.0));    
-    }
-    
-    public long getMaxAvailableSession() {
-        return this.availableSessionLevel;
-    }
-     
-    public long getActiveMemoryLevel() {
-        return this.activeMemoryLevel;
-    }
-
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,207 +22,63 @@
 
 package com.metamatrix.common.buffer.impl;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
+import javax.xml.transform.Source;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
+import com.metamatrix.common.buffer.FileStore;
 import com.metamatrix.common.buffer.StorageManager;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.lob.LobChunk;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.InputStreamFactory;
+import com.metamatrix.common.types.SQLXMLImpl;
+import com.metamatrix.common.types.SourceTransform;
+import com.metamatrix.common.types.StandardXMLTranslator;
 import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLType;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.log.MessageLevel;
 import com.metamatrix.core.util.Assertion;
-import com.metamatrix.dqp.DQPPlugin;
 import com.metamatrix.dqp.util.LogConstants;
-import com.metamatrix.query.execution.QueryExecPlugin;
+import com.metamatrix.query.processor.xml.XMLUtil;
 import com.metamatrix.query.sql.symbol.Expression;
 
 /**
- * <p>Default implementation of BufferManager.  This buffer manager implementation
- * assumes the usage of a StorageManager of type memory and optionally (preferred)
- * an additional StorageManager of type FILE.</p>
+ * <p>Default implementation of BufferManager.</p>
+ * Responsible for creating/tracking TupleBuffers and providing access to the StorageManager
  */
-public class BufferManagerImpl implements BufferManager {
+public class BufferManagerImpl implements BufferManager, StorageManager {
 
-	//memory availability when reserveMemory() is called
-	static final int MEMORY_AVAILABLE = 1;
-	static final int MEMORY_EXCEED_MAX = 2; //exceed buffer manager max memory
-	static final int MEMORY_EXCEED_SESSION_MAX = 3; //exceed session max memory
-
-    private static ThreadLocal<Set<ManagedBatch>> PINNED_BY_THREAD = new ThreadLocal<Set<ManagedBatch>>() {
-    	protected Set<ManagedBatch> initialValue() {
-    		return new HashSet<ManagedBatch>();
-    	};
-    };
-
-    // Initialized stuff
-    private String lookup;
-    private BufferConfig config;
-
-    // Cache tuple source info in memory 
-    private Map<TupleSourceID, TupleSourceInfo> tupleSourceMap = new ConcurrentHashMap<TupleSourceID, TupleSourceInfo>();
-    // groupName (String) -> TupleGroupInfo map
-    private Map<String, TupleGroupInfo> groupInfos = new HashMap<String, TupleGroupInfo>();
-
-    // Storage manager
+	// Configuration 
+    private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
+    private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
+    private int maxProcessingBatches = BufferManager.DEFAULT_MAX_PROCESSING_BATCHES;
+    
     private StorageManager diskMgr;
 
-    // ID creator
     private AtomicLong currentTuple = new AtomicLong(0);
-
-    // Keep track of how memory usage
-    private volatile long memoryUsed = 0;
     
-    // Track the currently unpinned stuff in a sorted set
-    private Set<ManagedBatch> unpinned = Collections.synchronizedSet(new LinkedHashSet<ManagedBatch>());
+    public int getMaxProcessingBatches() {
+		return maxProcessingBatches;
+	}
     
-    // Trigger to handle management and stats logging
-    private Timer timer;
-
-    // Collected stats
-    private AtomicInteger pinRequests = new AtomicInteger(0);
-    private AtomicInteger pinFailures = new AtomicInteger(0);
-    private AtomicInteger pinnedFromDisk = new AtomicInteger(0);
-    private AtomicInteger cleanings = new AtomicInteger(0);
-    private AtomicLong totalCleaned = new AtomicLong(0);
-    private AtomicInteger pinned = new AtomicInteger();
-
-    /**
-     * See {@link com.metamatrix.common.buffer.BufferManagerPropertyNames} for a
-     * description of all the properties.
-     * @param lookup An object telling the buffer manager what his location is and
-     * how to find other buffer managers of different locations
-     * @param properties Properties to configure the buffer manager
-     */
-    public synchronized void initialize(String lookup, Properties properties) throws MetaMatrixComponentException {
-        this.lookup = lookup;
-
-        // Set up config based on properties
-        this.config = new BufferConfig(properties);
-
-        // Set up alarms based on config
-        if(this.config.getManagementInterval() > 0) {
-            TimerTask mgmtTask = new TimerTask() {
-                public void run() {
-                    clean(0, null);
-                }
-
-            };
-            getTimer().schedule(mgmtTask, 0, this.config.getManagementInterval());
-        }
-        if(this.config.getLogStatInterval() > 0) {
-            TimerTask statTask = new TimerTask() {
-                public void run() {
-                    BufferStats stats = getStats();
-                   // stats.log();
-                }
-            };
-            getTimer().schedule(statTask, 0, this.config.getLogStatInterval());
-        }
-    }
-
-	private Timer getTimer() {
-		if (timer == null) {
-			timer = new Timer("BufferManagementThread", true); //$NON-NLS-1$
-		}
-		return timer;
+    public void setMaxProcessingBatches(int maxProcessingBatches) {
+		this.maxProcessingBatches = maxProcessingBatches;
 	}
 
     /**
-     * Get the configuration of the buffer manager
-     * @return Configuration
-     */
-    public BufferConfig getConfig() {
-        return this.config;
-    }
-
-    /**
-     * Construct a BufferStats object by looking at all the state.  This should
-     * be multi-thread safe but calling this method clears several counters and
-     * resets that state.
-     * @return Buffer statistics
-     */
-    public BufferStats getStats() {
-        BufferStats stats = new BufferStats();
-        
-        // Get memory info
-        stats.memoryUsed = this.memoryUsed;
-        stats.memoryFree = config.getTotalAvailableMemory() - memoryUsed;
-        
-        // Get picture of what's happening
-        Set<TupleSourceID> copyKeys = tupleSourceMap.keySet();
-        Iterator<TupleSourceID> infoIter = copyKeys.iterator();
-        stats.numTupleSources = copyKeys.size();
-
-        // Walk through each info and count where all the batches are -
-        // lock only a single info at a time to minimize locking
-        while(infoIter.hasNext()) {
-            TupleSourceID key = infoIter.next();
-            TupleSourceInfo info = tupleSourceMap.get(key);
-            if(info == null) {
-                continue;
-            }
-
-            synchronized(info) {
-                Iterator<ManagedBatch> batchIter = info.getBatchIterator();
-                while(batchIter.hasNext()) {
-                    ManagedBatch batch = batchIter.next();
-                    switch(batch.getLocation()) {
-                        case ManagedBatch.PERSISTENT:
-                            stats.numPersistentBatches++;
-                            break;
-                        case ManagedBatch.PINNED:
-                            stats.numPinnedBatches++;
-                            
-                            if ( LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE )) {
-                                stats.pinnedManagedBatches.add(batch);
-                            }
-
-                            break;
-                        case ManagedBatch.UNPINNED:
-                            stats.numUnpinnedBatches++;
-                            break;
-                    }
-                }
-            }
-        }
-
-        stats.pinRequests = this.pinRequests.get();
-        stats.pinSuccesses = this.pinRequests.get() - this.pinFailures.get();
-        stats.pinnedFromMemory = this.pinRequests.get() - this.pinnedFromDisk.get();
-		stats.numCleanings = this.cleanings.get();
-        stats.totalCleaned = this.totalCleaned.get();
-
-        return stats;
-    }
-
-    /**
      * Get processor batch size
      * @return Number of rows in a processor batch
      */
     public int getProcessorBatchSize() {        
-        return config.getProcessorBatchSize();
+        return this.processorBatchSize;
     }
 
     /**
@@ -230,9 +86,17 @@
      * @return Number of rows in a connector batch
      */
     public int getConnectorBatchSize() {
-        return config.getConnectorBatchSize();
+        return this.connectorBatchSize;
     }
+    
+    public void setConnectorBatchSize(int connectorBatchSize) {
+        this.connectorBatchSize = connectorBatchSize;
+    } 
 
+    public void setProcessorBatchSize(int processorBatchSize) {
+        this.processorBatchSize = processorBatchSize;
+    } 
+
     /**
      * Add a storage manager to this buffer manager, order is unimportant
      * @param storageManager Storage manager to add
@@ -242,37 +106,62 @@
     	Assertion.isNull(diskMgr);
         this.diskMgr = storageManager;
     }
-
-    /**
-     * Register a new tuple source and return a unique ID for it.
-     * @param groupName Group name
-     * @param tupleSourceType Type of tuple source as defined in BufferManager constants
-     * @param schema List of ElementSymbol
-     * @return New unique ID for this tuple source
-     * @throws MetaMatrixComponentException If internal server error occurs
-     */
-    public TupleSourceID createTupleSource(List schema, String groupName, TupleSourceType tupleSourceType)
-    throws MetaMatrixComponentException {
-
-        TupleSourceID newID = new TupleSourceID(String.valueOf(this.currentTuple.getAndIncrement()), this.lookup);
-        TupleGroupInfo tupleGroupInfo = getGroupInfo(groupName);
-		TupleSourceInfo info = new TupleSourceInfo(newID, schema, getTypeNames(schema), tupleGroupInfo, tupleSourceType);
-        tupleGroupInfo.getTupleSourceIDs().add(newID);
-		tupleSourceMap.put(newID, info);
+    
+    public StorageManager getStorageManager() {
+		return diskMgr;
+	}
+    
+    @Override
+    public TupleBuffer createTupleBuffer(List elements, String groupName,
+    		TupleSourceType tupleSourceType)
+    		throws MetaMatrixComponentException {
+    	String newID = String.valueOf(this.currentTuple.getAndIncrement());
+        TupleBuffer tupleBuffer = new TupleBuffer(this, newID, elements, getTypeNames(elements), getProcessorBatchSize());
         if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
-            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, new Object[]{"Creating TupleSource:", newID, "of type "+tupleSourceType}); //$NON-NLS-1$ //$NON-NLS-2$
+            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, new Object[]{"Creating TupleBuffer:", newID, "of type "+tupleSourceType}); //$NON-NLS-1$ //$NON-NLS-2$
         }
-
-        return newID;
+        return tupleBuffer;
     }
     
+    @Override
+    public FileStore createFileStore(String name) {
+    	if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
+            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating FileStore:", name); //$NON-NLS-1$ 
+        }
+    	return this.diskMgr.createFileStore(name);
+    }
+    
+	@Override
+	public void initialize(Properties props) throws MetaMatrixComponentException {
+		PropertiesUtils.setBeanProperties(this, props, "metamatrix.buffer"); //$NON-NLS-1$
+		DataTypeManager.addSourceTransform(Source.class, new SourceTransform<Source, XMLType>() {
+			@Override
+			public XMLType transform(Source value) {
+				if (value instanceof InputStreamFactory) {
+					return new XMLType(new SQLXMLImpl((InputStreamFactory)value));
+				}
+				StandardXMLTranslator sxt = new StandardXMLTranslator(value, null);
+				SQLXMLImpl sqlxml;
+				try {
+					sqlxml = XMLUtil.saveToBufferManager(BufferManagerImpl.this, sxt, Streamable.STREAMING_BATCH_SIZE_IN_BYTES);
+				} catch (MetaMatrixComponentException e) {
+					throw new MetaMatrixRuntimeException(e);
+				}
+				return new XMLType(sqlxml);
+			}
+		});
+	}
+    
     /**
      * Gets the data type names for each of the input expressions, in order.
      * @param expressions List of Expressions
      * @return
      * @since 4.2
      */
-    public static String[] getTypeNames(List expressions) {
+    private static String[] getTypeNames(List expressions) {
+    	if (expressions == null) {
+    		return null;
+    	}
         String[] types = new String[expressions.size()];
         for (ListIterator i = expressions.listIterator(); i.hasNext();) {
             Expression expr = (Expression)i.next();
@@ -281,689 +170,7 @@
         return types;
     }
 
-    /**
-     * Remove a tuple source based on ID
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If internal server error occurs
-     */
-    public void removeTupleSource(TupleSourceID tupleSourceID)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        if(tupleSourceID == null || tupleSourceID.getLocation() == null) {
-            // this is a bogus tuple source ID
-            return;
-        }
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
-            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, new Object[]{"Removing TupleSource:", tupleSourceID}); //$NON-NLS-1$
-        }
-
-        // Remove from main map first
-        TupleSourceInfo info = this.tupleSourceMap.remove(tupleSourceID);
-        if(info == null) {
-        	throw new TupleSourceNotFoundException(QueryExecPlugin.Util.getString("BufferManagerImpl.tuple_source_not_found", tupleSourceID)); //$NON-NLS-1$
-        }
-
-        // Walk through batches and determine whether memory or disk cleanup needs to occur
-        synchronized(info) {
-            if(! info.isRemoved()) {
-                info.setRemoved();
-
-                Iterator<ManagedBatch> iter = info.getBatchIterator();
-                while(iter.hasNext()) {
-                    ManagedBatch batch = iter.next();
-                    switch(batch.getLocation()) {
-                        case ManagedBatch.UNPINNED:
-                            this.unpinned.remove(batch);
-                            releaseMemory(batch.getSize(), info.getGroupInfo());
-                            break;
-                        case ManagedBatch.PINNED:
-                        	PINNED_BY_THREAD.get().remove(batch);
-                        	this.pinned.getAndDecrement();
-                            releaseMemory(batch.getSize(), info.getGroupInfo());
-                            break;
-                    }
-                }
-            }
-        }
-        TupleGroupInfo tupleGroupInfo = info.getGroupInfo();
-		tupleGroupInfo.getTupleSourceIDs().remove(tupleSourceID);
-        
-        // Remove disk storage
-        if (this.diskMgr != null){
-            this.diskMgr.removeBatches(tupleSourceID);
-        }
-    }
-
-    /**
-     * Remove all the tuple sources with the specified group name.  Typically the group
-     * name is really a session identifier and this is called to remove all tuple sources
-     * used by a particular session.
-     * @param groupName Name of the group
-     * @throws MetaMatrixComponentException If internal server error occurs
-     */
-    public void removeTupleSources(String groupName)
-    throws MetaMatrixComponentException {
-
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
-            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, new Object[]{"Removing TupleSources for group", groupName}); //$NON-NLS-1$
-        }
-
-        TupleGroupInfo tupleGroupInfo = null;
-        synchronized(groupInfos) {
-        	tupleGroupInfo = groupInfos.remove(groupName);
-        }
-        if (tupleGroupInfo == null) {
-        	return;
-        }
-        List<TupleSourceID> tupleSourceIDs = null;
-        synchronized (tupleGroupInfo.getTupleSourceIDs()) {
-			tupleSourceIDs = new ArrayList<TupleSourceID>(tupleGroupInfo.getTupleSourceIDs());
-		}
-        MetaMatrixComponentException ex = null;
-
-        for (TupleSourceID tsID : tupleSourceIDs) {
-     		try {
-     			this.removeTupleSource(tsID);
-     		} catch(TupleSourceNotFoundException e) {
-     			// ignore and go on
-     		} catch(MetaMatrixComponentException e) {
-     			if(ex == null) {
-     				ex = e;
-     			}
-     		}
-        }
-
-        if(ex != null) {
-        	throw ex;
-        }
-    }
-
-    /**
-     * Get a tuple source to walk through the rows for a particular
-     * tupleSourceID.
-     * @param tupleSourceID Tuple source identifier
-     * @return TupleSource
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public IndexedTupleSource getTupleSource(TupleSourceID tupleSourceID)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-		TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        int batchSize = this.config.getProcessorBatchSize();
-        return new TupleSourceImpl(this, tupleSourceID, info.getTupleSchema(), batchSize);
-    }
-
-    /**
-     * Get the tuple schema for a particular tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @return List of elements describing tuple source
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public List getTupleSchema(TupleSourceID tupleSourceID)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        return info.getTupleSchema();
-    }
-
-    /**
-     * Set the status for a particular tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @param status New status
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public void setStatus(TupleSourceID tupleSourceID, TupleSourceStatus status)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
-            LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, new Object[]{"Setting status for", tupleSourceID, "to", status}); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-  		synchronized(info) {
-       		info.setStatus(status);
-		}
-    }
-
-    /**
-     * Get the status for a particular tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @return Status
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public TupleSourceStatus getStatus(TupleSourceID tupleSourceID)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-    	return info.getStatus();
-    }
-
-    /**
-     * Get the row count for a particular tuple source
-     * @param tupleSourceID Tuple source identifier
-     * @return Row count
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public int getRowCount(TupleSourceID tupleSourceID)
-        throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-    	return info.getRowCount();
-    }
-
-    /**
-     * Add a batch to the given tuple source.  It is assumed that batches are
-     * added in order, so the row count is reset to the end row of this batch.
-     * @param tupleSourceID Tuple source identifier
-     * @param tupleBatch New batch
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public void addTupleBatch(TupleSourceID tupleSourceID, TupleBatch tupleBatch)
-    throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
-            LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, new Object[]{"AddTupleBatch for", tupleSourceID, "with " + tupleBatch.getRowCount() + " rows"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        }
-        
-        if (tupleBatch.getRowCount() == 0 && !tupleBatch.getTerminationFlag()) {
-        	return;
-        }
-        
-        // Look up info
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        
-        if (info.lobsInSource()) {
-            correctLobReferences(info, tupleBatch);
-        }        
-
-        // Determine where to store
-        long bytes = SizeUtility.getBatchSize(info.getTypes(), tupleBatch.getAllTuples());
-        tupleBatch.setSize(bytes);
-        short location = ManagedBatch.PERSISTENT;
-                
-        if(reserveMemory(bytes, info.getGroupInfo()) == BufferManagerImpl.MEMORY_AVAILABLE) {
-            location = ManagedBatch.UNPINNED;
-        }
-
-        synchronized(info) {
-            if(info.isRemoved()) {
-            	if(location != ManagedBatch.PERSISTENT) {
-            		releaseMemory(bytes, info.getGroupInfo());
-            	}
-                throw new TupleSourceNotFoundException(QueryExecPlugin.Util.getString("BufferManagerImpl.tuple_source_not_found", tupleSourceID)); //$NON-NLS-1$
-            }
-
-            // Update tuple source state
-            ManagedBatch managedBatch = new ManagedBatch(tupleSourceID, tupleBatch.getBeginRow(), tupleBatch.getEndRow(), bytes);
-            managedBatch.setLocation(location);
-
-            // Store into storage manager
-            try {
-                if(location == ManagedBatch.PERSISTENT) {
-                    this.diskMgr.addBatch(tupleSourceID, tupleBatch, info.getTypes());
-                } else {
-                    managedBatch.setBatch(tupleBatch);
-                }
-            } catch(MetaMatrixComponentException e) {
-                // If we were storing to memory, clean up memory we reserved
-                if(location != ManagedBatch.PERSISTENT) {
-                    releaseMemory(bytes, info.getGroupInfo());
-                }
-                throw e;
-            }
-            
-            // Add to memory state if in memory
-            if(location == ManagedBatch.UNPINNED) {
-            	this.unpinned.add(managedBatch);
-            }
-
-            // Update info with new rows
-            info.addBatch(managedBatch);
-            info.setRowCount(tupleBatch.getEndRow());
-        }
-    }
-    
-    /**
-     * Pin a tuple batch in memory and return it.  This batch must be unpinned by
-     * passed the identical tuple source ID and beginning row.
-     * NOTE: the returned {@link TupleBatch} will have the exact same bounds as the {@link ManagedBatch}
-     * @param tupleSourceID Tuple source identifier
-     * @param beginRow Beginning row
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     * @throws MemoryNotAvailableException If memory was not available for the pin
-     */
-    public TupleBatch pinTupleBatch(TupleSourceID tupleSourceID, int beginRow)
-        throws TupleSourceNotFoundException, MemoryNotAvailableException, MetaMatrixComponentException {
-
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
-            LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, new Object[]{"Pinning tupleBatch for", tupleSourceID, "beginRow:", beginRow}); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
-        this.pinRequests.incrementAndGet();
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        int memoryAvailability = BufferManagerImpl.MEMORY_AVAILABLE;
-
-        ManagedBatch mbatch = null;
-        synchronized (info) {
-        	mbatch = info.getBatch(beginRow);
-        }
-        if (mbatch == null || beginRow == mbatch.getEndRow() + 1) {
-        	return new TupleBatch(beginRow, Collections.EMPTY_LIST);
-        }
-        long memoryRequiredByBatch = mbatch.getSize();
-
-        TupleBatch memoryBatch = null;
-
-        for (int pass = 0; pass < 2; pass++) {
-        	if (memoryAvailability == BufferManagerImpl.MEMORY_EXCEED_MAX) {
-        		clean(memoryRequiredByBatch, null);
-        	} else if (memoryAvailability == BufferManagerImpl.MEMORY_EXCEED_SESSION_MAX) {
-        		clean(memoryRequiredByBatch, info.getGroupInfo());
-        	}
-            
-            synchronized(info) {
-                if(mbatch.getLocation() == ManagedBatch.PINNED) {
-                    // Load batch from memory - already pinned
-                    memoryBatch = mbatch.getBatch();
-                    break;
-                }
-                if(mbatch.getLocation() == ManagedBatch.UNPINNED) {
-                    // Already in memory - just move from unpinned to pinned
-                    this.unpinned.remove(mbatch);
-                    pin(mbatch);
-    
-                    // Load batch from memory
-                    memoryBatch = mbatch.getBatch();
-                    break;                            
-                } 
-                memoryRequiredByBatch = mbatch.getSize();
-                
-                // Try to reserve some memory
-                if((memoryAvailability = reserveMemory(memoryRequiredByBatch, info.getGroupInfo())) != BufferManagerImpl.MEMORY_AVAILABLE) {
-                	continue;
-                }
-
-                this.pinnedFromDisk.incrementAndGet();
-
-                // Memory was reserved, so move from persistent to memory and pin
-                int internalBeginRow = mbatch.getBeginRow();
-                memoryBatch = diskMgr.getBatch(tupleSourceID, internalBeginRow, info.getTypes());
-
-                mbatch.setBatch(memoryBatch);
-                if (info.lobsInSource()) {
-                	correctLobReferences(info, memoryBatch);
-                }
-                pin(mbatch);
-            }
-        }
-        
-        if (memoryBatch == null) {
-            // Failed to reserve the memory even after a clean, so record the failure and fail the pin
-            this.pinFailures.incrementAndGet();
-            throw new MemoryNotAvailableException(QueryExecPlugin.Util.getString("BufferManagerImpl.no_memory_available")); //$NON-NLS-1$
-        }
-
-        return memoryBatch;
-    }
-    
-	private void pin(ManagedBatch mbatch) {
-		mbatch.setLocation(ManagedBatch.PINNED);
-		PINNED_BY_THREAD.get().add(mbatch);
-		if (!mbatch.hasPinnedRows()) {
-			pinned.getAndIncrement();
-		}
-		mbatch.pin();
+	public void shutdown() {
 	}
-
-    /**
-     * Unpin a tuple source batch.
-     * @param tupleSourceID Tuple source identifier
-     * @param beginRow Beginning row
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-     */
-    public void unpinTupleBatch(TupleSourceID tupleSourceID, int beginRow)
-        throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
-            LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, new Object[]{"Unpinning tupleBatch for", tupleSourceID, "beginRow: " + beginRow}); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        synchronized(info) {
-            ManagedBatch mbatch = info.getBatch(beginRow);
-            if(mbatch == null || mbatch.getLocation() != ManagedBatch.PINNED) {
-                return;
-            }
-            
-            mbatch.unpin();
-
-            // Determine whether batch itself should be unpinned
-            if(! mbatch.hasPinnedRows()) {
-                mbatch.setLocation(ManagedBatch.UNPINNED);
-                PINNED_BY_THREAD.get().remove(mbatch);
-                this.unpinned.add(mbatch);
-                pinned.getAndDecrement();
-            }
-        }
-    }
-
-	/**
-	 * Gets the final row count if tuple source is FULL, otherwise returns -1.
-	 * @param tupleSourceID Tuple source identifier
-	 * @return Final row count if status == FULL, -1 otherwise
-     * @throws TupleSourceNotFoundException If tuple source not found
-     * @throws MetaMatrixComponentException If an internal server error occurred
-	 */
-	public int getFinalRowCount(TupleSourceID tupleSourceID)
-    	throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        synchronized(info) {
-    		if(info.getStatus() == TupleSourceStatus.FULL) {
-    			return info.getRowCount();
-    		}
-    		return -1;
-        }
-    }
-
-    /**
-     * Get the tuple source info for the specified tuple source ID
-     * @param tupleSourceID Tuple source to get
-     * @param throwException Whether to throw exception if the TupleSourceInfo is not found
-     * @return Tuple source info
-     * @throws TupleSourceNotFoundException If not found
-     */
-    TupleSourceInfo getTupleSourceInfo(TupleSourceID tupleSourceID, boolean throwException)
-    throws TupleSourceNotFoundException {
-
-        // Look up info
-        TupleSourceInfo info = this.tupleSourceMap.get(tupleSourceID);
-
-        if(info == null && throwException) {
-        	throw new TupleSourceNotFoundException(QueryExecPlugin.Util.getString("BufferManagerImpl.tuple_source_not_found", tupleSourceID)); //$NON-NLS-1$
-        }
-        return info;
-    }
     
-    /**
-     * This can be done actively if someone wants memory and none is free.
-     */
-    protected void clean(long memoryRequired, TupleGroupInfo targetGroupInfo) {
-    	cleanLobTupleSource();
-    	
-    	long released = 0;
-
-        long targetLevel = config.getActiveMemoryLevel();
-        long totalMemory = config.getTotalAvailableMemory();
-        
-        boolean generalCleaningDone = false;
-        List<ManagedBatch> toClean = null;
-        synchronized (unpinned) {
-        	//TODO: re-implement without having to scan and compete
-			toClean = new ArrayList<ManagedBatch>(unpinned);
-		}
-        for (ManagedBatch batch : toClean) {
-            TupleSourceID tsID = batch.getTupleSourceID();
-            TupleSourceInfo tsInfo = this.tupleSourceMap.get(tsID);
-            if(tsInfo == null) {
-                //may be removed by another thread
-                continue;
-            }
-
-            long currentMemoryUsed = memoryUsed;
-            if (!generalCleaningDone && (memoryRequired <= totalMemory - currentMemoryUsed && // if the memory needed is more than what's available, or
-                currentMemoryUsed <= targetLevel)) { // if we've crossed the active memory threshold, then cleanup
-            	generalCleaningDone = true;
-            }
-            if (generalCleaningDone) {
-            	if (targetGroupInfo == null) {
-            		break;
-            	}
-                if (targetGroupInfo == tsInfo.getGroupInfo()) {
-    	            //if the memory needed is more than what is available for the session, then cleanup. Otherwise, break the loop.
-    	            if(memoryRequired <= config.getMaxAvailableSession() - targetGroupInfo.getGroupMemoryUsed()) {
-    	            	break;
-    	            }                
-                } 
-            }
-            
-            released += releaseMemory(batch, tsInfo);
-        }
-
-        if(released > 0) {
-            this.cleanings.incrementAndGet();
-            this.totalCleaned.addAndGet(released);
-        }
-    }
-
-    //TODO: run asynch
-	private void cleanLobTupleSource() {
-		String tupleSourceId = TupleSourceInfo.getStaleLobTupleSource();
-		if (tupleSourceId != null) {
-        	try {
-				removeTupleSource(new TupleSourceID(tupleSourceId));
-			} catch (TupleSourceNotFoundException e) {
-			} catch (MetaMatrixComponentException e) {
-				LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, e, "Exception removing stale lob tuple source"); //$NON-NLS-1$
-			}
-        }
-	}
-        
-    /**
-     * Release the memory for the given unpinned batch.
-     * @param batch Batch to be released from memory
-     * @param tsID ID of the tuple source to be released from memory 
-     * @return The size of memory released in bytes
-     * @since 4.3
-     */
-    private long releaseMemory(ManagedBatch batch, TupleSourceInfo info) {
-        // Find info and lock on it
-        synchronized(info) {
-            if(info.isRemoved() || batch.getLocation() != ManagedBatch.UNPINNED) {
-                return 0;
-            }
-
-            // This batch is still unpinned - move to persistent storage
-            TupleBatch dataBatch = batch.getBatch();
-
-            try {
-                diskMgr.addBatch(info.getTupleSourceID(), dataBatch, info.getTypes());
-            } catch(MetaMatrixComponentException e) {
-                // Can't move
-                return 0;
-            }
-
-            batch.setBatch(null);
-
-            // Update memory
-            batch.setLocation(ManagedBatch.PERSISTENT);
-            this.unpinned.remove(batch);
-            releaseMemory(batch.getSize(), info.getGroupInfo());
-
-            return batch.getSize();
-        }
-    }
-    
-    /**
-     * Gets a TupleGroupInfo representing the group 
-     * @param groupName Logical grouping name for tuple sources. Can be null.
-     * @return TupleGroupInfo for the group. Never null.
-     * @since 4.3
-     */
-    private TupleGroupInfo getGroupInfo(String groupName) {
-        TupleGroupInfo info = null;
-        synchronized(groupInfos) {
-            info = groupInfos.get(groupName);
-            if (info == null) {
-                // If it doesn't exist, create a new one
-                info = new TupleGroupInfo(groupName);
-                groupInfos.put(groupName, info);
-            }
-        }
-        return info;
-    }
-
-    /** 
-     * @see com.metamatrix.common.buffer.BufferManager#stop()
-     */
-    public synchronized void stop() {
-    	if (timer != null) {
-    		timer.cancel();
-    	}
-    }
-    
-    /**
-     * If a tuple batch is being added with Lobs, then references to
-     * the lobs will be held on the {@link TupleSourceInfo} 
-     * @param batch
-     */
-    @SuppressWarnings("unchecked")
-	private void correctLobReferences(TupleSourceInfo info, TupleBatch batch) {
-        List parentSchema = info.getTupleSchema();        
-        List[] rows = batch.getAllTuples();
-        int columns = parentSchema.size();
-        // walk through the results and find all the lobs
-        for (int row = 0; row < rows.length; row++) {
-            for (int col = 0; col < columns; col++) {                                                
-                Object anObj = rows[row].get(col);
-                
-                if (!(anObj instanceof Streamable<?>)) {
-                	continue;
-                }
-                Streamable lob = (Streamable)anObj;                  
-                info.addLobReference(lob);
-                if (lob.getReference() == null) {
-                	lob.setReference(info.getLobReference(lob.getReferenceStreamId()).getReference());
-                }
-            }
-        }
-    }
-    
-    @Override
-    public Streamable<?> getStreamable(TupleSourceID id, String referenceId) throws TupleSourceNotFoundException, MetaMatrixComponentException {
-    	TupleSourceInfo tsInfo = getTupleSourceInfo(id, true);
-    	Streamable<?> s = tsInfo.getLobReference(referenceId);
-    	if (s == null) {
-    		throw new MetaMatrixComponentException(DQPPlugin.Util.getString("ProcessWorker.wrongdata")); //$NON-NLS-1$
-    	}
-    	return s;
-    }
-    
-    @Override
-    public void setPersistentTupleSource(TupleSourceID id, Streamable<?> s) throws TupleSourceNotFoundException {
-    	cleanLobTupleSource();
-    	TupleSourceInfo tsInfo = getTupleSourceInfo(id, true);
-    	s.setPersistenceStreamId(id.getStringID());
-    	tsInfo.setContainingLobReference(s);
-    }
-
-    /**  
-     * @see com.metamatrix.common.buffer.BufferManager#addStreamablePart(com.metamatrix.common.buffer.TupleSourceID, com.metamatrix.common.lob.LobChunk, int)
-     */
-    public void addStreamablePart(TupleSourceID tupleSourceID, LobChunk streamChunk, int beginRow) 
-        throws TupleSourceNotFoundException, MetaMatrixComponentException {
-        
-        // Look up info
-        TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        
-        synchronized(info) {
-            List<LobChunk> data = new ArrayList<LobChunk>();
-            data.add(streamChunk);
-            TupleBatch batch = new TupleBatch(beginRow, new List[] {data});
-            this.diskMgr.addBatch(tupleSourceID, batch, info.getTypes());                
-                        
-            // Update tuple source state (we could calculate the size of stream if need to)
-            ManagedBatch managedBatch = new ManagedBatch(tupleSourceID, beginRow, batch.getEndRow(), 0);
-            managedBatch.setLocation(ManagedBatch.PERSISTENT);
-
-            // Update info with new rows
-            info.addBatch(managedBatch);
-            info.setRowCount(batch.getEndRow());
-        }                
-    }
-
-    /** 
-     * @see com.metamatrix.common.buffer.BufferManager#getStreamable(com.metamatrix.common.buffer.TupleSourceID)
-     */
-    public LobChunk getStreamablePart(final TupleSourceID tupleSourceID, int beginRow) 
-        throws TupleSourceNotFoundException, MetaMatrixComponentException {
-        
-        final TupleSourceInfo info = getTupleSourceInfo(tupleSourceID, true);
-        TupleBatch batch = diskMgr.getBatch(tupleSourceID, beginRow, info.getTypes());
-        LobChunk chunk = (LobChunk)batch.getAllTuples()[0].get(0);
-        
-        return chunk;        
-    }
-
-    /** 
-     * @see com.metamatrix.common.buffer.BufferManager#releasePinnedBatches()
-     */
-    public void releasePinnedBatches() throws MetaMatrixComponentException {
-    	MetaMatrixComponentException e = null;
-    	List<ManagedBatch> pinnedByThread = new ArrayList<ManagedBatch>(PINNED_BY_THREAD.get());
-    	for (ManagedBatch managedBatch : pinnedByThread) {
-    		try {
-    			//TODO: add trace logging about the batch that is being unpinned
-    			unpinTupleBatch(managedBatch.getTupleSourceID(), managedBatch.getBeginRow());
-    		} catch (TupleSourceNotFoundException err) {
-    		} catch (MetaMatrixComponentException err) {
-    			e = err;
-    		}
-		}
-    	if (e != null) {
-    		throw e;
-    	}
-    }
-    
-    /**
-     * Check for whether the specified amount of memory can be reserved,
-     * and if so reserve it.  This is done in the same method so that the
-     * memory is not taken away by a different thread between checking and 
-     * reserving - standard "test and set" behavior. 
-     * @param bytes Bytes requested
-     * @return One of MEMORY_AVAILABLE, MEMORY_EXCEED_MAX, or MEMORY_EXCEED_SESSION_MAX
-     */
-    private synchronized int reserveMemory(long bytes, TupleGroupInfo groupInfo) {
-        //check session limit first
-        long sessionMax = config.getMaxAvailableSession();
-        if(sessionMax - groupInfo.getGroupMemoryUsed() < bytes) {
-            return BufferManagerImpl.MEMORY_EXCEED_SESSION_MAX;
-        }
-        
-        //then check the total memory limit
-        long max = config.getTotalAvailableMemory();
-        if(max - memoryUsed < bytes) {
-            return BufferManagerImpl.MEMORY_EXCEED_MAX;
-        }
-        
-        groupInfo.reserveMemory(bytes);
-        memoryUsed += bytes;
-        
-        return BufferManagerImpl.MEMORY_AVAILABLE;
-    }
-
-    /**
-     * Release memory 
-     * @param bytes Bytes to release
-     */
-    private synchronized void releaseMemory(long bytes, TupleGroupInfo groupInfo) {
-        groupInfo.releaseMemory(bytes);
-        memoryUsed -= bytes;
-    }
-    
-    /**
-     * for testing purposes 
-     */
-    public int getPinnedCount() {
-    	return pinned.get();
-    }
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferStats.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferStats.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferStats.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.dqp.util.LogConstants;
-
-/**
- * This encapsulates all the statistics for the BufferManagerImpl.  The attribute
- * values are set by direct attribute manipulation (no getter/setters).
- */
-public class BufferStats {
-    
-    // Basic stats
-    public long memoryUsed;
-    public long memoryFree;
-    public int numTupleSources;
-    public int numPersistentBatches;
-    public int numPinnedBatches;
-    public int numUnpinnedBatches;
-    public String sLocalDrive;
-
-    // Accumulated stats
-    public int pinRequests;
-    public int pinSuccesses;
-    public int pinnedFromMemory;
-    public int numCleanings;
-    public long totalCleaned;
-
-    // Pinned batch details
-    public List<ManagedBatch> pinnedManagedBatches = new LinkedList<ManagedBatch>();
-    
-    /**
-     * Constructor for BufferStats.
-     */
-    BufferStats() {
-    }
-    
-    /**
-     * Log this set of stats.
-     */
-    void log() {
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "\n");         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "BUFFER MANAGER STATS");         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    memoryFree = " + memoryFree);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    memoryUsed = " + memoryUsed);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    numTupleSources = " + numTupleSources);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    numPersistentBatches = " + numPersistentBatches);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    numPinnedBatches = " + numPinnedBatches);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    numUnpinnedBatches = " + numUnpinnedBatches);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    pinRequests = " + pinRequests);         //$NON-NLS-1$
-        
-        // pinSuccesses / pinRequests
-        double pinSuccessRate = (pinRequests > 0) ? (((double)pinSuccesses / (double)pinRequests) * 100) : 100;
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    pinSuccessRate = " + pinSuccessRate);         //$NON-NLS-1$
-        
-        // pinnedFromMemory / pinRequests
-        double memoryHitRate = (pinRequests > 0) ? (((double)pinnedFromMemory / (double)pinRequests) * 100): 100;
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    memoryHitRate = " + memoryHitRate);         //$NON-NLS-1$
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    numCleanings = " + numCleanings);         //$NON-NLS-1$
-        
-        // totalCleaned / numCleanings
-        long avgCleaned = (numCleanings > 0) ? (totalCleaned / numCleanings) : 0;
-        LogManager.logInfo(LogConstants.CTX_BUFFER_MGR, "    avgCleaned = " + avgCleaned);         //$NON-NLS-1$
-
-        if ( LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE) ) {
-            HashMap<List<String>, Integer> stackTraces = new HashMap<List<String>, Integer>();
-            
-            if ( pinnedManagedBatches.isEmpty() ) {
-                return;
-            }
-            
-            LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "\n");         //$NON-NLS-1$
-            LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "    =========== Pinned Batch Details: ===========");         //$NON-NLS-1$            
-            
-            int stackNumber = 1;
-    
-            // pinned batch details
-            for (ManagedBatch batch : pinnedManagedBatches) {
-                LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "    TupleSourceID: " + batch.getTupleSourceID() + " Begin: " + batch.getBeginRow() + " End: " + batch.getEndRow()); //$NON-NLS-1$  //$NON-NLS-2$  //$NON-NLS-3$
-                
-                Integer stackKey = stackTraces.get(batch.getCallStack());
-                
-                boolean isFirst = false;
-                
-                if (stackKey == null) {
-                    isFirst = true;
-                    stackKey = new Integer(stackNumber++);
-                    stackTraces.put(batch.getCallStack(), stackKey);
-                }
-                
-                LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "        Pinned at: " + batch.getCallStackTimeStamp() + " by call# " + stackKey); //$NON-NLS-1$ //$NON-NLS-2$ 
-                if (isFirst) {
-                    for (Iterator<String> j = batch.getCallStack().iterator(); j.hasNext();) {
-                        LogManager.logTrace( LogConstants.CTX_BUFFER_MGR, "        " + j.next() );         //$NON-NLS-1$                
-                    }
-                }
-            }
-        }
-    }
-        
-}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.buffer.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.buffer.BufferManager;
+import com.metamatrix.common.buffer.FileStore;
+import com.metamatrix.common.buffer.StorageManager;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.core.util.Assertion;
+import com.metamatrix.dqp.util.LogConstants;
+import com.metamatrix.query.execution.QueryExecPlugin;
+
+/**
+ * Implements file storage that automatically splits large files and limits the number of open files.
+ */
+public class FileStorageManager implements StorageManager {
+	
+    private static final String FILE_PREFIX = "b_"; //$NON-NLS-1$
+	
+	private class FileInfo {
+    	private File file;
+        private RandomAccessFile fileData;       // may be null if not open
+
+        public FileInfo(File file) {
+            this.file = file;
+        }
+
+        public RandomAccessFile open() throws FileNotFoundException {
+        	if(this.fileData == null) {
+        		this.fileData = fileCache.remove(this.file);
+        		if (this.fileData == null) {
+        			this.fileData = new RandomAccessFile(file, "rw"); //$NON-NLS-1$
+        		}
+            }
+        	return this.fileData;
+        }
+
+        public void close() {
+        	fileCache.put(this.file, this.fileData);
+            this.fileData = null;
+        }
+        
+        public void delete()  {
+        	RandomAccessFile raf = fileCache.remove(this.file);
+        	if (raf != null) {
+        		try {
+					raf.close();
+				} catch (IOException e) {
+				}
+        	}
+        	file.delete();
+        }
+
+        public String toString() {
+            return "FileInfo<" + file.getName() + ", has fileData = " + (fileData != null) + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        }
+    }
+	
+	public class DiskStore extends FileStore {
+	    private String name;
+		private TreeMap<Long, FileInfo> storageFiles = new TreeMap<Long, FileInfo>(); 
+	    
+	    public DiskStore(String name) {
+			this.name = name;
+		}
+	    
+	    public synchronized int readDirect(long fileOffset, byte[] b, int offSet, int length) throws MetaMatrixComponentException {
+	    	Map.Entry<Long, FileInfo> entry = storageFiles.floorEntry(fileOffset);
+			Assertion.isNotNull(entry);
+			FileInfo fileInfo = entry.getValue();
+			try {
+				RandomAccessFile fileAccess = fileInfo.open();
+		        fileAccess.seek(fileOffset - entry.getKey());
+		        return fileAccess.read(b, offSet, length);
+			} catch (IOException e) {
+				throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.error_reading", fileInfo.file.getAbsoluteFile())); //$NON-NLS-1$
+			} finally {
+				fileInfo.close();
+			}
+	    }
+
+		public synchronized long writeDirect(byte[] bytes, int offset, int length) throws MetaMatrixComponentException {
+			Map.Entry<Long, FileInfo> entry = this.storageFiles.lastEntry();
+			boolean createNew = false;
+			FileInfo fileInfo = null;
+			long fileOffset = 0;
+			if (entry == null) {
+				createNew = true;
+			} else {
+				fileInfo = entry.getValue();
+				fileOffset = entry.getKey();
+				createNew = entry.getValue().file.length() + length > getMaxFileSize();
+			}
+			if (createNew) {
+				FileInfo newFileInfo = new FileInfo(createFile(name, storageFiles.size()));
+	            if (fileInfo != null) {
+	            	fileOffset += fileInfo.file.length();
+	            }
+	            storageFiles.put(fileOffset, newFileInfo);
+	            fileInfo = newFileInfo;
+	        }
+	        try {
+	        	RandomAccessFile fileAccess = fileInfo.open();
+	            long pointer = fileAccess.length();
+	            fileAccess.setLength(pointer + length);
+	            fileAccess.seek(pointer);
+	            fileAccess.write(bytes, offset, length);
+	            return fileOffset + pointer;
+	        } catch(IOException e) {
+	            throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.error_reading", fileInfo.file.getAbsoluteFile())); //$NON-NLS-1$
+	        } finally {
+	        	fileInfo.close();
+	        }
+		}
+		
+		public synchronized void removeDirect() {
+			for (FileInfo info : storageFiles.values()) {
+				info.delete();
+			}
+		}
+		
+	}
+
+    // Initialization
+    private int maxOpenFiles = 32;
+    private long maxFileSize = 2L * 1024L * 1024L * 1024L; // 2GB
+    private String directory;
+    private File dirFile;
+
+    // State
+    private Map<File, RandomAccessFile> fileCache = Collections.synchronizedMap(new LinkedHashMap<File, RandomAccessFile>() {
+    	@Override
+    	protected boolean removeEldestEntry(
+    			java.util.Map.Entry<File, RandomAccessFile> eldest) {
+    		if (this.size() > maxOpenFiles) {
+    			try {
+					eldest.getValue().close();
+				} catch (IOException e) {
+				}
+    			return true;
+    		}
+    		return false;
+    	}
+    });
+    
+    /**
+     * Initialize with properties
+     * @param props Initialization properties
+     * @see com.metamatrix.common.buffer.BufferManager#BUFFER_STORAGE_DIRECTORY
+     * @see com.metamatrix.common.buffer.BufferManager#MAX_OPEN_FILES
+     * @see com.metamatrix.common.buffer.BufferManager#MAX_FILE_SIZE
+     */
+    public void initialize(Properties props) throws MetaMatrixComponentException {
+        this.directory = props.getProperty(BufferManager.BUFFER_STORAGE_DIRECTORY);
+        if(this.directory == null) {
+        	throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("FileStoreageManager.no_directory")); //$NON-NLS-1$
+        }
+
+        dirFile = new File(this.directory);
+        if(dirFile.exists()) {
+            if(! dirFile.isDirectory()) {
+            	throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("FileStoreageManager.not_a_directory", dirFile.getAbsoluteFile())); //$NON-NLS-1$
+
+            }
+        } else if(! dirFile.mkdirs()) {
+        	throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("FileStoreageManager.error_creating", dirFile.getAbsoluteFile())); //$NON-NLS-1$
+        }
+
+        // Set up max number of open file descriptors
+        maxOpenFiles = PropertiesUtils.getIntProperty(props, BufferManager.MAX_OPEN_FILES, 32);
+        
+        // Set the max file size
+        maxFileSize = PropertiesUtils.getIntProperty(props, BufferManager.MAX_FILE_SIZE, 2048) * 1024L * 1024L; // Multiply by 1MB
+    }
+    
+    File createFile(String name, int fileNumber) throws MetaMatrixComponentException {
+        try {
+        	File storageFile = File.createTempFile(FILE_PREFIX + name + "_" + String.valueOf(fileNumber) + "_", null, this.dirFile); //$NON-NLS-1$ //$NON-NLS-2$
+            if (LogManager.isMessageToBeRecorded(LogConstants.CTX_STORAGE_MGR, MessageLevel.DETAIL)) {
+                LogManager.logDetail(LogConstants.CTX_STORAGE_MGR, "Created temporary storage area file " + storageFile.getAbsoluteFile()); //$NON-NLS-1$
+            }
+            return storageFile;
+        } catch(IOException e) {
+        	throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.error_creating", name + "_" + fileNumber)); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+    
+    public FileStore createFileStore(String name) {
+    	return new DiskStore(name);
+    }
+    
+    public long getMaxFileSize() {
+		return maxFileSize;
+	}
+    
+    public String getDirectory() {
+		return directory;
+	}
+    
+    Map<File, RandomAccessFile> getFileCache() {
+		return fileCache;
+	}
+    
+    public int getOpenFiles() {
+    	return this.fileCache.size();
+    }
+
+}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/ManagedBatch.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/ManagedBatch.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/ManagedBatch.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,217 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.sql.Timestamp;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * A ManagedBatch basically describes a TupleBatch that is being managed and 
- * appends a bunch of additional state used within the BufferManagerImpl.  The 
- * batch is described by it's beginRow and endRow and it's size is in bytes.  
- * The lastAccessed field records the last accessed time in memory.  The location 
- * tells where the batch is currently stored, as defined in the TupleSourceInfo 
- * constants.  The pinned intervals describe which rows within the batch are 
- * currently pinned.
- */
-class ManagedBatch {
-
-    /** Constant for the location of this batch - stored in persistent storage */
-    public final static short PERSISTENT = 0;
-
-    /** Constant for the location of this batch - stored in memory, but not currently in use */
-    public final static short UNPINNED = 1;
-
-    /** Constant for the location of this batch - stored in memory and currently in use */
-    public final static short PINNED = 2;
-
-    private TupleSourceID tupleSourceID;
-    private int beginRow;
-    private int endRow;
-    private long size;    
-    private int location;  
-    private int pinnedCount;
-    private int hashCode;
-    private TupleBatch batch;
-    
-    // logging
-    private static int STACK_LEVELS_TO_OMIT = 2;
-    private static int STACK_LEVELS_TO_CAPTURE = 5;
-
-    private List<String> whoCalledUs;
-    private String sCallStackTimeStamp;
-    
-    /**
-     * Constructor for ManagedBatch.
-     */
-    public ManagedBatch(TupleSourceID tupleSourceID, int begin, int end, long size) {
-        this.tupleSourceID = tupleSourceID;
-        this.beginRow = begin;
-        this.endRow = end;
-        this.size = size;
-        this.hashCode = HashCodeUtil.hashCode(tupleSourceID.hashCode(), beginRow);
-    }
-    
-    public TupleBatch getBatch() {
-		return batch;
-	}
-    
-    public void setBatch(TupleBatch batch) {
-		this.batch = batch;
-	}
-    
-    /**
-     * Get the tuple source ID 
-     * @return Tuple sourceID
-     */
-    public TupleSourceID getTupleSourceID() {
-        return this.tupleSourceID;
-    }
-    
-    /**
-     * Get the begin row, must be >= 1
-     * @return Begin row
-     */
-    public int getBeginRow() {
-        return this.beginRow;
-    }
-    
-    /**
-     * Get the end row, inclusive
-     * @return End row
-     */
-    public int getEndRow() {
-        return this.endRow;
-    }
-
-    /**
-     * Get the size of the batch in bytes
-     * @return Size, in bytes
-     */
-    public long getSize() {
-        return this.size;
-    }
-    
-    /**
-     * Get the location of the batch, as defined in constants
-     * @return Location
-     */
-    public int getLocation() {
-        return this.location;
-    }
-    
-    /**
-     * Set location of the batch, as defined in constants
-     */
-    public void setLocation(int location) {
-        this.location = location;
-    }
-    
-    /**
-     * Check whether this managed batch has any pinned rows
-     * @return True if any are pinned
-     */
-    public boolean hasPinnedRows() {
-        return pinnedCount > 0;
-    }
-    
-    public void pin() {
-    	this.pinnedCount++;
-    }
-    
-    public void unpin() {
-    	this.pinnedCount--;
-    }
-    
-    /**
-     * Capture partial stack trace to express who owns this batch 
-     */
-    public void captureCallStack() {
-        /*
-         * If more detail is needed StackTraceElement has several useful methods.
-         */
-        StackTraceElement[] elements =  new Exception().getStackTrace();
-        
-        whoCalledUs = new LinkedList<String>();
-        
-        for ( int i = STACK_LEVELS_TO_OMIT; i < elements.length && i < STACK_LEVELS_TO_OMIT + STACK_LEVELS_TO_CAPTURE; i++ ) {
-            whoCalledUs.add(elements[ i ].toString());
-        }
-        sCallStackTimeStamp = new Timestamp(System.currentTimeMillis()).toString();
-    }    
-    
-    /**
-     * Returns call stack 
-     */
-    public List<String> getCallStack() {
-        
-        return whoCalledUs;
-    }    
-    
-    /**
-     * Returns call stack timestamp 
-     */
-    public String getCallStackTimeStamp() {
-        
-        return this.sCallStackTimeStamp;
-    }    
-
-    /**
-     * Compare two managed batches for equality - this check 
-     * is made based on TupleSourceID and beginRow.
-     * @param obj Other object
-     * @return True if equal
-     */
-    public boolean equals(Object obj) {
-        if(obj == this) {
-            return true;
-        }
-        
-        if(! (obj instanceof ManagedBatch)) {
-            return false;
-        }
-        
-        ManagedBatch other = (ManagedBatch) obj;
-        return ( this.getTupleSourceID().equals(other.getTupleSourceID()) &&
-                  this.getBeginRow() == other.getBeginRow() );
-        
-    }
-    
-    /**
-     * Get hash code, based on tupleSourceID and beginRow
-     * @return Hash code
-     */
-    public int hashCode() {
-        return hashCode;
-    }
-    
-    public String toString() {
-        return "ManagedBatch[" + tupleSourceID + ", " + beginRow + ", " + endRow + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/MemoryStorageManager.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/MemoryStorageManager.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/MemoryStorageManager.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/MemoryStorageManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.buffer.impl;
+
+import java.nio.ByteBuffer;
+import java.util.Properties;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.buffer.FileStore;
+import com.metamatrix.common.buffer.StorageManager;
+
+public class MemoryStorageManager implements StorageManager {
+    
+    /**
+     * @see StorageManager#initialize(Properties)
+     */
+    public void initialize(Properties props) throws MetaMatrixComponentException {
+    }
+
+	@Override
+	public FileStore createFileStore(String name) {
+		return new FileStore() {
+			private ByteBuffer buffer = ByteBuffer.allocate(2 << 15);
+			private int end;
+			
+			@Override
+			public synchronized long writeDirect(byte[] bytes, int offset, int length) throws MetaMatrixComponentException {
+				if (end + length > buffer.capacity()) {
+					ByteBuffer newBuffer = ByteBuffer.allocate(buffer.capacity() * 2 + length);
+					newBuffer.put(buffer);
+					buffer = newBuffer;
+				}
+				buffer.position(end);
+				buffer.put(bytes, offset, length);
+				long result = end;
+				end += length;
+				return result;
+			}
+			
+			@Override
+			public synchronized void removeDirect() {
+				buffer = ByteBuffer.allocate(0);
+			}
+			
+			@Override
+			public synchronized int readDirect(long fileOffset, byte[] b, int offset, int length)
+					throws MetaMatrixComponentException {
+				if (fileOffset >= end) {
+					return -1;
+				}
+				int position = (int)fileOffset;
+				buffer.position(position);
+				length = Math.min(length, end - position);
+				buffer.get(b, offset, length);
+				return length;
+			}
+		};
+	}
+}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/SizeUtility.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/SizeUtility.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/SizeUtility.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,241 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Vector;
-
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.Assertion;
-
-
-/**
- * Utility methods to determine the size of Java objects, particularly with 
- * respect to the MetaMatrix runtime types.
- */
-public final class SizeUtility {
-    private static final int DEFAULT_BUFFER_SIZE = 4096;
-	public static final boolean IS_64BIT = System.getProperty("sun.arch.data.model", "32").indexOf("64") != -1; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-//	public static final boolean IS_64BIT = true;
-	public static final int REFERENCE_SIZE = IS_64BIT?8:4;
-    
-    
-    /**
-     * Constructor for SizeUtility - utility class, can't construct
-     */
-    private SizeUtility() {
-    }
-    
-    /**
-     * This method calculates the sizes of the tuples based on their list sizes
-     * Since we know the type and length, it jsut calculates size from that 
-     * information, instead of walking whole object tree. 
-     * @param types - Data type for the each column
-     * @param data - data 
-     * @return size in total
-     */
-    public static long getBatchSize(String[] types, List[] data) {
-        
-        // If the type information is not available then, use the long route
-        // and calculate each and every size.
-        if (types == null) {
-            return getSize(data);
-        }
-        
-        int colLength = types.length;
-        int rowLength = data.length;
-    
-        // Array overhead for row array
-        long size = 16 + alignMemory(rowLength * REFERENCE_SIZE); 
-        // array overhead for all the columns ( 8 object overhead + 4 ref + 4 int)
-        size += (rowLength * (48 + alignMemory(colLength * REFERENCE_SIZE)));         
-        for (int col = 0; col < colLength; col++) {
-            Class type = DataTypeManager.getDataTypeClass(types[col]);
-                        
-            if (type == DataTypeManager.DefaultDataClasses.CHAR
-                    || type == DataTypeManager.DefaultDataClasses.BOOLEAN
-                    || type == DataTypeManager.DefaultDataClasses.BYTE
-                    || type == DataTypeManager.DefaultDataClasses.SHORT
-                    || type == DataTypeManager.DefaultDataClasses.INTEGER
-                    || type == DataTypeManager.DefaultDataClasses.LONG
-                    || type == DataTypeManager.DefaultDataClasses.FLOAT
-                    || type == DataTypeManager.DefaultDataClasses.DOUBLE) {
-            	size += (20*rowLength); 
-            } else if (type == DataTypeManager.DefaultDataClasses.DATE
-                    || type == DataTypeManager.DefaultDataClasses.TIME
-                    || type == DataTypeManager.DefaultDataClasses.TIMESTAMP) { 
-                	// Even though Timestamp contains an extra int, these are 
-                	// the same size because of rounding                                                                               // though
-                size += (32*rowLength);            
-            } else if (type == DataTypeManager.DefaultDataClasses.NULL) {
-            	//do nothing
-            }
-            else {
-                for (int row = 0; row < rowLength; row++) {
-                    size += getSize(data[row].get(col));
-                }
-            }
-        }
-        return size;
-    }
-    
-    /**
-     * Get size of object
-     * @return Size in bytes
-     */
-    public static long getSize(Object obj) {
-        if(obj == null) {
-            return 0;
-        }
-
-        Class type = obj.getClass();
-        // Defect 14530 - this code represents the size of the object in the heap,
-        // and not necessarily the number of bytes serialized.
-        if (type == DataTypeManager.DefaultDataClasses.CHAR ||
-            type == DataTypeManager.DefaultDataClasses.BOOLEAN ||
-            type == DataTypeManager.DefaultDataClasses.BYTE ||
-            type == DataTypeManager.DefaultDataClasses.SHORT ||
-            type == DataTypeManager.DefaultDataClasses.INTEGER ||
-            type == DataTypeManager.DefaultDataClasses.LONG ||
-            type == DataTypeManager.DefaultDataClasses.FLOAT ||
-            type == DataTypeManager.DefaultDataClasses.DOUBLE) {
-                return 20;
-        } else if (type == DataTypeManager.DefaultDataClasses.DATE ||
-                   type == DataTypeManager.DefaultDataClasses.TIME ||
-                   type == DataTypeManager.DefaultDataClasses.TIMESTAMP) { // Even though Timestamp contains an extra int, these are the same size because of rounding
-            return 32;
-        } else if(type == DataTypeManager.DefaultDataClasses.STRING) {
-            int length = ((String)obj).length();
-            if (length > 0) {
-                return alignMemory(40 + (2 * length));
-            }
-            return 40;
-        } else if(obj instanceof List) {
-            int total = 16; // Object overhead + 4(int modcount), rounded
-            if (obj instanceof LinkedList) {
-                total += 8; // 4 (Entry ref) + 4 (int size)
-                for (Iterator i = ((List)obj).iterator(); i.hasNext();) {
-                    total+= 16 + SizeUtility.getSize(i.next()); // rounded(4 (Object ref + 4 (next Entry ref) + 4 (previous Entry ref)) + actual object
-                }
-            } else if (obj instanceof ArrayList) {
-                List arrayList = (ArrayList)obj;
-                int arraySize = arrayList.size();
-                int maxEnsuredSize = (arraySize < 10) ? 10 : arraySize * 3 / 2; // assuming default size
-                total += 24 /*4(char[] ref) + 4(int) + 16 (array overhead)*/
-                         +alignMemory(maxEnsuredSize * REFERENCE_SIZE); /*number of references held in the array*/                if (arraySize > 0) {
-                    for (int i = 0; i < arraySize; i++) {
-                        total += SizeUtility.getSize(arrayList.get(i));
-                    }
-                }
-            } else if (obj instanceof Vector) {
-                List arrayList = (List)obj;
-                int arraySize = arrayList.size();
-                int maxEnsuredSize = (arraySize < 10) ? 10 : arraySize * 2; // assuming default size, default capacity growth
-                total += 16 // 4(Object[] ref) + 4 (int capacity) + 4 (int capIncrement), rounded
-                         + alignMemory(maxEnsuredSize * REFERENCE_SIZE); // Array overhead
-            } else { // Assume java.util.Arrays.ArrayList
-                List list = (List)obj;
-                int arraySize = list.size();
-                total += 16 + alignMemory(arraySize * REFERENCE_SIZE); // For the Object[]                
-                if (arraySize > 0) {
-                    for (int i = 0; i < arraySize; i++) {
-                        total += SizeUtility.getSize(list.get(i));
-                    }
-                }
-            }             
-            return total;
-        } else if(type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
-            int bitLength = ((BigDecimal)obj).unscaledValue().bitLength();
-            return // 8     // Object overhead
-                   // + 4   // BigInteger reference
-                   // + 4   // int scale
-                   // Not aligning the above since they are already a multiple of 8
-                   // The remaining should be the same as BigInteger
-                   // + 8   // object overhead
-                   // + 24  // 6 int fields
-                   // + 4   // int[] ref
-                   // + 16 + alignMemory(4 * ((bitLength/32) + 1))   // int[] overhead
-                72 + alignMemory(4 + (bitLength >> 3)); // Same as above calculation
-        } else if(type == DataTypeManager.DefaultDataClasses.BIG_INTEGER) {
-            int bitLength = ((BigInteger)obj).bitLength();
-            return // + 8           // object overhead
-                   // + 24          // 6 int fields
-                   // + 4           // int[] ref
-                   // + 16 + alignMemory(4 * ((bitLength/32) + 1))   // int[] overhead. BigInteger represents all values in all bases as a concatenation of chunks of 32-bits.
-                56 + alignMemory(4 + (bitLength >> 3)); // Same as above calculation
-        } else if(type.isArray() && !type.getComponentType().isPrimitive()) {
-            Object[] rows = (Object[]) obj;
-            long total = 16 + alignMemory(rows.length * REFERENCE_SIZE); // Array overhead
-            for(int i=0; i<rows.length; i++) {
-                total += SizeUtility.getSize(rows[i]);
-            }
-            return total;
-        } else {
-            // Unknown object
-            // 8 - for object overhead
-            return 8+alignMemory(4+getSerializedSize(obj)); // Assume some max value for unknown objects.
-        }
-    }
-    
-    /**
-     * Most current VMs have memory alignment that places objects into heap space that is a multiple of 8 Bytes.
-     * This utility method helps with calculating the aligned size of an object.
-     * @param numBytes
-     * @return
-     * @since 4.2
-     */
-    private static long alignMemory(long numBytes) {
-        long remainder = numBytes % 8;
-        if (remainder != 0) {
-            numBytes += (8 - remainder);
-        }
-        return numBytes;
-    }
-
-    private static long getSerializedSize(Object anObj) {
-		Assertion.assertTrue(anObj instanceof Serializable);
-		try {
-			ByteArrayOutputStream bout = new ByteArrayOutputStream(DEFAULT_BUFFER_SIZE);
-			ObjectOutputStream out = new ObjectOutputStream(bout);
-			out.writeObject(anObj);
-			out.flush();
-			long size = bout.size();
-			out.close();
-			bout.close();
-			return size;
-		} catch (IOException e) {
-			// just return exception, this should not happen
-			throw new MetaMatrixRuntimeException(e);
-		}
-	}
-}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleGroupInfo.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleGroupInfo.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleGroupInfo.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.metamatrix.common.buffer.TupleSourceID;
-
-
-
-/** 
- * Represents a logical grouping of tuple sources managed by the buffer manager.
- * Tuple sources are typically grouped by session, and the groupName is typically a sessionID/connectionID.
- * @since 4.3
- */
-class TupleGroupInfo {
-    
-    private String groupName;
-    /** The bytes of memory used by this tuple group*/
-    private volatile long memoryUsed;
-    private Set<TupleSourceID> tupleSourceIDs = Collections.synchronizedSet(new HashSet<TupleSourceID>());
-    
-    TupleGroupInfo(String groupName) {
-        this.groupName = groupName;
-    }
-    
-    public Set<TupleSourceID> getTupleSourceIDs() {
-		return tupleSourceIDs;
-	}
-    
-    String getGroupName() {
-        return groupName;
-    }
-    
-    long getGroupMemoryUsed() {
-        return memoryUsed;
-    }
-    
-    long reserveMemory(long bytes) {
-        return memoryUsed += bytes;
-    }
-    
-    long releaseMemory(long bytes) {
-        return memoryUsed -= bytes;
-    }
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,188 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.lang.ref.WeakReference;
-import java.util.List;
-
-import com.metamatrix.api.exception.ComponentNotFoundException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-
-class TupleSourceImpl implements IndexedTupleSource {
-	private final BufferManagerImpl bufferManagerImpl;
-	private TupleSourceID tupleSourceID;
-    private List<?> schema;
-    private WeakReference<TupleBatch> currentBatch;
-    private int currentRow = 1;
-    private int mark = 1;
-	private List<?> currentTuple;
-
-    TupleSourceImpl(BufferManagerImpl bufferManagerImpl, TupleSourceID tupleSourceID, List schema, int batchSize){
-        this.bufferManagerImpl = bufferManagerImpl;
-		this.tupleSourceID = tupleSourceID;
-        this.schema = schema;
-    }
-    
-    @Override
-    public int getCurrentIndex() {
-    	return this.currentRow;
-    }
-
-    @Override
-    public List getSchema(){
-        return this.schema;
-    }
-
-    @Override
-    public List<?> nextTuple()
-    throws MetaMatrixComponentException{
-    	List<?> result = null;
-    	if (currentTuple != null){
-			result = currentTuple;
-			currentTuple = null;
-    	} else {
-    		result = getCurrentTuple();
-    	} 
-    	if (result != null) {
-    		currentRow++;
-    	}
-        return result;
-    }
-
-	private List getCurrentTuple() throws MetaMatrixComponentException,
-			BlockedException, ComponentNotFoundException {
-		TupleBatch batch = getBatch();
-        if(batch.getRowCount() == 0) {
-            // Check if last
-            try {
-                TupleSourceStatus status = this.bufferManagerImpl.getStatus(this.tupleSourceID);
-                if(status == TupleSourceStatus.FULL) {
-                    unpinCurrentBatch();
-                    return null;
-                } 
-                throw BlockedException.INSTANCE;
-            } catch(TupleSourceNotFoundException e) {
-                throw new ComponentNotFoundException(e, e.getMessage());
-            }
-        }
-
-        return batch.getTuple(currentRow);
-	}
-
-    @Override
-    public void closeSource()
-    throws MetaMatrixComponentException{
-        // Reset to same state as newly-instantiated TupleSourceImpl
-        unpinCurrentBatch();
-        mark = 1;
-        reset();
-        //TODO: this is not quite correct wrt the javadoc, close does
-        //not need to ensure that we are back at the beginning
-    }
-    
-    private TupleBatch getCurrentBatch() {
-        if (currentBatch != null) {
-            return currentBatch.get();
-        }
-        return null;
-    }
-
-    private void unpinCurrentBatch()
-    throws MetaMatrixComponentException {
-        TupleBatch batch = getCurrentBatch();
-        if(batch != null ) {
-            try {
-                this.bufferManagerImpl.unpinTupleBatch(this.tupleSourceID, batch.getBeginRow());
-            } catch (TupleSourceNotFoundException e) {
-				throw new MetaMatrixComponentException(e);
-			} finally {
-                currentBatch = null;
-            }
-        }
-    }
-    
-    // Retrieves the necessary batch based on the currentRow
-    public TupleBatch getBatch()
-    throws MetaMatrixComponentException{
-        TupleBatch batch = getCurrentBatch();
-        if (batch != null) {
-            if (currentRow <= batch.getEndRow() && currentRow >= batch.getBeginRow()) {
-                return batch;
-            }
-            unpinCurrentBatch();
-        } 
-        
-        try{
-            batch = this.bufferManagerImpl.pinTupleBatch(this.tupleSourceID, currentRow);
-            currentBatch = new WeakReference<TupleBatch>(batch);
-        } catch (MemoryNotAvailableException e) {
-            /* Defect 18499 - ProcessWorker doesn't know how to handle MemoryNotAvailableException properly,
-             * and this should always be converted to a BlockedOnMemoryException during processing so that
-             * the work can be requeued.
-             */
-            throw BlockedOnMemoryException.INSTANCE;
-        } catch(MetaMatrixComponentException e) {
-            throw e;
-        } catch(TupleSourceNotFoundException e){
-            throw new MetaMatrixComponentException(e);
-        }
-        return batch;
-    }
-    
-    @Override
-	public boolean hasNext() throws MetaMatrixComponentException {
-        if (this.currentTuple != null) {
-            return true;
-        }
-        
-        this.currentTuple = getCurrentTuple();
-		return this.currentTuple != null;
-	}
-
-	@Override
-	public void reset() {
-		this.setPosition(mark);
-		this.mark = 1;
-	}
-
-    @Override
-    public void mark() {
-        this.mark = currentRow;
-    }
-
-    @Override
-    public void setPosition(int position) {
-        if (this.currentRow != position) {
-	        this.currentRow = position;
-	        this.currentTuple = null;
-        }
-    }
-}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceInfo.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceInfo.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/TupleSourceInfo.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer.impl;
-
-import java.lang.ref.PhantomReference;
-import java.lang.ref.ReferenceQueue;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.common.types.Streamable;
-
-/**
- * Describe a TupleSource and all important information about it.
- */
-public class TupleSourceInfo {
-    
-	private static final AtomicLong LOB_ID = new AtomicLong();
-	private static final ReferenceQueue<Streamable<?>> LOB_QUEUE = new ReferenceQueue<Streamable<?>>();
-	
-	private static class LobReference extends PhantomReference<Streamable<?>> {
-		
-		String persistentStreamId;
-		
-		public LobReference(Streamable<?> lob) {
-			super(lob, LOB_QUEUE);
-			this.persistentStreamId = lob.getPersistenceStreamId();
-		}		
-	}
-	
-    private TupleSourceType type;       // Type of TupleSource, as defined in BufferManager constants
-    private TupleSourceID tsID;
-    private List schema;
-    private String[] types;
-    private int rowCount;
-    private TupleSourceStatus status = TupleSourceStatus.ACTIVE;
-    private TupleGroupInfo groupInfo;  
-    private boolean removed = false;
-    private TreeMap<Integer, ManagedBatch> batches = new TreeMap<Integer, ManagedBatch>();
-    private Map<String, Streamable<?>> lobReferences; //references to contained lobs
-    private boolean lobs;
-    
-    @SuppressWarnings("unused")
-	private LobReference containingLobReference; //reference to containing lob
-    
-    /**
-     * Construct a TupleSourceInfo given information about it.
-     * @param tsID Identifier 
-     * @param schema Schema describing tuple source
-     * @param groupInfo The tuple gorup to which this tuple source belongs
-     * @param type Type of tuple source, as defined in BufferManager constants
-     */
-    public TupleSourceInfo(TupleSourceID tsID, List schema, String[] types, TupleGroupInfo groupInfo, TupleSourceType type) {
-        this.tsID = tsID;
-        this.schema = schema;
-        this.types = types;
-        this.groupInfo = groupInfo;
-        this.type = type;
-        this.lobs = checkForLobs();
-    }
-    
-    public void setContainingLobReference(Streamable<?> s) {
-		this.containingLobReference = new LobReference(s);
-	}
-    
-    public void addLobReference(Streamable<Object> lob) {
-    	String id = lob.getReferenceStreamId();
-    	if (id == null) {
-    		id = String.valueOf(LOB_ID.getAndIncrement());
-    		lob.setReferenceStreamId(id);
-    	}
-    	if (this.lobReferences == null) {
-    		this.lobReferences = Collections.synchronizedMap(new HashMap<String, Streamable<?>>());
-    	}
-    	this.lobReferences.put(id, lob);
-    }
-    
-    public static String getStaleLobTupleSource() {
-    	LobReference ref = (LobReference)LOB_QUEUE.poll();
-    	if (ref == null) {
-    		return null;
-    	}
-    	return ref.persistentStreamId;
-    }
-    
-    public Streamable<?> getLobReference(String id) {
-    	if (this.lobReferences == null) {
-    		return null;
-    	}
-    	return this.lobReferences.get(id);
-    }
-    
-    public void addBatch(ManagedBatch batch) {
-        batches.put(batch.getBeginRow(), batch);
-    }
-    
-    /**
-     * Returns the batch containing the begin row or null
-     * if it doesn't exist
-     * @param beginRow
-     * @return
-     */
-    public ManagedBatch getBatch(int beginRow) {
-        Map.Entry<Integer, ManagedBatch> entry = batches.floorEntry(beginRow);
-        if (entry != null && entry.getValue().getEndRow() >= beginRow) {
-        	return entry.getValue();
-        }
-        return null;
-    }
-    
-    public void removeBatch(int beginRow) {
-        batches.remove(new Integer(beginRow));
-    }
-    
-    public Iterator<ManagedBatch> getBatchIterator() {
-        return batches.values().iterator();
-    }
-    
-    /**
-     * Get the tuple source identifier
-     * @return Tuple source identifier
-     */
-    public TupleSourceID getTupleSourceID() { 
-        return this.tsID;
-    }
-    
-    /**
-     * Get the tuple schema describing a tuple source
-     * @return Schema
-     */
-    public List getTupleSchema() { 
-        return this.schema;
-    }
-    
-    /**
-     * Get group this tuple source is in. Never null
-     * @return TupleGroupInfo instance representing the tuple group to which this tuple source belongs.
-     */
-    public TupleGroupInfo getGroupInfo() { 
-        return this.groupInfo;      
-    }    
-    
-    void setGroupInfo(TupleGroupInfo info) { 
-        this.groupInfo = info;       
-    } 
-    
-    /**
-     * Get current row count
-     * @return Row count
-     */
-    public int getRowCount() { 
-        return this.rowCount;
-    }
-    
-    /**
-     * Set the current row count
-     * @param rows New row count
-     */
-    public void setRowCount(int rows) { 
-        this.rowCount = rows;
-    }
-
-    /**
-     * Get status of this tuple source, as defined in BufferManager constants
-     * @return Status
-     */
-    public TupleSourceStatus getStatus() { 
-        return this.status;    
-    }
-    
-    /**
-     * Set status of this tuple source
-     * @param status New status
-     */
-	public void setStatus(TupleSourceStatus status) {
-		this.status = status;	
-	}
-
-    /**
-     * Get type of this tuple source
-     * @return Type of tuple source
-     */
-    public TupleSourceType getType() {
-        return this.type;
-    }
-     
-    /**
-     * Check whether this tuple source has been removed.  Due to
-     * synchronization, this tuple source may have been removed 
-     * between the time it was retrieved and now.
-     */       
-    public boolean isRemoved() {
-        return this.removed;    
-    }
-    
-    /**
-     * Set a flag that this tuple source has been removed
-     */
-    public void setRemoved() {
-        this.removed = true;
-    }
-
-    public boolean lobsInSource() {
-        return this.lobs;
-    }
-    
-    public String[] getTypes() {
-        return types;
-    }
-    
-    /**
-     * Get string representation
-     * @return String representation
-     */
-    public String toString() {
-        return "TupleSourceInfo[" + this.tsID + "]";     //$NON-NLS-1$ //$NON-NLS-2$
-    }            
-    
-    private boolean checkForLobs() {
-        if (types == null) {
-            // assume the worst
-        	return true;
-        }
-        for (int i = 0; i < types.length; i++) {
-            if (DataTypeManager.isLOB(types[i]) || types[i] == DataTypeManager.DefaultDataTypes.OBJECT) {
-            	return true;
-            }
-        }
-        return false;
-    }
-}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal (from rev 1724, trunk/engine/src/main/java/com/metamatrix/dqp/internal)

Copied: branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr (from rev 1724, trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr)

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	2010-01-08 20:39:31 UTC (rev 1724)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.internal.datamgr;
-
-import java.io.Serializable;
-
-/**
- * Used to uniquely identify a connector.
- */
-public class ConnectorID implements Serializable {
-    private static final long serialVersionUID = -3507451286236400399L;
-
-    private String id;
-
-    /**
-     * Construct a new instance.
-     */
-    public ConnectorID(String id) {
-        this.id = id;
-    }
-
-    /**
-     * Return the id that identifies this connector instance.
-     * @return Unique ID for the connector
-     */
-    public String getID() {
-        return id;
-    }
-
-    /**
-     * Compare two ConnectorID's for equality.
-     * Return true if instanceName == instanceName and
-     * serviceName == serviceName.
-     * @param obj ConnectorID to compare to.
-     * @return true if ConnectorID's are equal
-     */
-    public boolean equals(Object obj) {
-
-    	// Quick same object test
-    	if(this == obj) {
-    		return true;
-		}
-    	
-    	if (!(obj instanceof ConnectorID)) {
-    		return false;
-    	}
-
-        ConnectorID other = (ConnectorID) obj;
-
-        // compare service name
-        return getID().equals(other.getID());
-    }
-
-    public int hashCode() {
-        return this.id.hashCode();
-    }
-
-    /**
-     * Return a String representation of this instance.
-     */
-    public String toString() {
-        return "ConnectorID<"+getID()+">"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-}
-

Copied: branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.internal.datamgr;
+
+import java.io.Serializable;
+
+/**
+ * Used to uniquely identify a connector.
+ */
+public class ConnectorID implements Serializable {
+    private static final long serialVersionUID = -3507451286236400399L;
+
+    private String id;
+
+    /**
+     * Construct a new instance.
+     */
+    public ConnectorID(String id) {
+        this.id = id;
+    }
+
+    /**
+     * Return the id that identifies this connector instance.
+     * @return Unique ID for the connector
+     */
+    public String getID() {
+        return id;
+    }
+
+    /**
+     * Compare two ConnectorID's for equality.
+     * Return true if instanceName == instanceName and
+     * serviceName == serviceName.
+     * @param obj ConnectorID to compare to.
+     * @return true if ConnectorID's are equal
+     */
+    public boolean equals(Object obj) {
+
+    	// Quick same object test
+    	if(this == obj) {
+    		return true;
+		}
+    	
+    	if (!(obj instanceof ConnectorID)) {
+    		return false;
+    	}
+
+        ConnectorID other = (ConnectorID) obj;
+
+        // compare service name
+        return getID().equals(other.getID());
+    }
+
+    public int hashCode() {
+        return this.id.hashCode();
+    }
+
+    /**
+     * Return a String representation of this instance.
+     */
+    public String toString() {
+        return "ConnectorID<"+getID()+">"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+}
+

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,7 +30,7 @@
 
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import com.metamatrix.common.buffer.impl.BufferConfig;
+import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.query.sql.lang.Command;
 
@@ -67,7 +67,7 @@
 	private Command command;
 
 	// results fetch size
-	private int fetchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
+	private int fetchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
 
 	// The time when the command was created by the client
 	private Date submittedTimestamp;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,7 +35,7 @@
  * <li>Debug trace information, if requested</LI>
  * </ul>
  */
-public class AnalysisRecord {
+public class AnalysisRecord implements Serializable {
 
     // Flags regarding what should be recorded
     private boolean recordQueryPlan = false;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,10 +24,10 @@
 
 import java.sql.SQLException;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
@@ -318,7 +318,7 @@
         } else if (criteria instanceof DependentSetCriteria){
         	ContextReference ref = (ContextReference)criteria;
     		ValueIteratorSource vis = (ValueIteratorSource)getContext(criteria).getVariableContext().getGlobalValue(ref.getContextSymbol());
-    		HashSet<Object> values;
+    		Set<Object> values;
     		try {
     			values = vis.getCachedSet(ref.getValueExpression());
     		} catch (MetaMatrixProcessingException e) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/function/FunctionTree.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -70,7 +70,9 @@
     /**
      * Function selection use: Map of function name (uppercase) to List of FunctionMethod
      */
-    private Map functionsByName = new HashMap();
+    private Map<String, List<FunctionMethod>> functionsByName = new HashMap<String, List<FunctionMethod>>();
+    
+    private Set<FunctionMethod> allFunctions = new HashSet<FunctionMethod>();
 
 	/**
 	 * Function lookup and invocation use: Function name (uppercase) to Map (recursive tree)
@@ -160,11 +162,7 @@
 	 * newer indistinguishable functions will just not be added.
 	 */
 	private boolean containsIndistinguishableFunction(FunctionMethod method){
-        List knownMethods = (List) functionsByName.get(method.getName().toUpperCase());
-        if(knownMethods == null) {
-			return false;
-        }
-        return knownMethods.contains(method);
+        return allFunctions.contains(method);
 	}
 
     /**
@@ -202,12 +200,13 @@
         methods.add(method);
 
         // Add method to list by function name
-        List knownMethods = (List) functionsByName.get(nameKey);
+        List<FunctionMethod> knownMethods = functionsByName.get(nameKey);
         if(knownMethods == null) {
-            knownMethods = new ArrayList();
+            knownMethods = new ArrayList<FunctionMethod>();
             functionsByName.put(nameKey, knownMethods);
         }
         knownMethods.add(method);
+        allFunctions.add(method);
     }
 
     /**
@@ -265,7 +264,7 @@
      */
     List<FunctionMethod> findFunctionMethods(String name, int args) {
         final List<FunctionMethod> allMatches = new ArrayList<FunctionMethod>();
-        List<FunctionMethod> methods = (List<FunctionMethod>) functionsByName.get(name.toUpperCase());
+        List<FunctionMethod> methods = functionsByName.get(name.toUpperCase());
         if(methods == null || methods.size() == 0) {
             return allMatches;
         }
@@ -305,8 +304,6 @@
         	inputTypes.set(inputTypes.size() - 1, Array.newInstance(inputTypes.get(inputTypes.size() - 1), 0).getClass());
         }
 
-        inputTypes.add(0, CommandContext.class);
-
         // Get return type
         FunctionParameter outputParam = method.getOutputParameter();
         Class outputType = null;
@@ -323,10 +320,10 @@
                 ReflectionHelper helper = new ReflectionHelper(methodClass);
                 try {
                 	invocationMethod = helper.findBestMethodWithSignature(method.getInvocationMethod(), inputTypes);
-                	requiresContext = true;
                 } catch (NoSuchMethodException e) {
-		            inputTypes = inputTypes.subList(1, inputTypes.size());
+                    inputTypes.add(0, CommandContext.class);
                 	invocationMethod = helper.findBestMethodWithSignature(method.getInvocationMethod(), inputTypes);
+                	requiresContext = true;
                 }
             } catch (ClassNotFoundException e) {
               // Failed to load class, so can't load method - this will fail at invocation time.
@@ -339,6 +336,8 @@
             if(invocationMethod != null && !FunctionTree.isValidMethod(invocationMethod)) {
             	throw new MetaMatrixRuntimeException(ErrorMessageKeys.FUNCTION_0047, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0047, new Object[]{method.getInvocationClass(), invocationMethod, inputTypes}));
             }
+        } else {
+            inputTypes.add(0, CommandContext.class);
         }
 
         FunctionDescriptor descriptor = new FunctionDescriptor(method.getName(), method.getPushdown(), types, outputType, invocationMethod, requiresContext, method.isNullDependent(), method.getDeterministic());

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/function/metadata/FunctionMethod.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,6 +23,8 @@
 package com.metamatrix.query.function.metadata;
 
 import java.io.Serializable;
+import java.util.Arrays;
+
 import com.metamatrix.core.util.HashCodeUtil;
 
 /**
@@ -333,12 +335,7 @@
     public int hashCode() { 
         int hash = HashCodeUtil.hashCode(0, name);
         if(inputParameters != null) { 
-            hash = HashCodeUtil.hashCode(hash, inputParameters.length);
-            
-            // Base hash only on first input parameter type, not all, for performance
-            if(inputParameters.length > 0 && inputParameters[0] != null) {
-                hash = HashCodeUtil.hashCode(hash, inputParameters[0].getType());
-            }    
+            hash = HashCodeUtil.hashCode(hash, Arrays.hashCode(inputParameters));
         }             
         return hash;
     }
@@ -353,9 +350,8 @@
     public boolean equals(Object obj) {
         if(obj == this) { 
             return true;
-        } else if(obj == null) { 
-            return false;
-        } else if(obj instanceof FunctionMethod) { 
+        } 
+        if(obj instanceof FunctionMethod) { 
             FunctionMethod other = (FunctionMethod) obj;
 
             // Compare # of parameters - do this first as it is much faster than name compare
@@ -390,10 +386,8 @@
             
             // Found no discrepancies, must be equal
             return true;            
-        } else {
-            // Can't compare object of different type
-            return false;
-        }    
+        } 
+        return false;
     }    
     
     /**

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -100,18 +100,6 @@
         this.rsPlan = plan;
     }
     
-    public List getReferences() {
-        return boundReferences;
-    }
-    
-    public void setReferences(List references) {
-        this.boundReferences = references;
-    }
-    
-    public boolean hasReferences() {
-        return boundReferences != null;
-    }
-    
     public int getUserRowLimit() {
         return userRowLimit;
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,6 +30,7 @@
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.processor.ProcessorPlan;
+import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.util.CommandContext;
 
 /**
@@ -37,38 +38,14 @@
  * object and produce a 
  * {@link com.metamatrix.query.processor.ProcessorPlan ProcessorPlan} 
  * object, which is a plan for executing the query.</p>
- * 
- * <p>Implementations need to be stateless; state can be stored in the
- * {@link CommandTreeNode CommandTreeNode} objects during planning.  
- * The main client of this interface, {@link QueryOptimizer}, will assume
- * the planners to be stateless and therefore thread safe.</p>
  */
 public interface CommandPlanner {
 	
 	/**
-	 * <p>Requests that the planner generate the canonical plan(s) for the 
-	 * Command object(s) represented by the CommandTreeNode tree parameter.
-	 * The canonical plan(s) should be added to the node(s) of the tree rooted
-	 * at rootNode.</p>
-	 * 
-	 * <p>It may or may not make sense for a specific implementation of this
-	 * Class to create a canonical plan.  It may be that all planning can be done
-	 * during the call to {@link #optimize}</p>
-	 * @param rootNode tree of CommandTreeNode object(s) rooted at rootNode
-	 * @param context 
-	 * @param debug whether or not to generate verbose debug output during planning
-	 * @throws QueryPlannerException indicating a problem in planning
-     * @throws MetaMatrixComponentException indicating an unexpected exception
-	 */
-	void generateCanonical(CommandTreeNode rootNode, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
-	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException;
-	
-	/**
 	 * Allows the planner a chance to optimize the canonical plan(s) stored in
 	 * the CommandTreeNode tree.  This method should be called in a bottom-up
 	 * manner; from leaf nodes up to the root node.
-	 * @param node root of a tree (or subtree) of CommandTreeNode objects, each of 
-	 * which should have its canonical plan
+	 * @param command TODO
 	 * @param metadata source of metadata
 	 * @param capFinder Class usable to find the connector capabilities for a particular model
 	 * @param context 
@@ -78,7 +55,7 @@
      * @throws QueryMetadataException indicating an exception in accessing the metadata
      * @throws MetaMatrixComponentException indicating an unexpected exception
 	 */
-	ProcessorPlan optimize(CommandTreeNode node, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
+	ProcessorPlan optimize(Command command, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
 	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException;
 
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,316 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.optimizer;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.sql.lang.Command;
-
-/**
- * A tree node object used to hold state during command planning and optimizing.
- */
-public class CommandTreeNode {
-	
-	/** The command type is a relational command */
-	public static final int TYPE_RELATIONAL_COMMAND = 2;
-	
-	/** The command type is an XML query */
-	public static final int TYPE_XML_COMMAND = 3;
-	
-	/** The command type is a procedural command */
-	public static final int TYPE_PROCEDURAL_COMMAND = 4;
-
-    /** The command type is an XQuery command */
-    public static final int TYPE_XQUERY_COMMAND = 5;
-    
-    /** The command type is a batched update command. */
-    public static final int TYPE_BATCHED_UPDATE_COMMAND = 6;
-
-    /** The command type is a dynamic command. */
-    public static final int TYPE_DYNAMIC_COMMAND = 7;
-    
-    /** The command type is a prepared batched update command. */
-    public static final int TYPE_PREPARED_BATCH_UPDATE_COMMAND = 8;
-    
-	/** The command, or subcommand, stored at this node */
-	private Command command;
-
-	/** The type of node, as defined by class constants */
-	private int commandType;
-	
-	/** The Planner-specific canonical plan object */
-	private Object canonicalPlan;
-	
-	/** Planner-specific node properties, as defined by each CommandPlanner implementation */
-	private Map<Integer, Object> properties = new HashMap<Integer, Object>();
-	
-	/** The parent of this node, null if root. */
-	private CommandTreeNode parent;
-
-	/** Child nodes */
-	private LinkedList<CommandTreeNode> children = new LinkedList<CommandTreeNode>();	
-
-	// ====================================================
-	// API
-	// ====================================================
-	
-	/**
-	 * Get the type of this command
-	 * @return int one of three type constants defined in this class
-	 * @see #TYPE_RELATIONAL_COMMAND
-	 * @see #TYPE_XML_COMMAND
-	 * @see #TYPE_PROCEDURAL_COMMAND
-	 */
-	public int getCommandType() {
-		return commandType;
-	}	
-
-	/**
-	 * Set the type of this command
-	 * @param commandType one of three type constants defined in this class
-	 * @see #TYPE_RELATIONAL_COMMAND
-	 * @see #TYPE_XML_COMMAND
-	 * @see #TYPE_PROCEDURAL_COMMAND
-	 */
-	public void setCommandType(int commandType) {
-		this.commandType = commandType;
-	}	
-	
-	/**
-	 * Returns the Command object.
-	 * @return Command
-	 */
-	public Command getCommand() {
-		return command;
-	}
-
-	/**
-	 * Sets the Command object.
-	 * @param command The command to set
-	 */
-	public void setCommand(Command command) {
-		this.command = command;
-	}
-	
-	/**
-	 * Retrieve the planner-specific canonical plan
-	 * @return Object planner-specific canonical plan
-	 */
-	public Object getCanonicalPlan(){
-		return this.canonicalPlan;
-	}
-	
-	/**
-	 * Set the planner-specific canonical plan
-	 * @param canonicalPlan Object
-	 */
-	public void setCanonicalPlan(Object canonicalPlan){
-		this.canonicalPlan = canonicalPlan;
-	}
-	
-	/**
-	 * Returns the planner-specific ProcessorPlan implementation.
-	 * This ProcessorPlan may be needed by the planner of this
-	 * node's parent node - in other words a planner may need 
-	 * access to the ProcessorPlans of subcommands or other nested
-	 * commands.
-	 * @return ProcessorPlan at this node, or null if none
-	 */
-	public ProcessorPlan getProcessorPlan() {
-		return this.command.getProcessorPlan();
-	}
-
-	/**
-	 * Sets the planner-specific ProcessorPlan implementation for the
-	 * Command represented by this node.
-	 * @param processorPlan The processorPlan to set
-	 */
-	public void setProcessorPlan(ProcessorPlan processorPlan) {
-		this.command.setProcessorPlan(processorPlan);
-	}	
-
-	// ====================================================
-	// Tree Stuff
-	// ====================================================
-
-	public CommandTreeNode getParent() {
-		return parent;
-	}
-
-	public void setParent(CommandTreeNode parent) {
-		this.parent = parent;
-	}
-
-	public List<CommandTreeNode> getChildren() {
-		return this.children;
-	}
-	
-	public int getChildCount() {
-		return this.children.size();
-	}
-		
-	public CommandTreeNode getFirstChild() {
-		return this.children.getFirst();
-	}
-	
-	public CommandTreeNode getLastChild() {
-		return this.children.getLast();
-	}
-		
-	public void addFirstChild(CommandTreeNode child) {
-		this.children.addFirst(child);
-	}
-	
-	public void addLastChild(CommandTreeNode child) {
-		this.children.addLast(child);
-	}
-	
-	public void addChildren(List<CommandTreeNode> otherChildren) {
-		this.children.addAll(otherChildren);
-	}
-	
-	public boolean hasChild(CommandTreeNode child) {
-		return this.children.contains(child);
-	}
-		
-	public boolean removeChild(CommandTreeNode child) {
-		return this.children.remove(child);
-	}		
-
-	// ====================================================
-	// Properties
-	// ====================================================
-
-	/**
-	 * Retrieve one of the {@link CommandPlanner}-specific properties 
-	 * stored at this node, or null if no property of the given key
-	 * exists.
-	 * @param propertyID key of the property
-	 * @return Object property value
-	 */
-	public Object getProperty(Integer propertyID) {
-		return properties.get(propertyID);
-	}
-	
-	/**
-	 * Set a {@link CommandPlanner}-specific property.  Each planner may have
-	 * conflicting property keys, so an object of this Class should only be
-	 * used for one CommandPlanner at a time.
-	 * @param propertyID planner-specific property key
-	 * @param value property value
-	 */
-	public void setProperty(Integer propertyID, Object value) {
-		properties.put(propertyID, value);
-	}
-
-	// ====================================================
-	// Overriden Object Methods
-	// ====================================================
-
-	/**
-	 * Print CommandTreeNode structure starting at this node
-	 * @return String representing this node and all children under this node
-	 */
-	public String toString() {
-		StringBuffer str = new StringBuffer();
-		getRecursiveString(str, 0);
-		return str.toString();
-	}
-
-	// ====================================================
-	// Utility
-	// ====================================================
-
-	/**
-	 * Just print single node to string instead of node+recursive plan.
-	 * @return String representing just this node
-	 */
-	public String nodeToString() {
-		StringBuffer str = new StringBuffer();
-		getNodeString(str);
-		return str.toString();
-	}
-	
-	// Define a single tab
-	private static final String TAB = "  "; //$NON-NLS-1$
-
-	
-	private void setTab(StringBuffer str, int tabStop) {
-		for(int i=0; i<tabStop; i++) {
-			str.append(TAB);
-		}			
-	}
-	
-	private void getRecursiveString(StringBuffer str, int tabLevel) {
-		setTab(str, tabLevel);
-		getNodeString(str);
-		str.append("\n");  //$NON-NLS-1$
-		getCanonicalPlanString(str);
-		
-		// Recursively add children at one greater tab level
-		for (CommandTreeNode child : this.children) {
-			child.getRecursiveString(str, tabLevel+1);
-		}		
-	}
-
-	private void getNodeString(StringBuffer str) {
-		str.append("(type="); //$NON-NLS-1$
-		str.append(CommandTreeNode.getNodeTypeString(this.commandType));
-		str.append(", command="); //$NON-NLS-1$
-		str.append(this.command);
-		if(this.properties != null) {
-			str.append(", props="); //$NON-NLS-1$
-			str.append(this.properties);
-		}
-		str.append(")");  //$NON-NLS-1$
-	}	
-
-	private void getCanonicalPlanString(StringBuffer str) {
-		if(this.canonicalPlan != null) {
-			str.append("canonical plan:\n"); //$NON-NLS-1$
-			str.append(this.canonicalPlan);
-			str.append("\n");  //$NON-NLS-1$
-		}		
-	}
-	
-	/** 
-	 * Convert a type code into a type string. 
-	 * @param type Type code, as defined in class constants
-	 * @return String representation for code
-	 */
-	private static final String getNodeTypeString(int type) {
-		switch(type) {
-			case TYPE_PROCEDURAL_COMMAND:		return "Procedural"; //$NON-NLS-1$
-			case TYPE_RELATIONAL_COMMAND:		return "Relational"; //$NON-NLS-1$
-			case TYPE_XML_COMMAND:				return "XML"; //$NON-NLS-1$
-            case TYPE_XQUERY_COMMAND:           return "XQuery"; //$NON-NLS-1$
-            case TYPE_BATCHED_UPDATE_COMMAND:   return "BatchedUpdate"; //$NON-NLS-1$
-			default:							return "Unknown: " + type; //$NON-NLS-1$
-		}
-	}	
-
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/CommandTreeProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.optimizer;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-
-/**
- * An object that performs some processing on a tree of 
- * {@link CommandTreeNode CommandTreeNodes} during command
- * planning.
- */
-public interface CommandTreeProcessor {
-	
-	/**
-	 * Do any necessary processing on the given tree of
-	 * command tree nodes; return the root of the modified
-	 * tree.
-	 * @param root root of the tree of nodes
-	 * @return root of the modified tree, or just the root
-	 * param if no modification occurred.
-	 * @param metadata source of metadata 
-	 */
-	CommandTreeNode process(CommandTreeNode root, QueryMetadataInterface metadata)
-	throws QueryMetadataException, MetaMatrixComponentException; 
-
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/OptimizerContext.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/OptimizerContext.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/OptimizerContext.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.optimizer;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.metamatrix.query.util.CommandContext;
-
-public class OptimizerContext {
-
-    private static ThreadLocal<OptimizerContext> CONTEXT = new ThreadLocal<OptimizerContext>() {
-        protected OptimizerContext initialValue() {
-            return new OptimizerContext();
-        }
-    };
-    
-    private Set<String> groups = new HashSet<String>();
-    private CommandContext commandContext;
-    
-    public static OptimizerContext getOptimizerContext() {
-        return CONTEXT.get();
-    }
-    
-    void reset(CommandContext context) {
-        this.commandContext = context;
-        this.groups.clear();
-    }
-
-    public Set<String> getGroups() {
-        return this.groups;
-    }
-
-    public CommandContext getCommandContext() {
-        return this.commandContext;
-    }
-
-    public void setCommandContext(CommandContext commandContext) {
-        this.commandContext = commandContext;
-    }
-    
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,13 +22,13 @@
 
 package com.metamatrix.query.optimizer;
 
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.api.exception.query.QueryPlannerException;
+import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.id.IDGenerator;
 import com.metamatrix.core.id.IntegerIDFactory;
 import com.metamatrix.query.analysis.AnalysisRecord;
@@ -38,15 +38,13 @@
 import com.metamatrix.query.optimizer.batch.BatchedUpdatePlanner;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.proc.ProcedurePlanner;
-import com.metamatrix.query.optimizer.relational.MergeTreeNodeProcessor;
-import com.metamatrix.query.optimizer.relational.PlanHints;
 import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.xml.XMLPlanner;
 import com.metamatrix.query.optimizer.xquery.XQueryPlanner;
 import com.metamatrix.query.processor.ProcessorPlan;
+import com.metamatrix.query.resolver.QueryResolver;
 import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
+import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.util.CommandContext;
 
 /**
@@ -59,247 +57,70 @@
  * tree.</p>
  */
 public class QueryOptimizer {
-
-	private static final CommandPlanner RELATIONAL_PLANNER = new RelationalPlanner();
+	
 	private static final CommandPlanner XML_PLANNER = new XMLPlanner();
 	private static final CommandPlanner PROCEDURE_PLANNER = new ProcedurePlanner();
     private static final CommandPlanner XQUERY_PLANNER = new XQueryPlanner();
     private static final CommandPlanner BATCHED_UPDATE_PLANNER = new BatchedUpdatePlanner();
-	private static final CommandTreeProcessor MERGE_TREE_NODE_PROCESSOR = new MergeTreeNodeProcessor();
 
 	// Can't construct	
 	private QueryOptimizer() {}
 
-	/**
-	 * <p>This method is intended only for clients with a need to have access to the 
-	 * planning state of QueryOptimizer, which it can get to through the 
-	 * {@link CommandTreeNode CommandTreeNode} reference passed in.</p>
-	 * 
-	 * <p>If there's no need to access the planning state, use one of the other
-	 * overloaded methods, either
-	 * {@link #optimizePlan(Command, boolean, QueryMetadataInterface) optimizePlan}
-	 * or
-	 * {@link #optimizePlan(Command, boolean, QueryMetadataInterface, boolean) optimizePlan}
-	 * </p>
-	 * 
-	 * @param command fully-resolved user's command object
-	 * @param metadata source of metadata
-	 * @param idGenerator IDGenerator to be used for data nodes - if null, one will be created
-	 * @param context 
-	 * @param annotations Collection to add annotations to, null if annotations should be co  
-	 * @param debug True if OPTION DEBUG output should be sent to analysisRecord 
-	 * @return ProcessorPlan plan for query execution.
-	 * @throws QueryPlannerException if there is a problem planning the query plan
-	 * @throws QueryMetadataException if there is a problem accessing the metadata source
-	 * @throws MetaMatrixComponentException if there is an unexpected exception
-	 */
-	public static ProcessorPlan optimizePlan(Command command, QueryMetadataInterface metadata, IDGenerator idGenerator, CapabilitiesFinder capabilitiesFinder, AnalysisRecord analysisRecord, CommandContext context)
+	public static ProcessorPlan optimizePlan(Command command, QueryMetadataInterface metadata, IDGenerator idGenerator, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
 		throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
+		if (analysisRecord == null) {
+			analysisRecord = new AnalysisRecord(false, false, false);
+		}
+		
+		if (context == null) {
+			context = new CommandContext();
+		}
+		
         boolean debug = analysisRecord.recordDebug();
-		if(debug) {
-			analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
-            analysisRecord.println("USER COMMAND:\n" + command);		 //$NON-NLS-1$
-            analysisRecord.println("\nINITIAL COMMAND STRUCTURE:\n" + command.printCommandTree());             //$NON-NLS-1$
-        }
-
-		// Generate canonical plans for each command
-        CommandTreeNode root = new CommandTreeNode();
-		recursiveGenerateCanonical(root, command, metadata, analysisRecord, context);
+        
+        Map tempMetadata = command.getTemporaryMetadata();
+        metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
                 
-		// Run preprocessors
-        root = MERGE_TREE_NODE_PROCESSOR.process(root, metadata);
-		if(debug) {
-            analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
-			analysisRecord.println("COMMAND TREE after merging relational nodes: \n" + root); //$NON-NLS-1$
-		}   
-
         // Create an ID generator that can be used for all plans to generate unique data node IDs
         if(idGenerator == null) {
             idGenerator = new IDGenerator();
             idGenerator.setDefaultFactory(new IntegerIDFactory());
         }
         
-        OptimizerContext.getOptimizerContext().reset(context);
-        
-		// Optimize command tree recursively, bottom-up
-		ProcessorPlan plan = recursiveOptimize(root, idGenerator, metadata, capabilitiesFinder, analysisRecord, context);
-		
-        OptimizerContext.getOptimizerContext().reset(context);
-
 		if(debug) {
-            analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
-            analysisRecord.println("OPTIMIZATION COMPLETE:"); //$NON-NLS-1$
-            analysisRecord.println("PLAN TREE:\n" + root); //$NON-NLS-1$
-            analysisRecord.println("PROCESSOR PLAN:\n" + plan); //$NON-NLS-1$
-			analysisRecord.println("============================================================================");		 //$NON-NLS-1$
-		}			
-
-		return plan;
-	}
-	
-	/**
-	 * Method recursiveGenerateCanonical.
-	 * @param CommandTreeNode
-	 * @param command
-	 * @param minimizeToSource
-	 * @param metadata
-	 * @param planNodeIDOffset
-	 * @param boundReferencesMap
-	 * @param debug
-	 */
-	private static void recursiveGenerateCanonical(
-		CommandTreeNode node,
-		Command command,
-		QueryMetadataInterface metadata,
-		AnalysisRecord analysisRecord,
-        CommandContext context) 
-	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-		
-        boolean debug = analysisRecord.recordDebug();
-		if(debug) {
-            analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
-            analysisRecord.println("GENERATE CANONICAL: \n" + command); //$NON-NLS-1$
-		}   
-		makeCanonical(node, command, metadata, analysisRecord, context);
-
-		if(debug) {
-            analysisRecord.println("\nCANONICAL PLAN: \n" + node.getCanonicalPlan()); //$NON-NLS-1$
-		}   
-				
-		for (Command subcommand : command.getSubCommands()) {
-			CommandTreeNode child = new CommandTreeNode();
-			node.addLastChild(child);
-            child.setParent(node);
-			recursiveGenerateCanonical(child, subcommand, metadata, analysisRecord, context);
-		}
-	}
-
-	/**
-	 * Method recursiveOptimize.
-	 * @param node
-	 * @param minimizeToSource
-	 * @param metadata
-	 * @param boundReferencesMap
-	 * @param debug
-	 */
-	private static ProcessorPlan recursiveOptimize(
-		CommandTreeNode node,
-        IDGenerator idGenerator,
-		QueryMetadataInterface metadata,
-        CapabilitiesFinder capFinder,
-		AnalysisRecord analysisRecord,
-        CommandContext context) 
-	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-		for (CommandTreeNode child : node.getChildren()) {
-			recursiveOptimize(child, idGenerator, metadata, capFinder, analysisRecord, context);
-		}
-        
-        // Create metadata adapter if necessary
-        QueryMetadataInterface optMetadata = metadata;
-        Map commandMetadata = node.getCommand().getTemporaryMetadata();
-        if(commandMetadata != null && commandMetadata.size() > 0) {
-            optMetadata = new TempMetadataAdapter(metadata, new TempMetadataStore(commandMetadata));
-        }
-
-        boolean debug = analysisRecord.recordDebug();
-		if(debug) {
 			analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
-            analysisRecord.println("OPTIMIZE: \n" + node.getCommand()); //$NON-NLS-1$
+            analysisRecord.println("OPTIMIZE: \n" + command); //$NON-NLS-1$
 		}   
                                    
-		//optimize step
-		ProcessorPlan plan = optimize(node, idGenerator, optMetadata, capFinder, analysisRecord, context);
-		node.setProcessorPlan(plan);
-
-		return plan;
-	}
-	
-	/**
-	 * Method optimize.
-	 * @param node
-	 * @param minimizeToSource
-	 * @param metadata
-	 * @param boundReferencesMap
-	 * @return ProcessorPlan
-	 */
-	private static ProcessorPlan optimize(
-		CommandTreeNode node,
-        IDGenerator idGenerator,
-		QueryMetadataInterface metadata,
-        CapabilitiesFinder capFinder,
-		AnalysisRecord analysisRecord,
-        CommandContext context) 
-	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
 		ProcessorPlan result = null;
 
-		if (node.getCommandType() == CommandTreeNode.TYPE_RELATIONAL_COMMAND){
-			result = RELATIONAL_PLANNER.optimize(node, idGenerator, metadata, capFinder, analysisRecord, context);
-		} else if (node.getCommandType() == CommandTreeNode.TYPE_XML_COMMAND){
-			result = XML_PLANNER.optimize(node, idGenerator, metadata, capFinder, analysisRecord, context);
-		} else if (node.getCommandType() == CommandTreeNode.TYPE_PROCEDURAL_COMMAND){
-			result = PROCEDURE_PLANNER.optimize(node, idGenerator, metadata, capFinder, analysisRecord, context);
-        } else if (node.getCommandType() == CommandTreeNode.TYPE_XQUERY_COMMAND){
-            result = XQUERY_PLANNER.optimize(node, idGenerator, metadata, capFinder, analysisRecord, context);
-        } else if (node.getCommandType() == CommandTreeNode.TYPE_BATCHED_UPDATE_COMMAND){
-            result = BATCHED_UPDATE_PLANNER.optimize(node, idGenerator, metadata, capFinder, analysisRecord, context);
+		if (command.getType() == Command.TYPE_UPDATE_PROCEDURE){
+			result = PROCEDURE_PLANNER.optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
+        } else if (command.getType() == Command.TYPE_XQUERY){
+            result = XQUERY_PLANNER.optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
+        } else if (command.getType() == Command.TYPE_BATCHED_UPDATE){
+            result = BATCHED_UPDATE_PLANNER.optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
+        } else {
+			try {
+				if (command.getType() == Command.TYPE_QUERY && command instanceof Query && QueryResolver.isXMLQuery((Query)command, metadata)) {
+					result = XML_PLANNER.optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
+				} else {
+					result = new RelationalPlanner().optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
+				}
+			} catch (QueryResolverException e) {
+				throw new MetaMatrixRuntimeException(e);
+			}
         }
+		
+		if(debug) {
+            analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
+            analysisRecord.println("OPTIMIZATION COMPLETE:"); //$NON-NLS-1$
+            analysisRecord.println("PROCESSOR PLAN:\n" + result); //$NON-NLS-1$
+			analysisRecord.println("============================================================================");		 //$NON-NLS-1$
+		}			
+
 		return result;
 	}
 	
-	private static void makeCanonical(CommandTreeNode node, Command command, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
-	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
-        node.setCommand(command);
-
-        // Use command metadata while checking type                
-        QueryMetadataInterface optMetadata = metadata;
-        Map tempMetadata = command.getTemporaryMetadata();
-        if(tempMetadata != null && !tempMetadata.isEmpty()) {
-            optMetadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
-        }
-        
-        // Easy to detect batched update planner, procedural planner, or XQueryPlanner
-        int commandType = command.getType();
-        if (commandType == Command.TYPE_BATCHED_UPDATE) {
-            node.setCommandType(CommandTreeNode.TYPE_BATCHED_UPDATE_COMMAND);
-            BATCHED_UPDATE_PLANNER.generateCanonical(node, optMetadata, analysisRecord, context);
-            return;
-        } else if (commandType == Command.TYPE_UPDATE_PROCEDURE){
-            //it's a procedure command
-            node.setCommandType(CommandTreeNode.TYPE_PROCEDURAL_COMMAND);
-            PROCEDURE_PLANNER.generateCanonical(node, optMetadata, analysisRecord, context);   
-			return;
-        } else if (commandType == Command.TYPE_XQUERY){
-            node.setCommandType(CommandTreeNode.TYPE_XQUERY_COMMAND);
-            XQUERY_PLANNER.generateCanonical(node, optMetadata, analysisRecord, context);   
-            return;
-        } else if (commandType == Command.TYPE_DYNAMIC){
-            node.setCommandType(CommandTreeNode.TYPE_DYNAMIC_COMMAND);
-            return;
-        }
-        
-        // Set type
-        node.setCommandType(CommandTreeNode.TYPE_RELATIONAL_COMMAND);
-        if(commandType == Command.TYPE_QUERY) {
-            Collection groups = GroupCollectorVisitor.getGroups(command, true);
-            if(groups.size() == 1) {
-                GroupSymbol group = (GroupSymbol) groups.iterator().next();
-                                     
-                if(optMetadata.isXMLGroup(group.getMetadataID())) {
-                    node.setCommandType(CommandTreeNode.TYPE_XML_COMMAND);    
-                }                    
-            }
-        }
-        
-        if(node.getCommandType() == CommandTreeNode.TYPE_RELATIONAL_COMMAND) {    
-            PlanHints hints = new PlanHints();
-            node.setProperty(RelationalPlanner.HINTS, hints);
-            RELATIONAL_PLANNER.generateCanonical(node, optMetadata, analysisRecord, context);
-        } else {
-            XML_PLANNER.generateCanonical(node, optMetadata, analysisRecord, context);            
-        }
-        
-	}
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/batch/BatchedUpdatePlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/batch/BatchedUpdatePlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/batch/BatchedUpdatePlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,11 +35,10 @@
 import com.metamatrix.query.execution.QueryExecPlugin;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.CommandPlanner;
-import com.metamatrix.query.optimizer.CommandTreeNode;
+import com.metamatrix.query.optimizer.QueryOptimizer;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
-import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.rules.CapabilitiesUtil;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.batch.BatchedUpdatePlan;
@@ -50,7 +49,6 @@
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Delete;
 import com.metamatrix.query.sql.lang.Insert;
-import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.Update;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.util.VariableContext;
@@ -65,17 +63,6 @@
 public class BatchedUpdatePlanner implements CommandPlanner {
 
     /** 
-     * @see com.metamatrix.query.optimizer.CommandPlanner#generateCanonical(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
-     * @since 4.2
-     */
-    public void generateCanonical(CommandTreeNode rootNode,
-                                  QueryMetadataInterface metadata,
-                                  AnalysisRecord analysisRecord, CommandContext context)
-    throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-        // do nothing. the planner framework takes care of generating the canonical plan for each of the child commands
-    }
-
-    /** 
      * Optimizes batched updates by batching all contiguous commands that relate to the same physical model.
      * For example, for the following batch of commands:
      * <br/>
@@ -95,21 +82,24 @@
      * </ol>
      * <br/> this implementation will batch as follows: (1,2), (5, 6, 7), (8 thru 12).
      * The remaining commands/plans will be executed individually.
-     * @see com.metamatrix.query.optimizer.CommandPlanner#optimize(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
+     * @see com.metamatrix.query.optimizer.CommandPlanner#optimize(Command, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
      * @since 4.2
      */
-    public ProcessorPlan optimize(CommandTreeNode node,
+    public ProcessorPlan optimize(Command command,
                                   IDGenerator idGenerator,
                                   QueryMetadataInterface metadata,
                                   CapabilitiesFinder capFinder,
                                   AnalysisRecord analysisRecord, CommandContext context)
     throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-        List children = node.getChildren();
-        List childPlans = new ArrayList(children.size());
-        BatchedUpdateCommand batchedUpdateCommand = (BatchedUpdateCommand)node.getCommand();
+        BatchedUpdateCommand batchedUpdateCommand = (BatchedUpdateCommand)command;
+        List childPlans = new ArrayList(batchedUpdateCommand.getUpdateCommands().size());
         List updateCommands = batchedUpdateCommand.getUpdateCommands();
         int numCommands = updateCommands.size();
-        List<VariableContext> allContexts = (List<VariableContext>)node.getProperty(RelationalPlanner.VARIABLE_CONTEXTS);
+        List<VariableContext> allContexts = batchedUpdateCommand.getVariableContexts();
+        List<VariableContext> planContexts = null;
+        if (allContexts != null) {
+        	planContexts = new ArrayList<VariableContext>(allContexts.size());
+        }
         for (int commandIndex = 0; commandIndex < numCommands; commandIndex++) {
             // Potentially the first command of a batch
             Command updateCommand = (Command)updateCommands.get(commandIndex);
@@ -167,6 +157,9 @@
                         projectNode.addChild(batchNode);
                         // Add a new RelationalPlan that represents the plan for this batch.
                         childPlans.add(new RelationalPlan(projectNode));
+                        if (planContexts != null) {
+                        	planContexts.add(new VariableContext());
+                    	}
                         // Skip those commands that were added to this batch
                         commandIndex += batch.size() - 1;
                         commandWasBatched = true;
@@ -174,10 +167,18 @@
                 }
             }
             if (!commandWasBatched) { // If the command wasn't batched, just add the plan for this command to the list of plans
-                childPlans.add(((CommandTreeNode)children.get(commandIndex)).getProcessorPlan()); // Assumes the command index is the same as the plan node index
+            	Command cmd = (Command)batchedUpdateCommand.getUpdateCommands().get(commandIndex);
+            	ProcessorPlan plan = cmd.getProcessorPlan();
+            	if (plan == null) {
+            		plan = QueryOptimizer.optimizePlan(cmd, metadata, idGenerator, capFinder, analysisRecord, context);
+            	}
+                childPlans.add(plan);
+                if (allContexts != null) {
+                	planContexts.add(allContexts.get(commandIndex));
+                }
             }
         }
-        return new BatchedUpdatePlan(childPlans, children.size());
+        return new BatchedUpdatePlan(childPlans, batchedUpdateCommand.getUpdateCommands().size(), planContexts);
     }
     
     /**
@@ -194,8 +195,6 @@
             return ((Update)command).getGroup();
         } else if (type == Command.TYPE_DELETE) {
             return ((Delete)command).getGroup();
-        } else if (type == Command.TYPE_QUERY) { 
-            return ((Query)command).getInto().getGroup();
         }
         throw new MetaMatrixRuntimeException(QueryExecPlugin.Util.getString("BatchedUpdatePlanner.unrecognized_command", command)); //$NON-NLS-1$
     }
@@ -210,10 +209,6 @@
      * @since 4.2
      */
     public static boolean isEligibleForBatching(Command command, QueryMetadataInterface metadata) throws QueryMetadataException, MetaMatrixComponentException {
-        // If it's a SELECT INTO, it shouldn't be part of a connector batch.
-        if (command.getType() == Command.TYPE_QUERY) {
-            return false;
-        }
         // If the command updates a physical group, it's eligible
         return !metadata.isVirtualGroup(getUpdatedGroup(command).getMetadataID());
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,27 +23,27 @@
 package com.metamatrix.query.optimizer.proc;
 
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.api.exception.query.QueryPlannerException;
 import com.metamatrix.core.id.IDGenerator;
+import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.execution.QueryExecPlugin;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.CommandPlanner;
-import com.metamatrix.query.optimizer.CommandTreeNode;
+import com.metamatrix.query.optimizer.QueryOptimizer;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.proc.AbstractAssignmentInstruction;
 import com.metamatrix.query.processor.proc.AssignmentInstruction;
 import com.metamatrix.query.processor.proc.BreakInstruction;
 import com.metamatrix.query.processor.proc.ContinueInstruction;
+import com.metamatrix.query.processor.proc.CreateCursorResultSetInstruction;
 import com.metamatrix.query.processor.proc.ErrorInstruction;
 import com.metamatrix.query.processor.proc.ExecDynamicSqlInstruction;
-import com.metamatrix.query.processor.proc.ExecSqlInstruction;
 import com.metamatrix.query.processor.proc.IfInstruction;
 import com.metamatrix.query.processor.proc.LoopInstruction;
 import com.metamatrix.query.processor.proc.ProcedurePlan;
@@ -52,9 +52,7 @@
 import com.metamatrix.query.processor.program.ProgramInstruction;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.DynamicCommand;
-import com.metamatrix.query.sql.lang.Into;
 import com.metamatrix.query.sql.lang.ProcedureContainer;
-import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.TranslatableProcedureContainer;
 import com.metamatrix.query.sql.proc.AssignmentStatement;
 import com.metamatrix.query.sql.proc.Block;
@@ -65,7 +63,7 @@
 import com.metamatrix.query.sql.proc.Statement;
 import com.metamatrix.query.sql.proc.WhileStatement;
 import com.metamatrix.query.sql.symbol.Expression;
-import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.visitor.CommandCollectorVisitor;
 import com.metamatrix.query.util.CommandContext;
 
 /**
@@ -76,25 +74,9 @@
 public final class ProcedurePlanner implements CommandPlanner {
 	
 	/**
-	 * <p>This method does nothing as the method call to {@link #optimize} directly produces
-	 * the ProcessorPlan for the given procedure.</p>
-	 *
-	 * @param rootNode tree of CommandTreeNode object(s) rooted at rootNode
-	 * @param debug whether or not to generate verbose debug output during planning
-	 * @throws QueryPlannerException indicating a problem in planning
-     * @throws MetaMatrixComponentException indicating an unexpected exception
-	 */
-	public void generateCanonical(CommandTreeNode rootNode, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
-	throws QueryPlannerException, MetaMatrixComponentException {
-		// does nothing
-	}
-
-	/**
 	 * <p>Produce a ProcessorPlan for the CreateUpdateProcedureCommand on the current node
 	 * of the CommandTreeNode, the procedure plan construction involves using the child
 	 * processor plans.</p>
-	 * @param node root of a tree (or subtree) of CommandTreeNode objects, each of
-	 * which should have its canonical plan
 	 * @param metadata source of metadata
 	 * @param debug whether or not to generate verbose debug output during planning
 	 * @return ProcessorPlan This processorPlan is a <code>ProcedurePlan</code>
@@ -102,29 +84,30 @@
      * @throws QueryMetadataException indicating an exception in accessing the metadata
      * @throws MetaMatrixComponentException indicating an unexpected exception
 	 */
-	public ProcessorPlan optimize(CommandTreeNode node, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
+	public ProcessorPlan optimize(Command procCommand, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
 	throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
-		// get the current command on the current node of the tree
-		Command procCommand = node.getCommand();
-        
-		// set state of the planner with child nodes
-		// to be used while planning
-		List<CommandTreeNode> childNodes = node.getChildren();
-
         boolean debug = analysisRecord.recordDebug();
         if(debug) {
             analysisRecord.println("\n####################################################"); //$NON-NLS-1$
-            analysisRecord.println("PROCEDURE COMMAND: " + node.getCommand()); //$NON-NLS-1$
+            analysisRecord.println("PROCEDURE COMMAND: " + procCommand); //$NON-NLS-1$
         }
 
-        if(!(procCommand instanceof CreateUpdateProcedureCommand)) {
-        	throw new QueryPlannerException(QueryExecPlugin.Util.getString("ProcedurePlanner.wrong_type", procCommand.getType())); //$NON-NLS-1$
+        Assertion.isInstanceOf(procCommand, CreateUpdateProcedureCommand.class, "Wrong command type"); //$NON-NLS-1$
+
+        if(debug) {
+            analysisRecord.println("OPTIMIZING SUB-COMMANDS: "); //$NON-NLS-1$
         }
+        
+        for (Command command : CommandCollectorVisitor.getCommands(procCommand)) {
+        	if (!(command instanceof DynamicCommand)) {
+        		command.setProcessorPlan(QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context));
+        	}
+        }
 
         Block block = ((CreateUpdateProcedureCommand) procCommand).getBlock();
 
-		Program programBlock = planBlock(((CreateUpdateProcedureCommand)procCommand), block, metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+		Program programBlock = planBlock(((CreateUpdateProcedureCommand)procCommand), block, metadata, debug, idGenerator, capFinder, analysisRecord, context);
 
         if(debug) {
             analysisRecord.println("\n####################################################"); //$NON-NLS-1$
@@ -170,7 +153,7 @@
 	 * @throws QueryMetadataException if there is an error accessing metadata
 	 * @throws MetaMatrixComponentException if unexpected error occurs
 	 */
-    private Program planBlock(CreateUpdateProcedureCommand parentProcCommand, Block block, QueryMetadataInterface metadata, List<CommandTreeNode> childNodes, boolean debug, IDGenerator idGenerator, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord)
+    private Program planBlock(CreateUpdateProcedureCommand parentProcCommand, Block block, QueryMetadataInterface metadata, boolean debug, IDGenerator idGenerator, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
         throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
         Iterator stmtIter = block.getStatements().iterator();
@@ -183,7 +166,7 @@
 		// plan each statement in the block
         while(stmtIter.hasNext()) {
 			Statement statement = (Statement) stmtIter.next();
-			Object instruction = planStatement(parentProcCommand, statement, metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+			Object instruction = planStatement(parentProcCommand, statement, metadata, debug, idGenerator, capFinder, analysisRecord, context);
 			//childIndex = ((Integer) array[0]).intValue();
             if(instruction instanceof ProgramInstruction){
                 programBlock.addInstruction((ProgramInstruction)instruction);
@@ -215,7 +198,7 @@
 	 * @throws QueryMetadataException if there is an error accessing metadata
 	 * @throws MetaMatrixComponentException if unexpected error occurs
 	 */
-    private Object planStatement(CreateUpdateProcedureCommand parentProcCommand, Statement statement, QueryMetadataInterface metadata, List<CommandTreeNode> childNodes, boolean debug, IDGenerator idGenerator, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord)
+    private Object planStatement(CreateUpdateProcedureCommand parentProcCommand, Statement statement, QueryMetadataInterface metadata, boolean debug, IDGenerator idGenerator, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
         throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
 		int stmtType = statement.getType();
@@ -260,19 +243,12 @@
             {
 				CommandStatement cmdStmt = (CommandStatement) statement;
                 Command command = cmdStmt.getCommand();
-                GroupSymbol intoGroup = null;
-                if(command instanceof Query){
-                    Into into = ((Query)command).getInto();
-                    if(into != null){
-                        intoGroup = into.getGroup();
-                    }
-                }
 				ProcessorPlan commandPlan = cmdStmt.getCommand().getProcessorPlan();                
                 
 				if (command.getType() == Command.TYPE_DYNAMIC){
 					instruction = new ExecDynamicSqlInstruction(parentProcCommand,((DynamicCommand)command), metadata, idGenerator, capFinder );
 				}else{
-					instruction = new ExecSqlInstruction(commandPlan, intoGroup);
+					instruction = new CreateCursorResultSetInstruction(CreateCursorResultSetInstruction.RS_NAME, commandPlan);
 				}
                 
 				if(debug) {
@@ -284,10 +260,10 @@
 			case Statement.TYPE_IF:
             {
 				IfStatement ifStmt = (IfStatement)statement;
-				Program ifProgram = planBlock(parentProcCommand, ifStmt.getIfBlock(), metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+				Program ifProgram = planBlock(parentProcCommand, ifStmt.getIfBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
 				Program elseProgram = null;
 				if(ifStmt.hasElseBlock()) {
-					elseProgram = planBlock(parentProcCommand, ifStmt.getElseBlock(), metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+					elseProgram = planBlock(parentProcCommand, ifStmt.getElseBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
 				}
 				instruction = new IfInstruction(ifStmt.getCondition(), ifProgram, elseProgram);
 				if(debug) {
@@ -318,16 +294,17 @@
                 	analysisRecord.println("\tLOOP STATEMENT:\n" + statement); //$NON-NLS-1$
                 }
                 String rsName = loopStmt.getCursorName();
+
                 ProcessorPlan commandPlan = loopStmt.getCommand().getProcessorPlan();
 
-                Program loopProgram = planBlock(parentProcCommand, loopStmt.getBlock(), metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+                Program loopProgram = planBlock(parentProcCommand, loopStmt.getBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
                 instruction = new LoopInstruction(loopProgram, rsName, commandPlan);
                 break;
             }
             case Statement.TYPE_WHILE:
             {
                 WhileStatement whileStmt = (WhileStatement)statement;
-                Program whileProgram = planBlock(parentProcCommand, whileStmt.getBlock(), metadata, childNodes, debug, idGenerator, capFinder, analysisRecord);
+                Program whileProgram = planBlock(parentProcCommand, whileStmt.getBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
                 if(debug) {
                 	analysisRecord.println("\tWHILE STATEMENT:\n" + statement); //$NON-NLS-1$
                 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,502 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.optimizer.relational;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.api.exception.query.QueryPlannerException;
-import com.metamatrix.query.execution.QueryExecPlugin;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
-import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
-import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
-import com.metamatrix.query.optimizer.relational.plantree.NodeConstants.Info;
-import com.metamatrix.query.processor.relational.JoinNode.JoinStrategyType;
-import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.Criteria;
-import com.metamatrix.query.sql.lang.From;
-import com.metamatrix.query.sql.lang.FromClause;
-import com.metamatrix.query.sql.lang.GroupBy;
-import com.metamatrix.query.sql.lang.Insert;
-import com.metamatrix.query.sql.lang.JoinPredicate;
-import com.metamatrix.query.sql.lang.JoinType;
-import com.metamatrix.query.sql.lang.Limit;
-import com.metamatrix.query.sql.lang.Option;
-import com.metamatrix.query.sql.lang.OrderBy;
-import com.metamatrix.query.sql.lang.ProcedureContainer;
-import com.metamatrix.query.sql.lang.Query;
-import com.metamatrix.query.sql.lang.QueryCommand;
-import com.metamatrix.query.sql.lang.Select;
-import com.metamatrix.query.sql.lang.SetQuery;
-import com.metamatrix.query.sql.lang.StoredProcedure;
-import com.metamatrix.query.sql.lang.SubqueryFromClause;
-import com.metamatrix.query.sql.lang.UnaryFromClause;
-import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.symbol.SingleElementSymbol;
-import com.metamatrix.query.sql.visitor.AggregateSymbolCollectorVisitor;
-import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
-import com.metamatrix.query.sql.visitor.GroupsUsedByElementsVisitor;
-import com.metamatrix.query.util.ErrorMessageKeys;
-
-public final class GenerateCanonical {
-
-	/**
-	 * Generate an initial plan given a command.  This plan will contain all necessary
-	 * information from the command but will not be optimized or even executable.
-	 * @param command Command to plan
-	 * @param metadata Metadata access
-	 * @param debug True if debugging information should be dumped to STDOUT
-	 * @return Initial query plan tree
-	 */
-	public static PlanNode generatePlan(Command command, PlanHints hints, QueryMetadataInterface metadata)
-	    throws QueryPlannerException, MetaMatrixComponentException {
-		if( command.getType() == Command.TYPE_QUERY ) {
-
-			return GenerateCanonical.createQueryPlan(command, hints, metadata);
-
-		} else if( command.getType() == Command.TYPE_INSERT ||
-					command.getType() == Command.TYPE_UPDATE ||
-					command.getType() == Command.TYPE_DELETE ||
-                    command.getType() == Command.TYPE_CREATE ||
-                    command.getType() == Command.TYPE_DROP            
-        ) {
-
-			// update PlanHints to note that it is an update
-			hints.isUpdate = true;
-
-			return GenerateCanonical.createUpdatePlan(command, hints, metadata);
-
-		} else if( command.getType() == Command.TYPE_STORED_PROCEDURE) {
-
-			return GenerateCanonical.createStoredProcedurePlan(command, hints);
-
-		} else {
-            throw new QueryPlannerException(QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0005, command.getClass().getName()));
-		}
-	}
-
-	private GenerateCanonical() { }
-
-	static PlanNode createUpdatePlan(Command command, PlanHints hints, QueryMetadataInterface metadata) throws QueryPlannerException, MetaMatrixComponentException {
-
-        // Create top project node - define output columns for stored query / procedure
-        PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
-
-        Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, false);
-        projectNode.addGroups(groups);
-
-        // Set output columns
-        List<SingleElementSymbol> cols = command.getProjectedSymbols();
-        projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
-
-        // Define source of data for stored query / procedure
-        PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
-        sourceNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
-        sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, command);
-        if (command instanceof ProcedureContainer) {
-        	ProcedureContainer container = (ProcedureContainer)command;
-	        if (container.getSubCommand() != null) {
-	            sourceNode.setProperty(NodeConstants.Info.NESTED_COMMAND, container.getSubCommand());
-	        }
-        }
-        sourceNode.addGroups(groups);
-
-        GenerateCanonical.attachLast(projectNode, sourceNode);
-
-        //for INTO query, attach source and project nodes
-        if(command instanceof Insert){
-        	Insert insert = (Insert)command;
-        	if (insert.getQueryExpression() != null) {
-	            PlanNode plan = createQueryPlan(insert.getQueryExpression(), hints, metadata);
-	            GenerateCanonical.attachLast(sourceNode, plan);
-	            MergeTreeNodeProcessor.mergeTempMetadata(insert.getQueryExpression(), insert);
-	            projectNode.setProperty(NodeConstants.Info.INTO_GROUP, insert.getGroup());
-        	}
-        }
-        
-        return projectNode;
-	}
-
-    static PlanNode createStoredProcedurePlan(Command command, PlanHints hints) {
-
-        StoredProcedure storedProc = (StoredProcedure) command;
-
-        // Create top project node - define output columns for stored query / procedure
-        PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
-
-        // Set output columns
-        List cols = storedProc.getProjectedSymbols();
-        projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
-
-        // Define source of data for stored query / procedure
-        PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
-        sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, storedProc);
-        if (storedProc.getSubCommand() != null) {
-            sourceNode.setProperty(NodeConstants.Info.NESTED_COMMAND, storedProc.getSubCommand());
-        }
-        
-        hints.hasRelationalProc |= storedProc.isProcedureRelational();
-
-        // Set group on source node
-        sourceNode.addGroup(storedProc.getGroup());
-
-        GenerateCanonical.attachLast(projectNode, sourceNode);
-
-        return projectNode;
-    }
-
-	static PlanNode createQueryPlan(Command command, PlanHints hints, QueryMetadataInterface metadata)
-		throws QueryPlannerException, MetaMatrixComponentException {
-
-        // Add make dependent hints from OPTION clause
-        QueryCommand qcommand = (QueryCommand) command;
-        Option option = qcommand.getOption();
-        if(option != null) {
-            hints.addMakeDepGroups(option.getDependentGroups());
-            hints.addMakeNotDepGroups(option.getNotDependentGroups());
-        }
-
-        // Build canonical plan
-    	PlanNode node = null;
-        if(command instanceof Query) {
-            node = createQueryPlan((Query) command, hints, metadata);
-        } else {
-            node = createQueryPlan((SetQuery) command, hints, metadata);
-        }
-
-        return node;
-    }
-
-    private static PlanNode createQueryPlan(SetQuery query, PlanHints hints, QueryMetadataInterface metadata)
-		throws QueryPlannerException, MetaMatrixComponentException {
-
-        hints.hasSetQuery = true;
-        
-        PlanNode leftPlan = createQueryPlan( query.getLeftQuery(), hints, metadata);
-        PlanNode rightPlan = createQueryPlan( query.getRightQuery(), hints, metadata);
-
-        PlanNode plan = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
-        plan.setProperty(NodeConstants.Info.SET_OPERATION, query.getOperation());
-        plan.setProperty(NodeConstants.Info.USE_ALL, query.isAll());
-        
-        GenerateCanonical.attachLast(plan, leftPlan);
-        GenerateCanonical.attachLast(plan, rightPlan);
-
-		// Attach sorting on top of union
-		if(query.getOrderBy() != null) {
-			plan = attachSorting(plan, query.getOrderBy());
-            hints.hasSort = true;
-		}
-
-        if (query.getLimit() != null) {
-            plan = attachTupleLimit(plan, query.getLimit(), hints);
-        }
-        
-        return plan;
-    }
-
-    private static PlanNode createQueryPlan(Query query, PlanHints hints, QueryMetadataInterface metadata)
-		throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
-        PlanNode plan = null;
-
-        if(query.getFrom() != null){
-            FromClause fromClause = mergeClauseTrees(query.getFrom());
-            
-            PlanNode dummyRoot = new PlanNode();
-            
-    		hints.hasOptionalJoin |= buildTree(fromClause, dummyRoot, metadata, hints);
-            
-            plan = dummyRoot.getFirstChild();
-            
-            hints.hasJoin |= plan.getType() == NodeConstants.Types.JOIN;
-
-    		// Attach criteria on top
-    		if(query.getCriteria() != null) {
-    			plan = attachCriteria(plan, query.getCriteria(), false);
-                hints.hasCriteria = true;
-    		}
-
-    		// Attach grouping node on top
-    		if(query.getGroupBy() != null || query.getHaving() != null || !AggregateSymbolCollectorVisitor.getAggregates(query.getSelect(), false).isEmpty()) {
-    			plan = attachGrouping(plan, query, hints);
-    		}
-
-    		// Attach having criteria node on top
-    		if(query.getHaving() != null) {
-    			plan = attachCriteria(plan, query.getHaving(), true);
-                hints.hasCriteria = true;
-    		}
-            
-        }
-
-		// Attach project on top
-		plan = attachProject(plan, query.getSelect());
-
-		// Attach dup removal on top
-		if(query.getSelect().isDistinct()) {
-			plan = attachDupRemoval(plan);
-		}
-
-		// Attach sorting on top
-		if(query.getOrderBy() != null) {
-			plan = attachSorting(plan, query.getOrderBy());
-            hints.hasSort = true;
-		}
-        
-        if (query.getLimit() != null) {
-            plan = attachTupleLimit(plan, query.getLimit(), hints);
-        }
-
-		return plan;
-	}
-
-    /**
-     * Merges the from clause into a single join predicate if there are more than 1 from clauses
-     */
-    private static FromClause mergeClauseTrees(From from) {
-        List clauses = from.getClauses();
-        
-        while (clauses.size() > 1) {
-            FromClause first = (FromClause)from.getClauses().remove(0);
-            FromClause second = (FromClause)from.getClauses().remove(0);
-            JoinPredicate jp = new JoinPredicate(first, second, JoinType.JOIN_CROSS);
-            clauses.add(0, jp);
-        }
-        
-        return (FromClause)clauses.get(0);
-    }
-    
-    /**
-     * Build a join plan based on the structure in a clause.  These structures should be
-     * essentially the same tree, but with different objects and details.
-     * @param clause Clause to build tree from
-     * @param parent Parent node to attach join node structure to
-     * @param sourceMap Map of group to source node, used for connecting children to join plan
-     * @param markJoinsInternal Flag saying whether joins built in this method should be marked
-     * as internal
-     * @return true if there are optional join nodes
-     * @throws MetaMatrixComponentException 
-     * @throws QueryMetadataException 
-     */
-    static boolean buildTree(FromClause clause, PlanNode parent, QueryMetadataInterface metadata, PlanHints hints)
-        throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-        
-        boolean result = false;
-        
-        PlanNode node = null;
-        
-        if(clause instanceof UnaryFromClause) {
-            // No join required
-            UnaryFromClause ufc = (UnaryFromClause)clause;
-            GroupSymbol group = ufc.getGroup();
-            if (metadata.isVirtualGroup(group.getMetadataID())) {
-            	hints.hasVirtualGroups = true;
-            }
-            Command nestedCommand = ufc.getExpandedCommand();
-            node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
-            node.addGroup(group);
-            node.setProperty(NodeConstants.Info.NESTED_COMMAND, nestedCommand);
-
-            parent.addLastChild(node);
-        } else if(clause instanceof JoinPredicate) {
-            JoinPredicate jp = (JoinPredicate) clause;
-
-            // Set up new join node corresponding to this join predicate
-            node = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
-            node.setProperty(NodeConstants.Info.JOIN_TYPE, jp.getJoinType());
-            node.setProperty(NodeConstants.Info.JOIN_STRATEGY, JoinStrategyType.NESTED_LOOP);
-            node.setProperty(NodeConstants.Info.JOIN_CRITERIA, jp.getJoinCriteria());
-            
-            if (jp.getJoinType() == JoinType.JOIN_LEFT_OUTER) {
-            	result = true;
-            }
-         
-            // Attach join node to parent
-            parent.addLastChild(node);
-
-            // Handle each child
-            FromClause[] clauses = new FromClause[] {jp.getLeftClause(), jp.getRightClause()};
-            for(int i=0; i<2; i++) {
-                result |= buildTree(clauses[i], node, metadata, hints);
-
-                // Add groups to joinNode
-                for (PlanNode child : node.getChildren()) {
-                    node.addGroups(child.getGroups());
-                }
-            }
-        } else if (clause instanceof SubqueryFromClause) {
-            SubqueryFromClause sfc = (SubqueryFromClause)clause;
-            GroupSymbol group = sfc.getGroupSymbol();
-            Command nestedCommand = sfc.getCommand();
-            node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
-            node.addGroup(group);
-            node.setProperty(NodeConstants.Info.NESTED_COMMAND, nestedCommand);
-            hints.hasVirtualGroups = true;
-            parent.addLastChild(node);
-        }
-        
-        if (clause.isOptional()) {
-            node.setProperty(NodeConstants.Info.IS_OPTIONAL, Boolean.TRUE);
-            result = true;
-        }
-        
-        if (clause.isMakeDep()) {
-            node.setProperty(NodeConstants.Info.MAKE_DEP, Boolean.TRUE);
-        } else if (clause.isMakeNotDep()) {
-            node.setProperty(NodeConstants.Info.MAKE_NOT_DEP, Boolean.TRUE);
-        }
-
-        return result;
-    }
-
-	/**
-	 * Attach all criteria above the join nodes.  The optimizer will push these
-	 * criteria down to the appropriate source.
-	 * @param plan Existing plan, which joins all source groups
-	 * @param criteria Criteria from query
-	 * @return Updated tree
-	 */
-	private static PlanNode attachCriteria(PlanNode plan, Criteria criteria, boolean isHaving) {
-	    List crits = Criteria.separateCriteriaByAnd(criteria);
-	    
-	    for (final Iterator iterator = crits.iterator(); iterator.hasNext();) {
-            final Criteria crit = (Criteria)iterator.next();
-            PlanNode critNode = createSelectNode(crit, isHaving);
-            GenerateCanonical.attachLast(critNode, plan);
-            plan = critNode;
-        } 
-	    
-		return plan;
-	}
-
-    public static PlanNode createSelectNode(final Criteria crit, boolean isHaving) {
-        PlanNode critNode = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
-        critNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit);
-        if (isHaving && !AggregateSymbolCollectorVisitor.getAggregates(crit, false).isEmpty()) {
-            critNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
-        }
-        // Add groups to crit node
-        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit));
-        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(critNode.getCorrelatedReferenceElements()));
-        return critNode;
-    }
-
-	/**
-	 * Attach a grouping node at top of tree.
-	 * @param plan Existing plan
-	 * @param groupBy Group by clause, which may be null
-	 * @return Updated plan
-	 */
-	private static PlanNode attachGrouping(PlanNode plan, Query query, PlanHints hints) {
-		PlanNode groupNode = NodeFactory.getNewNode(NodeConstants.Types.GROUP);
-
-		GroupBy groupBy = query.getGroupBy();
-		if(groupBy != null) {
-			groupNode.setProperty(NodeConstants.Info.GROUP_COLS, groupBy.getSymbols());
-            groupNode.addGroups(GroupsUsedByElementsVisitor.getGroups(groupBy));
-		}
-
-		GenerateCanonical.attachLast(groupNode, plan);
-        
-        // Mark in hints
-        hints.hasAggregates = true;
-        
-		return groupNode;
-	}
-
-    /**
-	 * Attach SORT node at top of tree.  The SORT may be pushed down to a source (or sources)
-	 * if possible by the optimizer.
-	 * @param plan Existing plan
-	 * @param orderBy Sort description from the query
-	 * @return Updated plan
-	 */
-	private static PlanNode attachSorting(PlanNode plan, OrderBy orderBy) {
-		PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT);
-		
-		sortNode.setProperty(NodeConstants.Info.SORT_ORDER, orderBy.getVariables());
-		sortNode.setProperty(NodeConstants.Info.ORDER_TYPES, orderBy.getTypes());
-		if (orderBy.hasUnrelated()) {
-			sortNode.setProperty(Info.UNRELATED_SORT, true);
-		}
-		sortNode.addGroups(GroupsUsedByElementsVisitor.getGroups(orderBy));
-
-		GenerateCanonical.attachLast(sortNode, plan);
-		return sortNode;
-	}
-    
-    private static PlanNode attachTupleLimit(PlanNode plan, Limit limit, PlanHints hints) {
-        hints.hasLimit = true;
-        PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
-        
-        boolean attach = false;
-        if (limit.getOffset() != null) {
-            limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, limit.getOffset());
-            attach = true;
-        }
-        if (limit.getRowLimit() != null) {
-            limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, limit.getRowLimit());
-            attach = true;
-        }
-        if (attach) {
-            GenerateCanonical.attachLast(limitNode, plan);
-            plan = limitNode;
-        }
-        return plan;
-    }
-
-	/**
-	 * Attach DUP_REMOVE node at top of tree.  The DUP_REMOVE may be pushed down
-	 * to a source (or sources) if possible by the optimizer.
-	 * @param plan Existing plan
-	 * @return Updated plan
-	 */
-	private static PlanNode attachDupRemoval(PlanNode plan) {
-		PlanNode dupNode = NodeFactory.getNewNode(NodeConstants.Types.DUP_REMOVE);
-		GenerateCanonical.attachLast(dupNode, plan);
-		return dupNode;
-	}
-
-	private static PlanNode attachProject(PlanNode plan, Select select) {
-		PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
-		projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select.getProjectedSymbols());
-
-		// Set groups
-		projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select));
-
-		GenerateCanonical.attachLast(projectNode, plan);
-		return projectNode;
-	}
-
-	static final void attachLast(PlanNode parent, PlanNode child) {
-		if(child != null) {
-			parent.addLastChild(child);
-		}
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,297 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.optimizer.relational;
-
-import java.util.*;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.core.util.Assertion;
-import com.metamatrix.query.metadata.*;
-import com.metamatrix.query.optimizer.CommandTreeNode;
-import com.metamatrix.query.optimizer.CommandTreeProcessor;
-import com.metamatrix.query.optimizer.relational.plantree.*;
-import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.SubqueryContainer;
-import com.metamatrix.query.sql.symbol.*;
-import com.metamatrix.query.sql.util.SymbolMap;
-import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
-
-/**
- * Merge neighboring relational nodes by combining canonical plans 
- */
-public class MergeTreeNodeProcessor implements CommandTreeProcessor {
-
-	/**
-	 * @see com.metamatrix.query.optimizer.CommandTreeProcessor#process(com.metamatrix.query.optimizer.CommandTreeNode)
-	 */
-	public CommandTreeNode process(CommandTreeNode node, QueryMetadataInterface metadata) 
-	throws QueryMetadataException, MetaMatrixComponentException {
-		MergeTreeNodeProcessor.processRecursive(node, metadata);
-		return node;
-	}
-
-	/**
-	 * Recursively, in depth-first order, examines the tree of CommandTreeNode
-	 * objects.  
-	 * @param node
-	 * @param metadata
-	 * @throws QueryMetadataException
-	 * @throws MetaMatrixComponentException
-	 */
-	private static void processRecursive(CommandTreeNode node, QueryMetadataInterface metadata) throws QueryMetadataException, MetaMatrixComponentException{
-
-        // process children
-		Iterator children = node.getChildren().iterator();
-		while (children.hasNext()) {
-			CommandTreeNode child = (CommandTreeNode) children.next();
-			processRecursive(child, metadata);
-		}
-        
-        // Use command-level metadata if necessary
-        QueryMetadataInterface fullMetadata = metadata;
-        Map commandMetadata = node.getCommand().getTemporaryMetadata();
-        if(commandMetadata != null && commandMetadata.size() > 0) {
-            fullMetadata = new TempMetadataAdapter(metadata, new TempMetadataStore(commandMetadata));    
-        }
-        
-		// process node	
-		List oldChildren = new ArrayList(node.getChildren());
-		int childCount = oldChildren.size();
-		for (int childIndex=0; childIndex < childCount; childIndex++){
-			CommandTreeNode child = (CommandTreeNode)oldChildren.get(childIndex);                        
-			checkNode(node, child, childIndex, fullMetadata);
-		}
-	}
-	
-	/**
-	 * Checks if parent and child both contain relational commands.  If so, 
-	 * they will be merged - unless the child node is a subquery of a
-	 * criteria or scalar subquery of parent command; these have to remain unmerged.
-	 * @param parent 
-	 * @param child
-	 * @param childIndex index of child in the parent's List of children
-	 * @param metadata source of metadata
-	 * @throws QueryMetadataException
-	 * @throws MetaMatrixComponentException
-	 */
-	private static void checkNode(CommandTreeNode parent, CommandTreeNode child, int childIndex, QueryMetadataInterface metadata) 
-	throws QueryMetadataException, MetaMatrixComponentException{
-		if (parent.getCommandType() == CommandTreeNode.TYPE_RELATIONAL_COMMAND &&
-		    child.getCommandType() == CommandTreeNode.TYPE_RELATIONAL_COMMAND){
-		    	
-			Command childCommand = child.getCommand();
-			Command parentCommand = parent.getCommand();
-			
-			for (SubqueryContainer crit : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(parentCommand)) {
-				if (crit.getCommand() == childCommand){
-					//Don't merge these two nodes
-					return;
-				}
-			}
-
-			removeChildNode(parent, child);
-			mergeRelationalPlans(parent, child, metadata);
-            mergeTempMetadata(childCommand, parentCommand);
-		}
-	}
-
-    /**
-     * Adds temp metadata (if any) of child command to temp metadata
-     * (if any) of parent command.
-     * @param childCommand 
-     * @param parentCommand
-     */
-    static void mergeTempMetadata(
-        Command childCommand,
-        Command parentCommand) {
-        Map childTempMetadata = childCommand.getTemporaryMetadata();
-        if (childTempMetadata != null && !childTempMetadata.isEmpty()){
-            // Add to parent temp metadata
-            Map parentTempMetadata = parentCommand.getTemporaryMetadata();
-            if (parentTempMetadata == null){
-                parentCommand.setTemporaryMetadata(new HashMap(childTempMetadata));
-            } else {
-                parentTempMetadata.putAll(childTempMetadata);
-            }
-        }
-    }
-	
-	/**
-	 * The canonical plan stored in child must be grafted onto the appropriate
-	 * source node in the canonical plan of parent - since the other previous
-     * children have already been merged, this must occur on the first eligible
-     * node.
-	 * @param parent a node containing a relational plan
-	 * @param child a node containing a relational plan
-	 * @param metadata source of metadata
-	 */
-	private static void mergeRelationalPlans(
-		CommandTreeNode parent,
-		CommandTreeNode child, 
-		QueryMetadataInterface metadata) 
-	throws QueryMetadataException, MetaMatrixComponentException {
-			
-		PlanNode parentPlan = (PlanNode)parent.getCanonicalPlan();
-		for (PlanNode sourceNode : NodeEditor.findAllNodes(parentPlan, NodeConstants.Types.SOURCE)) {
-            if(sourceNode.getChildCount()>0) {
-                continue;
-            }
-            
-            Command command = (Command)sourceNode.getProperty(NodeConstants.Info.NESTED_COMMAND);
-            /* Defect 13296 - Check for UPDATE PROCEDURE Source nodes, since an update procedure
-             * is also considered a virtual group, 
-             */
-            if(command == null || command.getType() == Command.TYPE_UPDATE_PROCEDURE) {
-                continue;
-            }
-
-			GroupSymbol sourceGroup = sourceNode.getGroups().iterator().next();
-			// Only source nodes representing virtual groups are eligible to
-			// be merged with.
-			if (metadata.isVirtualGroup(sourceGroup.getMetadataID())){
-                // Attach nodes
-                PlanNode childPlan = (PlanNode) child.getCanonicalPlan();
-				sourceNode.addFirstChild(childPlan);
-                
-                // Create symbol map from virtual group to child plan
-                List projectCols = child.getCommand().getProjectedSymbols();
-                sourceNode.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(sourceNode.getGroups().iterator().next(), projectCols));
-                
-                // Combine hints
-                combineHints(parent, child);
-                
-                // done        
-				break;
-			}
-		}
-	}
-    
-    /**
-     * Method combineHints.
-     * @param parent
-     * @param child
-     */
-    private static void combineHints(CommandTreeNode parent, CommandTreeNode child) {
-        PlanHints parentHints = (PlanHints) parent.getProperty(RelationalPlanner.HINTS);
-        PlanHints childHints = (PlanHints) child.getProperty(RelationalPlanner.HINTS);
-
-        if(childHints.hasCriteria) {
-            parentHints.hasCriteria = true;
-        }        
-        if(childHints.hasJoin) {
-            parentHints.hasJoin = true;
-        }        
-        if(childHints.hasSort) {
-            parentHints.hasSort = true;
-        }        
-        if(childHints.hasVirtualGroups) {
-            parentHints.hasVirtualGroups = true;
-        }        
-        if(childHints.isUpdate) {
-            parentHints.isUpdate = true;
-        }        
-        if(childHints.isUpdate) {
-            parentHints.isUpdate = true;
-        }      
-        if(childHints.hasSetQuery) {
-            parentHints.hasSetQuery = true;
-        }
-        if(childHints.hasAggregates) {
-            parentHints.hasAggregates = true;
-        }
-        if(childHints.makeDepGroups != null && childHints.makeDepGroups.size() > 0) {
-            if(parentHints.makeDepGroups == null) {
-                parentHints.makeDepGroups = childHints.makeDepGroups;
-            } else {
-                parentHints.makeDepGroups.addAll(childHints.makeDepGroups);
-            }    
-        }  
-        if(childHints.makeNotDepGroups != null && childHints.makeNotDepGroups.size() > 0) {
-            if(parentHints.makeNotDepGroups == null) {
-                parentHints.makeNotDepGroups = childHints.makeNotDepGroups;
-            } else {
-                parentHints.makeNotDepGroups.addAll(childHints.makeNotDepGroups);
-            }    
-        }  
-        if(childHints.hasLimit) {
-            parentHints.hasLimit = true;
-        }
-        if(childHints.hasOptionalJoin) {
-            parentHints.hasOptionalJoin = true;
-        }
-        if(childHints.hasRelationalProc) {
-            parentHints.hasRelationalProc = true;
-        }
-    }
-	        
-	/**
-	 * All of child's children become children of parent
-	 */
-	private static final void removeChildNode(CommandTreeNode parent, CommandTreeNode child) {
-		Assertion.isNotNull(parent);
-		Assertion.isNotNull(child);
-
-		// Get all existing children from parent
-		List newChildren = new LinkedList(parent.getChildren());
-
-		// get child's children
-		List orphans = child.getChildren();
-        
-		// Find the child being removed and replace with the child's children
-		ListIterator childIter = newChildren.listIterator();
-		while(childIter.hasNext()) {
-			CommandTreeNode possibleChild = (CommandTreeNode) childIter.next();        
-			if(possibleChild == child) {
-				childIter.remove();
-				child.setParent(null);
-				Iterator orphanIter = orphans.iterator();
-				while(orphanIter.hasNext()) {
-					CommandTreeNode orphan = (CommandTreeNode) orphanIter.next();
-					childIter.add(orphan);
-				}                
-			}
-		}
-        		
-		// Remove all children from parent and re-add from newChildren
-		Iterator removeIter = new LinkedList(parent.getChildren()).iterator();
-		while(removeIter.hasNext()) {
-			CommandTreeNode removeNode = (CommandTreeNode) removeIter.next();
-			parent.removeChild(removeNode);
-		}
-		parent.addChildren(newChildren);
-        		
-		// set new children's parent to new parent
-		Iterator iter = newChildren.iterator();
-		while(iter.hasNext()) {
-			CommandTreeNode newChild = (CommandTreeNode) iter.next();
-			newChild.setParent(parent);
-		}
-        
-		// Remove old children from child
-		removeIter = new LinkedList(child.getChildren()).iterator();
-		while(removeIter.hasNext()) {
-			child.removeChild((CommandTreeNode)removeIter.next());
-		}
-	}
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanHints.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanHints.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanHints.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,8 +22,6 @@
 
 package com.metamatrix.query.optimizer.relational;
 
-import java.util.ArrayList;
-import java.util.List;
 
 public final class PlanHints { 
 
@@ -39,21 +37,12 @@
     // This flag indicates that the plan has a sort somewhere
     public boolean hasSort = false;
     
-    // flag added to indentify that the plan generated if for an updated
-    public boolean isUpdate = false;
-    
-    // List of groups to make dependent
-    public List makeDepGroups = null;
-    
     // flag indicates that the plan has a union somewhere
     public boolean hasSetQuery = false;
     
     // flag indicating that the plan has a grouping node somewhere
     public boolean hasAggregates = false;
         
-    // List of groups that should not be dependent
-    public List makeNotDepGroups = null;
-    
     public boolean hasLimit = false;
     
     public boolean hasOptionalJoin = false;
@@ -62,26 +51,6 @@
     
     public PlanHints() { }    
     
-    public void addMakeDepGroups(List groups) {
-        if(groups == null) {
-            return;
-        }
-        if(this.makeDepGroups == null) {
-            this.makeDepGroups = new ArrayList();
-        } 
-        this.makeDepGroups.addAll(groups);
-    }
-    
-    public void addMakeNotDepGroups(List groups) {
-        if(groups == null) {
-            return;
-        }
-        if(this.makeNotDepGroups == null) {
-            this.makeNotDepGroups = new ArrayList();
-        } 
-        this.makeNotDepGroups.addAll(groups);
-    }
-    
     public String toString(){
     	return "PlanHints"; //$NON-NLS-1$
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,39 +24,81 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
+import org.teiid.dqp.internal.process.Request;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.api.exception.query.QueryPlannerException;
+import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.api.exception.query.QueryValidatorException;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.core.id.IDGenerator;
+import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.analysis.QueryAnnotation;
 import com.metamatrix.query.execution.QueryExecPlugin;
+import com.metamatrix.query.mapping.relational.QueryNode;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.metadata.TempMetadataAdapter;
+import com.metamatrix.query.metadata.TempMetadataID;
 import com.metamatrix.query.optimizer.CommandPlanner;
-import com.metamatrix.query.optimizer.CommandTreeNode;
+import com.metamatrix.query.optimizer.QueryOptimizer;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
+import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
 import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
+import com.metamatrix.query.optimizer.relational.plantree.NodeConstants.Info;
 import com.metamatrix.query.optimizer.relational.rules.RuleConstants;
+import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.relational.RelationalPlan;
+import com.metamatrix.query.processor.relational.JoinNode.JoinStrategyType;
+import com.metamatrix.query.resolver.QueryResolver;
+import com.metamatrix.query.resolver.util.BindVariableVisitor;
+import com.metamatrix.query.rewriter.QueryRewriter;
 import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.lang.Criteria;
+import com.metamatrix.query.sql.lang.From;
+import com.metamatrix.query.sql.lang.FromClause;
+import com.metamatrix.query.sql.lang.GroupBy;
+import com.metamatrix.query.sql.lang.Insert;
+import com.metamatrix.query.sql.lang.JoinPredicate;
+import com.metamatrix.query.sql.lang.JoinType;
+import com.metamatrix.query.sql.lang.Limit;
+import com.metamatrix.query.sql.lang.Option;
+import com.metamatrix.query.sql.lang.OrderBy;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
+import com.metamatrix.query.sql.lang.Query;
+import com.metamatrix.query.sql.lang.QueryCommand;
+import com.metamatrix.query.sql.lang.Select;
+import com.metamatrix.query.sql.lang.SetQuery;
+import com.metamatrix.query.sql.lang.StoredProcedure;
 import com.metamatrix.query.sql.lang.SubqueryContainer;
+import com.metamatrix.query.sql.lang.SubqueryFromClause;
+import com.metamatrix.query.sql.lang.UnaryFromClause;
+import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.symbol.Reference;
 import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 import com.metamatrix.query.sql.util.SymbolMap;
+import com.metamatrix.query.sql.visitor.AggregateSymbolCollectorVisitor;
 import com.metamatrix.query.sql.visitor.CorrelatedReferenceCollectorVisitor;
+import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
 import com.metamatrix.query.sql.visitor.GroupsUsedByElementsVisitor;
+import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 import com.metamatrix.query.util.CommandContext;
 import com.metamatrix.query.util.ErrorMessageKeys;
 import com.metamatrix.query.util.LogConstants;
+import com.metamatrix.query.validator.ValidationVisitor;
 
 /**
  * This class generates a relational plan for query execution.  The output of
@@ -64,35 +106,24 @@
  * object - this object then becomes the input to
  * {@link PlanToProcessConverter PlanToProcessConverter}
  * to  produce a
- * {@link com. metamatrix.query.processor.relational.RelationalPlan RelationalPlan}.
+ * {@link com.metamatrix.query.processor.relational.RelationalPlan RelationalPlan}.
  */
 public class RelationalPlanner implements CommandPlanner {
+	
+	private AnalysisRecord analysisRecord;
+	private Command parentCommand;
+	private IDGenerator idGenerator;
+	private CommandContext context;
+	private CapabilitiesFinder capFinder;
+	private QueryMetadataInterface metadata;
+	private PlanHints hints = new PlanHints();
+	private Option option;
 
     /**
-	 * Key for a {@link PlanHints PlanHints} object 
-	 */
-	public static final Integer HINTS = Integer.valueOf(0);
-	public static final Integer VARIABLE_CONTEXTS = Integer.valueOf(1);
-
-	/**
-     * @see com.metamatrix.query.optimizer.CommandPlanner#generateCanonical(com.metamatrix.query.optimizer.CommandTreeNode, boolean)
-     */
-    public void generateCanonical(CommandTreeNode node, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
-        throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
-        // Create canonical plan for this command
-        Command command = node.getCommand();
-
-        PlanHints hints = (PlanHints)node.getProperty(RelationalPlanner.HINTS);
-        PlanNode canonicalPlan = GenerateCanonical.generatePlan(command, hints, metadata);
-        node.setCanonicalPlan(canonicalPlan);
-    }
-
-    /**
      * @see com.metamatrix.query.optimizer.CommandPlanner#optimize(com.metamatrix.query.optimizer.CommandTreeNode, java.util.Map, com.metamatrix.query.metadata.QueryMetadataInterface, boolean)
      */
     public ProcessorPlan optimize(
-        CommandTreeNode node,
+        Command command,
         IDGenerator idGenerator,
         QueryMetadataInterface metadata,
         CapabilitiesFinder capFinder,
@@ -101,44 +132,37 @@
             QueryPlannerException,
             QueryMetadataException,
             MetaMatrixComponentException {
+    	initialize(command, idGenerator, metadata, capFinder, analysisRecord, context);
 
+        boolean debug = analysisRecord.recordDebug();
+		if(debug) {
+            analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
+            analysisRecord.println("GENERATE CANONICAL: \n" + command); //$NON-NLS-1$
+		}   
+        PlanNode plan;
+		try {
+			plan = generatePlan(command);
+		} catch (QueryResolverException e) {
+			throw new QueryPlannerException(e, e.getMessage());
+		} catch (QueryValidatorException e) {
+			throw new QueryPlannerException(e, e.getMessage());
+		}
 
-        // Distribute childPlans into relational plan
-        PlanNode plan = (PlanNode)node.getCanonicalPlan();
-        connectChildPlans(plan);
+		if(debug) {
+            analysisRecord.println("\nCANONICAL PLAN: \n" + plan); //$NON-NLS-1$
+		} 
 
-        // Check whether command has virtual groups
-        Command command = node.getCommand();
-        PlanHints hints = (PlanHints)node.getProperty(RelationalPlanner.HINTS);
-
-        // Distribute make dependent hints as necessary
-        if(hints.makeDepGroups != null) {
-            RelationalPlanner.distributeDependentHints(hints.makeDepGroups, plan, metadata, NodeConstants.Info.MAKE_DEP);
-        }
-        if (hints.makeNotDepGroups != null) {
-            RelationalPlanner.distributeDependentHints(hints.makeNotDepGroups, plan, metadata, NodeConstants.Info.MAKE_NOT_DEP);
-        }
-
         // Connect ProcessorPlan to SubqueryContainer (if any) of SELECT or PROJECT nodes
-    	if (node.getChildCount() > 0) {
-    		connectSubqueryContainers(plan);
-    	}
+		connectSubqueryContainers(plan); //TODO: merge with node creation
         
         // Set top column information on top node
-        List projectCols = command.getProjectedSymbols();
-        List<SingleElementSymbol> topCols = new ArrayList<SingleElementSymbol>(projectCols.size());
-        Iterator projectIter = projectCols.iterator();
-        while(projectIter.hasNext()) {
-            SingleElementSymbol symbol = (SingleElementSymbol) projectIter.next();
-            topCols.add( (SingleElementSymbol)symbol.clone() );
-        }
+        List<SingleElementSymbol> topCols = QueryRewriter.deepClone(command.getProjectedSymbols(), SingleElementSymbol.class);
 
         // Build rule set based on hints
         RuleStack rules = RelationalPlanner.buildRules(hints);
 
         // Run rule-based optimizer
-        plan = RelationalPlanner.executeRules(rules, plan, metadata, capFinder, analysisRecord, context);
-        node.setCanonicalPlan(plan);
+        plan = executeRules(rules, plan);
 
         PlanToProcessConverter planToProcessConverter = null;
         if (context != null) {
@@ -155,7 +179,18 @@
         return result;
     }
 
-    private static void connectSubqueryContainers(PlanNode plan) {
+	public void initialize(Command command, IDGenerator idGenerator,
+			QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+			AnalysisRecord analysisRecord, CommandContext context) {
+		this.parentCommand = command;
+    	this.idGenerator = idGenerator;
+    	this.metadata = metadata;
+    	this.capFinder = capFinder;
+    	this.analysisRecord = analysisRecord;
+    	this.context = context;
+	}
+
+    private void connectSubqueryContainers(PlanNode plan) throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
         Set<GroupSymbol> groupSymbols = getGroupSymbols(plan);
 
         for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT | NodeConstants.Types.SELECT | NodeConstants.Types.JOIN)) {
@@ -170,6 +205,8 @@
             for (SubqueryContainer container : subqueryContainers) {
                 ArrayList<Reference> correlatedReferences = new ArrayList<Reference>(); 
                 Command subCommand = container.getCommand();
+                ProcessorPlan procPlan = QueryOptimizer.optimizePlan(subCommand, metadata, idGenerator, capFinder, analysisRecord, context);
+                subCommand.setProcessorPlan(procPlan);
                 CorrelatedReferenceCollectorVisitor.collectReferences(subCommand, localGroupSymbols, correlatedReferences);
                 if (!correlatedReferences.isEmpty()) {
 	                SymbolMap map = new SymbolMap();
@@ -192,23 +229,6 @@
 	}
 
     /**
-     * Method connectChildPlans.
-     * @param plan
-     * @param childPlans
-     * @param metadata
-     * @return Map <Command - child ProcessorPlan>
-     */
-    private static void connectChildPlans(PlanNode plan) {
-        // Find all nodes that need subcommands attached
-        for (PlanNode source : NodeEditor.findAllNodes(plan, NodeConstants.Types.SOURCE)) {
-            Command nodeCommand = (Command)source.getProperty(NodeConstants.Info.NESTED_COMMAND);
-            if(nodeCommand != null && nodeCommand.getProcessorPlan() != null) {
-                source.setProperty(NodeConstants.Info.PROCESSOR_PLAN, nodeCommand.getProcessorPlan());
-            }
-        }
-    }
-
-    /**
      * Distribute and "make (not) dependent" hints specified in the query into the
      * fully resolved query plan.  This is done after virtual group resolution so
      * that all groups in the plan are known.  The hint is attached to all SOURCE
@@ -216,43 +236,39 @@
      * @param groups List of groups (Strings) to be made dependent
      * @param plan The canonical plan
      */
-    private static void distributeDependentHints(Collection groups, PlanNode plan, QueryMetadataInterface metadata, NodeConstants.Info hintProperty)
+    private static void distributeDependentHints(Collection<String> groups, PlanNode plan, QueryMetadataInterface metadata, NodeConstants.Info hintProperty)
         throws QueryMetadataException, MetaMatrixComponentException {
     
-        if(groups != null && groups.size() > 0) {
-            // Get all source nodes
-            List nodes = NodeEditor.findAllNodes(plan, NodeConstants.Types.SOURCE);
-    
-            // Walk through each dependent group hint and
-            // attach to the correct source node
-            Iterator groupIter = groups.iterator();
-            while(groupIter.hasNext()) {
-                String groupName = (String) groupIter.next();
-    
-                // Walk through nodes and apply hint to all that match group name
-                boolean appliedHint = applyHint(nodes, groupName, hintProperty);
-    
+        if(groups == null || groups.isEmpty()) {
+        	return;
+        }
+        // Get all source nodes
+        List<PlanNode> nodes = NodeEditor.findAllNodes(plan, NodeConstants.Types.SOURCE);
+
+        // Walk through each dependent group hint and
+        // attach to the correct source node
+        for (String groupName : groups) {
+            // Walk through nodes and apply hint to all that match group name
+            boolean appliedHint = applyHint(nodes, groupName, hintProperty);
+
+            if(! appliedHint) {
+                //check if it is partial group name
+                Collection groupNames = metadata.getGroupsForPartialName(groupName);
+                if(groupNames.size() == 1) {
+                    groupName = (String)groupNames.iterator().next();
+                    appliedHint = applyHint(nodes, groupName, hintProperty);
+                }
+                
                 if(! appliedHint) {
-                    //check if it is partial group name
-                    Collection groupNames = metadata.getGroupsForPartialName(groupName);
-                    if(groupNames.size() == 1) {
-                        groupName = (String)groupNames.iterator().next();
-                        appliedHint = applyHint(nodes, groupName, hintProperty);
-                    }
-                    
-                    if(! appliedHint) {
-                        LogManager.logWarning(LogConstants.CTX_QUERY_PLANNER, QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName));
-                    }
+                    LogManager.logWarning(LogConstants.CTX_QUERY_PLANNER, QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName));
                 }
             }
         }
     }
     
-    private static boolean applyHint(List nodes, String groupName, NodeConstants.Info hintProperty) {
+    private static boolean applyHint(List<PlanNode> nodes, String groupName, NodeConstants.Info hintProperty) {
         boolean appliedHint = false;
-        Iterator nodeIter = nodes.iterator();
-        while(nodeIter.hasNext()) {
-            PlanNode node = (PlanNode) nodeIter.next();
+        for (PlanNode node : nodes) {
             GroupSymbol nodeGroup = node.getGroups().iterator().next();
             
             String sDefinition = nodeGroup.getDefinition();
@@ -328,7 +344,7 @@
         return rules;
     }
 
-    private static PlanNode executeRules(RuleStack rules, PlanNode plan, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
+    private PlanNode executeRules(RuleStack rules, PlanNode plan)
         throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
         boolean debug = analysisRecord.recordDebug();
@@ -349,4 +365,609 @@
         }
         return plan;
     }
-}
+	
+	public PlanNode generatePlan(Command cmd) throws QueryPlannerException, QueryResolverException, QueryValidatorException, MetaMatrixComponentException {
+		//cascade the option clause nocache
+		Option savedOption = option;
+		option = cmd.getOption();
+        if (option == null) {
+        	if (savedOption != null) {
+        		option = savedOption;
+        	} 
+        } else if (savedOption != null && savedOption.isNoCache()) { //merge no cache settings
+    		if (savedOption.getNoCacheGroups() == null || savedOption.getNoCacheGroups().isEmpty()) {
+    			if (option.getNoCacheGroups() != null) {
+    				option.getNoCacheGroups().clear(); // full no cache
+    			}
+    		} else if (option.getNoCacheGroups() != null && !option.getNoCacheGroups().isEmpty()) {
+    			for (String noCache : savedOption.getNoCacheGroups()) {
+					option.addNoCacheGroup(noCache); // only groups
+				}
+    		}
+    		option.setNoCache(true);
+        }
+		
+		PlanNode result = null;
+		switch (cmd.getType()) {
+		case Command.TYPE_QUERY:
+			result = createQueryPlan((QueryCommand)cmd);
+			break;
+		case Command.TYPE_INSERT:
+		case Command.TYPE_UPDATE:
+		case Command.TYPE_DELETE:
+		case Command.TYPE_CREATE:
+		case Command.TYPE_DROP:
+			result = createUpdatePlan(cmd);
+			break;
+		case Command.TYPE_STORED_PROCEDURE:
+			result = createStoredProcedurePlan((StoredProcedure)cmd);
+			break;
+		default:
+			throw new AssertionError("Invalid command type"); //$NON-NLS-1$
+		}
+        // Distribute make dependent hints as necessary
+        if (cmd.getOption() != null) {
+	        if(cmd.getOption().getDependentGroups() != null) {
+	            distributeDependentHints(cmd.getOption().getDependentGroups(), result, metadata, NodeConstants.Info.MAKE_DEP);
+	        }
+	        if (cmd.getOption().getNotDependentGroups() != null) {
+	            distributeDependentHints(cmd.getOption().getNotDependentGroups(), result, metadata, NodeConstants.Info.MAKE_NOT_DEP);
+	        }
+        }
+        this.option = savedOption;
+        return result;
+	}
+
+	PlanNode createUpdatePlan(Command command) throws QueryPlannerException, MetaMatrixComponentException, QueryResolverException, QueryValidatorException {
+        // Create top project node - define output columns for stored query / procedure
+        PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
+
+        Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, false);
+        projectNode.addGroups(groups);
+
+        // Set output columns
+        List<SingleElementSymbol> cols = command.getProjectedSymbols();
+        projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
+
+        // Define source of data for stored query / procedure
+        PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+        sourceNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
+        sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, command);
+        if (command instanceof ProcedureContainer) {
+        	ProcedureContainer container = (ProcedureContainer)command;
+        	addNestedProcedure(sourceNode, container);
+        }
+        sourceNode.addGroups(groups);
+
+        attachLast(projectNode, sourceNode);
+
+        //for INTO query, attach source and project nodes
+        if(command instanceof Insert){
+        	Insert insert = (Insert)command;
+        	if (insert.getQueryExpression() != null) {
+	            PlanNode plan = generatePlan(insert.getQueryExpression());
+	            attachLast(sourceNode, plan);
+	            mergeTempMetadata(insert.getQueryExpression(), insert);
+	            projectNode.setProperty(NodeConstants.Info.INTO_GROUP, insert.getGroup());
+        	}
+        }
+        
+        return projectNode;
+	}
+
+	private void addNestedProcedure(PlanNode sourceNode,
+			ProcedureContainer container) throws MetaMatrixComponentException,
+			QueryMetadataException, QueryResolverException,
+			QueryValidatorException, QueryPlannerException {
+		//plan any subqueries in criteria/parameters/values
+		for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
+    		ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
+    		subqueryContainer.getCommand().setProcessorPlan(plan);
+		}
+		
+		String cacheString = "transformation/" + container.getClass().getSimpleName(); //$NON-NLS-1$
+		Command c = (Command)metadata.getFromMetadataCache(container.getGroup().getMetadataID(), cacheString);
+		if (c == null) {
+			c = QueryResolver.expandCommand(container, metadata, analysisRecord);
+			if (c != null) {
+		        Request.validateWithVisitor(new ValidationVisitor(), metadata, c);
+		        metadata.addToMetadataCache(container.getGroup().getMetadataID(), cacheString, c.clone());
+			}
+		} else {
+			c = (Command)c.clone();
+			if (c instanceof CreateUpdateProcedureCommand) {
+				((CreateUpdateProcedureCommand)c).setUserCommand(container);
+			}
+		}
+		if (c != null) {
+		    c = QueryRewriter.rewrite(c, metadata, context);
+		    addNestedCommand(sourceNode, container.getGroup(), container, c, false);
+		}
+	}
+
+    PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryPlannerException, QueryResolverException, QueryValidatorException, QueryMetadataException, MetaMatrixComponentException {
+        // Create top project node - define output columns for stored query / procedure
+        PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
+
+        // Set output columns
+        List cols = storedProc.getProjectedSymbols();
+        projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
+
+        // Define source of data for stored query / procedure
+        PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+        sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, storedProc);
+    	addNestedProcedure(sourceNode, storedProc);
+        
+        hints.hasRelationalProc |= storedProc.isProcedureRelational();
+
+        // Set group on source node
+        sourceNode.addGroup(storedProc.getGroup());
+
+        attachLast(projectNode, sourceNode);
+
+        return projectNode;
+    }
+
+	PlanNode createQueryPlan(QueryCommand command)
+		throws QueryPlannerException, MetaMatrixComponentException, QueryResolverException, QueryValidatorException {
+        // Build canonical plan
+    	PlanNode node = null;
+        if(command instanceof Query) {
+            node = createQueryPlan((Query) command);
+        } else {
+            hints.hasSetQuery = true;
+            SetQuery query = (SetQuery)command;
+            PlanNode leftPlan = createQueryPlan( query.getLeftQuery());
+            PlanNode rightPlan = createQueryPlan( query.getRightQuery());
+
+            node = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
+            node.setProperty(NodeConstants.Info.SET_OPERATION, query.getOperation());
+            node.setProperty(NodeConstants.Info.USE_ALL, query.isAll());
+            
+            attachLast(node, leftPlan);
+            attachLast(node, rightPlan);
+        }
+        
+		if(command.getOrderBy() != null) {
+			node = attachSorting(node, command.getOrderBy());
+            hints.hasSort = true;
+		}
+
+        if (command.getLimit() != null) {
+            node = attachTupleLimit(node, command.getLimit(), hints);
+        }
+        
+        return node;
+    }
+
+    private PlanNode createQueryPlan(Query query)
+		throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException, QueryResolverException, QueryValidatorException {
+
+        PlanNode plan = null;
+
+        if(query.getFrom() != null){
+            FromClause fromClause = mergeClauseTrees(query.getFrom());
+            
+            PlanNode dummyRoot = new PlanNode();
+            
+    		buildTree(fromClause, dummyRoot);
+            
+            plan = dummyRoot.getFirstChild();
+            
+            hints.hasJoin |= plan.getType() == NodeConstants.Types.JOIN;
+
+    		// Attach criteria on top
+    		if(query.getCriteria() != null) {
+    			plan = attachCriteria(plan, query.getCriteria(), false);
+                hints.hasCriteria = true;
+    		}
+
+    		// Attach grouping node on top
+    		if(query.getGroupBy() != null || query.getHaving() != null || !AggregateSymbolCollectorVisitor.getAggregates(query.getSelect(), false).isEmpty()) {
+    			plan = attachGrouping(plan, query, hints);
+    		}
+
+    		// Attach having criteria node on top
+    		if(query.getHaving() != null) {
+    			plan = attachCriteria(plan, query.getHaving(), true);
+                hints.hasCriteria = true;
+    		}
+            
+        }
+
+		// Attach project on top
+		plan = attachProject(plan, query.getSelect());
+
+		// Attach dup removal on top
+		if(query.getSelect().isDistinct()) {
+			plan = attachDupRemoval(plan);
+		}
+
+		return plan;
+	}
+
+    /**
+     * Merges the from clause into a single join predicate if there are more than 1 from clauses
+     */
+    private static FromClause mergeClauseTrees(From from) {
+        List clauses = from.getClauses();
+        
+        while (clauses.size() > 1) {
+            FromClause first = (FromClause)from.getClauses().remove(0);
+            FromClause second = (FromClause)from.getClauses().remove(0);
+            JoinPredicate jp = new JoinPredicate(first, second, JoinType.JOIN_CROSS);
+            clauses.add(0, jp);
+        }
+        
+        return (FromClause)clauses.get(0);
+    }
+    
+    /**
+     * Build a join plan based on the structure in a clause.  These structures should be
+     * essentially the same tree, but with different objects and details.
+     * @param clause Clause to build tree from
+     * @param parent Parent node to attach join node structure to
+     * @param sourceMap Map of group to source node, used for connecting children to join plan
+     * @param markJoinsInternal Flag saying whether joins built in this method should be marked
+     * as internal
+     * @throws MetaMatrixComponentException 
+     * @throws QueryMetadataException 
+     * @throws QueryValidatorException 
+     * @throws QueryResolverException 
+     */
+    void buildTree(FromClause clause, PlanNode parent)
+        throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException, QueryResolverException, QueryValidatorException {
+        
+        PlanNode node = null;
+        
+        if(clause instanceof UnaryFromClause) {
+            // No join required
+            UnaryFromClause ufc = (UnaryFromClause)clause;
+            GroupSymbol group = ufc.getGroup();
+            if (metadata.isVirtualGroup(group.getMetadataID())) {
+            	hints.hasVirtualGroups = true;
+            }
+            Command nestedCommand = ufc.getExpandedCommand();
+            if (nestedCommand == null && !group.isTempGroupSymbol() && !group.isProcedure() 
+            		&& (!(group.getMetadataID() instanceof TempMetadataID) || metadata.getVirtualPlan(group.getMetadataID()) != null)
+        	        && (metadata.isVirtualGroup(group.getMetadataID()))) { 
+            	//must be a view layer
+            	nestedCommand = resolveVirtualGroup(group);
+            }
+            node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+            node.addGroup(group);
+            if (nestedCommand != null) {
+            	addNestedCommand(node, group, nestedCommand, nestedCommand, true);
+            }
+            parent.addLastChild(node);
+        } else if(clause instanceof JoinPredicate) {
+            JoinPredicate jp = (JoinPredicate) clause;
+
+            // Set up new join node corresponding to this join predicate
+            node = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
+            node.setProperty(NodeConstants.Info.JOIN_TYPE, jp.getJoinType());
+            node.setProperty(NodeConstants.Info.JOIN_STRATEGY, JoinStrategyType.NESTED_LOOP);
+            node.setProperty(NodeConstants.Info.JOIN_CRITERIA, jp.getJoinCriteria());
+            
+            if (jp.getJoinType() == JoinType.JOIN_LEFT_OUTER) {
+            	hints.hasOptionalJoin = true;
+            }
+         
+            // Attach join node to parent
+            parent.addLastChild(node);
+
+            // Handle each child
+            FromClause[] clauses = new FromClause[] {jp.getLeftClause(), jp.getRightClause()};
+            for(int i=0; i<2; i++) {
+                buildTree(clauses[i], node);
+
+                // Add groups to joinNode
+                for (PlanNode child : node.getChildren()) {
+                    node.addGroups(child.getGroups());
+                }
+            }
+        } else if (clause instanceof SubqueryFromClause) {
+            SubqueryFromClause sfc = (SubqueryFromClause)clause;
+            GroupSymbol group = sfc.getGroupSymbol();
+            Command nestedCommand = sfc.getCommand();
+            node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+            node.addGroup(group);
+            addNestedCommand(node, group, nestedCommand, nestedCommand, true);
+            hints.hasVirtualGroups = true;
+            parent.addLastChild(node);
+        }
+        
+        if (clause.isOptional()) {
+            node.setProperty(NodeConstants.Info.IS_OPTIONAL, Boolean.TRUE);
+            hints.hasOptionalJoin = true;
+        }
+        
+        if (clause.isMakeDep()) {
+            node.setProperty(NodeConstants.Info.MAKE_DEP, Boolean.TRUE);
+        } else if (clause.isMakeNotDep()) {
+            node.setProperty(NodeConstants.Info.MAKE_NOT_DEP, Boolean.TRUE);
+        }
+    }
+
+	private void addNestedCommand(PlanNode node,
+			GroupSymbol group, Command nestedCommand, Command toPlan, boolean merge) throws QueryPlannerException,
+			MetaMatrixComponentException, QueryResolverException,
+			QueryValidatorException, QueryMetadataException {
+		if (nestedCommand instanceof QueryCommand) {
+			//remove unnecessary order by
+        	QueryCommand queryCommand = (QueryCommand)nestedCommand;
+        	if (queryCommand.getLimit() == null) {
+        		queryCommand.setOrderBy(null);
+        	}
+        }
+		node.setProperty(NodeConstants.Info.NESTED_COMMAND, nestedCommand);
+
+		if (merge && nestedCommand instanceof Query && QueryResolver.isXMLQuery((Query)nestedCommand, metadata)) {
+			merge = false;
+		}
+
+		if (merge) {
+			mergeTempMetadata(nestedCommand, parentCommand);
+		    PlanNode childRoot = generatePlan(nestedCommand);
+		    node.addFirstChild(childRoot);
+			List<SingleElementSymbol> projectCols = nestedCommand.getProjectedSymbols();
+			node.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(group, projectCols, metadata));
+		} else {
+			QueryMetadataInterface actualMetadata = metadata;
+			if (actualMetadata instanceof TempMetadataAdapter) {
+				actualMetadata = ((TempMetadataAdapter)metadata).getMetadata();
+			}
+			ProcessorPlan plan = QueryOptimizer.optimizePlan(toPlan, actualMetadata, null, capFinder, analysisRecord, context);
+		    node.setProperty(NodeConstants.Info.PROCESSOR_PLAN, plan);
+		}
+	}
+
+	/**
+	 * Attach all criteria above the join nodes.  The optimizer will push these
+	 * criteria down to the appropriate source.
+	 * @param plan Existing plan, which joins all source groups
+	 * @param criteria Criteria from query
+	 * @return Updated tree
+	 */
+	private static PlanNode attachCriteria(PlanNode plan, Criteria criteria, boolean isHaving) {
+	    List<Criteria> crits = Criteria.separateCriteriaByAnd(criteria);
+	    
+	    for (Criteria crit : crits) {
+            PlanNode critNode = createSelectNode(crit, isHaving);
+            attachLast(critNode, plan);
+            plan = critNode;
+        } 
+	    
+		return plan;
+	}
+
+    public static PlanNode createSelectNode(final Criteria crit, boolean isHaving) {
+        PlanNode critNode = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
+        critNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit);
+        if (isHaving && !AggregateSymbolCollectorVisitor.getAggregates(crit, false).isEmpty()) {
+            critNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
+        }
+        // Add groups to crit node
+        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit));
+        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(critNode.getCorrelatedReferenceElements()));
+        return critNode;
+    }
+
+	/**
+	 * Attach a grouping node at top of tree.
+	 * @param plan Existing plan
+	 * @param groupBy Group by clause, which may be null
+	 * @return Updated plan
+	 */
+	private static PlanNode attachGrouping(PlanNode plan, Query query, PlanHints hints) {
+		PlanNode groupNode = NodeFactory.getNewNode(NodeConstants.Types.GROUP);
+
+		GroupBy groupBy = query.getGroupBy();
+		if(groupBy != null) {
+			groupNode.setProperty(NodeConstants.Info.GROUP_COLS, groupBy.getSymbols());
+            groupNode.addGroups(GroupsUsedByElementsVisitor.getGroups(groupBy));
+		}
+
+		attachLast(groupNode, plan);
+        
+        // Mark in hints
+        hints.hasAggregates = true;
+        
+		return groupNode;
+	}
+
+    /**
+	 * Attach SORT node at top of tree.  The SORT may be pushed down to a source (or sources)
+	 * if possible by the optimizer.
+	 * @param plan Existing plan
+	 * @param orderBy Sort description from the query
+	 * @return Updated plan
+	 */
+	private static PlanNode attachSorting(PlanNode plan, OrderBy orderBy) {
+		PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT);
+		
+		sortNode.setProperty(NodeConstants.Info.SORT_ORDER, orderBy.getVariables());
+		sortNode.setProperty(NodeConstants.Info.ORDER_TYPES, orderBy.getTypes());
+		if (orderBy.hasUnrelated()) {
+			sortNode.setProperty(Info.UNRELATED_SORT, true);
+		}
+		sortNode.addGroups(GroupsUsedByElementsVisitor.getGroups(orderBy));
+
+		attachLast(sortNode, plan);
+		return sortNode;
+	}
+    
+    private static PlanNode attachTupleLimit(PlanNode plan, Limit limit, PlanHints hints) {
+        hints.hasLimit = true;
+        PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
+        
+        boolean attach = false;
+        if (limit.getOffset() != null) {
+            limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, limit.getOffset());
+            attach = true;
+        }
+        if (limit.getRowLimit() != null) {
+            limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, limit.getRowLimit());
+            attach = true;
+        }
+        if (attach) {
+            attachLast(limitNode, plan);
+            plan = limitNode;
+        }
+        return plan;
+    }
+
+	/**
+	 * Attach DUP_REMOVE node at top of tree.  The DUP_REMOVE may be pushed down
+	 * to a source (or sources) if possible by the optimizer.
+	 * @param plan Existing plan
+	 * @return Updated plan
+	 */
+	private static PlanNode attachDupRemoval(PlanNode plan) {
+		PlanNode dupNode = NodeFactory.getNewNode(NodeConstants.Types.DUP_REMOVE);
+		attachLast(dupNode, plan);
+		return dupNode;
+	}
+
+	private static PlanNode attachProject(PlanNode plan, Select select) {
+		PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
+		projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select.getProjectedSymbols());
+
+		// Set groups
+		projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select));
+
+		attachLast(projectNode, plan);
+		return projectNode;
+	}
+
+	static final void attachLast(PlanNode parent, PlanNode child) {
+		if(child != null) {
+			parent.addLastChild(child);
+		}
+	}
+
+    /**
+     * Adds temp metadata (if any) of child command to temp metadata
+     * (if any) of parent command.
+     * @param childCommand 
+     * @param parentCommand
+     */
+    static void mergeTempMetadata(
+        Command childCommand,
+        Command parentCommand) {
+        Map childTempMetadata = childCommand.getTemporaryMetadata();
+        if (childTempMetadata != null && !childTempMetadata.isEmpty()){
+            // Add to parent temp metadata
+            Map parentTempMetadata = parentCommand.getTemporaryMetadata();
+            if (parentTempMetadata == null){
+                parentCommand.setTemporaryMetadata(new HashMap(childTempMetadata));
+            } else {
+                parentTempMetadata.putAll(childTempMetadata);
+            }
+        }
+    }
+	
+    private Command resolveVirtualGroup(GroupSymbol virtualGroup)
+    throws QueryMetadataException, MetaMatrixComponentException, QueryResolverException, QueryValidatorException {
+    	
+        QueryNode qnode = null;
+        
+        Object metadataID = virtualGroup.getMetadataID();
+        boolean noCache = false;
+        boolean isMaterializedGroup = metadata.hasMaterialization(metadataID);
+        String cacheString = "select"; //$NON-NLS-1$
+        if( isMaterializedGroup) {
+            noCache = isNoCacheGroup(metadata, metadataID, option);
+        	if(noCache){
+        		//not use cache
+        		qnode = metadata.getVirtualPlan(metadataID);
+        		String matTableName = metadata.getFullName(metadata.getMaterialization(metadataID));
+        		recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.materialized_table_not_used"); //$NON-NLS-1$
+        	}else{
+                // Default query for a materialized group - go to cached table
+                String groupName = metadata.getFullName(metadataID);
+                String matTableName = metadata.getFullName(metadata.getMaterialization(metadataID));
+                qnode = new QueryNode(groupName, "SELECT * FROM " + matTableName); //$NON-NLS-1$
+                cacheString = "matview"; //$NON-NLS-1$
+                recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.Query_was_redirected_to_Mat_table"); //$NON-NLS-1$                
+        	}
+        } else {
+            // Not a materialized view - query the primary transformation
+            qnode = metadata.getVirtualPlan(metadataID);            
+        }
+
+        Command result = (Command)metadata.getFromMetadataCache(virtualGroup.getMetadataID(), "transformation/" + cacheString); //$NON-NLS-1$
+        if (result != null) {
+        	result = (Command)result.clone();
+        } else {
+        	//parse, resolve, validate
+        	result = convertToSubquery(qnode, metadata);
+	        QueryResolver.resolveCommand(result, Collections.EMPTY_MAP, metadata, analysisRecord);
+	        Request.validateWithVisitor(new ValidationVisitor(), metadata, result);
+	        metadata.addToMetadataCache(virtualGroup.getMetadataID(), "transformation/" + cacheString, result.clone()); //$NON-NLS-1$
+        }        
+        return QueryRewriter.rewrite(result, metadata, context);
+    }
+
+    public static boolean isNoCacheGroup(QueryMetadataInterface metadata,
+                                          Object metadataID,
+                                          Option option) throws QueryMetadataException,
+                                                        MetaMatrixComponentException {
+        if(option == null || !option.isNoCache()){
+            return false;
+        }
+    	if(option.getNoCacheGroups() == null || option.getNoCacheGroups().isEmpty()){
+    		//only OPTION NOCACHE, no group specified
+    		return true;
+    	}       
+    	for (String groupName : option.getNoCacheGroups()) {
+            try {
+                Object noCacheGroupID = metadata.getGroupID(groupName);
+                if(metadataID.equals(noCacheGroupID)){
+                    return true;
+                }
+            } catch (QueryMetadataException e) {
+                //log that an unknown groups was used in the no cache
+                LogManager.logWarning(LogConstants.CTX_QUERY_RESOLVER, e, QueryPlugin.Util.getString("SimpleQueryResolver.unknown_group_in_nocache", groupName)); //$NON-NLS-1$
+            }
+        }
+        return false;
+    }
+    
+    private static void recordMaterializationTableAnnotation(GroupSymbol virtualGroup,
+                                                      AnalysisRecord analysis,
+                                                      String matTableName, String msg) {
+        if ( analysis.recordAnnotations() ) {
+            Object[] params = new Object[] {virtualGroup, matTableName};
+            QueryAnnotation annotation = new QueryAnnotation(QueryAnnotation.MATERIALIZED_VIEW, 
+                                                         QueryPlugin.Util.getString(msg, params), 
+                                                         null, 
+                                                         QueryAnnotation.LOW);
+            analysis.addAnnotation(annotation);
+        }
+    }
+
+    private static Command convertToSubquery(QueryNode qnode, QueryMetadataInterface metadata)
+    throws QueryResolverException, MetaMatrixComponentException {
+
+        // Parse this node's command
+        Command command = qnode.getCommand();
+        
+        if (command == null) {
+            try {
+                command = QueryParser.getQueryParser().parseCommand(qnode.getQuery());
+            } catch(QueryParserException e) {
+                throw new QueryResolverException(e, ErrorMessageKeys.RESOLVER_0011, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0011, qnode.getGroupName()));
+            }
+            
+            //Handle bindings and references
+            List bindings = qnode.getBindings();
+            if (bindings != null){
+                BindVariableVisitor.bindReferences(command, bindings, metadata);
+            }
+        }
+
+        return command;
+    }
+
+}
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -343,7 +343,7 @@
 				break;
 			}
 		}
-		return (List<SubqueryContainer>) ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(toSearch);
+		return ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(toSearch);
 	}
         
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -68,7 +68,7 @@
 
 public class FrameUtil {
 
-    static void convertFrame(PlanNode startNode, GroupSymbol oldGroup, Set<GroupSymbol> newGroups, Map symbolMap, QueryMetadataInterface metadata) 
+    public static void convertFrame(PlanNode startNode, GroupSymbol oldGroup, Set<GroupSymbol> newGroups, Map symbolMap, QueryMetadataInterface metadata) 
         throws QueryPlannerException {
 
         PlanNode current = startNode;
@@ -486,12 +486,9 @@
      * Finds the closest project columns in the current frame
      */
     static List<SingleElementSymbol> findTopCols(PlanNode node) {
-        List projects = NodeEditor.findAllNodes(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE|NodeConstants.Types.PROJECT);
-        PlanNode project = null;
-        if (projects.isEmpty()) {
+    	PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
+        if (project == null) {
             project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
-        } else {
-            project = (PlanNode)projects.get(0);
         }
         if (project != null) {
             return (List<SingleElementSymbol>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
@@ -499,5 +496,9 @@
         Assertion.failed("no top cols in frame"); //$NON-NLS-1$
         return null;
     }
+    
+    public static boolean isOrderedLimit(PlanNode node) {
+    	return node.getType() == NodeConstants.Types.TUPLE_LIMIT && NodeEditor.findNodePreOrder(node, NodeConstants.Types.SORT, NodeConstants.Types.PROJECT | NodeConstants.Types.SET_OP) != null;
+    }
 
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinRegion.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinRegion.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinRegion.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -37,7 +37,7 @@
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.query.function.metadata.FunctionMethod;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
 import com.metamatrix.query.resolver.util.AccessPattern;
@@ -152,7 +152,7 @@
         }
         for (Iterator i = joinCriteria.iterator(); i.hasNext();) {
             Criteria crit = (Criteria)i.next();
-            criteriaNodes.add(GenerateCanonical.createSelectNode(crit, false));
+            criteriaNodes.add(RelationalPlanner.createSelectNode(crit, false));
         }
     }
     

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/NewCalculateCostUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/NewCalculateCostUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -36,7 +36,7 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.buffer.impl.BufferConfig;
+import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.query.QueryPlugin;
@@ -904,7 +904,7 @@
         
         float numberComparisons = merge?(leftChildCardinality + rightChildCardinality):(leftChildCardinality * rightChildCardinality);
         
-        float connectorBatchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
+        float connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
         if(context != null) {
             connectorBatchSize = context.getConnectorBatchSize(); 
         }
@@ -965,8 +965,8 @@
             return UNKNOWN_VALUE;
         }
 
-        float connectorBatchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
-        float processorBatchSize = BufferConfig.DEFAULT_PROCESSOR_BATCH_SIZE;
+        float connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
+        float processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
         if(context != null) {
             connectorBatchSize = context.getConnectorBatchSize();
             processorBatchSize = context.getProcessorBatchSize();

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,8 +35,8 @@
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
 import com.metamatrix.query.optimizer.relational.OptimizerRule;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.RuleStack;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
@@ -307,7 +307,7 @@
             DependentSetCriteria crit = new DependentSetCriteria(SymbolMap.getExpression(depExpr), id);
             crit.setValueExpression(indepExpr);
             
-            PlanNode selectNode = GenerateCanonical.createSelectNode(crit, false);
+            PlanNode selectNode = RelationalPlanner.createSelectNode(crit, false);
             
             selectNode.setProperty(NodeConstants.Info.IS_DEPENDENT_SET, Boolean.TRUE);
             result.add(selectNode);

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,7 +35,6 @@
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.optimizer.OptimizerContext;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.relational.OptimizerRule;
 import com.metamatrix.query.optimizer.relational.RuleStack;
@@ -68,7 +67,11 @@
                                                    MetaMatrixComponentException,
                                                    QueryPlannerException {
 
-        Set<String> groups = OptimizerContext.getOptimizerContext().getGroups();
+        Set<String> groups = context.getGroups();
+        if (groups == null) {
+        	groups = new HashSet<String>();
+        	context.setGroups(groups);
+        }
 
         boolean[] addtionalRules = new boolean[2];
 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -53,6 +53,7 @@
 import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
 import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
 import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
+import com.metamatrix.query.optimizer.relational.plantree.NodeConstants.Info;
 import com.metamatrix.query.resolver.util.ResolverUtil;
 import com.metamatrix.query.resolver.util.ResolverVisitor;
 import com.metamatrix.query.rewriter.QueryRewriter;
@@ -64,6 +65,7 @@
 import com.metamatrix.query.sql.lang.Select;
 import com.metamatrix.query.sql.lang.SetQuery.Operation;
 import com.metamatrix.query.sql.symbol.AggregateSymbol;
+import com.metamatrix.query.sql.symbol.AliasSymbol;
 import com.metamatrix.query.sql.symbol.Constant;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.Expression;
@@ -208,7 +210,20 @@
 		
 		//update the parent plan with the staged aggregates and the new projected symbols
 		List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(child, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
-		SymbolMap newParentMap = SymbolMap.createSymbolMap(child.getGroups().iterator().next(), projectedViewSymbols);
+		List<ElementSymbol> updatedVirturalElement = new ArrayList<ElementSymbol>(virtualElements);
+		
+		//hack to introduce aggregate symbols to the parent view TODO: this should change the metadata properly.
+		GroupSymbol virtualGroup = child.getGroups().iterator().next();
+		for (int i = updatedVirturalElement.size(); i < projectedViewSymbols.size(); i++) {
+			SingleElementSymbol symbol = projectedViewSymbols.get(i);
+			String name = symbol.getShortName();
+            String virtualElementName = virtualGroup.getCanonicalName() + ElementSymbol.SEPARATOR + name;
+            ElementSymbol virtualElement = new ElementSymbol(virtualElementName);
+            virtualElement.setGroupSymbol(virtualGroup);
+            virtualElement.setType(symbol.getType());
+            updatedVirturalElement.add(virtualElement);
+		}
+		SymbolMap newParentMap = SymbolMap.createSymbolMap(updatedVirturalElement, projectedViewSymbols);
 		child.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
 		Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
 		Iterator<AggregateSymbol> aggIter = aggregates.iterator();
@@ -276,6 +291,26 @@
 			QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
 			throws MetaMatrixComponentException, QueryPlannerException, QueryResolverException {
 		PlanNode originalNode = unionSource;
+		//branches other than the first need to have their projected column names updated
+		PlanNode sortNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
+		List<SingleElementSymbol> sortOrder = null;
+		if (sortNode != null) {
+			sortOrder = (List<SingleElementSymbol>)sortNode.getProperty(Info.SORT_ORDER);
+		}
+		List<SingleElementSymbol> projectCols = FrameUtil.findTopCols(unionSource);
+		for (int i = 0; i < virtualElements.size(); i++) {
+			ElementSymbol virtualElem = virtualElements.get(i);
+			SingleElementSymbol projectedSymbol = projectCols.get(i);
+			if (!projectedSymbol.getShortCanonicalName().equals(virtualElem.getShortCanonicalName())) {
+				if (sortOrder != null) {
+					int sortIndex = sortOrder.indexOf(projectedSymbol);
+					if (sortIndex > -1) {
+						updateSymbolName(sortOrder, sortIndex, virtualElem, sortOrder.get(sortIndex));
+					}
+				}
+				updateSymbolName(projectCols, i, virtualElem, projectedSymbol);
+			}
+		}
     	PlanNode intermediateView = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
     	unionSource.addAsParent(intermediateView);
     	unionSource = intermediateView;
@@ -303,7 +338,7 @@
 
         List<SingleElementSymbol> projectedViewSymbols = QueryRewriter.deepClone(projectedSymbols, SingleElementSymbol.class);
 
-        SymbolMap viewMapping = SymbolMap.createSymbolMap(NodeEditor.findParent(unionSource, NodeConstants.Types.SOURCE).getGroups().iterator().next(), projectedSymbols);
+        SymbolMap viewMapping = SymbolMap.createSymbolMap(NodeEditor.findParent(unionSource, NodeConstants.Types.SOURCE).getGroups().iterator().next(), projectedSymbols, metadata);
         for (AggregateSymbol agg : aggregates) {
         	agg = (AggregateSymbol)agg.clone();
         	ExpressionMappingVisitor.mapExpressions(agg, viewMapping.asMap());
@@ -344,6 +379,15 @@
         }
     }
 
+	private void updateSymbolName(List<SingleElementSymbol> projectCols, int i,
+			ElementSymbol virtualElem, SingleElementSymbol projectedSymbol) {
+		if (projectedSymbol instanceof AliasSymbol) {
+			((AliasSymbol)projectedSymbol).setName(virtualElem.getShortCanonicalName());
+		} else {
+			projectCols.set(i, new AliasSymbol(virtualElem.getShortCanonicalName(), projectedSymbol));
+		}
+	}
+
     /**
      * Walk up the plan from the GROUP node. Should encounter only (optionally) a SELECT and can stop at the PROJECT node. Need to
      * collect any AggregateSymbols used in the select criteria or projected columns.

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushNonJoinCriteria.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushNonJoinCriteria.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushNonJoinCriteria.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -32,8 +32,8 @@
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
 import com.metamatrix.query.optimizer.relational.OptimizerRule;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.RuleStack;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
@@ -144,7 +144,7 @@
      */
     private boolean pushCriteria(PlanNode joinNode,
                                   Criteria tgtCrit) {
-        PlanNode newCritNode = GenerateCanonical.createSelectNode(tgtCrit, false);
+        PlanNode newCritNode = RelationalPlanner.createSelectNode(tgtCrit, false);
         
         Set<GroupSymbol> groups = newCritNode.getGroups();
         
@@ -156,7 +156,7 @@
             if (FrameUtil.findOriginatingNode(innerJoinNodes[i], groups) != null) {
                 if (pushed) {
                     //create a new copy since the old one has been used
-                    newCritNode = GenerateCanonical.createSelectNode(tgtCrit, false);
+                    newCritNode = RelationalPlanner.createSelectNode(tgtCrit, false);
                 }
                 innerJoinNodes[i].addAsParent(newCritNode);
                 pushed = true;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,7 +25,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
@@ -316,7 +315,7 @@
                 }  
             
                 satisfyAccessPatterns(critNode, currentNode);
-            } else if (currentNode.getType() == NodeConstants.Types.TUPLE_LIMIT && currentNode.getChildCount() == 1 && currentNode.getFirstChild().getType() == NodeConstants.Types.SORT) {
+            } else if (FrameUtil.isOrderedLimit(currentNode)) {
                 return currentNode;
             } else if (currentNode.getType() == NodeConstants.Types.GROUP && critNode.hasBooleanProperty(NodeConstants.Info.IS_HAVING)) {
                 return currentNode;
@@ -330,8 +329,7 @@
 		throws QueryPlannerException {
         
         //ensure that the criteria can be pushed further
-        if (sourceNode.getChildCount() == 1 && sourceNode.getFirstChild().getType() == NodeConstants.Types.TUPLE_LIMIT && 
-                        sourceNode.getFirstChild().getChildCount() == 1 && sourceNode.getFirstChild().getFirstChild().getType() == NodeConstants.Types.SORT) {
+        if (sourceNode.getChildCount() == 1 && FrameUtil.isOrderedLimit(sourceNode.getFirstChild())) {
             return false;
         }
         
@@ -415,7 +413,7 @@
 
         Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
         
-        Collection elements = getElementsIncriteria(crit);
+        Collection<ElementSymbol> elements = getElementsIncriteria(crit);
                         
         boolean removeAps = satisfyAccessPatterns(aps, elements);
         if (removeAps) {
@@ -426,8 +424,8 @@
         Collections.sort(aps);
     }
     
-    static Collection getElementsIncriteria(Criteria crit) {
-        Collection elements = new HashSet();
+    static Collection<ElementSymbol> getElementsIncriteria(Criteria crit) {
+        Collection<ElementSymbol> elements = new HashSet<ElementSymbol>();
         boolean first = true;
         if(crit instanceof CompoundCriteria) {
             CompoundCriteria compCrit = (CompoundCriteria) crit;
@@ -450,7 +448,7 @@
      * @param elements
      * @return
      */
-    static boolean satisfyAccessPatterns(List<AccessPattern> aps, Collection elements) {
+    static boolean satisfyAccessPatterns(List<AccessPattern> aps, Collection<ElementSymbol> elements) {
     	for (AccessPattern ap : aps) {
             ap.getUnsatisfied().removeAll(elements);
             if (ap.getUnsatisfied().isEmpty()) {
@@ -484,39 +482,28 @@
         satisfyAccessPatterns(critNode, sourceNode);
         
         SymbolMap symbolMap = (SymbolMap) sourceNode.getProperty(NodeConstants.Info.SYMBOL_MAP);
-
+        SymbolMap childMap = symbolMap;
+        
 		// Move criteria to first child of union - names are the same, so no symbol mapping
-		LinkedList unionChildren = new LinkedList();
+		LinkedList<PlanNode> unionChildren = new LinkedList<PlanNode>();
 		collectUnionChildren(setOp, unionChildren);
 
         int movedCount = 0;
-		Iterator childIter = unionChildren.iterator();
-		PlanNode firstChild = (PlanNode) childIter.next();
-        GroupSymbol sourceGroup = sourceNode.getGroups().iterator().next();
-        
-        PlanNode firstBranchNode = NodeEditor.findNodePreOrder(firstChild, NodeConstants.Types.PROJECT);
-        
-        if(createConvertedSelectNode(critNode, virtualGroup, firstBranchNode, symbolMap)) {
-            movedCount++;
-        }
 
-        // Find project cols on first branch
-        List firstProjectCols = (List) firstBranchNode.getProperty(NodeConstants.Info.PROJECT_COLS);
-
-		// For each of the remaining children of the union, push separately
-		while(childIter.hasNext()) {
-		    PlanNode childNode = (PlanNode) childIter.next();
-
+        for (PlanNode planNode : unionChildren) {
 		      // Find first project node
-	        PlanNode projectNode = NodeEditor.findNodePreOrder(childNode, NodeConstants.Types.PROJECT);
+	        PlanNode projectNode = NodeEditor.findNodePreOrder(planNode, NodeConstants.Types.PROJECT);
 		    
-	        // Create symbol map
-            symbolMap = SymbolMap.createSymbolMap(sourceGroup, firstProjectCols, (List) projectNode.getProperty(NodeConstants.Info.PROJECT_COLS));
+	        if (childMap == null) {
+	        	childMap = SymbolMap.createSymbolMap(symbolMap.getKeys(), (List) projectNode.getProperty(NodeConstants.Info.PROJECT_COLS));
+	        }
 		    
 			// Move the node
-			if(createConvertedSelectNode(critNode, virtualGroup, projectNode, symbolMap)) {
+			if(createConvertedSelectNode(critNode, virtualGroup, projectNode, childMap)) {
                 movedCount++;
             }
+			
+			childMap = null; //create a new symbol map for the other children
 		}
         
 		//TODO - the logic here could be made more intelligent about EXCEPT and INTERSECT.
@@ -588,7 +575,7 @@
                 return false;
             }
             
-            Collection scalarSubqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(converted);
+            Collection<SubqueryContainer> scalarSubqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(converted);
             if (!scalarSubqueries.isEmpty()){
                 return false;
             }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -327,7 +327,7 @@
         
         //don't push criteria into an invalid location above an ordered limit - shouldn't happen 
         PlanNode limitNode = NodeEditor.findNodePreOrder(accessNode, NodeConstants.Types.TUPLE_LIMIT, NodeConstants.Types.SOURCE);
-        if (limitNode != null && NodeEditor.findNodePreOrder(limitNode, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE) != null) {
+        if (limitNode != null && FrameUtil.isOrderedLimit(limitNode)) {
         	return false;
         }
         

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -262,7 +262,7 @@
 					return areAggregatesCardinalityDependent(aggs);
 				}
 				case NodeConstants.Types.TUPLE_LIMIT: {
-					if (parent.getFirstChild().getType() == NodeConstants.Types.SORT) {
+					if (FrameUtil.isOrderedLimit(parent)) {
 						return true;
 					}
 				}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -27,7 +27,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -57,7 +56,6 @@
 import com.metamatrix.query.sql.symbol.Expression;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.symbol.Reference;
-import com.metamatrix.query.sql.visitor.CommandCollectorVisitor;
 import com.metamatrix.query.sql.visitor.ReferenceCollectorVisitor;
 import com.metamatrix.query.util.CommandContext;
 import com.metamatrix.query.util.ErrorMessageKeys;
@@ -91,16 +89,6 @@
         return query;
     }
 
-    static Command parseQuery(String queryStr) throws QueryPlannerException {
-        Command query = null;
-        try {
-            query = QueryParser.getQueryParser().parseCommand(queryStr);            
-        } catch (QueryParserException e) {
-            throw new QueryPlannerException(e, QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0054, new Object[]{queryStr}));
-        }
-        return query;
-    }
-    
     /** 
      * Resolve a command using the metadata in the planner environment.
      * @param query The query to resolve
@@ -113,7 +101,7 @@
         throws MetaMatrixComponentException, QueryPlannerException {
         // Run resolver
         try {
-            QueryResolver.resolveCommand(query, Collections.EMPTY_MAP, true, metadata, AnalysisRecord.createNonRecordingRecord());
+            QueryResolver.resolveCommand(query, Collections.EMPTY_MAP, metadata, AnalysisRecord.createNonRecordingRecord());
         } catch(QueryResolverException e) {
             throw new QueryPlannerException(e, e.getMessage());
         }
@@ -129,7 +117,7 @@
     static Command rewriteQuery(Command query, QueryMetadataInterface metadata, CommandContext context) 
         throws QueryPlannerException {
         try {
-            return QueryRewriter.rewrite(query, null, metadata, context);
+            return QueryRewriter.rewrite(query, metadata, context);
         } catch(QueryValidatorException e) {
             throw new QueryPlannerException(e, e.getMessage());
         }
@@ -236,33 +224,21 @@
     }
 
     
-    static List getReferences(Command query, boolean embeddedOnly) {
+    static List getReferences(Command command) {
         List boundList = new ArrayList();
         
-        Collection commands = null;
-        
-        if (embeddedOnly) {
-            commands = new LinkedList();
-        } else {
-            commands = new LinkedList(CommandCollectorVisitor.getNonEmbeddedCommands(query));
-        }
-        commands.add(query);
-        
-        for (Iterator cmds = commands.iterator(); cmds.hasNext();) {
-            Command command = (Command)cmds.next();
-            for (Iterator refs = ReferenceCollectorVisitor.getReferences(command).iterator(); refs.hasNext();) {
-                Reference ref = (Reference) refs.next();
-                Expression expr = ref.getExpression();
-                if (!(expr instanceof ElementSymbol)){
-                    continue;
-                }
-                ElementSymbol elem = (ElementSymbol)expr;
-                
-                if (!query.getExternalGroupContexts().getGroups().contains(elem.getGroupSymbol())) {
-                    continue;
-                }                
-                boundList.add(ref);
+        for (Iterator refs = ReferenceCollectorVisitor.getReferences(command).iterator(); refs.hasNext();) {
+            Reference ref = (Reference) refs.next();
+            Expression expr = ref.getExpression();
+            if (!(expr instanceof ElementSymbol)){
+                continue;
             }
+            ElementSymbol elem = (ElementSymbol)expr;
+            
+            if (!command.getExternalGroupContexts().getGroups().contains(elem.getGroupSymbol())) {
+                continue;
+            }                
+            boundList.add(ref);
         }
         return boundList;
     }     

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -46,7 +46,6 @@
 import com.metamatrix.query.mapping.xml.ResultSetInfo;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.CommandPlanner;
-import com.metamatrix.query.optimizer.CommandTreeNode;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.xml.Program;
@@ -79,31 +78,15 @@
 	 */
 	public XMLPlanner() {}
 
-    /**
-	 * @see com.metamatrix.query.optimizer.CommandPlanner#generateCanonical
-	 */
-	public void generateCanonical(CommandTreeNode rootNode, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
-	throws QueryPlannerException, MetaMatrixComponentException {
-		//Nothing to do here
-	}
-
 	/**
 	 * @see com.metamatrix.query.optimizer.CommandPlanner#optimize
 	 */
-	public ProcessorPlan optimize(CommandTreeNode node,IDGenerator idGenerator,QueryMetadataInterface metadata,CapabilitiesFinder capFinder,AnalysisRecord analysisRecord,CommandContext context)
+	public ProcessorPlan optimize(Command command,IDGenerator idGenerator,QueryMetadataInterface metadata,CapabilitiesFinder capFinder,AnalysisRecord analysisRecord,CommandContext context)
 		throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
         XMLPlannerEnvironment env = new XMLPlannerEnvironment(metadata);
 
-        // Check for XML results form property in parent CommandTreeNode (if any)
-        if (node.getParent() != null && node.getParent().getCommandType() == CommandTreeNode.TYPE_XQUERY_COMMAND){
-            String xmlFormResults = (String)node.getParent().getProperty(XMLPlannerEnvironment.XML_FORM_RESULTS_PROPERTY);
-            if (xmlFormResults != null){
-                env.xmlFormResults = xmlFormResults;
-            }
-        }
-
-		return XMLPlanner.preparePlan(node.getCommand(), metadata, analysisRecord, env, idGenerator, capFinder, context);
+		return XMLPlanner.preparePlan(command, metadata, analysisRecord, env, idGenerator, capFinder, context);
 	}
 
     /**

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlannerEnvironment.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlannerEnvironment.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlannerEnvironment.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -89,13 +89,6 @@
     // Context this command is running in
     CommandContext context;
     
-    /*
-     * The form the result documents should be in, either
-     * String or JDOM Document, see
-     * {@link XML_FORM_RESULTS_PROPERTY} 
-     */
-    String xmlFormResults;
-    
     // ################## Planning state ################## 
     private HashMap stagingResultsInfo = new HashMap();
     
@@ -119,9 +112,6 @@
     XMLProcessorEnvironment createProcessorEnvironment(Program mainProgram) {
         XMLProcessorEnvironment processorEnv = new XMLProcessorEnvironment(mainProgram);
         
-        if (this.xmlFormResults != null){
-            processorEnv.setXMLResultsForm(xmlFormResults);
-        }  
         processorEnv.setDocumentGroup(documentGroup);
         return processorEnv;
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -72,7 +72,6 @@
 import com.metamatrix.query.sql.symbol.Constant;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.symbol.Reference;
-import com.metamatrix.query.sql.visitor.ReferenceCollectorVisitor;
 import com.metamatrix.query.sql.visitor.StaticSymbolMappingVisitor;
 
 public class XMLQueryPlanner {
@@ -125,9 +124,6 @@
                     
                     QueryUtil.rewriteQuery(command, planEnv.getGlobalMetadata(), planEnv.context);
                     
-                    List references = QueryUtil.getReferences(command, false);
-                    rsInfo.setReferences(references);    
-                    
                     // Plan the result set.
                     ProcessorPlan queryPlan = optimizePlan(command, planEnv);
                     rsInfo.setPlan(queryPlan);                    
@@ -362,7 +358,7 @@
             QueryUtil.rewriteQuery(contextQuery, planEnv.getGlobalMetadata(), planEnv.context);
 
             //selectively replace correlated references with their actual element symbols
-            List bindings = QueryUtil.getReferences(contextQuery, true);
+            List bindings = QueryUtil.getReferences(contextQuery);
             
             QueryNode modifiedNode = new QueryNode(rsInfo.getResultSetName(), null);
             modifiedNode.setCommand(contextQuery);
@@ -426,13 +422,6 @@
         
         QueryUtil.resolveQuery(query, planEnv.getGlobalMetadata());
         
-        if (!implicit) {
-	        UnaryFromClause ufc = (UnaryFromClause)query.getFrom().getClauses().get(0);
-	        if (!ReferenceCollectorVisitor.getReferences(ufc.getExpandedCommand()).isEmpty()) {
-	        	throw new QueryPlannerException(QueryExecPlugin.Util.getString("XMLQueryPlanner.staging_table_has_input_set", stageGroupName)); //$NON-NLS-1$
-	        }
-        }
-        
         Command cmd = QueryUtil.rewriteQuery(query, planEnv.getGlobalMetadata(), planEnv.context);
                 
         ProcessorPlan plan = null;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLStagaingQueryPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLStagaingQueryPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLStagaingQueryPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -34,7 +34,7 @@
 import com.metamatrix.query.mapping.xml.MappingVisitor;
 import com.metamatrix.query.mapping.xml.Navigator;
 import com.metamatrix.query.mapping.xml.ResultSetInfo;
-import com.metamatrix.query.resolver.command.SimpleQueryResolver;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.sql.lang.Option;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
@@ -114,24 +114,24 @@
         
         //id as mapping class
         Object metadataID = planEnv.getGlobalMetadata().getGroupID(sourceNode.getResultName());
-        if (SimpleQueryResolver.isNoCacheGroup(planEnv.getGlobalMetadata(), metadataID, option)) {
+        if (RelationalPlanner.isNoCacheGroup(planEnv.getGlobalMetadata(), metadataID, option)) {
             return false;
         }
 
         //id as generated mapping class name
         metadataID = planEnv.getGlobalMetadata().getGroupID(sourceNode.getActualResultSetName());
-        if (SimpleQueryResolver.isNoCacheGroup(planEnv.getGlobalMetadata(), metadataID, option)) {
+        if (RelationalPlanner.isNoCacheGroup(planEnv.getGlobalMetadata(), metadataID, option)) {
             return false;
         }
         
         // get the original transformation of the mapping class before planning. 
         Query stagableQuery = (Query)QueryUtil.getQueryFromQueryNode(groupName, planEnv);
         
-        Collection groups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(stagableQuery, false);
+        Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(stagableQuery, false);
         
         //check for already staged queries
         if (groups.size() == 1) {
-            GroupSymbol group = (GroupSymbol)groups.iterator().next();
+            GroupSymbol group = groups.iterator().next();
             group = QueryUtil.createResolvedGroup((GroupSymbol)group.clone(), planEnv.getGlobalMetadata());
             if (planEnv.isStagingTable(group.getMetadataID()) && stagableQuery.getCriteria() == null) {
                 return false;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xquery/XQueryPlanner.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xquery/XQueryPlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/optimizer/xquery/XQueryPlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -29,13 +29,10 @@
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.CommandPlanner;
-import com.metamatrix.query.optimizer.CommandTreeNode;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
-import com.metamatrix.query.optimizer.xml.XMLPlannerEnvironment;
 import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.processor.xml.XMLProcessorEnvironment;
 import com.metamatrix.query.processor.xquery.XQueryPlan;
-import com.metamatrix.query.sql.lang.ProcedureContainer;
+import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.XQuery;
 import com.metamatrix.query.util.CommandContext;
 
@@ -45,27 +42,12 @@
 public class XQueryPlanner implements CommandPlanner {
 
     /**
-     * @see com.metamatrix.query.optimizer.CommandPlanner#generateCanonical(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
+     * @see com.metamatrix.query.optimizer.CommandPlanner#optimize(Command, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
      */
-    public void generateCanonical(CommandTreeNode node, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
+    public ProcessorPlan optimize(Command command, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
         throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
 
-        //indicate child XML results should be as JDOM Documents
-        node.setProperty(XMLPlannerEnvironment.XML_FORM_RESULTS_PROPERTY, XMLProcessorEnvironment.JDOM_DOCUMENT_RESULT);
+    	return new XQueryPlan((XQuery)command);        
     }
 
-    /**
-     * @see com.metamatrix.query.optimizer.CommandPlanner#optimize(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)
-     */
-    public ProcessorPlan optimize(CommandTreeNode node, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
-        throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
-    	String parentGroup = null;
-    	if (node.getParent() != null && node.getParent().getCommand() instanceof ProcedureContainer) {
-    		parentGroup = ((ProcedureContainer)node.getParent().getCommand()).getGroup().getCanonicalName();
-    	}
-    	
-    	return new XQueryPlan((XQuery)node.getCommand(), parentGroup);        
-    }
-
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/parser/QueryParser.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/parser/QueryParser.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/parser/QueryParser.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -32,9 +32,6 @@
 import com.metamatrix.query.sql.lang.Criteria;
 import com.metamatrix.query.sql.lang.Option;
 import com.metamatrix.query.sql.lang.XQuery;
-import com.metamatrix.query.sql.proc.Block;
-import com.metamatrix.query.sql.proc.CriteriaSelector;
-import com.metamatrix.query.sql.proc.Statement;
 import com.metamatrix.query.sql.symbol.Expression;
 import com.metamatrix.query.xquery.XQueryExpression;
 import com.metamatrix.query.xquery.saxon.SaxonXQueryExpression;
@@ -44,9 +41,6 @@
  * QueryParser can be reused but is NOT thread-safe as the parser uses an
  * input stream.  Putting multiple queries into the same stream will result
  * in unpredictable and most likely incorrect behavior.</p>
- *
- * <p>In the future this class may hide a single- or multi-thread cache
- * of parsed queries. </p>
  */
 public class QueryParser {
     
@@ -66,7 +60,7 @@
     
     private static final String XQUERY_DECLARE = "declare"; //$NON-NLS-1$
     private static final String XML_OPEN_BRACKET = "<"; //$NON-NLS-1$
-    private static final String BOGUS_SELECT = "select x "; //$NON-NLS-1$
+    private static final String XML_CLOSE_BRACKET = ">"; //$NON-NLS-1$
 
 	private SQLParser parser;
     
@@ -119,37 +113,39 @@
             throw new QueryParserException(QueryPlugin.Util.getString("QueryParser.emptysql")); //$NON-NLS-1$
         }
         
-        // For XQueries
-        int type = getCommandType(sql);
-        if (type == Command.TYPE_XQUERY || type == Command.TYPE_UNKNOWN){
+        QueryParserException qpe = null;
+        try {
+	        Command result = parseCommandWithParser(sql, parseInfo);
+			return result;
+        } catch (QueryParserException e) {
+        	qpe = e;
+        }
+        
+        try {
+            // Check for OPTION
+            Option option = null;
+            int closeBracket = sql.lastIndexOf(XML_CLOSE_BRACKET);
+            int optionIndex = sql.toUpperCase().lastIndexOf(ReservedWords.OPTION);
+            if (optionIndex != -1 && optionIndex > closeBracket){
+                String optionSQL = sql.substring(optionIndex);
+                option = getOption(optionSQL, parseInfo);
+                sql = sql.substring(0, optionIndex-1);
+            }
             
-            try {
-                
-                // Check for OPTION
-                Option option = null;
-                int optionIndex = sql.toUpperCase().lastIndexOf(ReservedWords.OPTION);
-                if (optionIndex != -1){
-                    String optionSQL = sql.substring(optionIndex);
-                    option = getOption(optionSQL);
-                    sql = sql.substring(0, optionIndex-1);
-                }
-                
-                XQueryExpression expr = new SaxonXQueryExpression();
-                expr.compileXQuery(sql);
-                XQuery xquery = new XQuery(sql, expr);
-                if (option != null){
-                    xquery.setOption(option);
-                }
-                return xquery;        
-            } catch (MetaMatrixProcessingException e) {
-                if (type == Command.TYPE_XQUERY){
-                    throw new QueryParserException(QueryPlugin.Util.getString("QueryParser.xqueryCompilation", e.getMessage())); //$NON-NLS-1$
-                } // else let unknown query type fall through to code below for better error handling
+            XQueryExpression expr = new SaxonXQueryExpression();
+            expr.compileXQuery(sql);
+            XQuery xquery = new XQuery(sql, expr);
+            if (option != null){
+                xquery.setOption(option);
             }
+            return xquery;        
+        } catch (MetaMatrixProcessingException e) {
+            if(sql.startsWith(XML_OPEN_BRACKET) || sql.startsWith(XQUERY_DECLARE)) {
+            	throw new QueryParserException(e, QueryPlugin.Util.getString("QueryParser.xqueryCompilation")); //$NON-NLS-1$
+            }
         }
 
-        Command result = parseCommandWithParser(sql, parseInfo);
-		return result;
+        throw qpe;
 	}
 
     /**
@@ -157,10 +153,18 @@
      * @param optionSQL option SQL
      * @return Option object
      */
-    private Option getOption(String optionSQL) throws QueryParserException {
-        String sql = BOGUS_SELECT + optionSQL;
-        Command command = parseCommandWithParser(sql, new ParseInfo());
-        return command.getOption();
+    private Option getOption(String optionSQL, ParseInfo parseInfo) throws QueryParserException {
+    	Option result = null;
+        try{
+            result = getSqlParser(optionSQL).option(parseInfo);
+            
+        } catch(ParseException pe) {
+            throw convertParserException(pe);
+
+        } catch(TokenMgrError tme) {
+            handleTokenMgrError(tme);
+        }
+        return result;
     }
 
     /**
@@ -184,35 +188,6 @@
     }
 
     /**
-     * Takes a SQL string representing an SQL statement
-     * and returns the procedure object representation.
-     * @param stmt SQL statement string
-     * @return Statement Procedure object representation
-     * @throws QueryParserException if parsing fails
-     * @throws IllegalArgumentException if stmt is null
-     */
-     Statement parseStatement(String stmt) throws QueryParserException {
-        if(stmt == null) {
-            throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.nullSqlCrit")); //$NON-NLS-1$
-        }
-
-        ParseInfo dummyInfo = new ParseInfo();
-
-        Statement result = null;
-        try{
-            result = getSqlParser(stmt).statement(dummyInfo);
-
-        } catch(ParseException pe) {
-            throw convertParserException(pe);
-
-        } catch(TokenMgrError tme) {
-            handleTokenMgrError(tme);
-        }
-        return result;
-    }
-
-
-    /**
      * Takes a SQL string representing an SQL criteria (i.e. just the WHERE
      * clause) and returns the object representation.
      * @param sql SQL criteria (WHERE clause) string
@@ -240,65 +215,11 @@
         return result;
     }
 
-    /**
-     * Takes a SQL string representing a block
-     * and returns the object representation.
-     * @param block Block string
-     * @return Block Block object representation
-     * @throws QueryParserException if parsing fails
-     * @throws IllegalArgumentException if sql is null
-     */
-     Block parseBlock(String block) throws QueryParserException {
-        if(block == null) {
-            throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.nullBlock")); //$NON-NLS-1$
-        }
-
-        ParseInfo dummyInfo = new ParseInfo();
-
-        Block result = null;
-        try{
-            result = getSqlParser(block).block(dummyInfo);
-
-        } catch(ParseException pe) {
-            throw convertParserException(pe);
-
-        } catch(TokenMgrError tme) {
-            handleTokenMgrError(tme);
-        }
-        return result;
-    }
-     
     private QueryParserException convertParserException(ParseException pe) {
         return new QueryParserException(QueryPlugin.Util.getString("QueryParser.parsingError", pe.getMessage())); //$NON-NLS-1$                        
     }
 
     /**
-     * Takes a SQL string representing a criteria selector
-     * and returns the object representation.
-     * @param selector criteria selector string
-     * @return CriteriaSelector CriteriaSelector object representation
-     * @throws QueryParserException if parsing fails
-     * @throws IllegalArgumentException if sql is null
-     */
-    CriteriaSelector parseCriteriaSelector(String selector) throws QueryParserException {
-        if(selector == null) {
-            throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.nullSqlCrit")); //$NON-NLS-1$
-        }
-
-        CriteriaSelector result = null;
-        try{
-            result = getSqlParser(selector).criteriaSelector();
-
-        } catch(ParseException pe) {
-            throw convertParserException(pe);
-
-        } catch(TokenMgrError tme) {
-            handleTokenMgrError(tme);
-        }
-        return result;
-    }
-
-    /**
      * Takes a SQL string representing an SQL expression
      * and returns the object representation.
      * @param sql SQL expression string
@@ -363,54 +284,4 @@
         throw new QueryParserException(QueryPlugin.Util.getString("QueryParser.parsingError", tme.getMessage())); //$NON-NLS-1$
     }
 
-	/**
-	 * Takes a SQL string and determines the command type, as defined in the constants
-	 * of {@link com.metamatrix.query.sql.lang.Command}.
-	 * @param sql SQL string
-	 * @return Command type code, as defined in {@link com.metamatrix.query.sql.lang.Command}.
-     * Note: not all XQuery queries will necessarily be detected - if type UNKNOWN is indicated
-     * it's possible it is an XQuery.
-	 * @throws IllegalArgumentException if sql is null
-	 */
-	public static int getCommandType(String sql) {
-		if(sql == null) {
-            throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.emptysql")); //$NON-NLS-1$
-		}
-
-        // Shortcut for most XQuery commands
-        if(sql.startsWith(XML_OPEN_BRACKET) || sql.startsWith(XQUERY_DECLARE)) {
-            return Command.TYPE_XQUERY;
-        }
-
-		int startCommand = -1;
-		for(int index = 0; index < sql.length(); index++) {
-			char c = sql.charAt(index);
-			if(Character.isLetter(c) || c == '{') {
-			    startCommand = index;
-			    break;
-			} 
-		}
-
-		if(startCommand == -1) {
-			return Command.TYPE_UNKNOWN;
-		}
-
-		String commandWord = sql.substring(startCommand, Math.min(startCommand+6, sql.length())).toUpperCase();
-        if(commandWord.startsWith(ReservedWords.SELECT)) {
-			return Command.TYPE_QUERY;
-		} else if(commandWord.startsWith(ReservedWords.INSERT)) {
-			return Command.TYPE_INSERT;
-		} else if(commandWord.startsWith(ReservedWords.UPDATE)) {
-			return Command.TYPE_UPDATE;
-		} else if(commandWord.startsWith(ReservedWords.DELETE)) {
-			return Command.TYPE_DELETE;
-		} else if(commandWord.startsWith(ReservedWords.EXEC) || commandWord.startsWith("{")) { //$NON-NLS-1$
-			return Command.TYPE_STORED_PROCEDURE;
-        } else if(commandWord.startsWith(ReservedWords.CREATE)) { 
-            return Command.TYPE_UPDATE_PROCEDURE;
-		} else {
-			return Command.TYPE_UNKNOWN;
-		}
-	}
-
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -106,7 +106,7 @@
      * Check if this is a valid string literal
      * @param id Possible string literal
      */
-    boolean isStringLiteral(String str, ParseInfo info) throws ParseException {
+    boolean isStringLiteral(String str, ParseInfo info) {
     	if (info.useAnsiQuotedIdentifiers() || str.charAt(0) != '"' || str.charAt(str.length() - 1) != '"') {
     		return false;
     	}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BaseProcessorPlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BaseProcessorPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BaseProcessorPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.query.util.CommandContext;
-
-/**
- */
-public abstract class BaseProcessorPlan implements ProcessorPlan{
-
-    private List warnings = null;
-    
-    private CommandContext context;
-
-    /**
-     * Constructor for BaseProcessorPlan.
-     */
-    public BaseProcessorPlan() {
-        super();
-    }
-
-    /**
-     * @see com.metamatrix.query.processor.ProcessorPlan#getAndClearWarnings()
-     */
-    public List getAndClearWarnings() {
-        if (warnings == null) {
-            return null;
-        }
-        List copied = warnings;
-        warnings = null;
-        return copied;
-    }
-
-    protected void addWarning(MetaMatrixException warning) {
-        if (warnings == null) {
-            warnings = new ArrayList(1);
-        }
-        warnings.add(warning);
-    }
-
-    /**
-     * @return
-     */
-    public CommandContext getContext() {
-        return context;
-    }
-
-    /**
-     * @param context
-     */
-    public void setContext(CommandContext context) {
-        this.context = context;
-    }
-
-    public void reset() {
-        warnings = null;
-    }       
-
-	public abstract Object clone();
-
-}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchCollector.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/query/processor/BatchCollector.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchCollector.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchCollector.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.processor;
+
+import java.util.List;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.BlockedException;
+import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.common.buffer.TupleBuffer;
+
+public class BatchCollector {
+	
+	public interface BatchProducer {
+	    /**
+	     * Get a batch of results or possibly an Exception.
+	     * @return Batch of results
+	     * @throws BlockedException indicating next batch is not available yet
+	     * @throws MetaMatrixComponentException for non-business rule exception
+	     * @throws MetaMatrixProcessingException for business rule exception, related
+	     * to user input or modeling
+	     */
+	    TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException;
+	    
+	    /**
+	     * Get list of resolved elements describing output columns for this plan.
+	     * @return List of SingleElementSymbol
+	     */
+	    List getOutputElements();
+	}
+	
+	public interface BatchHandler {
+		void batchProduced(TupleBatch batch) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+	}
+
+    private BatchProducer sourceNode;
+    private BatchHandler batchHandler;
+
+    private boolean done = false;
+    private TupleBuffer buffer;
+    private boolean collectedAny;
+    
+    public BatchCollector(BatchProducer sourceNode, TupleBuffer buffer) {
+        this.sourceNode = sourceNode;
+        this.buffer = buffer;
+    }
+
+    public TupleBuffer collectTuples() throws MetaMatrixComponentException, MetaMatrixProcessingException {
+        TupleBatch batch = null;
+    	while(!done) {
+            batch = sourceNode.nextBatch();
+
+            flushBatch(batch);
+
+            // Check for termination condition
+            if(batch.getTerminationFlag()) {
+            	done = true;
+            	buffer.close();
+                break;
+            }
+        }
+        return buffer;
+    }
+    
+    public TupleBuffer getTupleBuffer() {
+		return buffer;
+	}
+    
+    /**
+     * Flush the batch by giving it to the buffer manager.
+     */
+    private void flushBatch(TupleBatch batch) throws MetaMatrixComponentException, MetaMatrixProcessingException {
+    	// Add batch
+        if(batch.getRowCount() > 0) {
+        	for (List tuple : batch.getAllTuples()) {
+				buffer.addTuple(tuple);
+			}
+            collectedAny = true;
+        }
+		if (this.batchHandler != null && (batch.getRowCount() > 0 || batch.getTerminationFlag())) {
+        	this.batchHandler.batchProduced(batch);
+        }
+    }
+    
+	public void setBatchHandler(BatchHandler batchHandler) {
+		this.batchHandler = batchHandler;
+	}
+    
+    public boolean collectedAny() {
+		boolean result = collectedAny;
+		collectedAny = false;
+		return result;
+	}
+    
+    public int getRowCount() {
+        return buffer.getRowCount();
+    }
+    
+    public boolean isDone() {
+		return done;
+	}
+
+}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchIterator.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/query/processor/BatchIterator.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchIterator.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/BatchIterator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.query.processor;
+
+import java.util.List;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.IndexedTupleSource;
+import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.query.processor.BatchCollector.BatchProducer;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
+
+public class BatchIterator implements
+                                 IndexedTupleSource {
+
+    private final BatchProducer source;
+
+    public BatchIterator(BatchProducer source) {
+        this.source = source;
+    }
+
+    private boolean done;
+    private int currentRow = 1;
+    private TupleBatch currentBatch;
+    private List currentTuple;
+
+    public boolean hasNext() throws MetaMatrixComponentException,
+                            MetaMatrixProcessingException {
+        if (done) {
+            return false;
+        }
+        while (currentTuple == null) {
+            if (currentBatch == null) {
+                currentBatch = this.source.nextBatch();
+            }
+
+            if (currentBatch.getEndRow() >= currentRow) {
+                this.currentTuple = currentBatch.getTuple(currentRow++);
+            } else {
+                done = currentBatch.getTerminationFlag();
+                currentBatch = null;
+                if (done) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+    
+    @Override
+    public void closeSource() throws MetaMatrixComponentException {
+    	
+    }
+    
+    @Override
+    public List<SingleElementSymbol> getSchema() {
+    	return source.getOutputElements();
+    }
+    
+    @Override
+    public List<?> nextTuple() throws MetaMatrixComponentException,
+    		MetaMatrixProcessingException {
+        if (currentTuple == null && !hasNext()) {
+            return null;
+        }
+        List result = currentTuple;
+        currentTuple = null;
+        return result;
+    }
+
+    public void reset() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void mark() {
+        //does nothing
+    }
+
+    @Override
+    public int getCurrentIndex() {
+        return currentRow;
+    }
+
+    public void setPosition(int position) {
+    	if (position == this.currentRow) {
+    		return;
+    	}
+		if (position < this.currentRow && (this.currentBatch == null || position < this.currentBatch.getBeginRow())) {
+			throw new UnsupportedOperationException("Backwards positioning is not allowed"); //$NON-NLS-1$
+		}
+        this.currentRow = position;
+        this.currentTuple = null;
+        if (currentBatch.getEndRow() < currentRow) {
+        	this.currentBatch = null;
+        }
+    }
+    
+}

Copied: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/CollectionTupleSource.java (from rev 1724, trunk/engine/src/main/java/com/metamatrix/query/processor/CollectionTupleSource.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/CollectionTupleSource.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/CollectionTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.processor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import com.metamatrix.common.buffer.TupleSource;
+import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
+
+public class CollectionTupleSource implements TupleSource {
+	
+	private Iterator<? extends List<?>> tuples;
+	private List<SingleElementSymbol> schema;
+
+	public static CollectionTupleSource createUpdateCountTupleSource(int count) {
+		return new CollectionTupleSource(Arrays.asList(Arrays.asList(count)).iterator(), Command.getUpdateCommandSymbol());
+	}
+	
+	public static CollectionTupleSource createNullTupleSource(List<SingleElementSymbol> schema) {
+		return new CollectionTupleSource(new ArrayList<List<Object>>(0).iterator(), schema);
+	}
+	
+	public CollectionTupleSource(Iterator<? extends List<?>> tuples,
+			List<SingleElementSymbol> schema) {
+		this.tuples = tuples;
+		this.schema = schema;
+	}
+
+	@Override
+	public List<?> nextTuple() {
+		if (tuples.hasNext()) {
+			return tuples.next();
+		}
+		return null;
+	}
+	
+	@Override
+	public List<SingleElementSymbol> getSchema() {
+		return schema;
+	}
+	
+	@Override
+	public void closeSource() {
+		
+	}
+}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/NullTupleSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/NullTupleSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/NullTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor;
-
-import java.util.List;
-
-import com.metamatrix.common.buffer.TupleSource;
-
-/**
- * <p>This class can be used to represent null tuples or no data for an
- * atomic query execution. Example usage is in implementation of partial
- * results feature where we have to return null tuples if there is an error
- * in the execution of atomic query.</p>
- */
-
-public class NullTupleSource implements TupleSource {
-
-	private List elements; // elementSymbols containing null tuples
-	
-	/**
-	 * <p>Constructor that takes the list of elementSymbols
-	 * that have null rows.</p>
-	 * @param elements List of elementSymbols that this source contains.
-	 */	
-	public NullTupleSource(List elements) {
-		this.elements = elements;
-	}
-	
-    /**
-     * @see TupleSource#getSchema()
-     */
-    public List getSchema() {
-        return this.elements;
-    }
-    
-	/**
-	 * <p>Open the tuple source to read tuples. This method does nothing.</p>
-	 */
-	public void openSource() {
-		// do nothing
-	}
-
-	/**
-	 * <p>This method returns a null indicating, that there are no
-	 * rows in the source.</p>
-	 * @return list containing the values of the next tuple.
-	 */
-	public List nextTuple() {
-		return null;
-	}
-	
-	/**
-	 * <p>Close the tuple source after reading tuples. This method does nothing.</p>
-	 */	
-	public void closeSource() {
-		// do nothing
-	}
-
-} // END CLASS

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,12 +22,15 @@
 
 package com.metamatrix.query.processor;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.*;
+import com.metamatrix.query.processor.BatchCollector.BatchProducer;
 import com.metamatrix.query.util.CommandContext;
 
 /**
@@ -43,7 +46,11 @@
  * the call to {@link #close}.
  * </p>
  */
-public interface ProcessorPlan extends Cloneable, Describable {
+public abstract class ProcessorPlan implements Cloneable, Describable, BatchProducer {
+	
+    private List warnings = null;
+    
+    private CommandContext context;
 
 	/**
 	 * Initialize the plan with some required pieces of data for making 
@@ -55,7 +62,7 @@
 	 * @param dataMgr Data manager reference
      * @param bufferMgr Buffer manager reference
 	 */
-	void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr);
+	public abstract void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr);
 	
     /**
      * Get all warnings found while processing this plan.  These warnings may
@@ -64,30 +71,52 @@
      * the current warnings list.  The warnings are in order they were detected.
      * @return Current list of warnings, never null
      */
-    List<Exception> getAndClearWarnings();
+    public List getAndClearWarnings() {
+        if (warnings == null) {
+            return null;
+        }
+        List copied = warnings;
+        warnings = null;
+        return copied;
+    }
     
+    protected void addWarning(MetaMatrixException warning) {
+        if (warnings == null) {
+            warnings = new ArrayList(1);
+        }
+        warnings.add(warning);
+    }
+
     /**
      * Reset a plan so that it can be processed again.
      */
-    void reset();
+    public void reset() {
+    	this.warnings = null;
+    }
     
     /**
      * Get list of resolved elements describing output columns for this plan.
      * @return List of SingleElementSymbol
      */
-    List getOutputElements();
+    public abstract List getOutputElements();
     
     /**
      * Get the processor context, which can be modified.
      * @return context object
      */
-    CommandContext getContext();
+    public CommandContext getContext() {
+        return context;
+    }
     
+    public void setContext(CommandContext context) {
+		this.context = context;
+	}
+    
     /**
      * Open the plan for processing.
      * @throws MetaMatrixComponentException
      */
-    void open() throws MetaMatrixComponentException, MetaMatrixProcessingException;
+    public abstract void open() throws MetaMatrixComponentException, MetaMatrixProcessingException;
     
     /**
      * Get a batch of results or possibly an Exception.
@@ -97,15 +126,14 @@
      * @throws MetaMatrixProcessingException for business rule exception, related
      * to user input or modeling
      */
-    TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException;
+    public abstract TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException;
 
     /**
      * Close the plan after processing.
      * @throws MetaMatrixComponentException
      */
-    void close() throws MetaMatrixComponentException;
+    public abstract void close() throws MetaMatrixComponentException;
     
-	
 	/**
 	 * Return a safe clone of the ProcessorPlan.  A ProcessorPlan may only be
 	 * safely cloned in between processings.  That is, it is only safe to clone
@@ -114,12 +142,12 @@
 	 * @return safe clone of this ProcessorPlan, as long as it is not open for
 	 * processing
 	 */
-	Object clone();
+	public abstract ProcessorPlan clone();
     
     /**
      * Finds all nested plans and returns them.
      * @return List of ProcessorPlan 
      * @since 4.2
      */
-    Collection getChildPlans();
+    public abstract Collection getChildPlans();
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,43 +30,33 @@
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.query.execution.QueryExecPlugin;
+import com.metamatrix.query.processor.BatchCollector.BatchProducer;
 import com.metamatrix.query.util.CommandContext;
 
-/**
- * TODO: combine overlapping responsibilities with RequestWorkItem
- */
-public class QueryProcessor {
+public class QueryProcessor implements BatchProducer {
 	
 	public interface ProcessorFactory {
 		QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext) throws MetaMatrixProcessingException, MetaMatrixComponentException;
 	}
 	
-	public interface BatchHandler {
-		void batchProduced(TupleBatch batch) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-	}
-
-	private TupleSourceID resultsID;
     private CommandContext context;
 	private ProcessorDataManager dataMgr;
-    private BufferManager bufferMgr;
+	private BufferManager bufferMgr;
 	private ProcessorPlan processPlan;
     private boolean initialized = false;
     /** Flag that marks whether the request has been canceled. */
     private volatile boolean requestCanceled = false;
-    private volatile boolean requestClosed = false;
     private static final int DEFAULT_WAIT = 50;       
     private boolean processorClosed = false;
-    private BatchHandler batchHandler;
     private volatile int highestRow;
+    
+    private boolean nonBlocking = false;
          
     /**
      * Construct a processor with all necessary information to process.
@@ -79,12 +69,10 @@
     public QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, ProcessorDataManager dataMgr) throws MetaMatrixComponentException {
         this.context = context;
 		this.dataMgr = dataMgr;
-        this.bufferMgr = bufferMgr;
 		this.processPlan = plan;
-
+		this.bufferMgr = bufferMgr;
 		// Add data manager to all nodes in tree
 		this.processPlan.initialize(context, this.dataMgr, bufferMgr);
-        this.resultsID = bufferMgr.createTupleSource(processPlan.getOutputElements(), context.getConnectionID(), TupleSourceType.PROCESSOR);
     }
     
     public CommandContext getContext() {
@@ -95,123 +83,98 @@
 		return this.context.getProcessorID();
 	}
 	
-	public TupleSourceID getResultsID() {
-		return resultsID;
-	}
-
     public ProcessorPlan getProcessorPlan() {
         return this.processPlan;
     }
 
-	private void initialize()
-		throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
-
-		// initialize if necessary
-		if(! initialized) {
-			// Open the top node for reading
-			processPlan.open();
-
-            initialized = true;
-		}
-	}
-
-	/**
-	 * Process fully blocking
-	 * @throws MetaMatrixCoreException 
-	 */
-	public void process()
+	public TupleBatch nextBatch()
 		throws BlockedException, MetaMatrixProcessingException, MetaMatrixComponentException {
-
-        while(true) {
-        	try {
-        		if (process(Integer.MAX_VALUE)) {
-            		break;
-            	}
-        	} catch(BlockedException e) {
-                try {
-                    Thread.sleep(DEFAULT_WAIT);
-                } catch (InterruptedException err) {
-                    throw new MetaMatrixComponentException(err);
-                }
-        	}             	
-        }        
+		
+	    while (true) {
+	    	try {
+	    		return nextBatchDirect();
+	    	} catch (BlockedException e) {
+	    		if (nonBlocking) {
+	    			try {
+	                    Thread.sleep(DEFAULT_WAIT);
+	                } catch (InterruptedException err) {
+	                    throw new MetaMatrixComponentException(err);
+	                }
+	    			continue;
+	    		}
+	    		throw e;
+	    	}
+	    }
 	}
-    
-	/**
-	 * Process until time expires or a {@link BlockedException} occurs
-	 * @param time
-	 * @return
-	 */
-	public boolean process(long time)
+	
+	private TupleBatch nextBatchDirect()
 		throws BlockedException, MetaMatrixProcessingException, MetaMatrixComponentException {
 		
 	    boolean done = false;
+	    TupleBatch result = null;
 		
 	    try {
-			// Will only initialize the first time process() is called
-			initialize();
+	    	// initialize if necessary
+			if(! initialized) {
+				// Open the top node for reading
+				processPlan.open();
 	
-			long start = System.currentTimeMillis();
-
-            while(System.currentTimeMillis() - start < time && !requestClosed && !processorClosed) {
-                checkState();
-
-                TupleBatch batch = processPlan.nextBatch();
-                flushBatch(batch);
-
-            	if(batch.getTerminationFlag()) {
-            		done = true;
-            		break;
-            	}
-            }
-        } catch (BlockedException e) {
-            throw e;
-        } catch (MetaMatrixException e) {
-        	try {
-        		closeProcessing();
-        	} catch (MetaMatrixException e1){
-        		LogManager.logDetail(LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$
-        	}
-        	if (e instanceof MetaMatrixProcessingException) {
-        		throw (MetaMatrixProcessingException)e;
-        	}
-        	if (e instanceof MetaMatrixComponentException) {
-        		throw (MetaMatrixComponentException)e;
-        	}
-        	throw new MetaMatrixComponentException(e);
-        } finally {
-        	//iff this is the root command context release any pinned (Unclosed tuplesources)
-        	if (this.context.getParent() == null) {
-        		bufferMgr.releasePinnedBatches(); 
-        	}
-        }
-
-		if(done || requestClosed) {
+	            initialized = true;
+			}
+	
+			long currentTime = System.currentTimeMillis();
+			Assertion.assertTrue(!processorClosed);
+	        while(currentTime < context.getTimeSliceEnd()) {
+	        	if (requestCanceled) {
+	                throw new MetaMatrixProcessingException(QueryExecPlugin.Util.getString("QueryProcessor.request_cancelled", getProcessID())); //$NON-NLS-1$
+	            }
+	        	if (currentTime > context.getTimeoutEnd()) {
+	        		throw new MetaMatrixProcessingException("Query timed out"); //$NON-NLS-1$
+	        	}
+	            result = processPlan.nextBatch();
+	            this.highestRow = result.getEndRow();
+	
+	        	if(result.getTerminationFlag()) {
+	        		done = true;
+	        		break;
+	        	}
+	        	
+	        	if (result.getRowCount() > 0) {
+	        		break;
+	        	}
+	        	
+	        }
+	    } catch (BlockedException e) {
+	    	throw e;
+	    } catch (MetaMatrixException e) {
+	    	try {
+	    		closeProcessing();
+	    	} catch (MetaMatrixException e1){
+	    		LogManager.logDetail(LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$
+	    	}
+	    	if (e instanceof MetaMatrixProcessingException) {
+	    		throw (MetaMatrixProcessingException)e;
+	    	}
+	    	if (e instanceof MetaMatrixComponentException) {
+	    		throw (MetaMatrixComponentException)e;
+	    	}
+	    	throw new MetaMatrixComponentException(e);
+	    }
+		if(done) {
 			closeProcessing();
-			return true;
 		} 
-		return processorClosed;
+	    if (result == null) {
+	    	throw BlockedException.INSTANCE; //expired timeslice
+	    }
+		return result;
 	}
-                   
+
+	                   
     /**
-     * Flush the batch by giving it to the buffer manager.
-     */
-    private void flushBatch(TupleBatch batch) throws MetaMatrixComponentException, MetaMatrixProcessingException {
-		if(batch.getRowCount() > 0) {
-			this.bufferMgr.addTupleBatch(this.resultsID, batch);
-			this.highestRow = batch.getEndRow();
-		}
-		if (this.batchHandler != null && (batch.getRowCount() > 0 || batch.getTerminationFlag())) {
-        	this.batchHandler.batchProduced(batch);
-        }
-    }
-    
-    /**
      * Close processing and clean everything up.  Should only be called by the same thread that called process.
      * @throws MetaMatrixComponentException 
-     * @throws TupleSourceNotFoundException 
      */
-    public void closeProcessing() throws TupleSourceNotFoundException, MetaMatrixComponentException  {
+    public void closeProcessing() throws MetaMatrixComponentException  {
     	if (processorClosed) {
     		return;
     	}
@@ -220,23 +183,12 @@
     	}
         processorClosed = true;
     	    
-        try {
-        	processPlan.close();
-        } finally {
-            // Mark tuple source FULL
-            this.bufferMgr.setStatus(this.resultsID, TupleSourceStatus.FULL);
-        }
+    	processPlan.close();
     }
 
-    /**
-     * Checks whether the request has been canceled of an error has occurred, and throws an exception if either of these conditions is true. 
-     * @throws MetaMatrixException if the request has been canceled or an error occurred during processing.
-     * @since 4.2
-     */
-    private void checkState() throws MetaMatrixException {
-        if (requestCanceled) {
-            throw new MetaMatrixProcessingException(QueryExecPlugin.Util.getString("QueryProcessor.request_cancelled", getProcessID())); //$NON-NLS-1$
-        }
+    @Override
+    public List getOutputElements() {
+    	return this.processPlan.getOutputElements();
     }
 
     public List<Exception> getAndClearWarnings() {
@@ -250,18 +202,15 @@
         this.requestCanceled = true;
     }
     
-    /**
-     * Asynch graceful shutdown of the QueryProcessor
-     */
-    public void requestClosed() {
-        this.requestClosed = true;        
-    }
-
-	public void setBatchHandler(BatchHandler batchHandler) {
-		this.batchHandler = batchHandler;
-	}
-
 	public int getHighestRow() {
 		return highestRow;
 	}    
+	
+	public BatchCollector createBatchCollector() throws MetaMatrixComponentException {
+		return new BatchCollector(this, this.bufferMgr.createTupleBuffer(this.processPlan.getOutputElements(), context.getConnectionID(), TupleSourceType.PROCESSOR));
+	}
+	
+	public void setNonBlocking(boolean nonBlocking) {
+		this.nonBlocking = nonBlocking;
+	}
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/TempTableDataManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/TempTableDataManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/TempTableDataManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,7 +26,6 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.tempdata.TempTableStore;
 import com.metamatrix.query.util.CommandContext;
@@ -62,7 +61,6 @@
      * If a temp group is <i>not</i> being selected from, then this request will be
      * passed through to the underlying ProcessorDataManager.
 	 * @throws MetaMatrixProcessingException 
-	 * @see com.metamatrix.query.processor.ProcessorDataManager#registerRequest(Object, Command, String, String, TupleSourceID)
 	 */
 	public TupleSource registerRequest(
 		Object processorID,

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -34,20 +34,23 @@
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.query.processor.BaseProcessorPlan;
 import com.metamatrix.query.processor.DescribableUtil;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.util.VariableContext;
 import com.metamatrix.query.util.CommandContext;
 
 
 /** 
  * Plan for execution for a batched update command. The plan executes the child plans of the
  * individual commands in order.
+ * 
+ * If variableContexts are provided, then this is a bulk update where all plans are the same object.
+ * 
  * @since 4.2
  */
-public class BatchedUpdatePlan extends BaseProcessorPlan {
+public class BatchedUpdatePlan extends ProcessorPlan {
     
     /** Array that holds the child update plans */
     private ProcessorPlan[] updatePlans;
@@ -60,6 +63,8 @@
     /** The position of the command for which the update count is being retrieved */
     private int commandIndex = 0;
     
+    private List<VariableContext> contexts; //only set for bulk updates
+    
     /**
      *  
      * @param childPlans the child update plans for this batch
@@ -67,22 +72,29 @@
      * commands have been batched together.
      * @since 4.2
      */
-    public BatchedUpdatePlan(List childPlans, int commandsInBatch) {
+    public BatchedUpdatePlan(List childPlans, int commandsInBatch, List<VariableContext> contexts) {
         this.updatePlans = (ProcessorPlan[])childPlans.toArray(new ProcessorPlan[childPlans.size()]);
         this.planOpened = new boolean[updatePlans.length];
         this.updateCounts = new List[commandsInBatch];
+        this.contexts = contexts;
     }
 
     /** 
      * @see java.lang.Object#clone()
      * @since 4.2
      */
-    public Object clone() {
-        List clonedPlans = new ArrayList(updatePlans.length);
-        for (int i = 0; i < updatePlans.length; i++) {
-            clonedPlans.add(updatePlans[i].clone());
+    public BatchedUpdatePlan clone() {
+        List<ProcessorPlan> clonedPlans = new ArrayList<ProcessorPlan>(updatePlans.length);
+        
+        clonedPlans.add((ProcessorPlan)updatePlans[0].clone());
+        for (int i = 1; i <updatePlans.length; i++) {
+        	if (contexts == null) {
+                clonedPlans.add((ProcessorPlan)updatePlans[1].clone());        		
+        	} else {
+        		clonedPlans.add(clonedPlans.get(0));
+        	}
         }
-        return new BatchedUpdatePlan(clonedPlans, updateCounts.length);
+        return new BatchedUpdatePlan(clonedPlans, updateCounts.length, contexts);
     }
 
     /** 
@@ -90,8 +102,11 @@
      * @since 4.2
      */
     public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
+    	context = (CommandContext)context.clone();
+    	context.setVariableContext(new VariableContext()); //start a new root variable context
+    	this.setContext(context);
         // Initialize all the child plans
-        for (int i = 0; i < updatePlans.length; i++) {
+        for (int i = 0; i < getPlanCount(); i++) {
             updatePlans[i].initialize(context, dataMgr, bufferMgr);
         }
     }
@@ -111,8 +126,7 @@
     public void open() throws MetaMatrixComponentException, MetaMatrixProcessingException {
         // It's ok to open() the first plan, as it is not dependent on any prior commands.
         // See note for defect 16166 in the nextBatch() method.
-        updatePlans[0].open();
-        planOpened[0] = true;
+       openPlan();
     }
 
     /** 
@@ -130,8 +144,7 @@
                  * guarantee that the commands in the previous plan are completed before the commands in any subsequent
                  * plans are executed.
                  */
-                updatePlans[planIndex].open();
-                planOpened[planIndex] = true;
+            	openPlan();
             }
             // Execute nextBatch() on each plan in sequence
             List[] currentBatch = updatePlans[planIndex].nextBatch().getAllTuples(); // Can throw BlockedException
@@ -148,6 +161,19 @@
         return batch;
     }
 
+	private void openPlan() throws MetaMatrixComponentException,
+			MetaMatrixProcessingException {
+		if (this.contexts != null && !this.contexts.isEmpty()) {
+			CommandContext context = updatePlans[planIndex].getContext();
+			context.getVariableContext().clear();
+			VariableContext currentValues = this.contexts.get(planIndex);
+			context.getVariableContext().putAll(currentValues); 
+		}
+		updatePlans[planIndex].reset();
+		updatePlans[planIndex].open();
+		planOpened[planIndex] = true;
+	}
+
     /** 
      * @see com.metamatrix.query.processor.ProcessorPlan#close()
      * @since 4.2
@@ -185,7 +211,7 @@
         Map props = new HashMap();
         props.put(PROP_TYPE, "Batched Update Plan"); //$NON-NLS-1$
         List children = new ArrayList();
-        for (int i = 0; i < updatePlans.length; i++) {
+        for (int i = 0; i < getPlanCount(); i++) {
             children.add(updatePlans[i].getDescriptionProperties());
         }
         props.put(PROP_CHILDREN, children);
@@ -195,7 +221,7 @@
     
     public String toString() {
         StringBuffer val = new StringBuffer("BatchedUpdatePlan {\n"); //$NON-NLS-1$
-        for (int i = 0; i < updatePlans.length; i++) {
+        for (int i = 0; i < getPlanCount(); i++) {
             val.append(updatePlans[i])
                .append("\n"); //$NON-NLS-1$
         }
@@ -203,6 +229,10 @@
         return val.toString();
     }
 
+	private int getPlanCount() {
+		return (contexts != null?1:updatePlans.length);
+	}
+
     /**
      * Returns the child plans for this batch. Used primarily for unit tests. 
      * @return

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SQLSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SQLSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SQLSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.dynamic;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.sax.SAXSource;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.TupleSource;
-
-
-/** 
- * This is merely a wrapper class which brings together the TupleInputSource and
- * TupleXMLReader classes together to build SAXSource object.
- */
-public class SQLSource extends SAXSource {
-    
-    public static SAXSource createSource(String[] columns, Class[] types, TupleSource source) throws  MetaMatrixProcessingException, MetaMatrixComponentException {
-
-        try {
-            // get the sax parser and the its XML reader and replace with 
-            // our own. and then supply the customized input source.            
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);            
-            SAXParser sp = spf.newSAXParser();            
-            XMLReader reader = sp.getXMLReader();
-            
-            return new SAXSource(new TupleXMLReader(reader), new TupleInputSource(columns, types, source));
-            
-        } catch (ParserConfigurationException e) {
-            throw new MetaMatrixComponentException(e);
-        } catch (SAXException e) {
-            throw new MetaMatrixProcessingException(e);
-        }        
-    }
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SqlEval.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SqlEval.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/SqlEval.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,25 +22,32 @@
 
 package com.metamatrix.query.processor.dynamic;
 
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Source;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
 
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
 import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.XMLType;
 import com.metamatrix.query.eval.Evaluator;
+import com.metamatrix.query.processor.BatchIterator;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.QueryProcessor;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
@@ -57,15 +64,59 @@
  */
 public class SqlEval implements XQuerySQLEvaluator {
 
-    private BufferManager bufferMgr;
+    private static final String NO_RESULTS_DOCUMENT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><results/>"; //$NON-NLS-1$
+	
     private CommandContext context;
-    private ArrayList<TupleSourceID> openTupleList;
+    private ArrayList<QueryProcessor> processors;
     private String parentGroup;
     private Map<String, Expression> params;
     private ProcessorDataManager dataManager;
+        
+    public static Source createSource(TupleSource source) 
+        throws  MetaMatrixProcessingException {
+
+        try {
+            // we only want to return the very first document from the result set
+            // as XML we expect in doc function to have single XML document
+            List tuple = source.nextTuple();
+            if (tuple != null) {                        
+                Object value = tuple.get(0);
+                if (value != null) {
+                    // below we will catch any invalid LOB refereces and return them
+                    // as processing excceptions.
+                    if (value instanceof XMLType) {
+                        XMLType xml = (XMLType)value;
+                        return xml.getSource(null);
+                    }
+                    return new StreamSource(new StringReader((String)value));
+                }
+            }
+        } catch (Exception e) { 
+            throw new MetaMatrixProcessingException(e);
+        }
+        return new StreamSource(new StringReader(NO_RESULTS_DOCUMENT));
+    }
     
-    public SqlEval(BufferManager bufferMgr, ProcessorDataManager dataManager, CommandContext context, String parentGroup, Map<String, Expression> params) {
-        this.bufferMgr = bufferMgr;
+    public static SAXSource createSource(String[] columns, Class[] types, TupleSource source) throws  MetaMatrixProcessingException, MetaMatrixComponentException {
+
+        try {
+            // get the sax parser and the its XML reader and replace with 
+            // our own. and then supply the customized input source.            
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);            
+            SAXParser sp = spf.newSAXParser();            
+            XMLReader reader = sp.getXMLReader();
+            
+            return new SAXSource(new TupleXMLReader(reader), new TupleInputSource(columns, types, source));
+            
+        } catch (ParserConfigurationException e) {
+            throw new MetaMatrixComponentException(e);
+        } catch (SAXException e) {
+            throw new MetaMatrixProcessingException(e);
+        }        
+    }
+    
+    public SqlEval(ProcessorDataManager dataManager, CommandContext context, String parentGroup, Map<String, Expression> params) {
         this.dataManager = dataManager;
         this.context = context;
         this.parentGroup = parentGroup;
@@ -80,17 +131,13 @@
         throws QueryParserException, MetaMatrixProcessingException, MetaMatrixComponentException {
 
     	QueryProcessor processor = context.getQueryProcessorFactory().createQueryProcessor(sql, parentGroup, context);
-        // keep track of all the tuple sources opened during the 
-        // xquery process; 
-        if (openTupleList == null) {
-            openTupleList = new ArrayList<TupleSourceID>();
+    	processor.setNonBlocking(true);
+        if (processors == null) {
+        	processors = new ArrayList<QueryProcessor>();
         }
-        openTupleList.add(processor.getResultsID());
+        processors.add(processor);
+        TupleSource src = new BatchIterator(processor);
         
-        processor.process();
-        
-        TupleSourceID tsID = processor.getResultsID();
-        TupleSource src = this.bufferMgr.getTupleSource(tsID);
         String[] columns = elementNames(src.getSchema());
         Class[] types= elementTypes(src.getSchema());
         boolean xml = false;
@@ -101,9 +148,9 @@
         }            
         
         if (xml) {
-            return XMLSource.createSource(columns, types, src, this.bufferMgr);
+            return createSource(src);
         }
-        return SQLSource.createSource(columns, types, src);
+        return createSource(columns, types, src);
     }
     
     @Override
@@ -153,16 +200,10 @@
      * Closes any resources opened during the evaluation 
      */
     public void close() throws MetaMatrixComponentException {
-        if (openTupleList != null && !openTupleList.isEmpty()) {
-            for (Iterator i = openTupleList.iterator(); i.hasNext();) {
-                TupleSourceID id = (TupleSourceID)i.next();
-                try {
-                    this.bufferMgr.removeTupleSource(id);
-                } catch (TupleSourceNotFoundException e) {
-                    // ignore and go on..
-                }
-            }
+        if (processors != null) {
+        	for (QueryProcessor processor : processors) {
+				processor.closeProcessing();
+			}
         }
-        
     }
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/XMLSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/XMLSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/dynamic/XMLSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.dynamic;
-
-import java.io.StringReader;
-import java.util.List;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.types.XMLType;
-
-
-/** 
- * This class will be a reader class for reading data from the XML Source realated
- * connectors. 
- */
-public class XMLSource {
-    private static final String NO_RESULTS_DOCUMENT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><results/>"; //$NON-NLS-1$
-    
-    public static Source createSource(String[] columns, Class[] types, TupleSource source, BufferManager bufferMgr) 
-        throws  MetaMatrixProcessingException {
-
-        try {
-            // we only want to return the very first document from the result set
-            // as XML we expect in doc function to have single XML document
-            List tuple = source.nextTuple();
-            if (tuple != null) {                        
-                Object value = tuple.get(0);
-                if (value != null) {
-                    // below we will catch any invalid LOB refereces and return them
-                    // as processing excceptions.
-                    if (value instanceof XMLType) {
-                        XMLType xml = (XMLType)value;
-                        return xml.getSource(null);
-                    }
-                    return new StreamSource(new StringReader((String)value));
-                }
-            }
-        } catch (Exception e) { 
-            throw new MetaMatrixProcessingException(e);
-        }
-        return new StreamSource(new StringReader(NO_RESULTS_DOCUMENT));
-    }    
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -39,6 +39,9 @@
 /**
  */
 public class CreateCursorResultSetInstruction extends ProgramInstruction {
+	
+	public static final String RS_NAME = "EXECSQL_INSTRUCTION"; //$NON-NLS-1$
+	
     protected String rsName;
     protected ProcessorPlan plan;
     

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -196,8 +196,7 @@
 							.createNonRecordingRecord(), procEnv
 							.getContext());
             
-			ExecSqlInstruction inst = new ExecSqlInstruction(commandPlan,
-					dynamicCommand.getIntoGroup());
+			CreateCursorResultSetInstruction inst = new CreateCursorResultSetInstruction(CreateCursorResultSetInstruction.RS_NAME, commandPlan);
 
             dynamicProgram = new Program();
             dynamicProgram.addInstruction(inst);
@@ -310,20 +309,6 @@
 			}
 		}
 
-		// validate the updating model count if transaction is optimistic
-		// Error if orig = 0 and command > 0 OR if orig = 1 and command <> 1
-		if (procEnv.getContext().isOptimisticTransaction()) {
-			final int origModelCount = dynamicCommand.getUpdatingModelCount();
-			final int newModelCount = command.updatingModelCount(metadata);
-			if ((origModelCount == 0 || origModelCount == 1)
-					&& newModelCount > origModelCount) {
-				Object[] params = new Object[] { new Integer(newModelCount),
-						new Integer(origModelCount) };
-				throw new QueryProcessingException(QueryExecPlugin.Util
-						.getString("ExecDynamicSqlInstruction.1", params)); //$NON-NLS-1$
-			}
-		}
-
 		// do a recursion check
 		// Add group to recursion stack
 		CommandContext context = procEnv.getContext();
@@ -346,7 +331,7 @@
 	public Map getDescriptionProperties() {
 		Map props = new HashMap();
 		props.put(PROP_TYPE, "SQL"); //$NON-NLS-1$
-		props.put(PROP_SQL, ExecSqlInstruction.RS_NAME); 
+		props.put(PROP_SQL, CreateCursorResultSetInstruction.RS_NAME); 
 		if (dynamicCommand.getIntoGroup() != null) {
 			props.put(PROP_GROUP, dynamicCommand.getIntoGroup().toString());
 		}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecSqlInstruction.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecSqlInstruction.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecSqlInstruction.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.proc;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.processor.program.ProgramInstruction;
-import com.metamatrix.query.sql.symbol.GroupSymbol;
-
-/**
- * <p> Executes a SQL statement, and remove its results from the buffer manager. Executing this
- * instruction does not modify the values of any of the variables, hence it's results are not
- * important so they are removed immediately.</p>
- */
-public class ExecSqlInstruction extends ProgramInstruction {
-
-    public static final String RS_NAME = "EXECSQL_INSTRUCTION"; //$NON-NLS-1$
-
-	// processor plan for the command on the CommandStatement
-    private ProcessorPlan commandPlan;
-    //group for into if it is Select Into
-    private GroupSymbol intoGroup;
-
-    /**
-     * Constructor for ExecSqlInstruction.
-     * @param command Object (such as a ProcessorPlan) that is executed when this instruction
-     * is processed.
-     */
-	public ExecSqlInstruction(ProcessorPlan commandPlan, GroupSymbol intoGroup) {
-        this.commandPlan = commandPlan;
-        this.intoGroup = intoGroup;
-	}
-
-	/**
-     * <p>Processing this instruction executes the ProcessorPlan for the command on the
-     * CommandStatement of the update procedure language. Executing this plan does not effect
-     * the values of any of the variables defined as part of the update procedure and hence
-     * the results of the ProcessPlan execution need not be stored for further processing. The
-     * results are removed from the buffer manager immediately after execution. The program
-     * counter is incremented after execution of the plan.</p>
-     * @throws BlockedException if this processing the plan throws a currentVarContext
-     */
-    public void process(ProcedurePlan procEnv)
-        throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
-
-        if(intoGroup != null && intoGroup.isTempGroupSymbol()){
-            procEnv.executePlan(commandPlan, intoGroup.getName());
-        }else{
-            procEnv.executePlan(commandPlan, RS_NAME);
-        }
-
-        // We don't close the result here because this ExecSQLInstruction may be the last one in the procedure,
-        // in which case the containing ProcedurePlan.close will manage the lifecycle of the last tuple source.
-        // Those tuple sources that are not the last will be closed by the ProcedureEnvironment.executePlan method before the next
-        // instruction is executed.
-    }
-
-    public ProcessorPlan getProcessorPlan(){ //Defect 13291 - made public to support changes to ProcedurePlan
-        return this.commandPlan;
-    }
-    
-    /**
-     * Returns a deep clone
-     */
-    public Object clone(){
-        ExecSqlInstruction clone = new ExecSqlInstruction((ProcessorPlan)commandPlan.clone(), intoGroup);
-        return clone;
-    }
-
-    public String toString() {
-		return "ExecSQLInstruction"; //$NON-NLS-1$
-    }
-
-    public Map getDescriptionProperties() {
-        Map props = new HashMap();
-        props.put(PROP_TYPE, "SQL"); //$NON-NLS-1$
-        props.put(PROP_SQL, RS_NAME); 
-        props.put(PROP_PROGRAM, this.commandPlan.getDescriptionProperties());
-        if(intoGroup != null) {
-            props.put(PROP_GROUP, intoGroup.toString());
-        }
-        return props;
-    }
-    
-    /** 
-     * @see com.metamatrix.query.processor.program.ProgramInstruction#getChildPlans()
-     * @since 4.2
-     */
-    public Collection getChildPlans() {
-        List plans = new ArrayList(1);
-        plans.add(this.commandPlan);
-        return plans;
-    }
-    
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -39,18 +39,17 @@
 import com.metamatrix.api.exception.query.QueryValidatorException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
+import com.metamatrix.common.buffer.IndexedTupleSource;
 import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.query.execution.QueryExecPlugin;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.metadata.SupportConstants;
-import com.metamatrix.query.processor.BaseProcessorPlan;
+import com.metamatrix.query.processor.BatchIterator;
+import com.metamatrix.query.processor.CollectionTupleSource;
 import com.metamatrix.query.processor.DescribableUtil;
-import com.metamatrix.query.processor.NullTupleSource;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.QueryProcessor;
@@ -71,12 +70,12 @@
 import com.metamatrix.query.util.ErrorMessageKeys;
 /**
  */
-public class ProcedurePlan extends BaseProcessorPlan {
+public class ProcedurePlan extends ProcessorPlan {
 
-	private class CursorState {
-		TupleSourceID tsID;
-		TupleSource ts;
-		List<?> currentRow;
+	public static class CursorState {
+		private QueryProcessor processor;
+		private IndexedTupleSource ts;
+		private List<?> currentRow;
 	}
 	
     private Program originalProgram;
@@ -88,8 +87,7 @@
     private int batchSize;
 
     private boolean done = false;
-    private QueryProcessor internalProcessor;
-    private TupleSourceID internalResultID;
+    private CursorState currentState;
 
     // Temp state for final results
     private TupleSource finalTupleSource;
@@ -157,8 +155,7 @@
         lastTupleSource = null;
         
         done = false;
-        internalProcessor = null;
-        internalResultID = null;
+        currentState = null;
 
         finalTupleSource = null;
         beginBatch = 1;
@@ -295,7 +292,7 @@
         }
 
         if(lastTupleSource == null){
-            return new NullTupleSource(null);
+            return CollectionTupleSource.createNullTupleSource(null);
         }
         return lastTupleSource;
     }
@@ -305,14 +302,9 @@
         if (!this.cursorStates.isEmpty()) {
         	List<String> cursors = new ArrayList<String>(this.cursorStates.keySet());
         	for (String rsName : cursors) {
-        		try {
-        			removeResults(rsName);
-        		} catch (MetaMatrixComponentException e) {
-        			LogManager.logDetail(LogConstants.CTX_DQP, e, "Exception closing procedure plan cursor"); //$NON-NLS-1$
-        		}
+    			removeResults(rsName);
 			}
         }
-        internalResultID = null;
         if(getTempTableStore()!=null) {
         	getTempTableStore().removeTempTables();
         }
@@ -327,7 +319,7 @@
         return "ProcedurePlan:\n" + ProgramUtil.programToString(this.originalProgram); //$NON-NLS-1$
     }
 
-	public Object clone(){
+	public ProcessorPlan clone(){
         ProcedurePlan plan = new ProcedurePlan((Program)originalProgram.clone());
         plan.setUpdateProcedure(this.isUpdateProcedure());
         plan.setOutputElements(this.getOutputElements());
@@ -409,7 +401,7 @@
     	if(rowCount == null) {
 			rowCount = new Integer(NO_ROWS_UPDATED);
     	}
-        return new UpdateCountTupleSource((Integer)rowCount);
+        return CollectionTupleSource.createUpdateCountTupleSource((Integer)rowCount);
     }
 
     /**
@@ -423,43 +415,35 @@
 		return this.currentVarContext;
     }
 
-    public void executePlan(ProcessorPlan command, String rsName)
+    public CursorState executePlan(ProcessorPlan command, String rsName)
         throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        boolean isExecSQLInstruction = rsName.equals(ExecSqlInstruction.RS_NAME);
-        // Defect 14544: Close all non-final ExecSqlInstruction tuple sources before creating a new source.
-        // This guarantees that the tuple source will be removed predictably from the buffer manager.
-        if (isExecSQLInstruction) {
-            removeResults(ExecSqlInstruction.RS_NAME);
-        }
-        
-        if(this.internalProcessor == null){
-            //this may not be the first time the plan is being run
-            command.reset();
+    	
+        CursorState state = this.cursorStates.get(rsName.toUpperCase());
+        if (state == null) {
+        	if (this.currentState == null) {
+		        //this may not be the first time the plan is being run
+		        command.reset();
+		
+		        CommandContext subContext = (CommandContext) getContext().clone();
+		        subContext.setVariableContext(this.currentVarContext);
+		        subContext.setTempTableStore(getTempTableStore());
+		        state = new CursorState();
+		        state.processor = new QueryProcessor(command, subContext, this.bufferMgr, this.dataMgr);
+		        state.ts = new BatchIterator(state.processor);
+		        
+	            //keep a reference to the tuple source
+	            //it may be the last one
+	            this.lastTupleSource = state.ts;
+	            
+	            this.currentState = state;
+        	}
+        	//force execution to the first batch
+    		this.currentState.ts.hasNext();
 
-            // Run query processor on command
-            CommandContext subContext = (CommandContext) getContext().clone();
-            subContext.setVariableContext(this.currentVarContext);
-            subContext.setTempTableStore(getTempTableStore());
-            internalProcessor = new QueryProcessor(command, subContext, this.bufferMgr, this.dataMgr);
-            this.internalResultID = this.internalProcessor.getResultsID();
+	        this.cursorStates.put(rsName.toUpperCase(), this.currentState);
+	        this.currentState = null;
         }
-        this.internalProcessor.process(Integer.MAX_VALUE); //TODO: put a better value here
-
-        // didn't throw processor blocked, so must be done
-        TupleSource source = this.bufferMgr.getTupleSource(this.internalResultID);
-
-        this.internalProcessor = null;        
-
-        CursorState cursorState = new CursorState();
-        cursorState.tsID = this.internalResultID;
-        cursorState.ts = source;
-        this.cursorStates.put(rsName.toUpperCase(), cursorState);
-        
-        if(isExecSQLInstruction){
-            //keep a reference to the tuple source
-            //it may be the last one
-            this.lastTupleSource = source;
-        }
+        return state;
     }
     
     /** 
@@ -561,15 +545,8 @@
     public void removeResults(String rsName) throws MetaMatrixComponentException {
         String rsKey = rsName.toUpperCase();
         CursorState state = this.cursorStates.remove(rsKey);
-        if(state != null) {
-            try {
-    			this.bufferMgr.removeTupleSource(state.tsID);
-    		} catch (TupleSourceNotFoundException e) {
-                throw new MetaMatrixComponentException(e, ErrorMessageKeys.PROCESSOR_0021, QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0021, (String)null));
-    		} catch (MetaMatrixComponentException e) {
-                throw new MetaMatrixComponentException(e, ErrorMessageKeys.PROCESSOR_0022, QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0022, (String) null));
-    		}
-            LogManager.logTrace(LogConstants.CTX_DQP, new Object[]{"removed tuple source", state.tsID, "for result set"}); //$NON-NLS-1$ //$NON-NLS-2$
+        if (state != null) {
+        	state.processor.closeProcessing();
         }
     }
 

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/UpdateCountTupleSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/UpdateCountTupleSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/UpdateCountTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.query.processor.proc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.query.sql.lang.Command;
-
-public class UpdateCountTupleSource implements
-                            TupleSource {
-
-    private boolean hasNextTuple = true;
-    private List nextTuple;
-
-    public UpdateCountTupleSource(List tuple) {
-        nextTuple = tuple;
-    }
-
-    public UpdateCountTupleSource(int count) {
-        nextTuple = new ArrayList(1);
-        nextTuple.add(new Integer(count));
-    }
-
-    public List getSchema() {
-        return Command.getUpdateCommandSymbol();
-    }
-
-    public List nextTuple() throws MetaMatrixComponentException {
-        if (hasNextTuple) {
-            hasNextTuple = false;
-            return nextTuple;
-        }
-        return null;
-    }
-
-    public void closeSource() throws MetaMatrixComponentException {
-    }
-}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchCollector.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchCollector.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchCollector.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.query.processor.relational;
-
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
-
-public class BatchCollector {
-
-    private RelationalNode sourceNode;
-
-    private boolean done = false;
-    private TupleSourceID tsID;
-    private int rowCount = 0;
-    private boolean collectedAny;
-    
-    public BatchCollector(RelationalNode sourceNode) throws MetaMatrixComponentException {
-        this.sourceNode = sourceNode;
-        List sourceElements = sourceNode.getElements();
-        tsID = sourceNode.getBufferManager().createTupleSource(sourceElements, sourceNode.getConnectionID(), TupleSourceType.PROCESSOR);
-    }
-
-    public TupleSourceID collectTuples() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        return collectTuples(null);
-    }
-    
-    public TupleSourceID collectTuples(TupleBatch batch) throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        while(!done) {
-            if (batch == null) {
-                batch = sourceNode.nextBatch();
-            }
-
-            // Add batch
-            if(batch.getRowCount() > 0) {
-                this.rowCount = batch.getEndRow();
-                sourceNode.getBufferManager().addTupleBatch(tsID, batch);
-                collectedAny = true;
-            }
-
-            // Check for termination condition - batch ending with null row
-            if(batch.getTerminationFlag()) {
-                break;
-            }
-            
-            batch = null;
-        }
-        if (!done) {
-            sourceNode.getBufferManager().setStatus(tsID, TupleSourceStatus.FULL);
-            done = true;
-        }
-        return tsID;
-    }
-    
-    public boolean collectedAny() {
-		boolean result = collectedAny;
-		collectedAny = false;
-		return result;
-	}
-    
-    public int getRowCount() {
-        return rowCount;
-    }
-    
-    public void close() throws MetaMatrixComponentException {
-        try {
-            this.sourceNode.getBufferManager().removeTupleSource(tsID);
-        } catch (TupleSourceNotFoundException err) {
-            //ignore
-        }
-    }
-    
-    public TupleSourceID getTupleSourceID() {
-        return this.tsID;
-    }
-    
-    public boolean isDone() {
-		return done;
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchIterator.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchIterator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchIterator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.relational;
-
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.query.sql.symbol.SingleElementSymbol;
-
-final class BatchIterator implements
-                                 IndexedTupleSource {
-
-    private final RelationalNode source;
-
-    BatchIterator(RelationalNode source) {
-        this.source = source;
-    }
-
-    private boolean done;
-    private int currentRow = 1;
-    private TupleBatch currentBatch;
-    private List currentTuple;
-
-    public boolean hasNext() throws MetaMatrixComponentException,
-                            MetaMatrixProcessingException {
-        if (done) {
-            return false;
-        }
-        while (currentTuple == null) {
-            if (currentBatch == null) {
-                currentBatch = this.source.nextBatch();
-            }
-
-            if (currentBatch.getEndRow() >= currentRow) {
-                this.currentTuple = currentBatch.getTuple(currentRow++);
-            } else {
-                done = currentBatch.getTerminationFlag();
-                currentBatch = null;
-                if (done) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-    
-    @Override
-    public void closeSource() throws MetaMatrixComponentException {
-    	
-    }
-    
-    @Override
-    public List<SingleElementSymbol> getSchema() {
-    	return source.getElements();
-    }
-    
-    @Override
-    public List<?> nextTuple() throws MetaMatrixComponentException,
-    		MetaMatrixProcessingException {
-        if (currentTuple == null && !hasNext()) {
-            return null;
-        }
-        List result = currentTuple;
-        currentTuple = null;
-        return result;
-    }
-
-    public void reset() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void mark() {
-        //does nothing
-    }
-
-    @Override
-    public int getCurrentIndex() {
-        return currentRow;
-    }
-
-    public void setPosition(int position) {
-    	if (position == this.currentRow) {
-    		return;
-    	}
-		if (position < this.currentRow && (this.currentBatch == null || position < this.currentBatch.getBeginRow())) {
-			throw new UnsupportedOperationException("Backwards positioning is not allowed"); //$NON-NLS-1$
-		}
-        this.currentRow = position;
-        this.currentTuple = null;
-        if (currentBatch.getEndRow() < currentRow) {
-        	this.currentBatch = null;
-        }
-    }
-    
-    @Override
-    public TupleBatch getBatch() throws MetaMatrixComponentException {
-		return currentBatch;
-    }
-
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -60,8 +60,8 @@
     
     /** Set containing the indexes of commands that weren't executed. */
     private Set<Integer> unexecutedCommands;
-    /** Flag indicating that at least one command was sent to the DataManager. */
-    private boolean commandsWereExecuted = true;
+
+	private int commandCount;
     
     /**
      *  
@@ -107,9 +107,7 @@
                 unexecutedCommands.add(Integer.valueOf(i));
             }
         }
-        if (commandsToExecute.isEmpty()) {
-            commandsWereExecuted = false;
-        } else {
+        if (!commandsToExecute.isEmpty()) {
             BatchedUpdateCommand command = new BatchedUpdateCommand(commandsToExecute);
             tupleSource = getDataManager().registerRequest(this.getContext().getProcessorID(), command, modelName, null, getID());
         }
@@ -122,29 +120,20 @@
      */
     public TupleBatch nextBatchDirect() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
         int numExpectedCounts = updateCommands.size();
-        // If we don't have the tuple source yet, then we're blocked
-        if (commandsWereExecuted) {
-            // Otherwise, this tuple source has all the data we need
-            List tuple;
-            for ( int i = 0; i < numExpectedCounts; i++) {
-                // If the command at this index was not executed
-                if (unexecutedCommands.contains(Integer.valueOf(i))) {
-                    addBatchRow(ZERO_COUNT_TUPLE);
-                } else { // Otherwise, get the next count in the batch
-                    tuple = tupleSource.nextTuple();
-                    if (tuple != null) {
-                        // Assumption: the number of returned tuples exactly equals the number of commands submitted
-                        addBatchRow(Arrays.asList(new Object[] {tuple.get(0)}));
-                    } else {
-                        // Should never happen since the number of expected results is known
-                        throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("BatchedUpdateNode.unexpected_end_of_batch")); //$NON-NLS-1$
-                    }
+        for (;commandCount < numExpectedCounts; commandCount++) {
+            // If the command at this index was not executed
+            if (tupleSource == null || unexecutedCommands.contains(Integer.valueOf(commandCount))) {
+                addBatchRow(ZERO_COUNT_TUPLE);
+            } else { // Otherwise, get the next count in the batch
+                List<?> tuple = tupleSource.nextTuple();
+                if (tuple != null) {
+                    // Assumption: the number of returned tuples exactly equals the number of commands submitted
+                    addBatchRow(Arrays.asList(new Object[] {tuple.get(0)}));
+                } else {
+                    // Should never happen since the number of expected results is known
+                    throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("BatchedUpdateNode.unexpected_end_of_batch", commandCount, numExpectedCounts)); //$NON-NLS-1$
                 }
             }
-        } else { // No commands were executed, so the counts are all 0.
-            for (int i = 0; i < numExpectedCounts; i++) {
-                addBatchRow(ZERO_COUNT_TUPLE);
-            }
         }
         // This is the only tuple batch we need.
         terminateBatches();
@@ -174,7 +163,7 @@
         super.reset();
         tupleSource = null;
         unexecutedCommands = null;
-        commandsWereExecuted = true;
+        commandCount = 0;
     }
     
     /** 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentCriteriaProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentCriteriaProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -34,9 +34,10 @@
 import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.query.processor.relational.SortUtility.Mode;
 import com.metamatrix.query.rewriter.QueryRewriter;
 import com.metamatrix.query.sql.lang.AbstractSetCriteria;
 import com.metamatrix.query.sql.lang.CollectionValueIterator;
@@ -77,7 +78,7 @@
         }
 
         public void sort() throws BlockedException,
-                   MetaMatrixComponentException {
+                   MetaMatrixComponentException, MetaMatrixProcessingException {
             if (dvs == null) {
             	if (sortUtility == null) {
             		List<Expression> sortSymbols = new ArrayList<Expression>(dependentSetStates.size());
@@ -87,22 +88,19 @@
 	                    sortSymbols.add(dependentSetStates.get(i).valueExpression);
 	                }
 	                DependentValueSource originalVs = (DependentValueSource)dependentNode.getContext().getVariableContext().getGlobalValue(valueSource);
-	                this.sortUtility = new SortUtility(originalVs.getTupleSourceID(), sortSymbols, sortDirection, true, dependentNode.getBufferManager(), dependentNode.getConnectionID());
+	                this.sortUtility = new SortUtility(originalVs.getTupleBuffer().createIndexedTupleSource(), sortSymbols, sortDirection, Mode.DUP_REMOVE, dependentNode.getBufferManager(), dependentNode.getConnectionID());
             	}
-            	dvs = new DependentValueSource(sortUtility.sort(), dependentNode.getBufferManager());
+            	dvs = new DependentValueSource(sortUtility.sort(), dependentNode.getBufferManager().getProcessorBatchSize() / 2);
             	for (SetState setState : dependentSetStates) {
                     setState.valueIterator = dvs.getValueIterator(setState.valueExpression);
     			}
             }
         }
         
-        public void close() throws MetaMatrixComponentException {
+        public void close() {
             if (dvs != null) {
             	sortUtility = null;
-                try {
-                    dependentNode.getBufferManager().removeTupleSource(dvs.getTupleSourceID());
-                } catch (TupleSourceNotFoundException e) {
-                }
+                dvs.getTupleBuffer().remove();
                 dvs = null;
             }
         }
@@ -189,7 +187,7 @@
         }
     }
 
-    public Criteria prepareCriteria() throws MetaMatrixComponentException {
+    public Criteria prepareCriteria() throws MetaMatrixComponentException, MetaMatrixProcessingException {
 
         if (phase == SORT) {
         	for (TupleState state : dependentState.values()) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -29,7 +29,6 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.rewriter.QueryRewriter;
 import com.metamatrix.query.sql.lang.CompareCriteria;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,7 +28,6 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.query.sql.lang.Criteria;
 import com.metamatrix.query.util.CommandContext;
 
@@ -89,7 +88,6 @@
     }
 
     /**
-     * @throws TupleSourceNotFoundException
      * @see com.metamatrix.query.processor.relational.PlanExecutionNode#prepareNextCommand()
      */
     protected boolean prepareNextCommand() throws BlockedException,

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentValueSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentValueSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DependentValueSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,15 +25,17 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.TupleBuffer;
+import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.sql.symbol.Expression;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 import com.metamatrix.query.sql.util.ValueIterator;
 import com.metamatrix.query.sql.util.ValueIteratorSource;
 
@@ -43,31 +45,25 @@
 public class DependentValueSource implements
                                  ValueIteratorSource {
 
-    private TupleSourceID tupleSourceID;
-    private BufferManager bm;
-    private Map<Expression, HashSet<Object>> cachedSets;
+    private TupleBuffer tupleSourceID;
+    private int maxSetSize;
+    private Map<Expression, Set<Object>> cachedSets;
     
-    public DependentValueSource(TupleSourceID tupleSourceID, BufferManager bm) {
+    public DependentValueSource(TupleBuffer tupleSourceID, int maxSetSize) {
         this.tupleSourceID = tupleSourceID;
-        this.bm = bm;
+        this.maxSetSize = maxSetSize;
     }
     
-    public TupleSourceID getTupleSourceID() {
+    public TupleBuffer getTupleBuffer() {
 		return tupleSourceID;
 	}
     
     /** 
      * @throws MetaMatrixComponentException 
-     * @throws TupleSourceNotFoundException 
      * @see com.metamatrix.query.sql.util.ValueIteratorSource#getValueIterator(com.metamatrix.query.sql.symbol.Expression)
      */
     public ValueIterator getValueIterator(Expression valueExpression) throws  MetaMatrixComponentException {
-    	IndexedTupleSource its;
-		try {
-			its = bm.getTupleSource(tupleSourceID);
-		} catch (TupleSourceNotFoundException e) {
-			throw new MetaMatrixComponentException(e);
-		}
+    	IndexedTupleSource its = tupleSourceID.createIndexedTupleSource();
     	int index = 0;
     	if (valueExpression != null) {
     		index = its.getSchema().indexOf(valueExpression);
@@ -76,27 +72,26 @@
         return new TupleSourceValueIterator(its, index);
     }
     
-    public HashSet<Object> getCachedSet(Expression valueExpression) throws MetaMatrixComponentException, MetaMatrixProcessingException {
-    	HashSet<Object> result = null;
+    public Set<Object> getCachedSet(Expression valueExpression) throws MetaMatrixComponentException, MetaMatrixProcessingException {
+    	Set<Object> result = null;
     	if (cachedSets != null) {
     		result = cachedSets.get(valueExpression);
     	}
     	if (result == null) {
-    		IndexedTupleSource its;
-    		try {
-    			if (bm.getRowCount(tupleSourceID) > bm.getProcessorBatchSize() / 2) {
-    				return null;
-    			}
-    			its = bm.getTupleSource(tupleSourceID);
-    		} catch (TupleSourceNotFoundException e) {
-    			throw new MetaMatrixComponentException(e);
-    		}
+			if (tupleSourceID.getRowCount() > maxSetSize) {
+				return null;
+			}
+			IndexedTupleSource its = tupleSourceID.createIndexedTupleSource();
         	int index = 0;
         	if (valueExpression != null) {
         		index = its.getSchema().indexOf(valueExpression);
         	}
         	Assertion.assertTrue(index != -1);
-        	result = new HashSet<Object>();
+        	if (((SingleElementSymbol)its.getSchema().get(index)).getType() == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
+        		result = new TreeSet<Object>();
+    		} else {
+    			result = new HashSet<Object>();
+    		}
         	while (its.hasNext()) {
         		Object value = its.nextTuple().get(index);
         		if (value != null) {
@@ -105,7 +100,7 @@
         	}
         	its.closeSource();
         	if (cachedSets == null) {
-        		cachedSets = new HashMap<Expression, HashSet<Object>>();
+        		cachedSets = new HashMap<Expression, Set<Object>>();
         	}
     		cachedSets.put(valueExpression, result);
     	}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,11 +30,11 @@
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
 import com.metamatrix.api.exception.query.FunctionExecutionException;
 import com.metamatrix.common.buffer.BufferManager;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
 import com.metamatrix.query.function.aggregate.AggregateFunction;
+import com.metamatrix.query.processor.relational.SortUtility.Mode;
 import com.metamatrix.query.sql.lang.OrderBy;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 
@@ -52,15 +52,13 @@
     private List sortTypes;
 
     // Temporary state - should be reset
-    private TupleSourceID collectionID = null;
-    private SortUtility sortUtility = null;
-    private TupleSourceID sortedID = null;
-    private TupleCollector tupleCollector;
+    private TupleBuffer collectionBuffer;
+    private SortUtility sortUtility;
 
     /**
      * Constructor for DuplicateFilter.
      */
-    public DuplicateFilter(AggregateFunction proxy, BufferManager mgr, String groupName, int batchSize) {
+    public DuplicateFilter(AggregateFunction proxy, BufferManager mgr, String groupName) {
         super();
 
         this.proxy = proxy;
@@ -89,12 +87,16 @@
 
     public void reset() {
         this.proxy.reset();
+        close();
+    }
 
-        this.collectionID = null;
-        this.tupleCollector = null;
+	private void close() {
+		if (this.collectionBuffer != null) {
+        	collectionBuffer.remove();
+        }
+        this.collectionBuffer = null;
         this.sortUtility = null;
-        this.sortedID = null;
-    }
+	}
 
     /**
      * @see com.metamatrix.query.function.aggregate.AggregateFunction#addInput(Object)
@@ -102,18 +104,13 @@
     public void addInput(Object input)
         throws FunctionExecutionException, ExpressionEvaluationException, MetaMatrixComponentException {
 
-        try {
-            if(collectionID == null) {
-                collectionID = mgr.createTupleSource(elements, groupName, TupleSourceType.PROCESSOR);
-                this.tupleCollector = new TupleCollector(collectionID, mgr);
-            }
-
-            List row = new ArrayList(1);
-            row.add(input);
-            this.tupleCollector.addTuple(row);
-        } catch(TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
+        if(collectionBuffer == null) {
+            collectionBuffer = mgr.createTupleBuffer(elements, groupName, TupleSourceType.PROCESSOR);
         }
+
+        List row = new ArrayList(1);
+        row.add(input);
+        this.collectionBuffer.addTuple(row);
     }
 
     /**
@@ -123,32 +120,27 @@
     public Object getResult()
         throws MetaMatrixComponentException, MetaMatrixProcessingException {
 
-        try {
-            if(collectionID != null) {
-                this.tupleCollector.close();
+        if(collectionBuffer != null) {
+            this.collectionBuffer.close();
 
-                // Sort
-                sortUtility = new SortUtility(collectionID, elements, sortTypes, true, mgr, groupName);
-                this.sortedID = sortUtility.sort();
-
-                // Add all input to proxy
-                TupleSource sortedSource = mgr.getTupleSource(sortedID);
-                while(true) {
-                    List tuple = sortedSource.nextTuple();
-                    if(tuple == null) {
-                        break;
-                    }
-                    this.proxy.addInput(tuple.get(0));
-                }
-                sortedSource.closeSource();
-
-                // Clean up
-                mgr.removeTupleSource(collectionID);
-                mgr.removeTupleSource(sortedID);
+            // Sort
+            sortUtility = new SortUtility(collectionBuffer.createIndexedTupleSource(), elements, sortTypes, Mode.DUP_REMOVE, mgr, groupName);
+            TupleBuffer sorted = sortUtility.sort();
+            try {
+	            // Add all input to proxy
+	            TupleSource sortedSource = sorted.createIndexedTupleSource();
+	            while(true) {
+	                List tuple = sortedSource.nextTuple();
+	                if(tuple == null) {
+	                    break;
+	                }
+	                this.proxy.addInput(tuple.get(0));
+	            }
+            } finally {
+            	sorted.remove();
             }
-
-        } catch(TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
+            
+            close();
         }
 
         // Return

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -32,12 +32,9 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.IndexedTupleSource;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
+import com.metamatrix.common.buffer.TupleBuffer;
+import com.metamatrix.common.buffer.TupleSource;
 import com.metamatrix.query.eval.Evaluator;
 import com.metamatrix.query.function.aggregate.AggregateFunction;
 import com.metamatrix.query.function.aggregate.Avg;
@@ -65,21 +62,15 @@
     private int phase = COLLECTION;
     private Map elementMap;                    // Map of incoming symbol to index in source elements
     private List collectedExpressions;         // Collected Expressions
-    private TupleBatch sourceBatch;           // Current batch loaded from the source, if blocked
-    private int sourceRow;                    // Current row index in batch, if blocked
-    private List[] collectedRows;             // Rows evaluated and collected 
-    private TupleSourceID collectionID;       // Tuple source collecting the endpoint of collection phase
-    private int rowCount;                     // Row count of incoming rows
        
     // Sort phase
     private SortUtility sortUtility;
-    private TupleSourceID sortedID;
+    private TupleBuffer sortedID;
+    private TupleSource groupTupleSource;
 
     // Group phase
     private Map expressionMap;                 // Index map for all collected expressions (Expression -> index in collectedExpressions)
     private AggregateFunction[] functions;
-    private IndexedTupleSource groupTupleSource;
-    private int groupBegin = 1;
     private List lastRow;
 	private List currentGroupTuple;
 
@@ -97,19 +88,12 @@
         phase = COLLECTION;
         elementMap = null;
         collectedExpressions = null;
-        sourceBatch = null;
-        sourceRow = -1;
-        collectedRows = null;
-        collectionID = null;
-        rowCount = 0;
                 
         sortUtility = null;
         sortedID = null;
         
         expressionMap = null;
         functions = null;
-        groupBegin = 1;
-        groupTupleSource = null;
         lastRow = null;
         currentGroupTuple = null;
     }
@@ -147,8 +131,6 @@
         // Determine expressions to build (all grouping expressions + expressions used by aggregates)   
         collectExpressions();
 
-        this.collectionID = getBufferManager().createTupleSource(collectedExpressions, getConnectionID(), TupleSourceType.PROCESSOR);
-
         initializeFunctionAccumulators();
 	}
 
@@ -212,8 +194,8 @@
                         functions[i] = new Max();
                     }
 
-                    if(aggSymbol.isDistinct()) {
-                        functions[i] = new DuplicateFilter(functions[i], getBufferManager(), getConnectionID(), getBatchSize());
+                    if(aggSymbol.isDistinct() && !function.equals(ReservedWords.MIN) && !function.equals(ReservedWords.MAX)) {
+                        functions[i] = new DuplicateFilter(functions[i], getBufferManager(), getConnectionID());
                     }
                     
                     functions[i] = new NullFilter(functions[i]);
@@ -233,107 +215,108 @@
 	public TupleBatch nextBatchDirect()
 		throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
 
-        try {
-            // Take inputs, evaluate expressions, and build initial tuple source
-            if(this.phase == COLLECTION) {
-                collectionPhase();
-            }
+        // Take inputs, evaluate expressions, and build initial tuple source
+        if(this.phase == COLLECTION) {
+            collectionPhase();
+        }
 
-            // If necessary, sort to determine groups (if no group cols, no need to sort)
-            if(this.phase == SORT) {
-                sortPhase();
-            }
-
-            // Walk through the sorted results and for each group, emit a row
-            if(this.phase == GROUP) {
-                return groupPhase();
-            }
-            
-            TupleBatch terminationBatch = new TupleBatch(1, Collections.EMPTY_LIST);
-            terminationBatch.setTerminationFlag(true);
-            return terminationBatch;
-        } catch(TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
+        // If necessary, sort to determine groups (if no group cols, no need to sort)
+        if(this.phase == SORT) {
+            sortPhase();
         }
 
+        // Walk through the sorted results and for each group, emit a row
+        if(this.phase == GROUP) {
+            return groupPhase();
+        }
+        
+        TupleBatch terminationBatch = new TupleBatch(1, Collections.EMPTY_LIST);
+        terminationBatch.setTerminationFlag(true);
+        return terminationBatch;
     }
+	
+	public TupleSource getCollectionTupleSource() {
+		
+		final RelationalNode sourceNode = this.getChildren()[0];
+		
+		return new TupleSource() {
+		    private TupleBatch sourceBatch;           // Current batch loaded from the source, if blocked
+		    private int sourceRow = 1;                   
 
-    private void collectionPhase() throws BlockedException, TupleSourceNotFoundException, MetaMatrixComponentException, MetaMatrixProcessingException {
-        RelationalNode sourceNode = this.getChildren()[0];
+			@Override
+			public List<?> nextTuple() throws MetaMatrixComponentException,
+					MetaMatrixProcessingException {
+				while (true) {
+					if(sourceBatch == null) {
+			            // Read next batch
+			            sourceBatch = sourceNode.nextBatch();
+			        }
+			        
+			        if(sourceBatch.getRowCount() > 0 && sourceRow <= sourceBatch.getEndRow()) {
+			            // Evaluate expressions needed for grouping
+		                List tuple = sourceBatch.getTuple(sourceRow);
+		                
+		                int columns = collectedExpressions.size();
+		                List exprTuple = new ArrayList(columns);
+		                for(int col = 0; col<columns; col++) { 
+		                    // The following call may throw BlockedException, but all state to this point
+		                    // is saved in class variables so we can start over on building this tuple
+		                    Object value = new Evaluator(elementMap, getDataManager(), getContext()).evaluate((Expression) collectedExpressions.get(col), tuple);
+		                    exprTuple.add(value);
+		                }
+		                sourceRow++;
+			            return exprTuple;
+			        }
+			        
+			        // Check for termination condition
+			        if(sourceBatch.getTerminationFlag()) {
+			        	sourceBatch = null;			            
+			            return null;
+			        } 
+			        sourceBatch = null;
+				}
+			}
+			
+			@Override
+			public List<SingleElementSymbol> getSchema() {
+				return collectedExpressions;
+			}
+			
+			@Override
+			public void closeSource() throws MetaMatrixComponentException {
+				
+			}
+		};
+		
+	}
 
-        while(true) {
-            if(this.sourceBatch == null) {
-                // Read next batch
-                this.sourceBatch = sourceNode.nextBatch();
-            }
-            
-            if(this.sourceBatch.getRowCount() > 0) {
-                this.rowCount = this.sourceBatch.getEndRow();
-                this.sourceRow = this.sourceBatch.getBeginRow();
-                this.collectedRows = new List[this.sourceBatch.getRowCount()];
-                // Evaluate expressions needed for grouping
-                for(int row=this.sourceRow; row<=this.sourceBatch.getEndRow(); row++) {
-                    List tuple = this.sourceBatch.getTuple(row);
-                    
-                    int columns = this.collectedExpressions.size();
-                    List exprTuple = new ArrayList(columns);
-                    for(int col = 0; col<columns; col++) { 
-                        // The following call may throw BlockedException, but all state to this point
-                        // is saved in class variables so we can start over on building this tuple
-                        Object value = new Evaluator(this.elementMap, getDataManager(), getContext()).evaluate((Expression) this.collectedExpressions.get(col), tuple);
-                        exprTuple.add(value);
-                    }
-                    
-                    collectedRows[row-this.sourceBatch.getBeginRow()] = exprTuple;
-                }
-                
-                // Add collected batch
-                TupleBatch exprBatch = new TupleBatch(this.sourceBatch.getBeginRow(), collectedRows);
-                getBufferManager().addTupleBatch(collectionID, exprBatch);                    
-            }
-            // Clear and setup for next loop
-            this.sourceRow = -1;
-            this.collectedRows = null;
-
-            // Check for termination condition
-            if(this.sourceBatch.getTerminationFlag()) {
-                this.sourceBatch = null;
-                break;
-            } 
-            
-            this.sourceBatch = null;
-        }
-
-    	this.getBufferManager().setStatus(this.collectionID, TupleSourceStatus.FULL);
-
-        if(this.sortElements == null || this.rowCount == 0) {
+    private void collectionPhase() {
+        if(this.sortElements == null) {
             // No need to sort
-            this.sortedID = this.collectionID;
-            this.collectionID = null;
+            this.groupTupleSource = getCollectionTupleSource();
             this.phase = GROUP;
         } else {
-            this.sortUtility = new SortUtility(collectionID, sortElements,
+            this.sortUtility = new SortUtility(getCollectionTupleSource(), sortElements,
                                                 sortTypes, removeDuplicates?Mode.DUP_REMOVE_SORT:Mode.SORT, getBufferManager(),
-                                                getConnectionID(), removeDuplicates);
+                                                getConnectionID());
             this.phase = SORT;
         }
     }
 
     private void sortPhase() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
         this.sortedID = this.sortUtility.sort();
-        this.rowCount = this.getBufferManager().getFinalRowCount(this.sortedID);
+        this.groupTupleSource = this.sortedID.createIndexedTupleSource();
         this.phase = GROUP;
     }
 
-    private TupleBatch groupPhase() throws BlockedException, TupleSourceNotFoundException, MetaMatrixComponentException, MetaMatrixProcessingException {
-        if (this.groupTupleSource == null) {
-            this.groupTupleSource = this.getBufferManager().getTupleSource(sortedID);
-        }
-        
-        while(groupBegin <= rowCount) {
+    private TupleBatch groupPhase() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
+        while(true) {
 
         	if (currentGroupTuple == null) {
         		currentGroupTuple = this.groupTupleSource.nextTuple();
+        		if (currentGroupTuple == null) {
+        			break;
+        		}
         	}
         	
             if(lastRow == null) {
@@ -365,10 +348,8 @@
             // Update function accumulators with new row - can throw blocked exception
             updateAggregates(currentGroupTuple);
             currentGroupTuple = null;
-            groupBegin++;
         }
-        this.groupTupleSource.closeSource();
-        if(rowCount != 0 || sortElements == null) {
+        if(lastRow != null || sortElements == null) {
             // Close last group
             List row = new ArrayList(functions.length);
             for(int i=0; i<functions.length; i++) {
@@ -431,16 +412,6 @@
     public void close() throws MetaMatrixComponentException {
         if (!isClosed()) {
             super.close();
-            try {
-                if(this.collectionID != null) {
-                    getBufferManager().removeTupleSource(collectionID);
-                }
-                if(this.sortedID != null) {
-                    getBufferManager().removeTupleSource(sortedID);
-                }
-            } catch(TupleSourceNotFoundException e) {
-                throw new MetaMatrixComponentException(e, e.getMessage());
-            }
         }
     }
 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,8 +35,7 @@
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.sql.LanguageObject;
 import com.metamatrix.query.sql.lang.Criteria;
@@ -54,7 +53,7 @@
 	    NESTED_LOOP
 	}
         
-    private enum State { LOAD_LEFT, LOAD_RIGHT, POST_LOAD_LEFT, POST_LOAD_RIGHT, EXECUTE }    
+    private enum State { LOAD_LEFT, LOAD_RIGHT, EXECUTE }    
     private State state = State.LOAD_LEFT;
     
     private boolean leftOpened;
@@ -191,23 +190,20 @@
         }
         if (state == State.LOAD_RIGHT) {
             if (isDependent() && !this.rightOpened) { 
-                TupleSourceID tsID = this.joinStrategy.leftSource.getTupleSourceID();
-                this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, new DependentValueSource(tsID, this.getBufferManager()));
+                TupleBuffer tsID = this.joinStrategy.leftSource.getTupleBuffer();
+                this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, new DependentValueSource(tsID, this.getBufferManager().getProcessorBatchSize() / 2));
                 //open the right side now that the tuples have been collected
                 this.getChildren()[1].open();
                 this.rightOpened = true;
             }
             this.joinStrategy.loadRight();
-            state = State.POST_LOAD_LEFT;
+            //force buffering based upon join type - may have already happened in the strategy load methods
+        	this.joinStrategy.rightSource.getTupleBuffer();
+            if (joinType == JoinType.JOIN_FULL_OUTER) {
+            	this.joinStrategy.leftSource.getTupleBuffer();
+            }
+            state = State.EXECUTE;
         }
-        if (state == State.POST_LOAD_LEFT) {
-        	this.joinStrategy.postLoadLeft();
-        	state = State.POST_LOAD_RIGHT;
-        }
-        if (state == State.POST_LOAD_RIGHT) {
-        	this.joinStrategy.postLoadRight();
-        	state = State.EXECUTE;
-        }
         
         while(true) {
             if(super.isBatchFull()) {
@@ -299,12 +295,7 @@
     public void close()
             throws MetaMatrixComponentException {
         super.close();
-        
-        try {
-            joinStrategy.close();
-        } catch (TupleSourceNotFoundException err) {
-            //ignore
-        }        
+        joinStrategy.close();
         if (this.isDependent()) {
         	this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, null);
         }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinStrategy.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinStrategy.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/JoinStrategy.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,7 +28,6 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.CriteriaEvaluationException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 
 public abstract class JoinStrategy {
             
@@ -36,7 +35,7 @@
     protected SourceState leftSource;
     protected SourceState rightSource;
     
-    public void close() throws TupleSourceNotFoundException, MetaMatrixComponentException {
+    public void close() {
         try {
             if (leftSource != null) {
                 leftSource.close();
@@ -53,8 +52,7 @@
         }
     }
         
-    public void initialize(JoinNode joinNode) 
-                            throws MetaMatrixComponentException {
+    public void initialize(JoinNode joinNode) {
         this.joinNode = joinNode;
         this.leftSource = new SourceState(joinNode.getChildren()[0], joinNode.getLeftExpressions());
         this.leftSource.markDistinct(this.joinNode.isLeftDistinct());
@@ -63,19 +61,11 @@
     }
             
     protected void loadLeft() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        this.leftSource.collectTuples();
     }
     
-    protected void postLoadLeft() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-    }
-    
     protected void loadRight() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        this.rightSource.collectTuples();
     }
     
-    protected void postLoadRight() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-    }
-        
     /**
      * Output a combined, projected tuple based on tuple parts from the left and right. 
      * @param leftTuple Left tuple part

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/MergeJoinStrategy.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/MergeJoinStrategy.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/MergeJoinStrategy.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,8 +28,6 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.CriteriaEvaluationException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.query.processor.relational.SortUtility.Mode;
 import com.metamatrix.query.sql.lang.JoinType;
 import com.metamatrix.query.sql.lang.OrderBy;
@@ -116,7 +114,7 @@
      * @see com.metamatrix.query.processor.relational.JoinStrategy#initialize(com.metamatrix.query.processor.relational.JoinNode)
      */
     @Override
-    public void initialize(JoinNode joinNode) throws MetaMatrixComponentException {
+    public void initialize(JoinNode joinNode) {
         super.initialize(joinNode);
         this.outerState = this.leftSource;
         this.innerState = this.rightSource;
@@ -134,8 +132,7 @@
      * @see com.metamatrix.query.processor.relational.JoinStrategy#close()
      */
     @Override
-    public void close() throws TupleSourceNotFoundException,
-                       MetaMatrixComponentException {
+    public void close() {
         super.close();
         this.outerState = null;
         this.innerState = null;
@@ -331,27 +328,15 @@
         return 0;
     }
     
-    /** 
-     * @see com.metamatrix.query.processor.relational.JoinStrategy#loadLeft()
-     */
     @Override
     protected void loadLeft() throws MetaMatrixComponentException,
-                             MetaMatrixProcessingException {
-    	if (sortLeft == SortOption.ALREADY_SORTED && !this.joinNode.isDependent() && !JoinType.JOIN_FULL_OUTER.equals(joinNode.getJoinType())) {
-    		return; // don't buffer
-    	}
-        super.loadLeft(); 
-    }
-    
-    @Override
-    protected void postLoadLeft() throws MetaMatrixComponentException,
     		MetaMatrixProcessingException {
         if (this.processingSortLeft == SortOption.SORT || this.processingSortLeft == SortOption.SORT_DISTINCT) {
             if (this.leftSort == null) {
             	List expressions = this.joinNode.getLeftExpressions();
-                this.leftSort = new SortUtility(this.leftSource.getTupleSourceID(),
+                this.leftSort = new SortUtility(this.leftSource.getIterator(),
                                                     expressions, Collections.nCopies(expressions.size(), OrderBy.ASC), processingSortLeft == SortOption.SORT_DISTINCT?Mode.DUP_REMOVE_SORT:Mode.SORT,
-                                                    this.joinNode.getBufferManager(), this.joinNode.getConnectionID(), true);         
+                                                    this.joinNode.getBufferManager(), this.joinNode.getConnectionID());         
                 this.leftSource.markDistinct(processingSortLeft == SortOption.SORT_DISTINCT && expressions.size() == this.leftSource.getOuterVals().size());
             }
             this.leftSource.setTupleSource(leftSort.sort());
@@ -360,19 +345,14 @@
     }
         
     @Override
-    protected void postLoadRight() throws MetaMatrixComponentException,
+    protected void loadRight() throws MetaMatrixComponentException,
     		MetaMatrixProcessingException {
-    	sortRight();
-    }
-
-	protected void sortRight() throws MetaMatrixComponentException,
-			TupleSourceNotFoundException, BlockedOnMemoryException {
 		if (this.processingSortRight == SortOption.SORT || this.processingSortRight == SortOption.SORT_DISTINCT) {
     		if (this.rightSort == null) {
     		    List expressions = this.joinNode.getRightExpressions();
-    		    this.rightSort = new SortUtility(this.rightSource.getTupleSourceID(), 
+    		    this.rightSort = new SortUtility(this.rightSource.getIterator(), 
     		                                        expressions, Collections.nCopies(expressions.size(), OrderBy.ASC), processingSortRight == SortOption.SORT_DISTINCT?Mode.DUP_REMOVE_SORT:Mode.SORT,
-    		                                        this.joinNode.getBufferManager(), this.joinNode.getConnectionID(), true);
+    		                                        this.joinNode.getBufferManager(), this.joinNode.getConnectionID());
     		    this.rightSource.markDistinct(processingSortRight == SortOption.SORT_DISTINCT && expressions.size() == this.rightSource.getOuterVals().size());
     		}
     		this.rightSource.setTupleSource(rightSort.sort());

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/PartitionedSortJoin.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/PartitionedSortJoin.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/PartitionedSortJoin.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -29,12 +29,9 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.CriteriaEvaluationException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
 import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.TupleBuffer;
 
 /**
  * Extends the basic fully sorted merge join to check for conditions necessary 
@@ -59,8 +56,7 @@
 	private List[] endTuples;
 	private List<Boolean> overlap = new ArrayList<Boolean>();
 	private List<Integer> endRows = new ArrayList<Integer>();
-	private List<TupleSourceID> partitionIds = new ArrayList<TupleSourceID>();
-	private List<TupleCollector> tupleCollectors = new ArrayList<TupleCollector>();
+	private List<TupleBuffer> partitionIds = new ArrayList<TupleBuffer>();
 	private int currentPartition;
 	private IndexedTupleSource currentSource;
 	private SourceState sortedSource;
@@ -75,21 +71,15 @@
 	}
 	
     @Override
-    public void close() throws TupleSourceNotFoundException,
-    		MetaMatrixComponentException {
+    public void close() {
     	super.close();
-    	for (TupleSourceID tupleSourceID : this.partitionIds) {
-    		try {
-    			this.joinNode.getBufferManager().removeTupleSource(tupleSourceID);
-    		} catch (TupleSourceNotFoundException e) {
-    			
-    		}
+    	for (TupleBuffer tupleSourceID : this.partitionIds) {
+			tupleSourceID.remove();
 		}
     	this.endTuples = null;
     	this.overlap.clear();
     	this.endRows.clear();
     	this.partitionIds.clear();
-    	this.tupleCollectors.clear();
     	this.currentSource = null;
     	this.sortedSource = null;
     	this.partitionedSource = null;
@@ -97,8 +87,7 @@
     }
     
     @Override
-    public void initialize(JoinNode joinNode)
-    		throws MetaMatrixComponentException {
+    public void initialize(JoinNode joinNode) {
     	super.initialize(joinNode);
     	this.currentPartition = 0;
     	this.partitioned = false;
@@ -106,8 +95,7 @@
     	this.matchEnd = -1;
     }
 	
-    //TODO: save partial work or combine with the sort operation
-    public void computeBatchBounds(SourceState state) throws TupleSourceNotFoundException, MetaMatrixComponentException {
+    public void computeBatchBounds(SourceState state) throws MetaMatrixComponentException, MetaMatrixProcessingException {
     	if (endTuples != null) {
     		return;
     	}
@@ -115,22 +103,16 @@
     	ArrayList<List<?>> bounds = new ArrayList<List<?>>();
         int beginRow = 1;
         while (beginRow <= state.getRowCount()) {
-        	TupleBatch batch = null;
-        	try {
-        		batch = this.joinNode.getBufferManager().pinTupleBatch(state.getTupleSourceID(), beginRow);
-        		if (batch.getRowCount() == 0) {
-        			break;
-        		}
-        		beginRow = batch.getEndRow() + 1; 
-        		this.joinNode.getBufferManager().unpinTupleBatch(state.getTupleSourceID(), batch.getBeginRow());
-        		if (!bounds.isEmpty()) {
-        			overlap.add(comp.compare(bounds.get(bounds.size() - 1), batch.getTuple(batch.getBeginRow())) == 0);
-        		}
-        		bounds.add(batch.getTuple(batch.getEndRow()));
-        		endRows.add(batch.getEndRow());
-        	} catch (MemoryNotAvailableException e) {
-        		throw BlockedOnMemoryException.INSTANCE;
-        	} 
+        	TupleBatch batch = state.getTupleBuffer().getBatch(beginRow);
+    		if (batch.getRowCount() == 0) {
+    			break;
+    		}
+    		beginRow = batch.getEndRow() + 1; 
+    		if (!bounds.isEmpty()) {
+    			overlap.add(comp.compare(bounds.get(bounds.size() - 1), batch.getTuple(batch.getBeginRow())) == 0);
+    		}
+    		bounds.add(batch.getTuple(batch.getEndRow()));
+    		endRows.add(batch.getEndRow());
         }
         this.endTuples = bounds.toArray(new List[bounds.size()]);
     }
@@ -139,13 +121,13 @@
     protected void loadLeft() throws MetaMatrixComponentException,
     		MetaMatrixProcessingException {
     	//always buffer to determine row counts
-    	this.leftSource.collectTuples();
+    	this.leftSource.getTupleBuffer();
     }
     
     @Override
     protected void loadRight() throws MetaMatrixComponentException,
     		MetaMatrixProcessingException {
-    	super.loadRight();
+    	this.rightSource.getTupleBuffer();
     	int maxRows = this.joinNode.getBatchSize() * MAX_PARTITIONS;
     	if (processingSortRight == SortOption.SORT
     			&& this.leftSource.getRowCount() < maxRows
@@ -156,42 +138,30 @@
     			&& this.rightSource.getRowCount() * 4 < this.leftSource.getRowCount()) {
     		this.processingSortLeft = SortOption.PARTITION;
     	} 
-        sortRight();
+        super.loadRight(); //sort right if needed
         if (this.processingSortLeft == SortOption.PARTITION) {
         	computeBatchBounds(this.rightSource);
         	this.sortedSource = this.rightSource;
         	this.partitionedSource = this.leftSource;
         }
-    }
-    
-    @Override
-    protected void postLoadLeft() throws MetaMatrixComponentException,
-    		MetaMatrixProcessingException {
-        super.postLoadLeft();
-
+        super.loadLeft(); //sort left if needed
         if (this.processingSortRight == SortOption.PARTITION) {
         	computeBatchBounds(this.leftSource);
         	this.sortedSource = this.leftSource;
         	this.partitionedSource = this.rightSource;
         }
-        
         if (this.processingSortLeft == SortOption.PARTITION) {
         	partitionSource(true);
-        }        
-    }
-    
-    @Override
-    protected void postLoadRight() throws MetaMatrixComponentException,
-    		MetaMatrixProcessingException {
-    	if (this.processingSortRight == SortOption.PARTITION) {
+        } 
+        if (this.processingSortRight == SortOption.PARTITION) {
     		partitionSource(false);
         	if (this.processingSortRight == SortOption.SORT) {
         		//degrade to a merge join
-        		sortRight(); 
+        		super.loadRight(); 
         	}
-    	} 
+    	}
     }
-
+    
 	private void partitionSource(boolean left) throws MetaMatrixComponentException,
 			MetaMatrixProcessingException {
 		if (partitioned) {
@@ -206,14 +176,13 @@
 			return;
 		}
 		if (endTuples.length < 2) {
-			partitionIds.add(this.partitionedSource.getTupleSourceID());
+			partitionIds.add(this.partitionedSource.getTupleBuffer());
 		} else {
 			if (partitionIds.isEmpty()) {
 				for (int i = 0; i < endTuples.length; i++) {
-					TupleCollector tc = new TupleCollector(this.partitionedSource.createSourceTupleSource(), this.joinNode.getBufferManager());
+					TupleBuffer tc = this.partitionedSource.createSourceTupleBuffer();
 					tc.setBatchSize(Math.max(1, this.joinNode.getBatchSize()/4));
-					this.tupleCollectors.add(tc);
-					this.partitionIds.add(tc.getTupleSourceID());
+					this.partitionIds.add(tc);
 				}
 			}
 			while (this.partitionedSource.getIterator().hasNext()) {
@@ -222,14 +191,14 @@
 				if (index < 0) {
 					index = -index - 1;
 				}
-				if (index > this.tupleCollectors.size() -1) {
+				if (index > this.partitionIds.size() -1) {
 					continue;
 				}
 				while (index > 0 && this.overlap.get(index - 1) 
 						&& compare(tuple, this.endTuples[index - 1], this.partitionedSource.getExpressionIndexes(), this.sortedSource.getExpressionIndexes()) == 0) {
 					index--;
 				}
-				this.tupleCollectors.get(index).addTuple(tuple);
+				this.partitionIds.get(index).addTuple(tuple);
 			}
 			this.partitionedSource.getIterator().setPosition(1);
 		}
@@ -247,16 +216,15 @@
     	}
     	while (currentPartition < partitionIds.size()) {
     		if (currentSource == null) {
-    			if (!this.tupleCollectors.isEmpty()) {
-    				this.tupleCollectors.get(currentPartition).close();
+    			if (!this.partitionIds.isEmpty()) {
+    				this.partitionIds.get(currentPartition).close();
     			}
-    			currentSource = this.joinNode.getBufferManager().getTupleSource(partitionIds.get(currentPartition));
+    			currentSource = partitionIds.get(currentPartition).createIndexedTupleSource();
     		}
     		
     		int beginIndex = currentPartition>0?endRows.get(currentPartition - 1)+1:1;
     		
-    		this.sortedSource.getIterator().setPosition(beginIndex);
-			List[] batch = this.sortedSource.getIterator().getBatch().getAllTuples();
+			List[] batch = this.sortedSource.getTupleBuffer().getBatch(beginIndex).getAllTuples();
 						
     		while (partitionedTuple != null || currentSource.hasNext()) {
     			if (partitionedTuple == null) {
@@ -283,7 +251,7 @@
 		    			}
 	    			}
 	    			if (matchEnd == batch.length - 1 && currentPartition < overlap.size() && overlap.get(currentPartition)) {
-	    				this.tupleCollectors.get(currentPartition + 1).addTuple(partitionedTuple);
+	    				this.partitionIds.get(currentPartition + 1).addTuple(partitionedTuple);
 	    			}
     			}
     			while (matchBegin <= matchEnd) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -44,6 +44,7 @@
 import com.metamatrix.query.processor.DescribableUtil;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
+import com.metamatrix.query.processor.BatchCollector.BatchProducer;
 import com.metamatrix.query.sql.LanguageObject;
 import com.metamatrix.query.sql.lang.SubqueryContainer;
 import com.metamatrix.query.sql.symbol.AliasSymbol;
@@ -52,7 +53,7 @@
 import com.metamatrix.query.util.CommandContext;
 import com.metamatrix.query.util.ErrorMessageKeys;
 
-public abstract class RelationalNode implements Cloneable, Describable{
+public abstract class RelationalNode implements Cloneable, Describable, BatchProducer {
 
     // External context and state
     private CommandContext context;
@@ -155,6 +156,11 @@
 	public void setElements(List elements) {
 		this.elements = elements;
 	}
+	
+	@Override
+	public List getOutputElements() {
+		return getElements();
+	}
 
 	public List getElements() {
 		return this.elements;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,7 +35,6 @@
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.query.processor.BaseProcessorPlan;
 import com.metamatrix.query.processor.DescribableUtil;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
@@ -44,7 +43,7 @@
 
 /**
  */
-public class RelationalPlan extends BaseProcessorPlan {
+public class RelationalPlan extends ProcessorPlan {
 
 	// Initialize state - don't reset
 	private RelationalNode root;
@@ -130,7 +129,7 @@
 		return this.root.toString();    
 	}
     
-	public Object clone(){
+	public RelationalPlan clone(){
 		RelationalPlan plan = new RelationalPlan((RelationalNode)root.clone());
 		plan.setOutputElements(new ArrayList(( outputCols != null ? outputCols : Collections.EMPTY_LIST )));
 		return plan;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,11 +30,9 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.TupleBuffer;
+import com.metamatrix.query.processor.BatchIterator;
 import com.metamatrix.query.processor.relational.SortUtility.Mode;
 import com.metamatrix.query.sql.lang.OrderBy;
 
@@ -45,13 +43,11 @@
     private Mode mode = Mode.SORT;
 
     private SortUtility sortUtility;
-    private int phase = COLLECTION;
-    private TupleSourceID outputID;
+    private int phase = SORT;
+    private TupleBuffer outputID;
     private int rowCount = -1;
     private int outputBeginRow = 1;
-    private BatchCollector collector;
 
-    private static final int COLLECTION = 1;
     private static final int SORT = 2;
     private static final int OUTPUT = 3;
 
@@ -62,11 +58,10 @@
     public void reset() {
         super.reset();
         sortUtility = null;
-        phase = COLLECTION;
+        phase = SORT;
         outputID = null;
         rowCount = -1;
         outputBeginRow = 1;
-        this.collector = null;
     }
 
 	public void setSortElements(List sortElements, List<Boolean> sortTypes) {
@@ -90,56 +85,33 @@
 		throws MetaMatrixComponentException, MetaMatrixProcessingException {
 
 		super.open();
-		this.collector = new BatchCollector(this.getChildren()[0]);
 	}
 
 	public TupleBatch nextBatchDirect()
 		throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
-
-        try {
-
-            if(this.phase == COLLECTION) {
-                collectionPhase();
-            }
-
-            if(this.phase == SORT) {
-                sortPhase();
-            }
-
-            return outputPhase();
-        } catch(TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
+        if(this.phase == SORT) {
+            sortPhase();
         }
+
+        return outputPhase();
     }
 
-    private void collectionPhase() throws BlockedException, TupleSourceNotFoundException, MetaMatrixComponentException, MetaMatrixProcessingException {
-		try {
-			collector.collectTuples();
-		} catch (BlockedOnMemoryException e) {
-			throw e;
-		} catch (BlockedException e) {
-			if (mode != Mode.DUP_REMOVE || !collector.collectedAny()) {
-				throw e;
-			}
-		}
-		if (this.sortUtility == null) {
-	        this.sortUtility = new SortUtility(collector.getTupleSourceID(), sortElements,
+    private void sortPhase() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
+    	if (this.sortUtility == null) {
+	        this.sortUtility = new SortUtility(new BatchIterator(getChildren()[0]), sortElements,
 	                                            sortTypes, this.mode, getBufferManager(),
-	                                            getConnectionID(), true);
+	                                            getConnectionID());
 		}
-        this.phase = SORT;
-    }
-
-    private void sortPhase() throws BlockedException, MetaMatrixComponentException {
 		this.outputID = this.sortUtility.sort();
         this.phase = OUTPUT;
     }
 
-    private TupleBatch outputPhase() throws BlockedException, TupleSourceNotFoundException, MetaMatrixComponentException {
+    private TupleBatch outputPhase() throws BlockedException, MetaMatrixComponentException {
     	if (this.rowCount == -1) {
-    		this.rowCount = getBufferManager().getFinalRowCount(outputID);
-    		if (this.rowCount == -1) {
-    			this.phase = this.collector.isDone()?SORT:COLLECTION;
+    		if (this.outputID.isFinal()) {
+    			this.rowCount = this.outputID.getRowCount();
+    		} else {
+    			this.phase = SORT;
     		}
     	}
         if(this.rowCount == 0 || (this.rowCount != -1 && this.outputBeginRow > this.rowCount)) {
@@ -148,23 +120,17 @@
             return terminationBatch;
         }
         int beginPinned = this.outputBeginRow;
-        try {
-            TupleBatch outputBatch = getBufferManager().pinTupleBatch(outputID, beginPinned);
-            
-            this.outputBeginRow += outputBatch.getRowCount();
+        TupleBatch outputBatch = this.outputID.getBatch(beginPinned);
+        
+        this.outputBeginRow += outputBatch.getRowCount();
 
-            outputBatch = removeUnrelatedColumns(outputBatch);
+        outputBatch = removeUnrelatedColumns(outputBatch);
 
-            if(rowCount != -1 && outputBeginRow > rowCount) {
-                outputBatch.setTerminationFlag(true);
-            }
-
-            return outputBatch;
-        } catch(MemoryNotAvailableException e) {
-            throw BlockedOnMemoryException.INSTANCE;
-        } finally {
-            getBufferManager().unpinTupleBatch(outputID, beginPinned);
+        if(rowCount != -1 && outputBeginRow > rowCount) {
+            outputBatch.setTerminationFlag(true);
         }
+
+        return outputBatch;
     }
 
 	private TupleBatch removeUnrelatedColumns(TupleBatch outputBatch) {
@@ -182,17 +148,9 @@
     public void close() throws MetaMatrixComponentException {
         if (!isClosed()) {
             super.close();
-            try {
-                if(this.collector != null) {
-                    this.collector.close();
-                    this.collector = null;
-                }
-                if(this.outputID != null) {
-                    getBufferManager().removeTupleSource(outputID);
-                    this.outputID = null;
-                }
-            } catch(TupleSourceNotFoundException e) {
-                throw new MetaMatrixComponentException(e, e.getMessage());
+            if(this.outputID != null) {
+                this.outputID.remove();
+                this.outputID = null;
             }
         }
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,417 +23,269 @@
 package com.metamatrix.query.processor.relational;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
+import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
+import com.metamatrix.common.buffer.TupleBuffer;
+import com.metamatrix.common.buffer.TupleSource;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.sql.lang.OrderBy;
 import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 
 /**
+ * Implements several modes of a multi-pass sort.
  */
 public class SortUtility {
 	
 	public enum Mode {
 		SORT,
-		DUP_REMOVE,
+		/** Removes duplicates, no sort elements need to be specified.
+		 *  may perform additional passes as new batches become available 
+		 */
+		DUP_REMOVE, 
+		/** Removes duplicates, but guarantees order based upon the sort elements.
+		 */
 		DUP_REMOVE_SORT
 	}
+	
+	/**
+	 * state holder for the merge algorithm
+	 */
+	private class SortedSublist implements Comparable<SortedSublist> {
+		List<?> tuple;
+		int index;
+		boolean duplicate;
+		IndexedTupleSource its;
+		
+		@Override
+		public int compareTo(SortedSublist o) {
+			return comparator.compare(this.tuple, o.tuple);
+		}
+	}
 
 	//constructor state
-    private TupleSourceID sourceID;
-    protected List sortElements;
-    protected List<Boolean> sortTypes;
+    private TupleSource sourceID;
     private Mode mode;
-    protected BufferManager bufferManager;
+    private BufferManager bufferManager;
     private String groupName;
-    private boolean useAllColumns;
-    
-    //init state
-    private int batchSize;
-    protected List schema;
-    protected int[] sortCols;
+    private List<SingleElementSymbol> schema;
 	private ListNestedSortComparator comparator;
 
-    private TupleSourceID outputID;
-	private IndexedTupleSource outTs;
+    private TupleBuffer output;
     private boolean doneReading;
-    private int sortPhaseRow = 1;
     private int phase = INITIAL_SORT;
-    protected List<TupleSourceID> activeTupleIDs = new ArrayList<TupleSourceID>();
-    private List<TupleBatch> workingBatches;
+    private List<TupleBuffer> activeTupleBuffers = new ArrayList<TupleBuffer>();
     private int masterSortIndex;
-	private TupleSourceID mergedID;
-	private TupleSourceID tempOutId;
 
     // Phase constants for readability
     private static final int INITIAL_SORT = 1;
     private static final int MERGE = 2;
     private static final int DONE = 3;
     
-    public SortUtility(TupleSourceID sourceID, List sortElements, List<Boolean> sortTypes, boolean removeDups, BufferManager bufferMgr,
-            String groupName) {
-    	this(sourceID, sortElements, sortTypes, removeDups?Mode.DUP_REMOVE_SORT:Mode.SORT, bufferMgr, groupName, false);
-    }
-    
-    public SortUtility(TupleSourceID sourceID, List sortElements, List<Boolean> sortTypes, Mode mode, BufferManager bufferMgr,
-                        String groupName, boolean useAllColumns) {
+    public SortUtility(TupleSource sourceID, List sortElements, List<Boolean> sortTypes, Mode mode, BufferManager bufferMgr,
+                        String groupName) {
         this.sourceID = sourceID;
-        this.sortElements = sortElements;
-        this.sortTypes = sortTypes;
         this.mode = mode;
         this.bufferManager = bufferMgr;
         this.groupName = groupName;
-        this.useAllColumns = useAllColumns;
+        this.schema = this.sourceID.getSchema();
+        int distinctIndex = sortElements != null? sortElements.size() - 1:0;
+        if (mode != Mode.SORT) {
+	        if (sortElements == null) {
+	    		sortElements = this.schema;
+	    		sortTypes = Collections.nCopies(sortElements.size(), OrderBy.ASC);
+	        } else if (sortElements.size() < schema.size()) {
+	        	sortElements = new ArrayList(sortElements);
+	        	List<SingleElementSymbol> toAdd = new ArrayList<SingleElementSymbol>(schema);
+	        	toAdd.removeAll(sortElements);
+	        	sortElements.addAll(toAdd);
+	        	sortTypes = new ArrayList<Boolean>(sortTypes);
+	        	sortTypes.addAll(Collections.nCopies(sortElements.size() - sortTypes.size(), OrderBy.ASC));
+        	}
+        }
+        
+        int[] cols = new int[sortElements.size()];
+
+        for (ListIterator<SingleElementSymbol> iter = sortElements.listIterator(); iter.hasNext();) {
+            SingleElementSymbol elem = iter.next();
+            
+            cols[iter.previousIndex()] = schema.indexOf(elem);
+            Assertion.assertTrue(cols[iter.previousIndex()] != -1);
+        }
+        this.comparator = new ListNestedSortComparator(cols, sortTypes);
+        this.comparator.setDistinctIndex(distinctIndex);
     }
     
     public boolean isDone() {
     	return this.doneReading && this.phase == DONE;
     }
     
-    public TupleSourceID sort()
-        throws BlockedOnMemoryException, MetaMatrixComponentException {
+    public TupleBuffer sort()
+        throws MetaMatrixComponentException, MetaMatrixProcessingException {
 
-        try {
-            // One time setup
-            if(this.schema == null) {
-                initialize();
-            }
-            
-            if(this.phase == INITIAL_SORT) {
-                initialSort();
-            }
-            
-            if(this.phase == MERGE) {
-                try {
-                    mergePhase();
-                } finally {
-                	if (this.mergedID != null) {
-	                	this.bufferManager.removeTupleSource(mergedID);
-	                	this.mergedID = null;
-                	}
-                	if (this.tempOutId != null) {
-	                	this.bufferManager.removeTupleSource(tempOutId);
-	                	this.tempOutId = null;
-                	}
-                    if (workingBatches != null) {
-                        for (int i = 0; i < workingBatches.size(); i++) {
-                            TupleBatch tupleBatch = workingBatches.get(i);
-                            if (tupleBatch != null) {
-                                unpinWorkingBatch(i, tupleBatch);
-                            }
-                        }
-                    }
-                    workingBatches = null;
-                }
-            }
-            if (this.outputID != null) {
-            	return this.outputID;
-            }
-            return this.activeTupleIDs.get(0);
-        } catch(TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
+        if(this.phase == INITIAL_SORT) {
+            initialSort();
         }
-
+        
+        if(this.phase == MERGE) {
+            mergePhase();
+        }
+        if (this.output != null) {
+        	return this.output;
+        }
+        return this.activeTupleBuffers.get(0);
     }
 
-	private TupleSourceID createTupleSource() throws MetaMatrixComponentException {
-		return bufferManager.createTupleSource(this.schema, this.groupName, TupleSourceType.PROCESSOR);
+	private TupleBuffer createTupleBuffer() throws MetaMatrixComponentException {
+		return bufferManager.createTupleBuffer(this.schema, this.groupName, TupleSourceType.PROCESSOR);
 	}
-
-    protected void initialSort() throws BlockedOnMemoryException, TupleSourceNotFoundException, MetaMatrixComponentException {
+    
+	/**
+	 * creates sorted sublists stored in tuplebuffers
+	 */
+    protected void initialSort() throws MetaMatrixComponentException, MetaMatrixProcessingException {
     	while(!doneReading) {
-        	ArrayList<int[]> pinned = new ArrayList<int[]>();     // of int[2] representing begin, end
-            List<List<Object>> workingTuples = new ArrayList<List<Object>>();
-	        // Load data until out of memory
-	        while(!doneReading) {
+            List<List<?>> workingTuples = new ArrayList<List<?>>();
+            int maxRows = bufferManager.getMaxProcessingBatches() * bufferManager.getProcessorBatchSize();
+	        while(!doneReading && workingTuples.size() < maxRows) {
 	            try {
-	                // Load and pin batch
-	                TupleBatch batch = bufferManager.pinTupleBatch(sourceID, sortPhaseRow);
-	
-	                if (batch.getRowCount() == 0) {
-	                	if (bufferManager.getStatus(sourceID) == TupleSourceStatus.FULL) {
-	                		doneReading = true;
-		                }
-	                	break;
-	                }
-                    // Remember pinned rows
-                    pinned.add(new int[] { sortPhaseRow, batch.getEndRow() });
-
-                    addTuples(workingTuples, batch);
-                    
-                    sortPhaseRow += batch.getRowCount();
-	            } catch(MemoryNotAvailableException e) {
-	                break;
-	            }
+	            	List<?> tuple = sourceID.nextTuple();
+	            	
+	            	if (tuple == null) {
+	            		doneReading = true;
+	            		break;
+	            	}
+	            	
+                    addTuple(workingTuples, tuple);
+	            } catch(BlockedException e) {
+	            	if (workingTuples.isEmpty() && (mode != Mode.DUP_REMOVE || activeTupleBuffers.isEmpty())) {
+	            		throw e; //block if no work can be performed
+	            	}
+	            	break;
+	            } 
 	        }
 	
 	        if(workingTuples.isEmpty()) {
-        		break;
+	        	break;
 	        }
 		
-	        TupleSourceID activeID = createTupleSource();
-	        activeTupleIDs.add(activeID);
-	        int sortedThisPass = workingTuples.size();
+	        TupleBuffer sublist = createTupleBuffer();
+	        activeTupleBuffers.add(sublist);
 	        if (this.mode == Mode.SORT) {
 	        	//perform a stable sort
 	    		Collections.sort(workingTuples, comparator);
 	        }
-	        int writeBegin = 1;
-	        while(writeBegin <= sortedThisPass) {
-	            int writeEnd = Math.min(sortedThisPass, writeBegin + batchSize - 1);
-	
-	            TupleBatch writeBatch = new TupleBatch(writeBegin, workingTuples.subList(writeBegin-1, writeEnd));
-	            bufferManager.addTupleBatch(activeID, writeBatch);
-	            writeBegin += writeBatch.getRowCount();
-	        }
-	
-	        // Clean up - unpin rows
-	        for (int[] bounds : pinned) {
-	            bufferManager.unpinTupleBatch(sourceID, bounds[0]);
-	        }
+	        for (List<?> list : workingTuples) {
+				sublist.addTuple(list);
+			}
+	        sublist.saveBatch(false);
         }
-
-    	if (!doneReading && (mode != Mode.DUP_REMOVE || this.activeTupleIDs.isEmpty())) {
-    		throw BlockedOnMemoryException.INSTANCE;
-    	}
     	
-    	if (this.activeTupleIDs.isEmpty()) {
-            activeTupleIDs.add(createTupleSource());
+    	if (this.activeTupleBuffers.isEmpty()) {
+            activeTupleBuffers.add(createTupleBuffer());
         }  
 
-        // Clean up
         this.phase = MERGE;
     }
 
-	protected void addTuples(List workingTuples, TupleBatch batch) {
+	protected void addTuple(List<List<?>> workingTuples, List<?> tuple) {
 		if (this.mode == Mode.SORT) {
-			workingTuples.addAll(Arrays.asList(batch.getAllTuples()));
+			workingTuples.add(tuple);
 			return;
 		}
-		for (List<Object> list : batch.getAllTuples()) {
-			int index = Collections.binarySearch(workingTuples, list, comparator);
-			if (index >= 0) {
-				continue;
-			}
-			workingTuples.add(-index - 1, list);
+		int index = Collections.binarySearch(workingTuples, tuple, comparator);
+		if (index >= 0) {
+			return; //it's already there
 		}
+		workingTuples.add(-index - 1, tuple);
 	}
-	
-    protected void mergePhase() throws BlockedOnMemoryException, MetaMatrixComponentException, TupleSourceNotFoundException {
-        appendOutput();
-        TupleCollector tempCollector = null;
-    	while(this.activeTupleIDs.size() > 1) {    		
-            // Load and pin batch from sorted sublists while memory available
-            this.workingBatches = new ArrayList<TupleBatch>(activeTupleIDs.size());
+		
+    protected void mergePhase() throws MetaMatrixComponentException, MetaMatrixProcessingException {
+    	while(this.activeTupleBuffers.size() > 1) {    		
+    		ArrayList<SortedSublist> workingTuples = new ArrayList<SortedSublist>(activeTupleBuffers.size());
+            
+            TupleBuffer merged = createTupleBuffer();
+
             int sortedIndex = 0;
-            for(; sortedIndex<activeTupleIDs.size(); sortedIndex++) {
-                TupleSourceID activeID = activeTupleIDs.get(sortedIndex);
-                try {
-                    TupleBatch sortedBatch = bufferManager.pinTupleBatch(activeID, 1);
-                    workingBatches.add(sortedBatch);
-                } catch(MemoryNotAvailableException e) {
-                    break;
-                }
+            int maxSortIndex = Math.min(this.bufferManager.getMaxProcessingBatches() * 2, activeTupleBuffers.size());
+            for(; sortedIndex<maxSortIndex; sortedIndex++) { 
+            	TupleBuffer activeID = activeTupleBuffers.get(sortedIndex);
+            	SortedSublist sortedSublist = new SortedSublist();
+            	sortedSublist.its = activeID.createIndexedTupleSource();
+            	sortedSublist.index = sortedIndex;
+            	addWorkingTuple(workingTuples, sortedSublist);
             }
             
-            //if we cannot make progress, just block for now
-            if (workingBatches.size() < 2) {
-                throw BlockedOnMemoryException.INSTANCE;
-            }
-            
-            // Initialize pointers into working batches
-            int[] workingPointers = new int[workingBatches.size()];
-            Arrays.fill(workingPointers, 1);
-
-            mergedID = createTupleSource();
-
-            // Merge from working sorted batches
-            TupleCollector collector = new TupleCollector(mergedID, this.bufferManager);
-            while(true) {
-                // Find least valued row among working batches
-                List<?> currentRow = null;
-                int chosenBatchIndex = -1;
-                TupleBatch chosenBatch = null;
-                for(int i=0; i<workingBatches.size(); i++) {
-                    TupleBatch batch = workingBatches.get(i);
-                    if(batch == null) {
-                    	continue;
+            // iteratively process the lowest tuple
+            while (workingTuples.size() > 0) {
+            	SortedSublist sortedSublist = workingTuples.remove(0);
+            	if (!sortedSublist.duplicate) {
+                	merged.addTuple(sortedSublist.tuple);
+                    if (this.output != null && sortedSublist.index != masterSortIndex && sortedIndex > masterSortIndex) {
+                    	this.output.addTuple(sortedSublist.tuple); //a new distinct row
                     }
-                    List<?> testRow = batch.getTuple(workingPointers[i]);
-                    int compare = -1;
-                    if (currentRow != null) {
-                    	compare = comparator.compare(testRow, currentRow);
-                    }
-                    if(compare < 0) {
-                        // Found lower row
-                        currentRow = testRow;
-                        chosenBatchIndex = i;
-                        chosenBatch = batch;
-                    } else if (compare == 0 && this.mode != Mode.SORT) {
-                    	incrementWorkingBatch(i, workingPointers, batch);
-                    }
-                }
+            	}
+            	addWorkingTuple(workingTuples, sortedSublist);
+            }                
 
-                // Check for termination condition - all batches must have been null
-                if(currentRow == null) {
-                    break;
-                }
-                // Output the row and update pointers
-                collector.addTuple(currentRow);
-                if (this.outputID != null && chosenBatchIndex != masterSortIndex && sortedIndex > masterSortIndex) {
-                	if (tempCollector == null) {
-                		tempOutId = createTupleSource();
-                    	tempCollector = new TupleCollector(tempOutId, this.bufferManager);
-                	}
-                    tempCollector.addTuple(currentRow);
-                }
-                incrementWorkingBatch(chosenBatchIndex, workingPointers, chosenBatch);
-            }
-
-            // Save without closing
-            collector.saveBatch();
-            
             // Remove merged sublists
             for(int i=0; i<sortedIndex; i++) {
-            	TupleSourceID id = activeTupleIDs.remove(0);
-            	if (!id.equals(this.outputID)) {
-            		bufferManager.removeTupleSource(id);
+            	TupleBuffer id = activeTupleBuffers.remove(0);
+            	if (id != this.output) {
+            		id.remove();
             	}
             }
-
-            this.activeTupleIDs.add(mergedID);           
-            this.mergedID = null;
+            merged.saveBatch(false);
+            this.activeTupleBuffers.add(merged);           
             masterSortIndex = masterSortIndex - sortedIndex + 1;
             if (masterSortIndex < 0) {
-            	masterSortIndex = this.activeTupleIDs.size() - 1;
+            	masterSortIndex = this.activeTupleBuffers.size() - 1;
             }
-        } 
+        }
     	
-    	if (tempCollector != null) {
-	    	tempCollector.close();
-	    	this.outTs = this.bufferManager.getTupleSource(tempOutId);
-	        appendOutput();
-    	}
-        
         // Close sorted source (all others have been removed)
         if (doneReading) {
-	        bufferManager.setStatus(activeTupleIDs.get(0), TupleSourceStatus.FULL);
-	        if (this.outputID != null) {
-	        	bufferManager.setStatus(outputID, TupleSourceStatus.FULL);
+        	activeTupleBuffers.get(0).close();
+	        if (this.output != null) {
+	        	this.output.close();
 	        }
 	        this.phase = DONE;
 	        return;
         }
     	Assertion.assertTrue(mode == Mode.DUP_REMOVE);
-    	if (this.outputID == null) {
-    		this.outputID = activeTupleIDs.get(0);
+    	if (this.output == null) {
+    		this.output = activeTupleBuffers.get(0);
     	}
     	this.phase = INITIAL_SORT;
     }
 
-	private void appendOutput() throws TupleSourceNotFoundException,
-			MetaMatrixComponentException {
-		if (this.outTs != null) {
-			//transfer the new dup removed tuples to the output id
-        	TupleCollector tc = new TupleCollector(outputID, this.bufferManager);
-        	try {
-	        	try {
-		        	while (outTs.hasNext()) {
-		        		tc.addTuple(outTs.nextTuple());
-		        	}
-	        	} catch (MetaMatrixProcessingException e) {
-	        		throw new MetaMatrixComponentException(e);
-	        	}
-			} finally {
-				tc.saveBatch();
-			}
-			outTs.closeSource();
-        	outTs = null;
+	private void addWorkingTuple(ArrayList<SortedSublist> workingTuples, SortedSublist sortedSublist) throws MetaMatrixComponentException, MetaMatrixProcessingException {
+		sortedSublist.tuple = null;
+		try {
+			sortedSublist.tuple = sortedSublist.its.nextTuple();
+        } catch (BlockedException e) {
+        	//intermediate sources aren't closed
+        }  
+        if (sortedSublist.tuple == null) {
+        	return; // done with this sublist
         }
-	}
+        sortedSublist.duplicate = false;
+		int index = Collections.binarySearch(workingTuples, sortedSublist);
+		if (index >= 0) {
+			sortedSublist.duplicate = mode != Mode.SORT;
+			workingTuples.add(index, sortedSublist);
+		} else {
+			workingTuples.add(-index - 1, sortedSublist);
+		}
+	} 
 
-    /**
-     * Increment the working batch at batchIndex.  The currentBatch is the currentBatch
-     * for that batchIndex, which we already happen to have.  Return whether the batch
-     * was changed or not.  True = changed.
-     */
-    private void incrementWorkingBatch(int batchIndex, int[] workingPointers, TupleBatch currentBatch) throws BlockedOnMemoryException, TupleSourceNotFoundException, MetaMatrixComponentException {
-        workingPointers[batchIndex] += 1;
-        if(workingPointers[batchIndex] > currentBatch.getEndRow()) {
-            TupleSourceID tsID = unpinWorkingBatch(batchIndex, currentBatch);
-
-            int beginRow = workingPointers[batchIndex];
-
-            try {
-                TupleBatch newBatch = bufferManager.pinTupleBatch(tsID, beginRow);
-                if(newBatch.getRowCount() == 0) {
-                    // Done with this working batch
-                    workingBatches.set(batchIndex, null);
-                } else {
-                    workingBatches.set(batchIndex, newBatch);
-                }
-            } catch(MemoryNotAvailableException e) {
-                throw BlockedOnMemoryException.INSTANCE;
-            }
-        }
-    }
-    
-    private TupleSourceID unpinWorkingBatch(int batchIndex,
-                                            TupleBatch currentBatch) throws TupleSourceNotFoundException,
-                                                                    MetaMatrixComponentException {
-        TupleSourceID tsID = activeTupleIDs.get(batchIndex);
-        int lastBeginRow = currentBatch.getBeginRow();
-        bufferManager.unpinTupleBatch(tsID, lastBeginRow);
-        return tsID;
-    }
-
-    private void initialize() throws TupleSourceNotFoundException, MetaMatrixComponentException {
-        this.schema = this.bufferManager.getTupleSchema(this.sourceID);
-        this.batchSize = bufferManager.getProcessorBatchSize();
-        int distinctIndex = sortElements != null? sortElements.size() - 1:0;
-        if (useAllColumns && mode != Mode.SORT) {
-	        if (this.sortElements != null) {
-	        	this.sortElements = new ArrayList(this.sortElements);
-	        	List toAdd = new ArrayList(schema);
-	        	toAdd.removeAll(this.sortElements);
-	        	this.sortElements.addAll(toAdd);
-	        	this.sortTypes = new ArrayList<Boolean>(this.sortTypes);
-	        	this.sortTypes.addAll(Collections.nCopies(this.sortElements.size() - this.sortTypes.size(), OrderBy.ASC));
-        	} else {
-	    		this.sortElements = this.schema;
-	    		this.sortTypes = Collections.nCopies(this.sortElements.size(), OrderBy.ASC);
-        	}
-        }
-        
-        int[] cols = new int[sortElements.size()];
-
-        Iterator iter = sortElements.iterator();
-        
-        for (int i = 0; i < cols.length; i++) {
-            SingleElementSymbol elem = (SingleElementSymbol)iter.next();
-            
-            cols[i] = schema.indexOf(elem);
-            Assertion.assertTrue(cols[i] != -1);
-        }
-        this.sortCols = cols;
-        this.comparator = new ListNestedSortComparator(sortCols, sortTypes);
-        this.comparator.setDistinctIndex(distinctIndex);
-    }
-    
     public boolean isDistinct() {
     	return this.comparator.isDistinct();
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SourceState.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SourceState.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SourceState.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,16 +28,16 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.IndexedTupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
+import com.metamatrix.query.processor.BatchCollector;
+import com.metamatrix.query.processor.BatchIterator;
 
 class SourceState {
 
     private RelationalNode source;
     private BatchCollector collector;
-    private IndexedTupleSource tupleSource;
-    private TupleSourceID tsID;
+    private TupleBuffer buffer;
     private List<Object> outerVals;
     private IndexedTupleSource iterator;
     private int[] expressionIndexes;
@@ -45,6 +45,8 @@
     private int maxProbeMatch = 1;
     private boolean distinct;
     
+    private boolean canBuffer = true;
+    
     public SourceState(RelationalNode source, List expressions) {
         this.source = source;
         List elements = source.getElements();
@@ -64,8 +66,8 @@
         return indecies;
     }
     
-    TupleSourceID createSourceTupleSource() throws MetaMatrixComponentException {
-    	return this.source.getBufferManager().createTupleSource(source.getElements(), source.getConnectionID(), TupleSourceType.PROCESSOR);
+    TupleBuffer createSourceTupleBuffer() throws MetaMatrixComponentException {
+    	return this.source.getBufferManager().createTupleBuffer(source.getElements(), source.getConnectionID(), TupleSourceType.PROCESSOR);
     }
     
     public List saveNext() throws MetaMatrixComponentException, MetaMatrixProcessingException {
@@ -79,52 +81,35 @@
         this.currentTuple = null;
     }
     
-    public void close() throws TupleSourceNotFoundException, MetaMatrixComponentException {
+    public void close() {
         closeTupleSource(); 
     }
 
-    private void closeTupleSource() throws TupleSourceNotFoundException,
-                                   MetaMatrixComponentException {
-        if (this.tsID != null) {
-            this.source.getBufferManager().removeTupleSource(tsID);
-            this.tsID = null;
+    private void closeTupleSource() {
+        if (this.buffer != null) {
+            this.buffer.remove();
+            this.buffer = null;
         }
+        if (this.iterator != null) {
+        	this.iterator = null;
+        }
     }
     
-    public int getRowCount() {
-    	return this.collector.getRowCount();
+    public int getRowCount() throws MetaMatrixComponentException, MetaMatrixProcessingException {
+    	return this.getTupleBuffer().getRowCount();
     }
 
-    /**
-     * Collect the underlying batches into a tuple source.  Subsequent calls will return that tuple source
-     */
-    public TupleSourceID collectTuples() throws MetaMatrixComponentException,
-                               MetaMatrixProcessingException {
-        if (collector == null) {
-            collector = new BatchCollector(source);
-        }
-        TupleSourceID result = collector.collectTuples();
-        if (this.tsID == null) {
-            setTupleSource(result);
-        }
-        return result;
+    void setTupleSource(TupleBuffer result) {
+    	closeTupleSource();
+        this.buffer = result;
     }
-
-    void setTupleSource(TupleSourceID result) throws MetaMatrixComponentException, TupleSourceNotFoundException {
-        closeTupleSource();
-        this.tsID = result;
-        try {
-            this.tupleSource = source.getBufferManager().getTupleSource(result);
-        } catch (TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e, e.getMessage());
-        }
-    }
     
     IndexedTupleSource getIterator() {
         if (this.iterator == null) {
-            if (this.tupleSource != null) {
-                iterator = this.tupleSource;
+            if (this.buffer != null) {
+                iterator = buffer.createIndexedTupleSource();
             } else {
+            	canBuffer = false;
                 // return a TupleBatch tuplesource iterator
                 iterator = new BatchIterator(this.source);
             }
@@ -152,8 +137,18 @@
         return maxProbeMatch;
     }
 
-    public TupleSourceID getTupleSourceID() {
-        return this.tsID;
+    public TupleBuffer getTupleBuffer() throws MetaMatrixComponentException, MetaMatrixProcessingException {
+        if (this.buffer == null) {
+        	if (!canBuffer) {
+        		throw new AssertionError("cannot buffer the source"); //$NON-NLS-1$
+        	}
+        	if (collector == null) {
+                collector = new BatchCollector(source, createSourceTupleBuffer());
+            }
+            TupleBuffer result = collector.collectTuples();
+            setTupleSource(result);
+        }
+        return this.buffer;
     }
 
     public boolean isDistinct() {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -30,9 +30,8 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.query.eval.Evaluator;
+import com.metamatrix.query.processor.BatchCollector;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.QueryProcessor;
@@ -52,6 +51,7 @@
 
 	public class SubqueryState {
 		QueryProcessor processor;
+		BatchCollector collector;
 		boolean done;
 		List<?> tuple;
 		ProcessorPlan plan;
@@ -60,13 +60,8 @@
 			if (processor == null) {
 				return;
 			}
-			try {
-				processor.closeProcessing();
-				TupleSourceID id = processor.getResultsID();
-	            manager.removeTupleSource(id);
-			} catch (TupleSourceNotFoundException e) {
-				
-			} 
+			processor.closeProcessing();
+			collector.getTupleBuffer().close();
 			processor = null;
 			this.done = false;
 		}
@@ -125,12 +120,12 @@
 					}
 					state.processor.getContext().pushVariableContext(currentContext);
 				}
+		        state.collector = state.processor.createBatchCollector();
 			}
-			state.processor.process(Integer.MAX_VALUE);
 			state.done = true;
 			state.processor.getProcessorPlan().reset();
 		}
-		return new DependentValueSource(state.processor.getResultsID(), this.manager).getValueIterator(ref.getValueExpression());
+		return new DependentValueSource(state.collector.collectTuples(), this.manager.getProcessorBatchSize() / 2).getValueIterator(ref.getValueExpression());
 	}
 	
 }

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/TupleCollector.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/TupleCollector.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/TupleCollector.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.relational;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-
-public class TupleCollector {
-	
-	private TupleSourceID tsid;
-	private BufferManager bm;
-	
-	private int batchSize;
-	private ArrayList<List<?>> batch;
-	private int index;
-
-	public TupleCollector(TupleSourceID tsid, BufferManager bm) throws TupleSourceNotFoundException, MetaMatrixComponentException {
-		this.tsid = tsid;
-		this.batchSize = bm.getProcessorBatchSize();
-		this.bm = bm;
-		this.index = bm.getRowCount(tsid) + 1;
-	}
-	
-	public TupleCollector(BufferManager bm) {
-		this.batchSize = bm.getProcessorBatchSize();
-		this.bm = bm;
-		this.index = 1;
-	}
-	
-	public void setBatchSize(int batchSize) {
-		this.batchSize = batchSize;
-	}
-	
-	public void setTupleSourceID(TupleSourceID tsid) {
-		this.tsid = tsid;
-	}
-	
-	public boolean isEmpty() {
-		return this.batch == null || this.batch.isEmpty();
-	}
-	
-	public TupleSourceID getTupleSourceID() {
-		return tsid;
-	}
-	
-	public ArrayList<List<?>> getBatch() {
-		if (batch == null) {
-			batch = new ArrayList<List<?>>(batchSize/4);
-		}
-		return batch;
-	}
-	
-	public void addTuple(List<?> tuple) throws TupleSourceNotFoundException, MetaMatrixComponentException {
-		if (batch == null) {
-			batch = new ArrayList<List<?>>(batchSize/4);
-		}
-		batch.add(tuple);
-		if (batch.size() == batchSize) {
-			saveBatch();
-		}
-	}
-
-	public void saveBatch() throws TupleSourceNotFoundException,
-			MetaMatrixComponentException {
-		if (batch == null || batch.isEmpty()) {
-			return;
-		}
-		int batchIndex = 0;
-		while(batchIndex < batch.size()) {
-            int writeEnd = Math.min(batch.size(), batchIndex + batchSize);
-
-            TupleBatch writeBatch = new TupleBatch(index, batch.subList(batchIndex, writeEnd));
-            bm.addTupleBatch(tsid, writeBatch);
-            index += writeBatch.getRowCount();
-            batchIndex += writeBatch.getRowCount();
-        }
-        batch = null;
-	}
-	
-	public void close() throws TupleSourceNotFoundException, MetaMatrixComponentException {
-		saveBatch();
-		this.bm.setStatus(this.tsid, TupleSourceStatus.FULL);
-	}
-	
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,7 +28,6 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
 import com.metamatrix.common.buffer.TupleBatch;
 
 public class UnionAllNode extends RelationalNode {
@@ -81,9 +80,6 @@
                             sourceDone[i] = true;
                             activeSources--;
                         }
-                        
-                    } catch (BlockedOnMemoryException e) {
-                        throw e;
                     } catch(BlockedException e) {
                     	if(i<children.length-1 && hasDependentProcedureExecutionNode(children[0])){
                     		throw e;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.query.processor.xml;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -30,20 +29,17 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
+import com.metamatrix.common.buffer.IndexedTupleSource;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.query.execution.QueryExecPlugin;
 import com.metamatrix.query.mapping.xml.ResultSetInfo;
+import com.metamatrix.query.processor.BatchIterator;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.QueryProcessor;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
-import com.metamatrix.query.sql.symbol.Reference;
 import com.metamatrix.query.sql.util.VariableContext;
 import com.metamatrix.query.util.CommandContext;
-import com.metamatrix.query.util.ErrorMessageKeys;
 import com.metamatrix.query.util.LogConstants;
 
 
@@ -64,7 +60,7 @@
     // flag to denote the end of rows
     boolean endOfRows = false;
     // results after the execution bucket.
-    TupleSource tupleSource;
+    IndexedTupleSource tupleSource;
     // cached current row of results.
     List currentRow;
     int currentRowNumber = 0;
@@ -94,32 +90,21 @@
      * @see com.metamatrix.query.processor.xml.PlanExecutor#execute(java.util.Map)
      */
     public void execute(Map referenceValues) throws MetaMatrixComponentException, BlockedException, MetaMatrixProcessingException {        
-        try {
-            // set the dynamic reference values
-            setReferenceValues(referenceValues);
-            
-            // execute
-            this.internalProcessor.process(Integer.MAX_VALUE); //TODO: but an actual value here
-        } catch (MetaMatrixComponentException e) {
-            throw e;
-        } catch (MetaMatrixProcessingException e) {
-        	throw e;
-        } catch (MetaMatrixCoreException e) {
-            throw new MetaMatrixComponentException(e, ErrorMessageKeys.PROCESSOR_0047,QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0047,e.getMessage()));
+        if (this.tupleSource == null) {
+        	setReferenceValues(referenceValues);
+            this.tupleSource = new BatchIterator(internalProcessor);
         }
+        //force execution
+        this.tupleSource.hasNext();
     }    
     
-    void setReferenceValues(Map referencesValues) throws MetaMatrixComponentException {
-        if (this.resultInfo.hasReferences() && (referencesValues != null && !referencesValues.isEmpty()) ) {
-            for (final Iterator i = this.resultInfo.getReferences().iterator(); i.hasNext();) {
-                Reference ref = (Reference)i.next();
-                ElementSymbol expr = ref.getExpression();
-                if(!referencesValues.containsKey(expr)) {
-                    throw new MetaMatrixComponentException(QueryExecPlugin.Util.getString("unmapped_reference", expr.getName())); //$NON-NLS-1$
-                }
-                this.internalProcessor.getContext().getVariableContext().setValue(expr, referencesValues.get(expr));
-            }
+    void setReferenceValues(Map<ElementSymbol, Object> referencesValues) {
+        if (referencesValues == null || referencesValues.isEmpty()) {
+        	return;
         }
+        for (Map.Entry<ElementSymbol, Object> entry : referencesValues.entrySet()) {
+            this.internalProcessor.getContext().getVariableContext().setValue(entry.getKey(), entry.getValue());
+		}
     }    
     
     /**
@@ -128,14 +113,6 @@
      * @throws MetaMatrixComponentException
      */
     public List nextRow() throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        if (this.tupleSource == null) {
-            try {
-                this.tupleSource = this.bufferMgr.getTupleSource(this.internalProcessor.getResultsID());
-            } catch (TupleSourceNotFoundException e) {
-                throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("tuple_not_found", this.resultInfo.getResultSetName())); //$NON-NLS-1$                
-            }
-        }
-        
         // if we not already closed the tuple source; look for more results.
         if (!endOfRows) {
 
@@ -176,12 +153,8 @@
      * Close the executor and release all the resources.
      */
     public void close() throws MetaMatrixComponentException {
-        try {
-            this.bufferMgr.removeTupleSource(this.internalProcessor.getResultsID());
-        } catch (TupleSourceNotFoundException e) {
-            
-        } 
-        LogManager.logTrace(LogConstants.CTX_XML_PLAN, new Object[]{"removed tuple source", this.internalProcessor.getResultsID(), "for result set", this.internalProcessor.getResultsID()}); //$NON-NLS-1$ //$NON-NLS-2$
+		this.internalProcessor.closeProcessing();
+        LogManager.logTrace(LogConstants.CTX_XML_PLAN, new Object[]{"closed executor", resultInfo.getResultSetName()}); //$NON-NLS-1$
     }
   
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,9 +25,10 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
-import java.io.StringWriter;
+import java.io.Writer;
 import java.nio.charset.Charset;
 import java.sql.SQLException;
+import java.sql.SQLXML;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -62,19 +63,18 @@
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
 import com.metamatrix.common.buffer.BufferManager;
+import com.metamatrix.common.buffer.FileStore;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
 import com.metamatrix.common.lob.LobChunk;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.SQLXMLImpl;
 import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLTranslator;
 import com.metamatrix.common.types.XMLType;
+import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.execution.QueryExecPlugin;
-import com.metamatrix.query.processor.BaseProcessorPlan;
 import com.metamatrix.query.processor.DescribableUtil;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
@@ -90,7 +90,7 @@
 /**
  * 
  */
-public class XMLPlan extends BaseProcessorPlan {
+public class XMLPlan extends ProcessorPlan {
 	
 	// State passed during construction
 	private XMLProcessorEnvironment env;
@@ -108,8 +108,7 @@
         
     // is document in progress currently?
     boolean docInProgress = false;
-    TupleSourceID docInProgressTupleSourceId = null;
-    int chunkPosition = 0;
+    private FileStore docInProgressStore;
     
     // Post-processing
 	private String styleSheet;
@@ -177,25 +176,22 @@
     public TupleBatch nextBatch()
         throws MetaMatrixComponentException, MetaMatrixProcessingException, BlockedException {
         
-        // If finished, processXML();
         while(true){
-	        List rows = processXML();
-	        
-            // we have no more to send
-	        if (rows == null){
-	        	TupleBatch batch = new TupleBatch(nextBatchCount++, Collections.EMPTY_LIST); 
+            LobChunk chunk = getNextXMLChunk(this.chunkSize);  
+            
+            if (chunk == null) {
+            	Assertion.assertTrue(!this.docInProgress);
+            	TupleBatch batch = new TupleBatch(nextBatchCount++, Collections.EMPTY_LIST); 
 	        	batch.setTerminationFlag(true);
 	        	return batch;
-	        }
+            }
+	                    
+            XMLType doc = processXML(chunk);
             
-            // we got one more to send.
-    	    List listOfRows = new ArrayList();
-        	listOfRows.add(rows);
-        
-	        TupleBatch batch = new TupleBatch(nextBatchCount++, listOfRows);
-            // when true; multiple doc return fails.
-    	    batch.setTerminationFlag(false);
-        	return batch;
+            if (doc != null) {
+    	        TupleBatch batch = new TupleBatch(nextBatchCount++, Arrays.asList(Arrays.asList(doc)));
+    	        return batch;
+            }
         }
     }
     
@@ -217,16 +213,10 @@
      * many XML documents, if the root of the document model has
      * a mapping class (i.e. result set) associated with it.</p>
      *
-     * @return List a single tuple that contains the ValueID
-     * of the XML document for the first document  chunk, or empty row
-     * for the rest of the document chunk; or will return null when 
-     * there are no more documents to return
      */
-    private List processXML()
-        throws MetaMatrixComponentException, MetaMatrixProcessingException, BlockedException {
+    private XMLType processXML(LobChunk chunk)
+        throws MetaMatrixComponentException, BlockedException {
 
-
-
         boolean postProcess = (this.styleSheet != null || this.shouldValidate);
         // Note that we need to stream the document right away, as multiple documents
         // results are generated from the same "env" object. So the trick here is either
@@ -234,46 +224,33 @@
         // right away so that we give way to next batch call. (this due to bad design of xml model)
         // also note that there could be "inst" object alive but no more chunks; that is reason
         // for "if" null block
-        LobChunk chunk = getNextXMLChunk(this.chunkSize);  
         XMLType xml = null;            
         
-        if (chunk == null) {
-            return null;
-        }
-        
         // if the chunk size is less than one chunk unit then send this as string based xml.
         if (!this.docInProgress && chunk.isLast()) {
-            xml = new XMLType(new SQLXMLImpl(new String(chunk.getBytes(), Charset.forName("UTF-16")), getProperties())); //$NON-NLS-1$
+            xml = new XMLType(new SQLXMLImpl(chunk.getBytes()));
         }
         else {
             
             // if this is the first chunk, then create a tuple source id for this sequence of chunks
             if (!this.docInProgress) {
                 this.docInProgress = true;
-                this.docInProgressTupleSourceId = XMLUtil.createXMLTupleSource(this.bufferMgr, this.getContext().getConnectionID());
-                this.chunkPosition = 1;
+                this.docInProgressStore = this.bufferMgr.createFileStore("xml"); //$NON-NLS-1$
             }
             
             // now save the chunk of data to the buffer manager and move on.
-            this.bufferMgr.addStreamablePart(this.docInProgressTupleSourceId, chunk, chunkPosition++);
-                                
+            this.docInProgressStore.write(chunk.getBytes());
             // now document is finished, so create a xml object and return to the client.
             if (chunk.isLast()) {
-                this.bufferMgr.setStatus(this.docInProgressTupleSourceId, TupleSourceStatus.FULL);
-                
                 // we want this to be naturally feed by chunks whether inside
                 // or out side the processor
-                xml = new XMLType(XMLUtil.getFromBufferManager(bufferMgr, this.docInProgressTupleSourceId, getProperties()));
-                this.bufferMgr.setPersistentTupleSource(this.docInProgressTupleSourceId, xml);
-                
+                xml = new XMLType(XMLUtil.createSQLXML(this.docInProgressStore));
                 //reset current document state.
                 this.docInProgress = false;
-                this.docInProgressTupleSourceId = null;
-                this.chunkPosition = 0;
+                this.docInProgressStore = null;
+            } else {
+            	return null; //need to continue processing
             }
-            else {
-                throw BlockedOnMemoryException.INSTANCE;
-            }
         }
 
         // check to see if we need to do any post validation on the document.
@@ -281,9 +258,7 @@
             xml = postProcessDocument(xml, getProperties());
         }
                                 
-        List row = new ArrayList(1);
-        row.add(xml);                    
-        return row;
+        return xml;
     }
         
     
@@ -311,7 +286,7 @@
                     if (doc.isFinished()) {
                         this.env.setDocumentInProgress(null);
                     }
-                    byte[] bytes = Arrays.copyOfRange(new String(chunk).getBytes(Charset.forName("UTF-16")), 2, chunk.length * 2 + 2); //$NON-NLS-1$
+                    byte[] bytes = new String(chunk).getBytes(Charset.forName(Streamable.ENCODING));
                     return new LobChunk(bytes, doc.isFinished()); 
                 }                
             }
@@ -523,37 +498,40 @@
 			// get a reader object for the style sheet
 			Reader styleReader = new StringReader(styleSheet);
 			// construct a Xlan source object for the syle sheet
-			Source styleSource = new StreamSource(styleReader);
+			final Source styleSource = new StreamSource(styleReader);
 
 			// get a reader object for the xml results
 			//Reader xmlReader = new StringReader(xmlResults);
 			// construct a Xlan source object for the xml results
-			Source xmlSource = new StreamSource(xmlResults.getCharacterStream());
+			final Source xmlSource = new StreamSource(xmlResults.getCharacterStream());
 
 			// Convert the output target for use in Xalan-J 2
-			StringWriter resultOut = new StringWriter();
-			StreamResult result = new StreamResult(resultOut);
+			SQLXML result = XMLUtil.saveToBufferManager(bufferMgr, new XMLTranslator() {
+				
+				@Override
+				public void translate(Writer writer) throws IOException {
+					try {
+						// get the Xalan-J 2 XSLT transformer
+		                TransformerFactory factory = new TransformerFactoryImpl();
+		                Transformer transformer = factory.newTransformer(styleSource);
 
-			try {
-				// get the Xalan-J 2 XSLT transformer
-                TransformerFactory factory = new TransformerFactoryImpl();
-                Transformer transformer = factory.newTransformer(styleSource);
+					    /*
+		                 * To use this line, the system property "javax.xml.transform.TransformerFactory"
+		                 * needs to be set to "com.icl.saxon.TransformerFactoryImpl" or desired
+		                 * TransformerFactory classname.  See com.metamatrix.jdbc.TestXMLQuery
+					     */
+		                //Transformer transformer = TransformerFactory.newInstance().newTransformer(styleSource);
 
-			    /*
-                 * To use this line, the system property "javax.xml.transform.TransformerFactory"
-                 * needs to be set to "com.icl.saxon.TransformerFactoryImpl" or desired
-                 * TransformerFactory classname.  See com.metamatrix.jdbc.TestXMLQuery
-			     */
-                //Transformer transformer = TransformerFactory.newInstance().newTransformer(styleSource);
+		                // Feed the resultant I/O stream into the XSLT processor
+						transformer.transform(xmlSource, new StreamResult(writer));
+					} catch(Exception e) {
+						throw new IOException(QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0046), e);
+					}
+				}
+			}, chunkSize);
 
-                // Feed the resultant I/O stream into the XSLT processor
-				transformer.transform(xmlSource, result);
-			} catch(Exception e) {
-				throw new MetaMatrixComponentException(e, ErrorMessageKeys.PROCESSOR_0046, QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0046));
-			}
-
 			// obtain the stringified XML results for the
-			xmlResults = new XMLType(new SQLXMLImpl(resultOut.toString(), props));
+			xmlResults = new XMLType(result);
 		}
 
 		return xmlResults;
@@ -666,7 +644,7 @@
  	 * in other words, it's only safe to call clone() on a plan after nextTuple() returns null,
  	 * meaning the plan has finished processing.
  	 */
-	public Object clone(){
+	public XMLPlan clone(){
         XMLPlan xmlPlan = new XMLPlan((XMLProcessorEnvironment)this.env.clone());
         return xmlPlan;
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -262,17 +262,6 @@
     }
 
     /**
-     * @see com.metamatrix.query.processor.xml.ProcessorEnvironment#getXMLResultsForm
-     */
-    public String getXMLResultsForm(){
-        return this.xmlResultsForm;
-    }
-
-    public void setXMLResultsForm(String xmlResultsForm){
-        this.xmlResultsForm = xmlResultsForm;
-    }
-   
-    /**
      * @see com.metamatrix.query.processor.xml.ProcessorEnvironment#getDataManager()
      */
     public ProcessorDataManager getDataManager() {
@@ -319,7 +308,6 @@
                
         // XML results form and format
         clone.setXMLFormat(this.getXMLFormat());
-        clone.setXMLResultsForm(this.getXMLResultsForm());
     }
 
     public GroupSymbol getDocumentGroup() {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xml/XMLUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,113 +22,69 @@
 
 package com.metamatrix.query.processor.xml;
 
+import java.io.BufferedInputStream;
 import java.io.IOException;
-import java.io.Reader;
-import java.sql.SQLException;
-import java.sql.SQLXML;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.BufferManagerLobChunkStream;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
-import com.metamatrix.common.lob.ByteLobChunkStream;
-import com.metamatrix.common.lob.LobChunk;
-import com.metamatrix.common.lob.LobChunkInputStream;
-import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.buffer.FileStore;
+import com.metamatrix.common.buffer.FileStore.FileStoreOutputStream;
+import com.metamatrix.common.types.InputStreamFactory;
 import com.metamatrix.common.types.SQLXMLImpl;
-import com.metamatrix.common.types.XMLReaderFactory;
-import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLTranslator;
 
 
 /** 
  * Utility methods to be used with the XML and XQuery processing.
  */
 public class XMLUtil {
-
+	
     /**
      * This method saves the given XML object to the buffer manager's disk process
-     * and returns the id which is saved under.  
+     * Documents less than the maxMemorySize will be held directly in memory
      */
-    public static TupleSourceID saveToBufferManager(BufferManager bufferMgr, String tupleGroupName, SQLXML srcXML, int chunkSize) 
+    public static SQLXMLImpl saveToBufferManager(BufferManager bufferMgr, XMLTranslator translator, int maxMemorySize) 
         throws MetaMatrixComponentException {        
+        boolean success = false;
+        final FileStore lobBuffer = bufferMgr.createFileStore("xml"); //$NON-NLS-1$
         try{  
-            // first persist the XML to the Buffer Manager
-            TupleSourceID sourceId = createXMLTupleSource(bufferMgr, tupleGroupName);
-
-            // since this object possibly will be streamed we need another streamable
-            // wrapper layer.            
-            ByteLobChunkStream lobStream = new ByteLobChunkStream(srcXML.getBinaryStream(), chunkSize);
-            
-            // read all the globs and Store into storage manager
-            int batchCount = 1;
-            LobChunk lobChunk = null;
-            do {
-                try {
-                    lobChunk = lobStream.getNextChunk();
-                } catch (IOException e) {
-                	throw new MetaMatrixComponentException(e);
-                }
-                bufferMgr.addStreamablePart(sourceId, lobChunk, batchCount++);
-            } while (!lobChunk.isLast());
-            
-            lobStream.close();
-            
-            bufferMgr.setStatus(sourceId, TupleSourceStatus.FULL);            
-            return sourceId;            
-        } catch (TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e);
-        } catch(SQLException e) {
-            throw new MetaMatrixComponentException(e);
+        	FileStoreOutputStream fsos = lobBuffer.createOutputStream(maxMemorySize);
+            Writer writer = new OutputStreamWriter(fsos, Streamable.ENCODING);
+            translator.translate(writer);
+            writer.close();
+            if (!fsos.bytesWritten()) {
+            	return new SQLXMLImpl(fsos.toByteArray());
+            }
+            success = true;
+            return createSQLXML(lobBuffer);
         } catch(IOException e) {
             throw new MetaMatrixComponentException(e);
-        } 
-    }
-    
-    /**
-     * This will reconstruct the XML object from the buffer manager from given 
-     * buffer manager id. 
-     */
-    public static SQLXML getFromBufferManager(final BufferManager bufferMgr, final TupleSourceID sourceId, Properties props) {
-        return new SQLXMLImpl(new BufferMangerXMLReaderFactory(bufferMgr, sourceId), props);
-    }
-    
-    /**
-     * Creates a buffer manager's id for XML based data. 
-     */
-    public static TupleSourceID createXMLTupleSource(BufferManager bufferMgr, String tupleGroupName) throws MetaMatrixComponentException {
-        TupleSourceID sourceID = bufferMgr.createTupleSource(getOutputElements(), tupleGroupName, TupleSourceType.PROCESSOR);
-        return sourceID;
-    }
-    
-    static List getOutputElements() {
-        ArrayList output = new ArrayList(1);
-        ElementSymbol xml = new ElementSymbol("xml"); //$NON-NLS-1$
-        xml.setType(DataTypeManager.DefaultDataClasses.XML);
-        output.add(xml);
-        return output;
-    }    
-    
-    /**
-     * This is buffer manager supported reader factory for the XML lobs
-     * so that XML can be streamed by the clients more than once. 
-     */
-    static class BufferMangerXMLReaderFactory implements XMLReaderFactory {
-        BufferManager bufferMgr;
-        TupleSourceID sourceId;
-        
-        BufferMangerXMLReaderFactory(BufferManager mgr, TupleSourceID id){
-            this.bufferMgr = mgr;
-            this.sourceId = id;
+        } finally {
+        	if (!success && lobBuffer != null) {
+        		lobBuffer.remove();
+        	}
         }
-        
-        public Reader getReader() {          
-            return new LobChunkInputStream(new BufferManagerLobChunkStream(this.sourceId.getStringID(), this.bufferMgr)).getUTF16Reader();
-        }            
     }
+
+	public static SQLXMLImpl createSQLXML(final FileStore lobBuffer) {
+		SQLXMLImpl sqlXML = new SQLXMLImpl(new InputStreamFactory(Streamable.ENCODING) {
+			@Override
+			public InputStream getInputStream() throws IOException {
+				//TODO: adjust the buffer size, and/or develop a shared buffer strategy
+				return new BufferedInputStream(lobBuffer.createInputStream());
+			}
+			
+			@Override
+			public void free() throws IOException {
+				lobBuffer.remove();
+			}
+		});     
+		lobBuffer.setCleanupReference(sqlXML);
+		return sqlXML;
+	}
+    
 }
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -36,14 +36,13 @@
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLTranslator;
 import com.metamatrix.common.types.XMLType;
-import com.metamatrix.query.processor.BaseProcessorPlan;
 import com.metamatrix.query.processor.DescribableUtil;
 import com.metamatrix.query.processor.ProcessorDataManager;
+import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.dynamic.SqlEval;
 import com.metamatrix.query.processor.xml.XMLUtil;
 import com.metamatrix.query.sql.lang.XQuery;
@@ -55,11 +54,10 @@
 /**
  * XQuery execution Plan
  */
-public class XQueryPlan extends BaseProcessorPlan {        
+public class XQueryPlan extends ProcessorPlan {        
     private XQuery xQuery;
     private BufferManager bufferMgr;
     private String xmlFormat;
-    private String parentGroup;
     private ProcessorDataManager dataManager;
 
     private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
@@ -70,18 +68,17 @@
      * @param xmlPlans Map of XQuery doc() args to XMLPlan for
      * that virtual doc
      */
-    public XQueryPlan(XQuery xQuery, String parentGroup) {
+    public XQueryPlan(XQuery xQuery) {
         super();
         this.xQuery = xQuery;
-        this.parentGroup = parentGroup;
     }
 
     /**
      * @see java.lang.Object#clone()
      */
-    public Object clone() {
+    public XQueryPlan clone() {
         XQuery clonedQuery = (XQuery)this.xQuery.clone();
-        return new XQueryPlan(clonedQuery, parentGroup);
+        return new XQueryPlan(clonedQuery);
     }
 
     /**
@@ -122,9 +119,9 @@
     	XQueryExpression expr = this.xQuery.getCompiledXQuery();    
         expr.setXMLFormat(xmlFormat);
         
-        SqlEval sqlEval = new SqlEval(bufferMgr, this.dataManager, getContext(), this.parentGroup, this.xQuery.getVariables());
+        SqlEval sqlEval = new SqlEval(this.dataManager, getContext(), this.xQuery.getProcedureGroup(), this.xQuery.getVariables());
         try {
-        	SQLXML xml = expr.evaluateXQuery(sqlEval);
+        	XMLTranslator xml = expr.evaluateXQuery(sqlEval);
             TupleBatch batch = packResultsIntoBatch(xml);        
             return batch;
         } finally {
@@ -149,30 +146,20 @@
      * @param rawResults
      * @return
      */
-    private TupleBatch packResultsIntoBatch(SQLXML srcXML) throws MetaMatrixComponentException{
-        try {
-            List rows = new ArrayList(1);
-            List row = new ArrayList(1);
+    private TupleBatch packResultsIntoBatch(XMLTranslator translator) throws MetaMatrixComponentException{
+        List rows = new ArrayList(1);
+        List row = new ArrayList(1);
 
-            TupleSourceID savedId = XMLUtil.saveToBufferManager(this.bufferMgr, this.getContext().getConnectionID(), srcXML, this.chunkSize);
+        SQLXML srcXML = XMLUtil.saveToBufferManager(this.bufferMgr, translator, this.chunkSize);
 
-            //for large documents use the buffermanager version instead
-            if (this.bufferMgr.getFinalRowCount(savedId) > 1) {
-            	srcXML = XMLUtil.getFromBufferManager(this.bufferMgr, savedId, getFormatProperties());
-            }
-            
-            XMLType xml = new XMLType(srcXML);
-            this.bufferMgr.setPersistentTupleSource(savedId, xml);
-            
-            // now build the top batch with information from the saved one.
-            row.add(xml);
-            rows.add(row);        
-            TupleBatch batch = new TupleBatch(1, rows);
-            batch.setTerminationFlag(true);
-            return batch;
-        } catch (TupleSourceNotFoundException e) {
-            throw new MetaMatrixComponentException(e);
-        }
+        XMLType xml = new XMLType(srcXML);
+        
+        // now build the top batch with information from the saved one.
+        row.add(xml);
+        rows.add(row);        
+        TupleBatch batch = new TupleBatch(1, rows);
+        batch.setTerminationFlag(true);
+        return batch;
     }
 
     /**

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/CommandResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/CommandResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/CommandResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,7 +38,6 @@
     /**
      * Resolve the command using the metadata.  
      * @param command The command to resolve
-     * @param useMetadataCommands true if the resolver should use metadata commands to completely resolve
      * @param metadata Metadata
      * @param analysis
      * @param resolveNullLiterals true if the resolver should consider replacing null literals with more appropriate types 
@@ -47,7 +46,7 @@
      * @throws QueryResolverException If the query cannot be resolved
      * @throws MetaMatrixComponentException If there is an internal error     
      */        
-    void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+    void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
     throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException;
     
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/ProcedureContainerResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/ProcedureContainerResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/ProcedureContainerResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -51,7 +51,6 @@
 public abstract class ProcedureContainerResolver implements CommandResolver {
 
     public abstract void resolveProceduralCommand(Command command,
-                                                  boolean useMetadataCommands,
                                                   TempMetadataAdapter metadata,
                                                   AnalysisRecord analysis) throws QueryMetadataException,
                                                                           QueryResolverException,
@@ -70,29 +69,50 @@
      * @throws QueryResolverException If the query cannot be resolved
      * @throws MetaMatrixComponentException If there is an internal error
      */
-    public void expandCommand(Command command, QueryMetadataInterface metadata, AnalysisRecord analysis)
+    public Command expandCommand(ProcedureContainer procCommand, QueryMetadataInterface metadata, AnalysisRecord analysis)
     throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
-        // Cast to known type
-        ProcedureContainer procCommand = (ProcedureContainer) command;
-
+    	
         // Resolve group so we can tell whether it is an update procedure
         GroupSymbol group = procCommand.getGroup();
 
-        if(!group.isTempGroupSymbol() && metadata.isVirtualGroup(group.getMetadataID())) {
-            String plan = getPlan(metadata, group);
-            
-            if(plan == null) {
-                String name = command.getClass().getName();
-                name = name.substring(name.lastIndexOf('.') + 1);
-                throw new QueryResolverException(ErrorMessageKeys.RESOLVER_0009, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0009, group, name));
-            }
-            QueryParser parser = QueryParser.getQueryParser();
-            try {
-                procCommand.setSubCommand(parser.parseCommand(plan));
-            } catch(QueryParserException e) {
-                throw new QueryResolverException(e, ErrorMessageKeys.RESOLVER_0045, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0045, group));
-            }
+        Command subCommand = null;
+        
+        String plan = getPlan(metadata, procCommand);
+        
+        if (plan == null) {
+            return null;
         }
+        
+        QueryParser parser = QueryParser.getQueryParser();
+        try {
+            subCommand = parser.parseCommand(plan);
+        } catch(QueryParserException e) {
+            throw new QueryResolverException(e, ErrorMessageKeys.RESOLVER_0045, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0045, group));
+        }
+        
+        if(subCommand instanceof CreateUpdateProcedureCommand){
+            CreateUpdateProcedureCommand cupCommand = (CreateUpdateProcedureCommand)subCommand;
+            //if the subcommand is virtual stored procedure, it must have the same
+            //projected symbol as its parent.
+            if(!cupCommand.isUpdateProcedure()){
+                cupCommand.setProjectedSymbols(procCommand.getProjectedSymbols());
+            } 
+            
+            cupCommand.setVirtualGroup(procCommand.getGroup());
+            cupCommand.setUserCommand(procCommand);
+        } 
+        
+        //find the childMetadata using a clean metadata store
+        TempMetadataStore childMetadata = new TempMetadataStore();
+        QueryMetadataInterface resolveMetadata = new TempMetadataAdapter(metadata, childMetadata);
+
+        GroupContext externalGroups = findChildCommandMetadata(procCommand, subCommand, childMetadata, resolveMetadata);
+        
+        QueryResolver.setChildMetadata(subCommand, childMetadata.getData(), externalGroups);
+        
+        QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, metadata, analysis);
+        
+        return subCommand;
     }
 
     /** 
@@ -113,99 +133,75 @@
      * in the childMetadata object.  Typical uses of this are for stored queries that define parameter
      * variables valid in subcommands. only used for inserts, updates, and deletes
      * @param command The command to find metadata on
-     * @param childMetadata The store to collect child metadata in 
-     * @param useMetadataCommands True if resolver should use metadata commands to completely resolve
      * @param metadata Metadata access
+     * @param childMetadata The store to collect child metadata in 
      * @throws QueryMetadataException If there is a metadata problem
      * @throws QueryResolverException If the query cannot be resolved
      * @throws MetaMatrixComponentException If there is an internal error    
      */ 
-    public GroupContext findChildCommandMetadata(Command command, TempMetadataStore discoveredMetadata, boolean useMetadataCommands, QueryMetadataInterface metadata)
+    public GroupContext findChildCommandMetadata(ProcedureContainer container, Command subCommand, TempMetadataStore discoveredMetadata, QueryMetadataInterface metadata)
     throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
-        // Cast to known type
-        ProcedureContainer container = (ProcedureContainer) command;
-
         // get the group on the delete statement
         GroupSymbol group = container.getGroup();
         // proceed further if it is a virtual group
-        if(metadata.isVirtualGroup(group.getMetadataID())) {
-            CreateUpdateProcedureCommand procCmd = (CreateUpdateProcedureCommand) container.getSubCommand();
-            if (procCmd == null) {
-                return null;
-            }
             
-            GroupContext externalGroups = new GroupContext();
-            
-            // set the user's command on the procedure
-            procCmd.setUserCommand(container);
-            
-            //Look up elements for the virtual group
-            List elements = ResolverUtil.resolveElementsInGroup(group, metadata);
+        GroupContext externalGroups = new GroupContext();
+        
+        //Look up elements for the virtual group
+        List<ElementSymbol> elements = ResolverUtil.resolveElementsInGroup(group, metadata);
 
-            // Create the INPUT variables
-            List inputElments = new ArrayList(elements.size());
-            for(int i=0; i<elements.size(); i++) {
-                ElementSymbol virtualElmnt = (ElementSymbol)elements.get(i);
-                ElementSymbol inputElement = (ElementSymbol)virtualElmnt.clone();
-                inputElments.add(inputElement);
-            }
+        // Create the INPUT variables
+        List<ElementSymbol> inputElments = new ArrayList<ElementSymbol>(elements.size());
+        for(int i=0; i<elements.size(); i++) {
+            ElementSymbol virtualElmnt = elements.get(i);
+            ElementSymbol inputElement = (ElementSymbol)virtualElmnt.clone();
+            inputElments.add(inputElement);
+        }
 
-            addScalarGroup(ProcedureReservedWords.INPUT, discoveredMetadata, externalGroups, inputElments);
+        addScalarGroup(ProcedureReservedWords.INPUT, discoveredMetadata, externalGroups, inputElments);
 
-            // Switch type to be boolean for all CHANGING variables
-            List changingElements = new ArrayList(elements.size());
-            for(int i=0; i<elements.size(); i++) {
-                ElementSymbol virtualElmnt = (ElementSymbol)elements.get(i);
-                ElementSymbol changeElement = (ElementSymbol)virtualElmnt.clone();
-                changeElement.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
-                changingElements.add(changeElement);
-            }
-
-            addScalarGroup(ProcedureReservedWords.CHANGING, discoveredMetadata, externalGroups, changingElements);
-            
-            // set the virtual group on the procedure
-            procCmd.setVirtualGroup(group);
-            
-            return externalGroups;
+        // Switch type to be boolean for all CHANGING variables
+        List<ElementSymbol> changingElements = new ArrayList<ElementSymbol>(elements.size());
+        for(int i=0; i<elements.size(); i++) {
+            ElementSymbol virtualElmnt = elements.get(i);
+            ElementSymbol changeElement = (ElementSymbol)virtualElmnt.clone();
+            changeElement.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
+            changingElements.add(changeElement);
         }
+
+        addScalarGroup(ProcedureReservedWords.CHANGING, discoveredMetadata, externalGroups, changingElements);
         
-        return null;
+        return externalGroups;
     }
         
     /** 
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
         
         ProcedureContainer procCommand = (ProcedureContainer)command;
         
         resolveGroup(metadata, procCommand);
         
-        resolveProceduralCommand(procCommand, useMetadataCommands, metadata, analysis);
+        resolveProceduralCommand(procCommand, metadata, analysis);
         
-        if (!useMetadataCommands) {
-            return;
-        }
-        
-        expandCommand(procCommand, metadata, analysis);
+        getPlan(metadata, procCommand);
+    }
 
-        Command subCommand = procCommand.getSubCommand();
-        
-        if (subCommand == null) {
-            return;
+	private String getPlan(QueryMetadataInterface metadata, ProcedureContainer procCommand)
+			throws MetaMatrixComponentException, QueryMetadataException,
+			QueryResolverException {
+		if(!procCommand.getGroup().isTempGroupSymbol() && metadata.isVirtualGroup(procCommand.getGroup().getMetadataID())) {
+            String plan = getPlan(metadata, procCommand.getGroup());
+            
+            if(plan == null) {
+                throw new QueryResolverException(ErrorMessageKeys.RESOLVER_0009, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0009, procCommand.getGroup(), procCommand.getClass().getSimpleName()));
+            }
+            return plan;
         }
-        
-        //find the childMetadata using a clean metadata store
-        TempMetadataStore childMetadata = new TempMetadataStore();
-        QueryMetadataInterface resolveMetadata = new TempMetadataAdapter(metadata.getMetadata(), childMetadata);
-
-        GroupContext externalGroups = findChildCommandMetadata(procCommand, childMetadata, useMetadataCommands, resolveMetadata);
-        
-        QueryResolver.setChildMetadata(subCommand, childMetadata.getData(), externalGroups);
-        
-        QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis);
-    }
+		return null;
+	}
     
     /** 
      * @param metadata

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/QueryResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/QueryResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/QueryResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -33,7 +33,6 @@
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.metadata.TempMetadataAdapter;
@@ -58,10 +57,10 @@
 import com.metamatrix.query.sql.lang.From;
 import com.metamatrix.query.sql.lang.FromClause;
 import com.metamatrix.query.sql.lang.GroupContext;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.UnaryFromClause;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.util.ErrorMessageKeys;
 import com.metamatrix.query.util.LogConstants;
 
 /**
@@ -85,6 +84,11 @@
     private static final CommandResolver BATCHED_UPDATE_RESOLVER = new BatchedUpdateResolver();
     private static final CommandResolver DYNAMIC_COMMAND_RESOLVER = new DynamicCommandResolver();
     private static final CommandResolver TEMP_TABLE_RESOLVER = new TempTableResolver();
+    
+    public static Command expandCommand(ProcedureContainer proc, QueryMetadataInterface metadata, AnalysisRecord analysisRecord) throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException {
+    	ProcedureContainerResolver cr = (ProcedureContainerResolver)chooseResolver(proc, metadata);
+    	return cr.expandCommand(proc, metadata, analysisRecord);
+    }
 
     /**
      * This implements an algorithm to resolve all the symbols created by the parser into real metadata IDs
@@ -95,7 +99,7 @@
      public static void resolveCommand(Command command, QueryMetadataInterface metadata, AnalysisRecord analysis)
          throws QueryResolverException, MetaMatrixComponentException {
 
-         resolveCommand(command, Collections.EMPTY_MAP, true, metadata, analysis);
+         resolveCommand(command, Collections.EMPTY_MAP, metadata, analysis);
      }
 
      /**
@@ -106,28 +110,26 @@
       public static void resolveCommand(Command command, QueryMetadataInterface metadata)
           throws QueryResolverException, MetaMatrixComponentException {
 
-          resolveCommand(command, Collections.EMPTY_MAP, true, metadata, AnalysisRecord.createNonRecordingRecord());
+          resolveCommand(command, Collections.EMPTY_MAP, metadata, AnalysisRecord.createNonRecordingRecord());
       }
 
    /**
     * This implements an algorithm to resolve all the symbols created by the parser into real metadata IDs
-    * @param command Command the SQL command we are running (Select, Update, Insert, Delete)
-    * @param externalMetadata Map of GroupSymbol to a List of ElementSymbol that identifies
+ * @param externalMetadata Map of GroupSymbol to a List of ElementSymbol that identifies
     * valid external groups that can be resolved against. Any elements resolved against external
     * groups will be treated as variables
-    * @param useMetadataCommands True if resolver should use metadata commands to completely resolve
-    * the command tree all the way to physical.  False if resolver should resolve only the visible command
-    * @param metadata QueryMetadataInterface the metadata
-    * @param analysis The analysis record which can be used to add anotations and debug information.
+ * @param metadata QueryMetadataInterface the metadata
+ * @param analysis The analysis record which can be used to add anotations and debug information.
+ * @param command Command the SQL command we are running (Select, Update, Insert, Delete)
     */
-    public static TempMetadataStore resolveCommand(Command currentCommand, Map externalMetadata, boolean useMetadataCommands, 
-                                                     QueryMetadataInterface metadata, AnalysisRecord analysis)
+    public static TempMetadataStore resolveCommand(Command currentCommand, Map externalMetadata, QueryMetadataInterface metadata, 
+                                                     AnalysisRecord analysis)
                        throws QueryResolverException, MetaMatrixComponentException {
-        return resolveCommand(currentCommand, externalMetadata, useMetadataCommands, metadata, analysis, true);
+        return resolveCommand(currentCommand, externalMetadata, metadata, analysis, true);
     }
       
-    public static TempMetadataStore resolveCommand(Command currentCommand, Map externalMetadata, boolean useMetadataCommands, 
-                                      QueryMetadataInterface metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+    public static TempMetadataStore resolveCommand(Command currentCommand, Map externalMetadata, QueryMetadataInterface metadata, 
+                                      AnalysisRecord analysis, boolean resolveNullLiterals)
         throws QueryResolverException, MetaMatrixComponentException {
 
 		LogManager.logTrace(LogConstants.CTX_QUERY_RESOLVER, new Object[]{"Resolving command", currentCommand}); //$NON-NLS-1$
@@ -171,7 +173,7 @@
             CommandResolver resolver = chooseResolver(currentCommand, resolverMetadata);
 
             // Resolve this command
-            resolver.resolveCommand(currentCommand, useMetadataCommands, resolverMetadata, analysis, resolveNullLiterals);            
+            resolver.resolveCommand(currentCommand, resolverMetadata, analysis, resolveNullLiterals);            
         } catch(QueryMetadataException e) {
             throw new QueryResolverException(e, e.getMessage());
         }
@@ -211,7 +213,7 @@
             case Command.TYPE_CREATE:               return TEMP_TABLE_RESOLVER;
             case Command.TYPE_DROP:                 return TEMP_TABLE_RESOLVER;
             default:
-                throw new QueryResolverException(ErrorMessageKeys.RESOLVER_0002, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0002, command.getType()));
+                throw new AssertionError("Unknown command type"); //$NON-NLS-1$
         }
     }
 
@@ -220,7 +222,7 @@
      * @param query the query to check
      * @param metadata QueryMetadataInterface the metadata
      */
-    static boolean isXMLQuery(Query query, QueryMetadataInterface metadata)
+    public static boolean isXMLQuery(Query query, QueryMetadataInterface metadata)
      throws MetaMatrixComponentException, QueryMetadataException, QueryResolverException {
 
         // Check first group

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/BatchedUpdateResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/BatchedUpdateResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/BatchedUpdateResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -42,9 +42,9 @@
 public class BatchedUpdateResolver implements CommandResolver {
     
     /** 
-     * @see com.metamatrix.query.resolver.command.AbstractCommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.command.AbstractCommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.analysis.AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         BatchedUpdateCommand batchedUpdateCommand = (BatchedUpdateCommand) command;
@@ -52,7 +52,7 @@
         for (Iterator i = batchedUpdateCommand.getSubCommands().iterator(); i.hasNext();) {
             Command subCommand = (Command)i.next();
             QueryResolver.setChildMetadata(subCommand, command);
-            QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis);
+            QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
         }
     }
 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DeleteResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DeleteResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DeleteResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -37,6 +37,7 @@
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Delete;
 import com.metamatrix.query.sql.lang.GroupContext;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 
 /**
@@ -45,15 +46,15 @@
 public class DeleteResolver extends ProcedureContainerResolver {
 
     /** 
-     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
+     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
      */
-    public void resolveProceduralCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis) 
+    public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         //Cast to known type
         Delete delete = (Delete) command;
 
-        Set groups = new HashSet();
+        Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
         groups.add(delete.getGroup());
         ResolverVisitor.resolveLanguageObject(delete, groups, delete.getExternalGroupContexts(), metadata);
 
@@ -73,12 +74,10 @@
     }
     
     @Override
-    public GroupContext findChildCommandMetadata(Command command,
-    		TempMetadataStore discoveredMetadata, boolean useMetadataCommands,
+    public GroupContext findChildCommandMetadata(ProcedureContainer container,
+    		Command subCommand, TempMetadataStore discoveredMetadata,
     		QueryMetadataInterface metadata) throws QueryMetadataException,
     		QueryResolverException, MetaMatrixComponentException {
-    	super.findChildCommandMetadata(command, discoveredMetadata,
-    			useMetadataCommands, metadata);
     	//defect 16451: don't expose input and changing variables to delete procedures
     	return null;
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -49,9 +49,9 @@
 public class DynamicCommandResolver implements CommandResolver {
 
     /** 
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, TempMetadataAdapter, AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, TempMetadataAdapter, AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         DynamicCommand dynamicCmd = (DynamicCommand)command;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,13 +25,13 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.dqp.message.ParameterInfo;
@@ -43,7 +43,6 @@
 import com.metamatrix.query.metadata.TempMetadataAdapter;
 import com.metamatrix.query.metadata.TempMetadataID;
 import com.metamatrix.query.metadata.TempMetadataStore;
-import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.resolver.ProcedureContainerResolver;
 import com.metamatrix.query.resolver.QueryResolver;
 import com.metamatrix.query.resolver.VariableResolver;
@@ -55,7 +54,7 @@
 import com.metamatrix.query.sql.lang.SPParameter;
 import com.metamatrix.query.sql.lang.StoredProcedure;
 import com.metamatrix.query.sql.lang.SubqueryContainer;
-import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
+import com.metamatrix.query.sql.lang.XQuery;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.Expression;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
@@ -65,50 +64,22 @@
 /**
  */
 public class ExecResolver extends ProcedureContainerResolver implements VariableResolver {
+	
+	@Override
+	public Command expandCommand(ProcedureContainer procCommand,
+			QueryMetadataInterface metadata, AnalysisRecord analysis)
+			throws QueryMetadataException, QueryResolverException,
+			MetaMatrixComponentException {
+		Command command = super.expandCommand(procCommand, metadata, analysis);
+		if (command instanceof XQuery) {
+			XQuery query = (XQuery)command;
+			query.setProcedureGroup(procCommand.getGroup().getCanonicalName());
+			query.setVariables(getVariableValues(procCommand, metadata));
+		}
+		return command;
+	}
 
     /**
-     * @see com.metamatrix.query.resolver.CommandResolver#expandCommand(com.metamatrix.query.sql.lang.Command, java.util.Map, com.metamatrix.query.metadata.QueryMetadataInterface, AnalysisRecord)
-     * 
-     * In this method - retrieve the parameter metadata information for the stored procedure, validate
-     * that it matches up with the actual parameters entered by the user, and replace the parsed
-     * expressions with the ones retrieved from metadata (except retain the user's parameter values).
-     * 
-     * The user may have used the more common indexed parameters syntax, or may have used named parameters syntax.
-     * Named parameters are a little more tricky, because the user is free to enter the parameters in
-     * any order and even to leave off optional parameters and/or parameters with default values.
-     */
-    public void expandCommand(Command command, QueryMetadataInterface metadata, AnalysisRecord analysis)
-        throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
-
-        StoredProcedure storedProcedureCommand = (StoredProcedure) command;
-
-        StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(storedProcedureCommand.getProcedureName());
-        
-        //if there is a query plan associated with the procedure, get it.
-        QueryNode plan = storedProcedureInfo.getQueryPlan();
-
-        //if there is a query plan, parse and resolve it
-        if(plan != null ){
-            try {
-                Command subCommand = QueryParser.getQueryParser().parseCommand(plan.getQuery());
-                if(subCommand instanceof CreateUpdateProcedureCommand){
-                    CreateUpdateProcedureCommand cupCommand = (CreateUpdateProcedureCommand)subCommand;
-                    //if the subcommand is virtual stored procedure, it must have the same
-                    //projected symbol as its parent.
-                    if(!cupCommand.isUpdateProcedure()){
-                        cupCommand.setProjectedSymbols(storedProcedureCommand.getProjectedSymbols());
-                    }
-                    
-                    cupCommand.setVirtualGroup(storedProcedureCommand.getGroup());
-                }
-                storedProcedureCommand.setSubCommand(subCommand);
-            } catch(QueryParserException e) {
-                throw new QueryResolverException(e, ErrorMessageKeys.RESOLVER_0008, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0008, storedProcedureCommand.getProcedureName()));
-            }
-        }
-    }
-
-    /**
      * @see com.metamatrix.query.resolver.CommandResolver#findCommandMetadata(com.metamatrix.query.sql.lang.Command,
      * com.metamatrix.query.metadata.QueryMetadataInterface)
      */
@@ -148,9 +119,10 @@
         while(oldParamIter.hasNext()) {
             SPParameter param = (SPParameter) oldParamIter.next();
             if(param.getExpression() != null) {
-                
                 if (namedParameters) {
-                    inputExpressions.put(param.getName().toUpperCase(), param.getExpression());
+                    if (inputExpressions.put(param.getName().toUpperCase(), param.getExpression()) != null) {
+                    	throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.duplicate_named_params", param.getName().toUpperCase())); //$NON-NLS-1$
+                    }
                 } else {
                     inputExpressions.put(new Integer(param.getIndex()), param.getExpression());
                 }
@@ -189,6 +161,7 @@
         // input parameters
         paramIter = clonedMetadataParams.iterator();
         int exprIndex = 1;
+        HashSet<String> expected = new HashSet<String>();
         while(paramIter.hasNext()) {
             SPParameter param = (SPParameter) paramIter.next();
             if(param.getParameterType() == ParameterInfo.IN || param.getParameterType() == ParameterInfo.INOUT) {
@@ -202,7 +175,8 @@
                     if (expr == null) {
                     	expr = ResolverUtil.getDefault(param.getParameterSymbol(), metadata);
                     	param.setUsingDefault(true);
-                    }
+                    	expected.add(nameKey);
+                    } 
                     param.setExpression(expr);                    
                 } else {
                     Expression expr = (Expression)inputExpressions.remove(new Integer(exprIndex));
@@ -214,7 +188,7 @@
         
         // Check for leftovers, i.e. params entered by user w/ wrong/unknown names
         if (namedParameters && !inputExpressions.isEmpty()) {
-            throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.invalid_named_params", inputExpressions.keySet())); //$NON-NLS-1$
+            throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.invalid_named_params", inputExpressions.keySet(), expected)); //$NON-NLS-1$
         }
         
         // Create temporary metadata that defines a group based on either the stored proc
@@ -232,16 +206,15 @@
         procGroup.setMetadataID(tid);
         storedProcedureCommand.setGroup(procGroup);
     }
+    
+    @Override
+    public GroupContext findChildCommandMetadata(ProcedureContainer container,
+    		Command subCommand, TempMetadataStore discoveredMetadata,
+    		QueryMetadataInterface metadata) throws QueryMetadataException,
+    		QueryResolverException, MetaMatrixComponentException {
 
-    /**
-     * @see com.metamatrix.query.resolver.CommandResolver#findChildCommandMetadata(com.metamatrix.query.sql.lang.
-     * Command, com.metamatrix.query.metadata.QueryMetadataInterface)
-     */
-    public GroupContext findChildCommandMetadata(Command command, TempMetadataStore childMetadata, boolean useMetadataCommands, QueryMetadataInterface metadata)
-    throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
+        StoredProcedure storedProcedureCommand = (StoredProcedure) container;
 
-        StoredProcedure storedProcedureCommand = (StoredProcedure) command;
-
         // Create temporary metadata that defines a group based on either the stored proc
         // name or the stored query name - this will be used later during planning
         String procName = storedProcedureCommand.getProcedureName();
@@ -249,7 +222,7 @@
         GroupContext context = new GroupContext();
 
         // Look through parameters to find input elements - these become child metadata
-        List tempElements = new ArrayList();
+        List<ElementSymbol> tempElements = new ArrayList<ElementSymbol>();
         Iterator iter = storedProcedureCommand.getParameters().iterator();
         while(iter.hasNext()) {
             SPParameter param = (SPParameter) iter.next();
@@ -259,21 +232,15 @@
             }
         }
 
-        ProcedureContainerResolver.addScalarGroup(procName, childMetadata, context, tempElements);
+        ProcedureContainerResolver.addScalarGroup(procName, discoveredMetadata, context, tempElements);
         
-        if (storedProcedureCommand.getSubCommand() instanceof CreateUpdateProcedureCommand) {
-            CreateUpdateProcedureCommand cup = (CreateUpdateProcedureCommand)storedProcedureCommand.getSubCommand();
-            
-            cup.setUserCommand(storedProcedureCommand);
-        }
-        
         return context;
     }
 
     /** 
-     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
+     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
      */
-    public void resolveProceduralCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis) 
+    public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         findCommandMetadata(command, metadata.getMetadataStore(), metadata);
@@ -291,7 +258,7 @@
                     for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr)) {
                         QueryResolver.setChildMetadata(container.getCommand(), command);
                         
-                        QueryResolver.resolveCommand(container.getCommand(), Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis);
+                        QueryResolver.resolveCommand(container.getCommand(), Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
                     }
                     ResolverVisitor.resolveLanguageObject(expr, null, externalGroups, metadata);
                     Class paramType = param.getClassType();
@@ -353,6 +320,11 @@
     protected String getPlan(QueryMetadataInterface metadata,
                              GroupSymbol group) throws MetaMatrixComponentException,
                                                QueryMetadataException {
-        return null;
+        StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(group.getCanonicalName());
+        
+        //if there is a query plan associated with the procedure, get it.
+        QueryNode plan = storedProcedureInfo.getQueryPlan();
+        
+        return plan.getQuery();
     }
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -65,9 +65,9 @@
 
     /**
      * Resolve an INSERT.  Need to resolve elements, constants, types, etc.
-     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
+     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
      */
-    public void resolveProceduralCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis) 
+    public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
 
@@ -81,7 +81,7 @@
         if(insert.getQueryExpression() != null) {
         	QueryResolver.setChildMetadata(insert.getQueryExpression(), command);
             
-            QueryResolver.resolveCommand(insert.getQueryExpression(), Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis, false);
+            QueryResolver.resolveCommand(insert.getQueryExpression(), Collections.EMPTY_MAP, metadata.getMetadata(), analysis, false);
         }
 
         Set<GroupSymbol> groups = new HashSet<GroupSymbol>();

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SetQueryResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SetQueryResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SetQueryResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -50,9 +50,9 @@
 public class SetQueryResolver implements CommandResolver {
 
     /**
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, java.util.Collection, TempMetadataAdapter, AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, TempMetadataAdapter, AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         SetQuery setQuery = (SetQuery) command;
@@ -60,7 +60,7 @@
         QueryCommand firstCommand = setQuery.getLeftQuery();
         
         QueryResolver.setChildMetadata(firstCommand, setQuery);
-        QueryResolver.resolveCommand(firstCommand, Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis, false);
+        QueryResolver.resolveCommand(firstCommand, Collections.EMPTY_MAP, metadata.getMetadata(), analysis, false);
 
         List firstProject = firstCommand.getProjectedSymbols();
         List<Class<?>> firstProjectTypes = new ArrayList<Class<?>>();
@@ -72,7 +72,7 @@
         QueryCommand rightCommand = setQuery.getRightQuery();
         
         QueryResolver.setChildMetadata(rightCommand, setQuery);
-        QueryResolver.resolveCommand(rightCommand, Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis, false);
+        QueryResolver.resolveCommand(rightCommand, Collections.EMPTY_MAP, metadata.getMetadata(), analysis, false);
 
         if (firstProject.size() != rightCommand.getProjectedSymbols().size()) {
             throw new QueryResolverException(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0035, setQuery.getOperation()));

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SimpleQueryResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SimpleQueryResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/SimpleQueryResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,25 +35,19 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.api.exception.query.UnresolvedSymbolDescription;
-import com.metamatrix.common.log.LogManager;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.dqp.message.ParameterInfo;
 import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.analysis.QueryAnnotation;
-import com.metamatrix.query.mapping.relational.QueryNode;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.metadata.StoredProcedureInfo;
 import com.metamatrix.query.metadata.SupportConstants;
 import com.metamatrix.query.metadata.TempMetadataAdapter;
 import com.metamatrix.query.metadata.TempMetadataID;
-import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.resolver.CommandResolver;
 import com.metamatrix.query.resolver.QueryResolver;
-import com.metamatrix.query.resolver.util.BindVariableVisitor;
 import com.metamatrix.query.resolver.util.ResolverUtil;
 import com.metamatrix.query.resolver.util.ResolverVisitor;
 import com.metamatrix.query.sql.LanguageObject;
@@ -62,8 +56,6 @@
 import com.metamatrix.query.sql.lang.From;
 import com.metamatrix.query.sql.lang.Into;
 import com.metamatrix.query.sql.lang.JoinPredicate;
-import com.metamatrix.query.sql.lang.Option;
-import com.metamatrix.query.sql.lang.OrderBy;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.SPParameter;
 import com.metamatrix.query.sql.lang.Select;
@@ -84,218 +76,21 @@
 import com.metamatrix.query.sql.symbol.ScalarSubquery;
 import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 import com.metamatrix.query.util.ErrorMessageKeys;
-import com.metamatrix.query.util.LogConstants;
 
 public class SimpleQueryResolver implements CommandResolver {
 
     private static final String ALL_IN_GROUP_SUFFIX = ".*"; //$NON-NLS-1$
 
-    private static Command resolveVirtualGroup(GroupSymbol virtualGroup, Command parentCommand, QueryMetadataInterface metadata, AnalysisRecord analysis)
-    throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
-        QueryNode qnode = null;
-        
-        Object metadataID = virtualGroup.getMetadataID();
-        boolean isSelectInto = ((Query)parentCommand).getInto() != null;
-        boolean isMaterializedViewLoad = false;
-        boolean noCache = false;
-        boolean cacheCommand = false;
-        boolean isMaterializedGroup = metadata.hasMaterialization(metadataID);
-        if( isMaterializedGroup) {
-            if(isSelectInto) {
-                //Case 2945: Only bypass Mat View logic if this is an explicit load into 
-                //the Matierialzed View.
-                final Object intoGrpID = ((Query)parentCommand).getInto().getGroup().getMetadataID();
-                final Object matID = metadata.getMaterialization(metadataID);
-                final Object matSTID =  metadata.getMaterializationStage(metadataID);
-                if(matID != null) {
-                    isMaterializedViewLoad = matID.equals(intoGrpID);
-                }
-                
-                if(matSTID != null && !isMaterializedViewLoad) {
-                    isMaterializedViewLoad = matSTID.equals(intoGrpID);
-                }
-            }
-
-            Option option  = parentCommand.getOption();
-            noCache = isNoCacheGroup(metadata, metadataID, option);
-        	if(noCache){
-        		//not use cache
-        		qnode = metadata.getVirtualPlan(metadataID);
-        		String matTableName = metadata.getFullName(metadata.getMaterialization(metadataID));
-        		recordMaterializedTableNotUsedAnnotation(virtualGroup, analysis, matTableName);
-        	}else{
-	            if(!isMaterializedViewLoad) {           	
-	                // Default query for a materialized group - go to cached table
-	                String groupName = metadata.getFullName(metadataID);
-	                String matTableName = metadata.getFullName(metadata.getMaterialization(metadataID));
-	                qnode = new QueryNode(groupName, "SELECT * FROM " + matTableName); //$NON-NLS-1$
-	                
-	                recordMaterializationTableAnnotation(virtualGroup, analysis, matTableName);                
-	            } else {
-	                // Loading due to SELECT INTO - query the primary transformation
-	                qnode = metadata.getVirtualPlan(metadataID);
-	
-	                recordLoadingMaterializationTableAnnotation(virtualGroup, analysis);                
-	            }
-        	}
-        } else {
-            if (metadata.isXMLGroup(virtualGroup.getMetadataID())) {
-                throw new QueryResolverException(ErrorMessageKeys.RESOLVER_0003, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0003));
-            }
-            cacheCommand = true;
-            Command command = (Command)metadata.getFromMetadataCache(virtualGroup.getMetadataID(), "transformation/select"); //$NON-NLS-1$
-            if (command != null) {
-            	command = (Command)command.clone();
-            	command.setVirtualGroup(virtualGroup);
-            	return command;
-            }
-            // Not a materialized view - query the primary transformation
-            qnode = metadata.getVirtualPlan(metadataID);            
-        }
-        
-        Command subCommand = convertToSubquery(qnode, noCache, metadata);
-        subCommand.setVirtualGroup(virtualGroup);
-        QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, true, metadata, analysis);
-        if (cacheCommand) {
-        	metadata.addToMetadataCache(virtualGroup.getMetadataID(), "transformation/select", subCommand.clone()); //$NON-NLS-1$
-        }        
-        return subCommand;
-    }
-
     /** 
-     * @param metadata
-     * @param metadataID
-     * @param noCache
-     * @param option
-     * @return
-     * @throws QueryMetadataException
-     * @throws MetaMatrixComponentException
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
      */
-    public static boolean isNoCacheGroup(QueryMetadataInterface metadata,
-                                          Object metadataID,
-                                          Option option) throws QueryMetadataException,
-                                                        MetaMatrixComponentException {
-        if(option == null){
-            return false;
-        }
-    	if(option.isNoCache() && (option.getNoCacheGroups() == null || option.getNoCacheGroups().isEmpty())){
-    		//only OPTION NOCACHE, no group specified
-    		return true;
-    	}       
-        if(option.getNoCacheGroups() != null){
-            for(int i=0; i< option.getNoCacheGroups().size(); i++){
-                String groupName = (String)option.getNoCacheGroups().get(i);
-                try {
-                    Object noCacheGroupID = metadata.getGroupID(groupName);
-                    if(metadataID.equals(noCacheGroupID)){
-                        return true;
-                    }
-                } catch (QueryMetadataException e) {
-                    //log that an unknown groups was used in the no cache
-                    LogManager.logWarning(LogConstants.CTX_QUERY_RESOLVER, e, QueryPlugin.Util.getString("SimpleQueryResolver.unknown_group_in_nocache", groupName)); //$NON-NLS-1$
-                }
-            }
-    	}
-        return false;
-    }
-    
-    /**
-	 * @param virtualGroup
-	 * @param analysis
-	 */
-	private static void recordMaterializedTableNotUsedAnnotation(GroupSymbol virtualGroup, AnalysisRecord analysis, String matTableName) {
-        if ( analysis.recordAnnotations() ) {
-            Object[] params = new Object[] {virtualGroup, matTableName};
-            QueryAnnotation annotation = new QueryAnnotation(QueryAnnotation.MATERIALIZED_VIEW, 
-                                                         QueryPlugin.Util.getString("SimpleQueryResolver.materialized_table_not_used", params),  //$NON-NLS-1$
-                                                         null, 
-                                                         QueryAnnotation.LOW);
-            analysis.addAnnotation(annotation);
-        }
-	}
-
-	/** 
-     * @param virtualGroup
-     * @param analysis
-     * @param matTableName
-     * @since 4.2
-     */
-    private static void recordMaterializationTableAnnotation(GroupSymbol virtualGroup,
-                                                      AnalysisRecord analysis,
-                                                      String matTableName) {
-        if ( analysis.recordAnnotations() ) {
-            Object[] params = new Object[] {virtualGroup, matTableName};
-            QueryAnnotation annotation = new QueryAnnotation(QueryAnnotation.MATERIALIZED_VIEW, 
-                                                         QueryPlugin.Util.getString("SimpleQueryResolver.Query_was_redirected_to_Mat_table", params),  //$NON-NLS-1$
-                                                         null, 
-                                                         QueryAnnotation.LOW);
-            analysis.addAnnotation(annotation);
-        }
-    }
-
-    /** 
-     * @param virtualGroup
-     * @param analysis
-     * @param matTableName
-     * @since 4.2
-     */
-    private static void recordLoadingMaterializationTableAnnotation(GroupSymbol virtualGroup,
-                                                      AnalysisRecord analysis) {
-        if ( analysis.recordAnnotations() ) {
-            Object[] params = new Object[] {virtualGroup};
-            QueryAnnotation annotation = new QueryAnnotation(QueryAnnotation.MATERIALIZED_VIEW, 
-                                                         QueryPlugin.Util.getString("SimpleQueryResolver.Loading_materialized_table", params),  //$NON-NLS-1$
-                                                         null, 
-                                                         QueryAnnotation.LOW);
-            analysis.addAnnotation(annotation);
-        }
-    }
-
-    private static Command convertToSubquery(QueryNode qnode, boolean nocache, QueryMetadataInterface metadata)
-    throws QueryResolverException, MetaMatrixComponentException {
-
-        // Parse this node's command
-        Command command = qnode.getCommand();
-        
-        if (command == null) {
-            try {
-                command = QueryParser.getQueryParser().parseCommand(qnode.getQuery());
-            } catch(QueryParserException e) {
-                throw new QueryResolverException(e, ErrorMessageKeys.RESOLVER_0011, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0011, qnode.getGroupName()));
-            }
-            
-            //Handle bindings and references
-            List bindings = qnode.getBindings();
-            if (bindings != null){
-                BindVariableVisitor.bindReferences(command, bindings, metadata);
-            }
-        }
-        
-        if (nocache) {
-            Option option = command.getOption();
-            if (option == null) {
-                option = new Option();
-                command.setOption(option);
-            }
-            option.setNoCache(true);
-            if (option.getNoCacheGroups() != null) {
-                option.getNoCacheGroups().clear();
-            }
-        }
-
-        return command;
-    }
-
-    /** 
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
-     */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         Query query = (Query) command;
         
         try {
-            QueryResolverVisitor qrv = new QueryResolverVisitor(query, metadata, useMetadataCommands, analysis);
+            QueryResolverVisitor qrv = new QueryResolverVisitor(query, metadata, analysis);
             qrv.visit(query);
             ResolverVisitor visitor = (ResolverVisitor)qrv.getVisitor();
 			visitor.throwException(true);
@@ -316,6 +111,10 @@
             ResolverUtil.resolveLimit(query.getLimit());
         }
         
+        if (query.getOrderBy() != null) {
+        	ResolverUtil.resolveOrderBy(query.getOrderBy(), query, metadata);
+        }
+        
         List symbols = query.getSelect().getProjectedSymbols();
         
         if (query.getInto() != null) {
@@ -326,11 +125,11 @@
         }
     }
 
-    private static GroupSymbol resolveAllInGroup(AllInGroupSymbol allInGroupSymbol, Set groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException {       
+    private static GroupSymbol resolveAllInGroup(AllInGroupSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException {       
         String name = allInGroupSymbol.getName();
         int index = name.lastIndexOf(ALL_IN_GROUP_SUFFIX);
         String groupAlias = name.substring(0, index);
-        List groupSymbols = ResolverUtil.findMatchingGroups(groupAlias.toUpperCase(), groups, metadata);
+        List<GroupSymbol> groupSymbols = ResolverUtil.findMatchingGroups(groupAlias.toUpperCase(), groups, metadata);
         if(groupSymbols.isEmpty() || groupSymbols.size() > 1) {
             String msg = QueryPlugin.Util.getString(groupSymbols.isEmpty()?ErrorMessageKeys.RESOLVER_0047:"SimpleQueryResolver.ambiguous_all_in_group", allInGroupSymbol);  //$NON-NLS-1$
             QueryResolverException qre = new QueryResolverException(msg);
@@ -338,7 +137,7 @@
             throw qre;
         }
 
-        return (GroupSymbol)groupSymbols.get(0);
+        return groupSymbols.get(0);
     }
     
     public static class QueryResolverVisitor extends PostOrderNavigator {
@@ -346,17 +145,15 @@
         private LinkedHashSet<GroupSymbol> currentGroups = new LinkedHashSet<GroupSymbol>();
         private List<GroupSymbol> discoveredGroups = new LinkedList<GroupSymbol>();
         private TempMetadataAdapter metadata;
-        private boolean expandCommand;
         private Query query;
         private AnalysisRecord analysis;
         
-        public QueryResolverVisitor(Query query, TempMetadataAdapter metadata, boolean expandCommand, AnalysisRecord record) {
+        public QueryResolverVisitor(Query query, TempMetadataAdapter metadata, AnalysisRecord record) {
             super(new ResolverVisitor(metadata, null, query.getExternalGroupContexts()));
             ResolverVisitor visitor = (ResolverVisitor)getVisitor();
             visitor.setGroups(currentGroups);
             this.query = query;
             this.metadata = metadata;
-            this.expandCommand = expandCommand;
             this.analysis = record;
         }
         
@@ -374,8 +171,6 @@
                 
         /**
          * Resolving a Query requires a special ordering
-         * 
-         * Note that into is actually first to handle mat view logic
          */
         public void visit(Query obj) {
             visitNode(obj.getInto());
@@ -384,7 +179,6 @@
             visitNode(obj.getGroupBy());
             visitNode(obj.getHaving());
             visitNode(obj.getSelect());        
-            visitNode(obj.getOrderBy());
         }
         
         public void visit(GroupSymbol obj) {
@@ -404,7 +198,7 @@
             command.pushNewResolvingContext(this.currentGroups);
             
             try {
-                QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, expandCommand, metadata.getMetadata(), analysis, false);
+                QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, metadata.getMetadata(), analysis, false);
             } catch (QueryResolverException err) {
                 throw new MetaMatrixRuntimeException(err);
             } catch (MetaMatrixComponentException err) {
@@ -414,14 +208,9 @@
         
         public void visit(AllSymbol obj) {
             try {
-                List elementSymbols = new ArrayList();
-                Iterator groupIter = currentGroups.iterator();
-                while(groupIter.hasNext()){
-                    GroupSymbol group = (GroupSymbol)groupIter.next();
-    
-                    List elements = resolveSelectableElements(group);
-    
-                    elementSymbols.addAll(elements);
+                List<ElementSymbol> elementSymbols = new ArrayList<ElementSymbol>();
+                for (GroupSymbol group : currentGroups) {
+                    elementSymbols.addAll(resolveSelectableElements(group));
                 }
                 obj.setElementSymbols(elementSymbols);
             } catch (MetaMatrixComponentException err) {
@@ -429,16 +218,14 @@
             } 
         }
 
-        private List resolveSelectableElements(GroupSymbol group) throws QueryMetadataException,
+        private List<ElementSymbol> resolveSelectableElements(GroupSymbol group) throws QueryMetadataException,
                                                                  MetaMatrixComponentException {
-            List elements = ResolverUtil.resolveElementsInGroup(group, metadata);
+            List<ElementSymbol> elements = ResolverUtil.resolveElementsInGroup(group, metadata);
             
-            List result = new ArrayList(elements.size());
+            List<ElementSymbol> result = new ArrayList<ElementSymbol>(elements.size());
    
             // Look for elements that are not selectable and remove them
-            Iterator elementIter = elements.iterator();
-            while(elementIter.hasNext()) {
-                ElementSymbol element = (ElementSymbol) elementIter.next();
+            for (ElementSymbol element : elements) {
                 if(metadata.elementSupports(element.getMetadataID(), SupportConstants.Element.SELECT)) {
                     element = (ElementSymbol)element.clone();
                     element.setGroupSymbol(group);
@@ -453,7 +240,7 @@
             try {
                 GroupSymbol group = resolveAllInGroup(obj, currentGroups, metadata);
                 
-                List elements = resolveSelectableElements(group);
+                List<ElementSymbol> elements = resolveSelectableElements(group);
                 
                 obj.setElementSymbols(elements);
             } catch (QueryResolverException err) {
@@ -466,7 +253,7 @@
         public void visit(ScalarSubquery obj) {
             resolveSubQuery(obj);
             
-            Collection projSymbols = obj.getCommand().getProjectedSymbols();
+            Collection<SingleElementSymbol> projSymbols = obj.getCommand().getProjectedSymbols();
 
             //Scalar subquery should have one projected symbol (query with one expression
             //in SELECT or stored procedure execution that returns a single value).
@@ -506,120 +293,107 @@
         public void visit(UnaryFromClause obj) {
             GroupSymbol group = obj.getGroup();
             visitNode(group);
-            this.discoveredGroups.add(group);
-            
             try {
-                if (expandCommand
-                    && !group.isTempGroupSymbol()
-                    && !group.isProcedure()
-                    && (!(group.getMetadataID() instanceof TempMetadataID) || metadata.getVirtualPlan(group.getMetadataID()) != null)
-                    && (metadata.isVirtualGroup(group.getMetadataID()))) {
-                    
-                    Command command = resolveVirtualGroup(group, query, metadata.getMetadata(), analysis);                    
-                    obj.setExpandedCommand(command);
-                } else if (group.isProcedure()) {
-                    //"relational" select of a virtual procedure
-                    String fullName = metadata.getFullName(group.getMetadataID());
-                    String queryName = group.getName();
-                    
-                    StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(fullName);
-
-                    StoredProcedure storedProcedureCommand = new StoredProcedure();
-                    storedProcedureCommand.setProcedureRelational(true);
-                    storedProcedureCommand.setProcedureName(fullName);
-                    
-                    List metadataParams = storedProcedureInfo.getParameters();
-                    
-                    Query procQuery = new Query();
-                    From from = new From();
-                    from.addClause(new SubqueryFromClause("X", storedProcedureCommand)); //$NON-NLS-1$
-                    procQuery.setFrom(from);
-                    Select select = new Select();
-                    select.addSymbol(new AllInGroupSymbol("X.*")); //$NON-NLS-1$
-                    procQuery.setSelect(select);
-                    
-                    List accessPatternElementNames = new LinkedList();
-                    
-                    int paramIndex = 1;
-                    
-                    for(Iterator paramIter = metadataParams.iterator(); paramIter.hasNext();){
-                        SPParameter metadataParameter  = (SPParameter)paramIter.next();
-                        SPParameter clonedParam = (SPParameter)metadataParameter.clone();
-                        if (clonedParam.getParameterType()==ParameterInfo.IN || metadataParameter.getParameterType()==ParameterInfo.INOUT) {
-                            ElementSymbol paramSymbol = clonedParam.getParameterSymbol();
-                            Reference ref = new Reference(paramSymbol);
-                            clonedParam.setExpression(ref);
-                            clonedParam.setIndex(paramIndex++);
-                            storedProcedureCommand.setParameter(clonedParam);
-                            
-                            String aliasName = paramSymbol.getShortName();
-                            
-                            if (metadataParameter.getParameterType()==ParameterInfo.INOUT) {
-                                aliasName += "_IN"; //$NON-NLS-1$
-                            }
-                            
-                            SingleElementSymbol newSymbol = new AliasSymbol(aliasName, new ExpressionSymbol(paramSymbol.getShortName(), ref));
-                            
-                            select.addSymbol(newSymbol);
-                            accessPatternElementNames.add(queryName + ElementSymbol.SEPARATOR + aliasName);
-                        }
-                    }
-                    
-                    QueryResolver.resolveCommand(procQuery, Collections.EMPTY_MAP, expandCommand, metadata.getMetadata(), analysis);
-                    
-                    List projectedSymbols = procQuery.getProjectedSymbols();
-                    
-                    HashSet foundNames = new HashSet();
-                    
-                    for (Iterator i = projectedSymbols.iterator(); i.hasNext();) {
-                        SingleElementSymbol ses = (SingleElementSymbol)i.next();
-                        if (!foundNames.add(ses.getShortCanonicalName())) {
-                            throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.Proc_Relational_Name_conflict", fullName)); //$NON-NLS-1$                            
-                        }
-                    }
-                    
-                    TempMetadataID id = metadata.getMetadataStore().getTempGroupID(queryName);
-
-                    if (id == null) {
-                        metadata.getMetadataStore().addTempGroup(queryName, projectedSymbols, true);
-                        
-                        id = metadata.getMetadataStore().getTempGroupID(queryName);
-                        id.setOriginalMetadataID(storedProcedureCommand.getProcedureID());
-                        List accessPatternIds = new LinkedList();
-                        
-                        for (Iterator i = accessPatternElementNames.iterator(); i.hasNext();) {
-                            String name = (String)i.next();
-                            accessPatternIds.add(metadata.getMetadataStore().getTempElementID(name));
-                        }
-                        
-                        id.setAccessPatterns(Arrays.asList(new TempMetadataID("procedure access pattern", accessPatternIds))); //$NON-NLS-1$
-                    }
-                    
-                    group.setMetadataID(id);
-                    group.setProcedure(true);
-                    procQuery.setVirtualGroup(group);
-                    
-                    if (expandCommand) {
-                        obj.setExpandedCommand(procQuery);
-                    }
-                }
+	            if (metadata.isXMLGroup(group.getMetadataID())) {
+	                throw new QueryResolverException(ErrorMessageKeys.RESOLVER_0003, QueryPlugin.Util.getString(ErrorMessageKeys.RESOLVER_0003));
+	            }
+	            this.discoveredGroups.add(group);
+	            if (group.isProcedure()) {
+	                createProcRelational(obj);
+	            }
             } catch(QueryResolverException e) {
                 throw new MetaMatrixRuntimeException(e);
             } catch(MetaMatrixComponentException e) {
                 throw new MetaMatrixRuntimeException(e);                        
 			}
         }
+
+		private void createProcRelational(UnaryFromClause obj)
+				throws MetaMatrixComponentException, QueryMetadataException,
+				QueryResolverException {
+			GroupSymbol group = obj.getGroup();
+			String fullName = metadata.getFullName(group.getMetadataID());
+			String queryName = group.getName();
+			
+			StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(fullName);
+
+			StoredProcedure storedProcedureCommand = new StoredProcedure();
+			storedProcedureCommand.setProcedureRelational(true);
+			storedProcedureCommand.setProcedureName(fullName);
+			
+			List metadataParams = storedProcedureInfo.getParameters();
+			
+			Query procQuery = new Query();
+			From from = new From();
+			from.addClause(new SubqueryFromClause("X", storedProcedureCommand)); //$NON-NLS-1$
+			procQuery.setFrom(from);
+			Select select = new Select();
+			select.addSymbol(new AllInGroupSymbol("X.*")); //$NON-NLS-1$
+			procQuery.setSelect(select);
+			
+			List<String> accessPatternElementNames = new LinkedList<String>();
+			
+			int paramIndex = 1;
+			
+			for(Iterator paramIter = metadataParams.iterator(); paramIter.hasNext();){
+			    SPParameter metadataParameter  = (SPParameter)paramIter.next();
+			    SPParameter clonedParam = (SPParameter)metadataParameter.clone();
+			    if (clonedParam.getParameterType()==ParameterInfo.IN || metadataParameter.getParameterType()==ParameterInfo.INOUT) {
+			        ElementSymbol paramSymbol = clonedParam.getParameterSymbol();
+			        Reference ref = new Reference(paramSymbol);
+			        clonedParam.setExpression(ref);
+			        clonedParam.setIndex(paramIndex++);
+			        storedProcedureCommand.setParameter(clonedParam);
+			        
+			        String aliasName = paramSymbol.getShortName();
+			        
+			        if (metadataParameter.getParameterType()==ParameterInfo.INOUT) {
+			            aliasName += "_IN"; //$NON-NLS-1$
+			        }
+			        
+			        SingleElementSymbol newSymbol = new AliasSymbol(aliasName, new ExpressionSymbol(paramSymbol.getShortName(), ref));
+			        
+			        select.addSymbol(newSymbol);
+			        accessPatternElementNames.add(queryName + ElementSymbol.SEPARATOR + aliasName);
+			    }
+			}
+			
+			QueryResolver.resolveCommand(procQuery, Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
+			
+			List projectedSymbols = procQuery.getProjectedSymbols();
+			
+			HashSet<String> foundNames = new HashSet<String>();
+			
+			for (Iterator i = projectedSymbols.iterator(); i.hasNext();) {
+			    SingleElementSymbol ses = (SingleElementSymbol)i.next();
+			    if (!foundNames.add(ses.getShortCanonicalName())) {
+			        throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.Proc_Relational_Name_conflict", fullName)); //$NON-NLS-1$                            
+			    }
+			}
+			
+			TempMetadataID id = metadata.getMetadataStore().getTempGroupID(queryName);
+
+			if (id == null) {
+			    metadata.getMetadataStore().addTempGroup(queryName, projectedSymbols, true);
+			    
+			    id = metadata.getMetadataStore().getTempGroupID(queryName);
+			    id.setOriginalMetadataID(storedProcedureCommand.getProcedureID());
+			    if (!accessPatternElementNames.isEmpty()) {
+				    List<TempMetadataID> accessPatternIds = new LinkedList<TempMetadataID>();
+				    
+				    for (String name : accessPatternElementNames) {
+				        accessPatternIds.add(metadata.getMetadataStore().getTempElementID(name));
+				    }
+				    
+				    id.setAccessPatterns(Arrays.asList(new TempMetadataID("procedure access pattern", accessPatternIds))); //$NON-NLS-1$
+			    }
+			}
+			
+			group.setMetadataID(id);
+			
+		    obj.setExpandedCommand(procQuery);
+		}
         
-        public void visit(OrderBy obj) {
-            try {
-                ResolverUtil.resolveOrderBy(obj, query, metadata);
-            } catch(QueryResolverException e) {
-                throw new MetaMatrixRuntimeException(e);
-            } catch(MetaMatrixComponentException e) {
-                throw new MetaMatrixRuntimeException(e);                        
-            }
-        }
-        
         /** 
          * @see com.metamatrix.query.sql.navigator.PreOrPostOrderNavigator#visit(com.metamatrix.query.sql.lang.Into)
          */
@@ -658,5 +432,4 @@
             addDiscoveredGroups();
         }
     }
-
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/TempTableResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/TempTableResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/TempTableResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -49,9 +49,9 @@
 public class TempTableResolver implements CommandResolver {
 
     /** 
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
         
         if(command.getType() == Command.TYPE_CREATE) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateProcedureResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateProcedureResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateProcedureResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -79,7 +79,7 @@
  */
 public class UpdateProcedureResolver implements CommandResolver {
 
-    public void resolveVirtualGroupElements(CreateUpdateProcedureCommand procCommand, boolean useMetadataCommands, QueryMetadataInterface metadata)
+    public void resolveVirtualGroupElements(CreateUpdateProcedureCommand procCommand, QueryMetadataInterface metadata)
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
 		// virtual group on procedure
@@ -109,26 +109,23 @@
 
 		ResolveVirtualGroupCriteriaVisitor.resolveCriteria(procCommand, virtualGroup, metadata);
 
-		// symbol map need not be checked as we are not validating
-		// in the modeler
-		if(useMetadataCommands) {
-	    	// get a symbol map between virtual elements and the elements that define
-	    	// then in the query transformation, this info is used in evaluating/validating
-	    	// has criteria/trnaslate criteria clauses
-			Command transformCmd = getQueryTransformCmd(virtualGroup, metadata);
-			Map symbolMap = SymbolMap.createSymbolMap(virtualGroup, (List<SingleElementSymbol>)transformCmd.getProjectedSymbols()).asMap();
-	        // set the symbolMap on the procedure
-			procCommand.setSymbolMap(symbolMap);
-		}
+    	// get a symbol map between virtual elements and the elements that define
+    	// then in the query transformation, this info is used in evaluating/validating
+    	// has criteria/translate criteria clauses
+        Command transformCmd = getQueryTransformCmd(virtualGroup, metadata);
+		Map symbolMap = SymbolMap.createSymbolMap(virtualGroup, (List<SingleElementSymbol>)transformCmd.getProjectedSymbols(), metadata).asMap();
+		procCommand.setSymbolMap(symbolMap);
     }
-
-	/**
+    
+    /**
 	 * Get the command for the transformation query that defines this virtual group.
 	 */
     private Command getQueryTransformCmd(GroupSymbol virtualGroup, QueryMetadataInterface metadata)
     throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
-
-        Command transformCmd = null;
+    	Command transformCmd = (Command)metadata.getFromMetadataCache(virtualGroup.getMetadataID(), "transformation/select"); //$NON-NLS-1$
+    	if (transformCmd != null) {
+    		return transformCmd;
+    	}
     	QueryNode queryNode = metadata.getVirtualPlan(virtualGroup.getMetadataID());
     	String transformQuery = queryNode.getQuery();
         try {
@@ -143,9 +140,9 @@
     }
 
     /**
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, java.util.Collection, TempMetadataAdapter, AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, TempMetadataAdapter, AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         CreateUpdateProcedureCommand procCommand = (CreateUpdateProcedureCommand) command;
@@ -157,7 +154,7 @@
         
         // virtual group elements in HAS and TRANSLATE criteria have to be resolved
         if(procCommand.isUpdateProcedure()){
-            resolveVirtualGroupElements(procCommand, useMetadataCommands, metadata);
+            resolveVirtualGroupElements(procCommand, metadata);
 
             //add the default variables
             String countVar = ProcedureReservedWords.VARIABLES + ElementSymbol.SEPARATOR + ProcedureReservedWords.ROWS_UPDATED;
@@ -167,11 +164,11 @@
             ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, metadata.getMetadataStore(), externalGroups, symbols);         
         }
         
-        resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata, useMetadataCommands, procCommand.isUpdateProcedure(), analysis);
+        resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata, procCommand.isUpdateProcedure(), analysis);
     }
 
 	private void resolveBlock(CreateUpdateProcedureCommand command, Block block, GroupContext externalGroups, 
-                              TempMetadataAdapter metadata, boolean useMetadataCommands, boolean isUpdateProcedure, AnalysisRecord analysis)
+                              TempMetadataAdapter metadata, boolean isUpdateProcedure, AnalysisRecord analysis)
         throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException {
         LogManager.logTrace(LogConstants.CTX_QUERY_RESOLVER, new Object[]{"Resolving block", block}); //$NON-NLS-1$
         
@@ -185,11 +182,11 @@
         
         Iterator stmtIter = block.getStatements().iterator();
         while(stmtIter.hasNext()) {
-            resolveStatement(command, (Statement)stmtIter.next(), externalGroups, variables, metadata, useMetadataCommands, isUpdateProcedure, analysis);
+            resolveStatement(command, (Statement)stmtIter.next(), externalGroups, variables, metadata, isUpdateProcedure, analysis);
         }
     }
 
-	private void resolveStatement(CreateUpdateProcedureCommand command, Statement statement, GroupContext externalGroups, GroupSymbol variables, TempMetadataAdapter metadata, boolean expandCommand, boolean isUpdateProcedure, AnalysisRecord analysis)
+	private void resolveStatement(CreateUpdateProcedureCommand command, Statement statement, GroupContext externalGroups, GroupSymbol variables, TempMetadataAdapter metadata, boolean isUpdateProcedure, AnalysisRecord analysis)
         throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException {
         LogManager.logTrace(LogConstants.CTX_QUERY_RESOLVER, new Object[]{"Resolving statement", statement}); //$NON-NLS-1$
 
@@ -198,19 +195,19 @@
                 IfStatement ifStmt = (IfStatement) statement;
                 Criteria ifCrit = ifStmt.getCondition();
                 for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(ifCrit)) {
-                	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), expandCommand, analysis);
+                	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), analysis);
                 }
                 ResolverVisitor.resolveLanguageObject(ifCrit, null, externalGroups, metadata);
-            	resolveBlock(command, ifStmt.getIfBlock(), externalGroups, metadata, expandCommand, isUpdateProcedure, analysis);
+            	resolveBlock(command, ifStmt.getIfBlock(), externalGroups, metadata, isUpdateProcedure, analysis);
                 if(ifStmt.hasElseBlock()) {
-                    resolveBlock(command, ifStmt.getElseBlock(), externalGroups, metadata, expandCommand, isUpdateProcedure, analysis);
+                    resolveBlock(command, ifStmt.getElseBlock(), externalGroups, metadata, isUpdateProcedure, analysis);
                 }
                 break;
             case Statement.TYPE_COMMAND:
                 CommandStatement cmdStmt = (CommandStatement) statement;
                 Command subCommand = cmdStmt.getCommand();
                 
-                TempMetadataStore discoveredMetadata = resolveEmbeddedCommand(metadata, externalGroups, subCommand, expandCommand, analysis);
+                TempMetadataStore discoveredMetadata = resolveEmbeddedCommand(metadata, externalGroups, subCommand, analysis);
                 
                 if (discoveredMetadata != null) {
                     metadata.getMetadataStore().getData().putAll(discoveredMetadata.getData());
@@ -220,12 +217,9 @@
                 if (subCommand instanceof DynamicCommand) {
                     DynamicCommand dynCommand = (DynamicCommand)subCommand;
                     
-                    if(dynCommand.getIntoGroup() == null && !command.isUpdateProcedure() && !dynCommand.isAsClauseSet()) {
-                        if (command.getProjectedSymbols().size() > 0) {
-                            dynCommand.setAsColumns(command.getProjectedSymbols());
-                        } else if (command.getParentProjectSymbols() != null) {
-                            dynCommand.setAsColumns(command.getParentProjectSymbols());
-                        }
+                    if(dynCommand.getIntoGroup() == null && !command.isUpdateProcedure() 
+                    		&& !dynCommand.isAsClauseSet() && !command.getProjectedSymbols().isEmpty()) {
+                        dynCommand.setAsColumns(command.getProjectedSymbols());
                     }
                 }
                 
@@ -251,11 +245,11 @@
             	if (assStmt.getValue() != null) {
 					if (assStmt.hasCommand()) {
 						Command cmd = assStmt.getCommand();
-						resolveEmbeddedCommand(metadata, externalGroups, cmd, expandCommand, analysis);
+						resolveEmbeddedCommand(metadata, externalGroups, cmd, analysis);
 					} else if (assStmt.hasExpression()) {
                         Expression expr = assStmt.getExpression();
                         for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr)) {
-                        	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), expandCommand, analysis);
+                        	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), analysis);
                         }
                         ResolverVisitor.resolveLanguageObject(expr, null, externalGroups, metadata);
                     }
@@ -291,10 +285,10 @@
                 WhileStatement whileStmt = (WhileStatement) statement;
                 Criteria whileCrit = whileStmt.getCondition();
                 for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(whileCrit)) {
-                	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), expandCommand, analysis);
+                	resolveEmbeddedCommand(metadata, externalGroups, container.getCommand(), analysis);
                 }
                 ResolverVisitor.resolveLanguageObject(whileCrit, null, externalGroups, metadata);
-                resolveBlock(command, whileStmt.getBlock(), externalGroups, metadata, expandCommand, isUpdateProcedure, analysis);
+                resolveBlock(command, whileStmt.getBlock(), externalGroups, metadata, isUpdateProcedure, analysis);
                 break;
             case Statement.TYPE_LOOP:
                 LoopStatement loopStmt = (LoopStatement) statement;
@@ -310,7 +304,7 @@
 	        		throw new QueryResolverException(errorMsg);
 	        	}
                 Command cmd = loopStmt.getCommand();
-                resolveEmbeddedCommand(metadata, externalGroups, cmd, expandCommand, analysis);
+                resolveEmbeddedCommand(metadata, externalGroups, cmd, analysis);
                 List symbols = cmd.getProjectedSymbols();
                 
                 //add the loop cursor group into its own context
@@ -320,7 +314,7 @@
                 
                 ProcedureContainerResolver.addScalarGroup(groupName, store, externalGroups, symbols);
                 
-                resolveBlock(command, loopStmt.getBlock(), externalGroups, metadata, expandCommand, isUpdateProcedure, analysis);
+                resolveBlock(command, loopStmt.getBlock(), externalGroups, metadata, isUpdateProcedure, analysis);
                 break;
             case Statement.TYPE_BREAK:
             case Statement.TYPE_CONTINUE:
@@ -331,11 +325,11 @@
     }
 
     private TempMetadataStore resolveEmbeddedCommand(TempMetadataAdapter metadata, GroupContext groupContext,
-                                Command cmd, boolean expandCommand, AnalysisRecord analysis) throws MetaMatrixComponentException,
+                                Command cmd, AnalysisRecord analysis) throws MetaMatrixComponentException,
                                             QueryResolverException {
         QueryResolver.setChildMetadata(cmd, metadata.getMetadataStore().getData(), groupContext);
         
-        return QueryResolver.resolveCommand(cmd, Collections.EMPTY_MAP, expandCommand, metadata.getMetadata(), analysis);
+        return QueryResolver.resolveCommand(cmd, Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
     }
         
     private void collectDeclareVariable(DeclareStatement obj, GroupSymbol variables, TempMetadataAdapter metadata, GroupContext externalGroups) throws QueryResolverException, MetaMatrixComponentException {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/UpdateResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -56,9 +56,9 @@
 public class UpdateResolver extends ProcedureContainerResolver implements VariableResolver {
 
     /** 
-     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
+     * @see com.metamatrix.query.resolver.ProcedureContainerResolver#resolveProceduralCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord)
      */
-    public void resolveProceduralCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis) 
+    public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
         //Cast to known type

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XMLQueryResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XMLQueryResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XMLQueryResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -63,9 +63,9 @@
 public class XMLQueryResolver implements CommandResolver {
 
     /**
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, java.util.Collection, TempMetadataAdapter, AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, TempMetadataAdapter, AnalysisRecord, boolean)
      */
-	public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
+	public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
 		throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
 
 		Query query = (Query) command;
@@ -96,7 +96,7 @@
             
             QueryResolver.setChildMetadata(subCommand, command);
             
-            QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis);
+            QueryResolver.resolveCommand(subCommand, Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
         }
         
 		if(crit != null) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XQueryResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XQueryResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/XQueryResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -44,9 +44,9 @@
 public class XQueryResolver implements CommandResolver {
 
     /** 
-     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, boolean, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
+     * @see com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, com.metamatrix.query.metadata.TempMetadataAdapter, com.metamatrix.query.analysis.AnalysisRecord, boolean)
      */
-    public void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
+    public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals) 
         throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
     }
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -551,18 +551,6 @@
 		return groupInfo;
 	}
     
-    public static List resolveElements(GroupSymbol group, QueryMetadataInterface metadata, List elementIDs) throws MetaMatrixComponentException, QueryMetadataException {
-    	GroupInfo groupInfo = getGroupInfo(group, metadata);
-    	List result = new ArrayList(elementIDs.size());
-    	for (Iterator iterator = elementIDs.iterator(); iterator.hasNext();) {
-			Object id = iterator.next();
-			ElementSymbol symbol = groupInfo.getSymbol(id);
-			assert symbol != null;
-			result.add(symbol);
-		}
-    	return result;
-    }
-        
     /**
      * When access patterns are flattened, they are an approximation the user
      * may need to enter as criteria.
@@ -590,11 +578,18 @@
 		        }
 		        while (j.hasNext()) {
 		        	List elements = metadata.getElementIDsInAccessPattern(j.next());
-		        	elements = resolveElements(group, metadata, elements);
+		        	GroupInfo groupInfo = getGroupInfo(group, metadata);
+		        	List result = new ArrayList(elements.size());
+		        	for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
+		    			Object id = iterator.next();
+		    			ElementSymbol symbol = groupInfo.getSymbol(id);
+		    			assert symbol != null;
+		    			result.add(symbol);
+		    		}
 		        	if (flatten) {
-		        		accessPatterns.addAll(elements);
+		        		accessPatterns.addAll(result);
 		        	} else {
-		        		accessPatterns.add(new AccessPattern(elements));
+		        		accessPatterns.add(new AccessPattern(result));
 		        	}
 		        }
 		    }
@@ -708,8 +703,8 @@
      * @throws MetaMatrixComponentException
      * @throws QueryMetadataException
      */
-    public static List findMatchingGroups(String groupContext,
-                            Collection groups,
+    public static List<GroupSymbol> findMatchingGroups(String groupContext,
+                            Collection<GroupSymbol> groups,
                             QueryMetadataInterface metadata) throws MetaMatrixComponentException,
                                                             QueryMetadataException {
 
@@ -717,14 +712,12 @@
             return null;
         }
 
-        LinkedList matchedGroups = new LinkedList();
+        LinkedList<GroupSymbol> matchedGroups = new LinkedList<GroupSymbol>();
 
         if (groupContext == null) {
             matchedGroups.addAll(groups);
         } else {
-            Iterator iter = groups.iterator();
-            while (iter.hasNext()) {
-                GroupSymbol group = (GroupSymbol)iter.next();
+        	for (GroupSymbol group : groups) {
                 String fullName = group.getCanonicalName();
                 if (nameMatchesGroup(groupContext, matchedGroups, group, fullName)) {
                     if (groupContext.length() == fullName.length()) {
@@ -767,7 +760,7 @@
     }
     
     private static boolean nameMatchesGroup(String groupContext,
-                                            LinkedList matchedGroups,
+                                            LinkedList<GroupSymbol> matchedGroups,
                                             GroupSymbol group,
                                             String fullName) {
         if (nameMatchesGroup(groupContext, fullName)) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -52,7 +52,6 @@
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.api.exception.query.QueryValidatorException;
-import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.util.TimestampWithTimezone;
 import com.metamatrix.core.MetaMatrixRuntimeException;
@@ -64,7 +63,6 @@
 import com.metamatrix.query.function.FunctionLibraryManager;
 import com.metamatrix.query.function.FunctionMethods;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.metadata.SupportConstants;
 import com.metamatrix.query.metadata.TempMetadataAdapter;
 import com.metamatrix.query.metadata.TempMetadataStore;
 import com.metamatrix.query.processor.ProcessorDataManager;
@@ -76,9 +74,9 @@
 import com.metamatrix.query.sql.ProcedureReservedWords;
 import com.metamatrix.query.sql.ReservedWords;
 import com.metamatrix.query.sql.lang.AbstractSetCriteria;
+import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
 import com.metamatrix.query.sql.lang.BetweenCriteria;
 import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.CommandContainer;
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.lang.CompoundCriteria;
 import com.metamatrix.query.sql.lang.Criteria;
@@ -96,9 +94,7 @@
 import com.metamatrix.query.sql.lang.Limit;
 import com.metamatrix.query.sql.lang.MatchCriteria;
 import com.metamatrix.query.sql.lang.NotCriteria;
-import com.metamatrix.query.sql.lang.Option;
 import com.metamatrix.query.sql.lang.OrderBy;
-import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.QueryCommand;
 import com.metamatrix.query.sql.lang.SPParameter;
@@ -115,7 +111,6 @@
 import com.metamatrix.query.sql.lang.TranslatableProcedureContainer;
 import com.metamatrix.query.sql.lang.UnaryFromClause;
 import com.metamatrix.query.sql.lang.Update;
-import com.metamatrix.query.sql.lang.XQuery;
 import com.metamatrix.query.sql.lang.PredicateCriteria.Negatable;
 import com.metamatrix.query.sql.navigator.PostOrderNavigator;
 import com.metamatrix.query.sql.navigator.PreOrderNavigator;
@@ -224,8 +219,8 @@
 		return rewriter.rewriteCommand(command, false);
 	}
     
-	public static Command rewrite(Command command, CreateUpdateProcedureCommand procCommand, QueryMetadataInterface metadata, CommandContext context) throws QueryValidatorException {
-		return rewrite(command, procCommand, metadata, context, null, Command.TYPE_UNKNOWN);
+	public static Command rewrite(Command command, QueryMetadataInterface metadata, CommandContext context) throws QueryValidatorException {
+		return rewrite(command, null, metadata, context, null, Command.TYPE_UNKNOWN);
     }
 
     /**
@@ -275,125 +270,42 @@
                 procCommand = (CreateUpdateProcedureCommand) command;
                 command = rewriteUpdateProcedure((CreateUpdateProcedureCommand) command);
                 break;
-            case Command.TYPE_XQUERY:
-            	((XQuery)command).setVariables(this.variables);
-            	break;
+            case Command.TYPE_BATCHED_UPDATE:
+            	List subCommands = ((BatchedUpdateCommand)command).getUpdateCommands();
+                for (int i = 0; i < subCommands.size(); i++) {
+                    Command subCommand = (Command)subCommands.get(i);
+                    subCommand = rewriteCommand(subCommand, false);
+                    subCommands.set(i, subCommand);
+                }
+                break;
+            	
 		}
         
-        //recursively rewrite simple containers - after the container itself was rewritten
-        if (command instanceof CommandContainer) {
-            Map oldVariables = variables;
-        	List subCommands = ((CommandContainer)command).getContainedCommands();
-            for (int i = 0; i < subCommands.size(); i++) {
-                Command subCommand = (Command)subCommands.get(i);
-                
-                if (command instanceof ProcedureContainer) {
-                       
-                    try {
-    	                variables = QueryResolver.getVariableValues(command, metadata);                        
-    	                commandType = command.getType();
-                    } catch (QueryMetadataException err) {
-                        throw new QueryValidatorException(err, err.getMessage());
-                    } catch (QueryResolverException err) {
-                        throw new QueryValidatorException(err, err.getMessage());
-                    } catch (MetaMatrixComponentException err) {
-                        throw new QueryValidatorException(err, err.getMessage());
-                    }
-                }
-                
-                subCommand = rewriteCommand(subCommand, false);
-                subCommands.set(i, subCommand);
-            }
-            variables = oldVariables;
-        }
-
-        Command result = removeProceduralWrapper(command);
         this.metadata = oldMetadata;
         this.procCommand = oldProcCommand;
-        return result;
+        return command;
 	}
     
-    private void mergeOptions( Option sourceOption, Option targetOption ) {
-        if ( sourceOption.getPlanOnly()) {
-            targetOption.setPlanOnly( true );
-        }
-        if ( sourceOption.getDebug()) {
-            targetOption.setDebug( true );
-        }
-        if ( sourceOption.getShowPlan()) {
-            targetOption.setShowPlan( true );
-        }
-    }
-	
-    private Command removeProceduralWrapper(Command command) throws QueryValidatorException {
-        
-        if (!(command instanceof StoredProcedure)) {
-            return command;
-        }
-        
-        StoredProcedure container = (StoredProcedure)command;
-        if (container.isProcedureRelational()) {
-            return command;
-        }
-        
-        if (!(container.getSubCommand() instanceof CreateUpdateProcedureCommand)) {
-            return command;
-        }
-        
-        CreateUpdateProcedureCommand subCommand = (CreateUpdateProcedureCommand)container.getSubCommand();
-        
-        if (subCommand == null) {
-            return command;
-        }
-        
-        //if all parameters can be evaluated, we need to validate their values before removing the procedure wrapper
-        for (Iterator iter = container.getInputParameters().iterator(); iter.hasNext();) {
-            SPParameter param = (SPParameter)iter.next();
-            Expression expr = param.getExpression();
-            if (!EvaluatableVisitor.isFullyEvaluatable(expr, true)) {
-                return command;
-            }
-            try {
-                Object value = new Evaluator(Collections.emptyMap(), this.dataMgr, context).evaluate(expr, Collections.emptyList());
-
-                //check contraint
-                if (value == null && !metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
-                    throw new QueryValidatorException(QueryExecPlugin.Util.getString("ProcedurePlan.nonNullableParam", expr)); //$NON-NLS-1$
-                }
-            } catch (ExpressionEvaluationException err) {
-            } catch (BlockedException err) {
-            } catch (MetaMatrixComponentException err) {            
-            }
-        } 
-        
-        Block block = subCommand.getBlock();
-        
-        if (block.getStatements().size() != 1) {
-            return command;
-        }
-        Statement statement = (Statement)block.getStatements().get(0);
-        if (statement.getType() != Statement.TYPE_COMMAND) {
-            return command;
-        }
-        
-        Command child = (((CommandStatement)statement).getCommand());
-        
-        if (child != null && child.getType() != Command.TYPE_DYNAMIC) {
-            if ( child.getOption() == null ) {
-                child.setOption( command.getOption() );                
-            } else if (command.getOption() != null) {
-                mergeOptions( command.getOption(), child.getOption() );
-            }
-            return child;        
-        }
-        return command;
-    }
-
 	private Command rewriteUpdateProcedure(CreateUpdateProcedureCommand command)
 								 throws QueryValidatorException {
-		
+        Map oldVariables = variables;
+        try {
+        	if (command.getUserCommand() != null) {
+	            variables = QueryResolver.getVariableValues(command.getUserCommand(), metadata);                        
+	            commandType = command.getUserCommand().getType();
+        	}
+        } catch (QueryMetadataException err) {
+            throw new QueryValidatorException(err, err.getMessage());
+        } catch (QueryResolverException err) {
+            throw new QueryValidatorException(err, err.getMessage());
+        } catch (MetaMatrixComponentException err) {
+            throw new QueryValidatorException(err, err.getMessage());
+        }
+
 		Block block = rewriteBlock(command.getBlock());
         command.setBlock(block);
+
+        variables = oldVariables;
         
         return command;
 	}
@@ -821,7 +733,7 @@
         Iterator iter = outerQuery.getSelect().getProjectedSymbols().iterator();
         HashMap<Expression, SingleElementSymbol> expressionMap = new HashMap<Expression, SingleElementSymbol>();
         for (SingleElementSymbol symbol : (List<SingleElementSymbol>)query.getSelect().getProjectedSymbols()) {
-            expressionMap.put((Expression)SymbolMap.getExpression(symbol).clone(), (SingleElementSymbol)iter.next());
+            expressionMap.put(SymbolMap.getExpression(symbol), (SingleElementSymbol)iter.next());
         }
         ExpressionMappingVisitor.mapExpressions(groupBy, expressionMap);
         outerQuery.setGroupBy(groupBy);
@@ -1054,24 +966,12 @@
 			 throws QueryValidatorException {
 		if(clause instanceof JoinPredicate) {
 			return rewriteJoinPredicate(parent, (JoinPredicate) clause);
-        } else if (clause instanceof UnaryFromClause) {
-            rewriteUnaryFromClause((UnaryFromClause)clause);
         } else if (clause instanceof SubqueryFromClause) {
             rewriteSubqueryContainer((SubqueryFromClause)clause, true);
         }
         return clause;
 	}
 
-    private void rewriteUnaryFromClause(UnaryFromClause ufc) throws QueryValidatorException {
-        Command nestedCommand = ufc.getExpandedCommand();
-        
-        if (nestedCommand == null) {
-            return;
-        }
-            
-        ufc.setExpandedCommand(rewriteCommand(nestedCommand, true));
-    }
-
 	private JoinPredicate rewriteJoinPredicate(Query parent, JoinPredicate predicate)
 			 throws QueryValidatorException {
 		List joinCrits = predicate.getJoinCriteria();

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/BatchedUpdateCommand.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/BatchedUpdateCommand.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/BatchedUpdateCommand.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -33,15 +33,17 @@
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.sql.LanguageVisitor;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.util.VariableContext;
 
 
 /** 
  * Represents a batch of INSERT, UPDATE, DELETE, and SELECT INTO commands
  * @since 4.2
  */
-public class BatchedUpdateCommand extends Command implements CommandContainer {
+public class BatchedUpdateCommand extends Command {
     
     protected List commands;
+    private List<VariableContext> variableContexts; //processing state
     
     /**
      * Add sub command
@@ -216,11 +218,12 @@
         return '?';
     }
 
-    /** 
-     * @see com.metamatrix.query.sql.lang.CommandContainer#getContainedCommands()
-     */
-    public List getContainedCommands() {
-        return getSubCommands();
-    }
+	public void setVariableContexts(List<VariableContext> variableContexts) {
+		this.variableContexts = variableContexts;
+	}
 
+	public List<VariableContext> getVariableContexts() {
+		return variableContexts;
+	}
+
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -120,8 +120,6 @@
 
     private boolean isResolved;
     
-    private GroupSymbol virtualGroup;
-    
 	/** The option clause */
 	private Option option;
 	
@@ -228,7 +226,6 @@
         if(this.tempGroupIDs != null) {
             copy.setTemporaryMetadata(new HashMap(this.tempGroupIDs));
         }
-        copy.setVirtualGroup(getVirtualGroup());
         
         copy.setIsResolved(this.isResolved());
         copy.plan = this.plan;
@@ -322,32 +319,15 @@
      */
     public abstract int updatingModelCount(QueryMetadataInterface metadata)  throws MetaMatrixComponentException;
     
-    
     protected int getSubCommandsUpdatingModelCount(QueryMetadataInterface metadata) throws MetaMatrixComponentException{
-        return getSubCommandsUpdatingModelCount(this, metadata);
-    }
-
-    public static int getSubCommandsUpdatingModelCount(Command object, QueryMetadataInterface metadata) throws MetaMatrixComponentException {
-        List<Command> subCommands = CommandCollectorVisitor.getCommands(object);
-        int numCommands = subCommands.size();
+        List<Command> subCommands = CommandCollectorVisitor.getCommands(this);
         for (Command command : subCommands) {
-            if (numCommands == 1) {
-                return command.updatingModelCount(metadata);
-            }
             if (command.updatingModelCount(metadata) > 0) {
                 return 2; //require a transaction if there is more than 1 statement
             }
         }
         return 0;
     }
-
-    public GroupSymbol getVirtualGroup() {
-        return this.virtualGroup;
-    }
-
-    public void setVirtualGroup(GroupSymbol virtualGroup) {
-        this.virtualGroup = virtualGroup;
-    }
     
     public ProcessorPlan getProcessorPlan() {
     	return this.plan;

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/CommandContainer.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/CommandContainer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/CommandContainer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.sql.lang;
-
-import java.util.List;
-
-/**
- * Returns a list of subCommands that is safe to manipulate 
- */
-public interface CommandContainer {
-
-    List getContainedCommands();
-    
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/GroupContext.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/GroupContext.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/GroupContext.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,24 +35,24 @@
  */
 public class GroupContext implements Cloneable {
     
-    private Collection groups;
+    private Collection<GroupSymbol> groups;
     
-    private GroupContext parent = null;
+    private GroupContext parent;
     
     public GroupContext() {
         this(null, null);
     }
     
-    public GroupContext(GroupContext parent, Collection groups) {
+    public GroupContext(GroupContext parent, Collection<GroupSymbol> groups) {
         this.parent = parent;
         if (groups == null) {
-            this.groups = new LinkedList();
+            this.groups = new LinkedList<GroupSymbol>();
         } else {
             this.groups = groups;    
         }
     }
 
-    public Collection getGroups() {
+    public Collection<GroupSymbol> getGroups() {
         return this.groups;
     }
     
@@ -69,8 +69,8 @@
      *  
      * @return
      */
-    public List getAllGroups() {
-        LinkedList result = new LinkedList();
+    public List<GroupSymbol> getAllGroups() {
+        LinkedList<GroupSymbol> result = new LinkedList<GroupSymbol>();
         
         GroupContext root = this;
         while (root != null) {

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -42,10 +42,10 @@
 
 	private boolean showPlan = false;
 	private boolean debug = false;
-    private List makeDependentGroups = null;        // of String
-    private List makeNotDependentGroups = null;        // of String
+    private List<String> makeDependentGroups;
+    private List<String> makeNotDependentGroups;
     private boolean planOnly = false;
-	private List noCacheGroups;	// List of String
+	private List<String> noCacheGroups;
     private boolean noCache;
 
 	/**
@@ -108,7 +108,7 @@
      */
     public void addDependentGroup(String group) {
         if(this.makeDependentGroups == null) {
-            this.makeDependentGroups = new ArrayList();
+            this.makeDependentGroups = new ArrayList<String>();
         }
         this.makeDependentGroups.add(group);    
     }
@@ -117,7 +117,7 @@
      * Get all groups to make dependent
      * @return List of String defining groups to be made dependent, may be null if no groups
      */
-    public List getDependentGroups() {
+    public List<String> getDependentGroups() {
         return this.makeDependentGroups;
     }
     
@@ -127,7 +127,7 @@
      */
     public void addNotDependentGroup(String group) {
         if(this.makeNotDependentGroups == null) {
-            this.makeNotDependentGroups = new ArrayList();
+            this.makeNotDependentGroups = new ArrayList<String>();
         }
         this.makeNotDependentGroups.add(group);    
     }
@@ -136,7 +136,7 @@
      * Get all groups to make dependent
      * @return List of String defining groups to be made dependent, may be null if no groups
      */
-    public List getNotDependentGroups() {
+    public List<String> getNotDependentGroups() {
         return this.makeNotDependentGroups;
     }
     
@@ -148,7 +148,7 @@
      */
     public void addNoCacheGroup(String group) {
         if(this.noCacheGroups == null) {
-            this.noCacheGroups = new ArrayList();
+            this.noCacheGroups = new ArrayList<String>();
         }
         this.noCacheGroups.add(group);    
     }
@@ -160,7 +160,7 @@
      * @return List of String defining groups that overrides the default behavior of 
      * Materialized View, may be null if there are no groups
      */
-    public List getNoCacheGroups() {
+    public List<String> getNoCacheGroups() {
         return this.noCacheGroups;
     }
 	
@@ -242,24 +242,15 @@
         newOption.setNoCache(noCache);
         
         if(getDependentGroups() != null) {
-            Iterator iter = getDependentGroups().iterator();
-            while(iter.hasNext()) {
-                newOption.addDependentGroup( (String) iter.next() );
-            }
+        	newOption.makeDependentGroups = new ArrayList<String>(getDependentGroups());
         }
             
         if(getNotDependentGroups() != null) {
-            Iterator iter = getNotDependentGroups().iterator();
-            while(iter.hasNext()) {
-                newOption.addNotDependentGroup( (String) iter.next() );
-            }
+        	newOption.makeNotDependentGroups = new ArrayList<String>(getNotDependentGroups());
         }
             
         if(getNoCacheGroups() != null) {
-            Iterator iter = getNoCacheGroups().iterator();
-            while(iter.hasNext()) {
-                newOption.addNoCacheGroup( (String) iter.next() );
-            }
+        	newOption.noCacheGroups = new ArrayList<String>(getNoCacheGroups());
         }
         
 		return newOption;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/ProcedureContainer.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/ProcedureContainer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/ProcedureContainer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,71 +22,23 @@
 
 package com.metamatrix.query.sql.lang;
 
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 
-public abstract class ProcedureContainer extends Command implements CommandContainer {
+public abstract class ProcedureContainer extends Command {
 
-    /**
-     * This is a little hack to maintain a list of at most 1
-     */
-    private List subCommands = new ArrayList(1);
-    
     private int updateCount = -1;
     
     public abstract GroupSymbol getGroup();
     
-    /** 
-     * @return Returns the subCommand.
-     */
-    public Command getSubCommand() {
-        if (subCommands.isEmpty()) {
-            return null;
-        }
-        return (Command)subCommands.get(0);
-    }
-
-    /** 
-     * @param subCommand The subCommand to set.
-     */
-    public void setSubCommand(Command subCommand) {
-        if (subCommands.isEmpty()) {
-            subCommands.add(null);
-        }
-        if (subCommand == null) {
-            subCommands.remove(0);
-        } else {
-            this.subCommands.set(0, subCommand);
-        }
-    }
-    
     protected void copyMetadataState(Command copy) {
         super.copyMetadataState(copy);
-        
-        Command subCommand = getSubCommand();
-        if (subCommand != null) {
-        	subCommand = (Command)subCommand.clone();
-	        ((ProcedureContainer)copy).subCommands.add(subCommand);
-	        if (subCommand instanceof CreateUpdateProcedureCommand) {
-	            ((CreateUpdateProcedureCommand)subCommand).setUserCommand(copy);
-	        } 
-        }
     }
     
-    /** 
-     * @see com.metamatrix.query.sql.lang.CommandContainer#getContainedCommands()
-     */
-    public List getContainedCommands() {
-        return subCommands;
-    }
-    
     public int updatingModelCount(QueryMetadataInterface metadata) throws MetaMatrixComponentException{
         if (updateCount != -1) {
             return updateCount;
@@ -105,7 +57,7 @@
             throw new MetaMatrixComponentException(e);
         }
         
-        return this.getSubCommand().updatingModelCount(metadata);
+        return 2;
     }
 
     

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Query.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Query.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/Query.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -429,7 +429,14 @@
 		if(this.getInto() != null){
 			return false;
 		}
+		if (isXML) {
+			return true;
+		}
 		List projectedSymbols = getProjectedSymbols();
+		return areResultsCachable(projectedSymbols);
+	}
+
+	static boolean areResultsCachable(List projectedSymbols) {
 		for(int i=0; i<projectedSymbols.size(); i++){
 			SingleElementSymbol projectedSymbol = (SingleElementSymbol)projectedSymbols.get(i);
 			if(DataTypeManager.isLOB(projectedSymbol.getType())) {
@@ -440,7 +447,7 @@
 	}
     
     public int updatingModelCount(QueryMetadataInterface metadata) throws MetaMatrixComponentException{
-        if(isXML) {
+        if(isXML) { //TODO: this is incorrect
             return 0;
         }
         
@@ -448,13 +455,7 @@
             return 2;
         }
         
-        //any subcommand performing an update requires a transaction
-        //since we may not be able to roll it back other wise
-        int count = getSubCommandsUpdatingModelCount(metadata);
-        if (count > 0) {
-        	return 2;
-        }
-        return 0;
+        return getSubCommandsUpdatingModelCount(metadata);
     }
 
     /** 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/StoredProcedure.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/StoredProcedure.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/StoredProcedure.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -335,7 +335,7 @@
 	 * @see com.metamatrix.query.sql.lang.Command#areResultsCachable()
 	 */
 	public boolean areResultsCachable() {
-		return true;
+		return Query.areResultsCachable(getProjectedSymbols());
 	}
     
     /** 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/XQuery.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/XQuery.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/lang/XQuery.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,14 +22,15 @@
 
 package com.metamatrix.query.sql.lang;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.core.util.EquivalenceUtil;
-import com.metamatrix.core.util.HashCodeUtil;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.sql.*;
+import com.metamatrix.query.sql.LanguageVisitor;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.visitor.SQLStringVisitor;
 import com.metamatrix.query.xquery.XQueryExpression;
@@ -42,6 +43,7 @@
     private String xQuery;
     private XQueryExpression compiledXQuery;
     private Map variables;
+    private String procedureGroup;
     
     public XQuery(){
     }
@@ -51,6 +53,10 @@
         this.compiledXQuery = compiledXQuery;
     }
     
+    public void setProcedureGroup(String procedureGroup) {
+		this.procedureGroup = procedureGroup;
+	}
+    
     public void setVariables(Map variables) {
 		this.variables = variables;
 	}
@@ -110,7 +116,7 @@
      * @return Hash code
      */
     public int hashCode() {
-        return HashCodeUtil.hashCode(0, getXQuery());
+        return xQuery.hashCode();
     }
 
     /**
@@ -120,6 +126,7 @@
     public Object clone() {
         XQuery copy = new XQuery(getXQuery(), this.compiledXQuery);
         copy.variables = variables;
+        copy.procedureGroup = procedureGroup;
         copyMetadataState(copy);
         return copy;
     }
@@ -140,10 +147,14 @@
 	 * @see com.metamatrix.query.sql.lang.Command#areResultsCachable()
 	 */
 	public boolean areResultsCachable() {
-		return false;
+		return true;
 	}
     
     public int updatingModelCount(QueryMetadataInterface metadata) throws MetaMatrixComponentException {
         return 2; //since there may be dynamic sql, just assume a transaction is required
     }
+
+	public String getProcedureGroup() {
+		return procedureGroup;
+	}
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/Block.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/Block.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/Block.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,26 +22,28 @@
 
 package com.metamatrix.query.sql.proc;
 
-import java.util.*;
-import com.metamatrix.core.util.HashCodeUtil;
-import com.metamatrix.query.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
 import com.metamatrix.core.util.EquivalenceUtil;
+import com.metamatrix.query.sql.LanguageObject;
+import com.metamatrix.query.sql.LanguageVisitor;
 import com.metamatrix.query.sql.visitor.SQLStringVisitor;
 
 /**
  * <p> This class represents a group of <code>Statement</code> objects. The
  * statements are stored on this object in the order in which they are added.</p>
  */
-public class Block  implements LanguageObject {
+public class Block implements LanguageObject {
 
 	// list of statements on this block
-	private List statements;
+	private List<Statement> statements;
 
 	/**
 	 * Constructor for Block.
 	 */
 	public Block() {
-		statements = new ArrayList();
+		statements = new ArrayList<Statement>();
 	}
 
 	/**
@@ -57,7 +59,7 @@
 	 * Get all the statements contained on this block.
 	 * @return A list of <code>Statement</code>s contained in this block
 	 */
-	public List getStatements() {
+	public List<Statement> getStatements() {
 		return statements;
 	}
 
@@ -65,7 +67,7 @@
 	 * Set the statements contained on this block.
 	 * @param statements A list of <code>Statement</code>s contained in this block
 	 */
-	public void setStatements(List statements) {
+	public void setStatements(List<Statement> statements) {
 		this.statements = statements;
 	}
 
@@ -91,11 +93,8 @@
 	 */
 	public Object clone() {		
 		Block copy = new Block();
-		if(!statements.isEmpty()) {
-			Iterator stmtIter = statements.iterator();
-			while(stmtIter.hasNext()) {
-				copy.addStatement((Statement) stmtIter.next());
-			}
+		for (Statement statement : statements) {
+			copy.addStatement((Statement)statement.clone());
 		}
 		return copy;
 	}
@@ -129,18 +128,7 @@
      * @return Hash code
      */
     public int hashCode() {
-    	// For speed, this hash code relies only on the hash codes of its select
-    	// and criteria clauses, not on the from, order by, or option clauses
-    	int myHash = 0;
-    	
-    	myHash = HashCodeUtil.hashCode(myHash, this.getStatements());
-		if(!this.getStatements().isEmpty()) {
-			Iterator stmtIter = this.getStatements().iterator();
-			while(stmtIter.hasNext()) {
-		    	myHash = HashCodeUtil.hashCode(myHash, stmtIter.next());
-			}
-		}    	
-		return myHash;
+    	return statements.hashCode();
 	}
       
     /**

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/CreateUpdateProcedureCommand.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/CreateUpdateProcedureCommand.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/proc/CreateUpdateProcedureCommand.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,6 +35,7 @@
 import com.metamatrix.query.sql.LanguageVisitor;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Option;
+import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.visitor.SQLStringVisitor;
 
 /**
@@ -59,7 +60,7 @@
     
     private List projectedSymbols;
     
-    private List parentProjectSymbols;
+    private GroupSymbol virtualGroup;
 
     //command that returns resultset. For virtual procedure only.
     private Command resultsCommand;
@@ -167,11 +168,8 @@
         if (this.projectedSymbols != null) {
             copy.setProjectedSymbols(new ArrayList(this.projectedSymbols));
         }
-        if (getResultsCommand() != null) {
-            copy.setResultsCommand((Command)this.getResultsCommand().clone());
-        } 
-        if (parentProjectSymbols != null) {
-            copy.parentProjectSymbols = new ArrayList(this.parentProjectSymbols);
+        if (this.virtualGroup != null) {
+        	copy.virtualGroup = (GroupSymbol)this.virtualGroup.clone();
         }
         this.copyMetadataState(copy);
 		return copy;
@@ -296,7 +294,7 @@
     		return 0;
     	}
     	Command lastCommand = null;
-    	Statement statement = (Statement)block.getStatements().get(block.getStatements().size() - 1);
+    	Statement statement = block.getStatements().get(block.getStatements().size() - 1);
     	if (statement instanceof CommandStatement) {
         	CommandStatement cmdStatement = (CommandStatement)statement;
         	lastCommand = cmdStatement.getCommand();
@@ -313,20 +311,12 @@
         return 0;
     }
 
-    
-    /** 
-     * @return Returns the parentProjectSymbols.
-     */
-    public List getParentProjectSymbols() {
-        return this.parentProjectSymbols;
+    public GroupSymbol getVirtualGroup() {
+        return this.virtualGroup;
     }
 
-    
-    /** 
-     * @param parentProjectSymbols The parentProjectSymbols to set.
-     */
-    public void setParentProjectSymbols(List parentProjectSymbols) {
-        this.parentProjectSymbols = parentProjectSymbols;
+    public void setVirtualGroup(GroupSymbol virtualGroup) {
+        this.virtualGroup = virtualGroup;
     }
 
 } // END CLASS

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/symbol/MultipleElementSymbol.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/symbol/MultipleElementSymbol.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/symbol/MultipleElementSymbol.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,7 +28,7 @@
  * <p>This is a subclass of Symbol representing multiple output columns.</p>
  */
 public abstract class MultipleElementSymbol extends SelectSymbol {
-    private List elementSymbols;
+    private List<ElementSymbol> elementSymbols;
 
     /**
      * Passthrough constructor used for cloning 
@@ -52,7 +52,7 @@
      * Set the {@link ElementSymbol}s that this symbol refers to
      * @param elementSymbols List of {@link ElementSymbol}
      */
-    public void setElementSymbols(List elementSymbols){
+    public void setElementSymbols(List<ElementSymbol> elementSymbols){
         this.elementSymbols = elementSymbols;
     }
 
@@ -60,7 +60,7 @@
      * Get the element symbols referred to by this multiple element symbol
      * @return List of {@link ElementSymbol}s, may be null
      */
-    public List getElementSymbols(){
+    public List<ElementSymbol> getElementSymbols(){
         return this.elementSymbols;
     }
 
@@ -70,7 +70,7 @@
      */
     public void addElementSymbol(ElementSymbol symbol) {
 		if(getElementSymbols() == null) { 
-			setElementSymbols(new LinkedList());
+			setElementSymbols(new LinkedList<ElementSymbol>());
 		}
 		getElementSymbols().add(symbol);
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ElementSymbolOptimizer.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ElementSymbolOptimizer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ElementSymbolOptimizer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -67,7 +67,7 @@
         } else {
             commandList.add(command);
 
-            List subCommands = CommandCollectorVisitor.getCommands(command, true);
+            List subCommands = CommandCollectorVisitor.getCommands(command);
             if(subCommands != null && subCommands.size() > 0) {
                 for(int i=0; i<subCommands.size(); i++) {
                     Command subCommand = (Command) subCommands.get(i);

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/SymbolMap.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/SymbolMap.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/SymbolMap.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,11 +26,14 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.core.util.Assertion;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.resolver.util.ResolverUtil;
 import com.metamatrix.query.sql.symbol.AggregateSymbol;
 import com.metamatrix.query.sql.symbol.AliasSymbol;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
@@ -100,27 +103,10 @@
     }
 
     public static final SymbolMap createSymbolMap(GroupSymbol virtualGroup,
-                                                  List<? extends SingleElementSymbol> projectCols) {
-        return createSymbolMap(virtualGroup, projectCols, projectCols);
+                                                  List<? extends SingleElementSymbol> projectCols, QueryMetadataInterface metadata) throws QueryMetadataException, MetaMatrixComponentException {
+        return createSymbolMap(ResolverUtil.resolveElementsInGroup(virtualGroup, metadata), projectCols);
     }
 
-    public static final SymbolMap createSymbolMap(GroupSymbol virtualGroup,
-                                                  List<? extends SingleElementSymbol> projectCols,
-                                                  List<? extends SingleElementSymbol> mappedCols) {
-        String virtualGroupName = virtualGroup.getName();
-        List<ElementSymbol> virtualElements = new LinkedList<ElementSymbol>();
-        for (SingleElementSymbol symbol : projectCols) {
-            String name = symbol.getShortName();
-            String virtualElementName = virtualGroupName + ElementSymbol.SEPARATOR + name;
-            ElementSymbol virtualElement = new ElementSymbol(virtualElementName);
-            virtualElement.setGroupSymbol(virtualGroup);
-            virtualElement.setType(symbol.getType());
-            virtualElements.add(virtualElement);
-        }
-
-        return createSymbolMap(virtualElements, mappedCols);
-    }
-
     public static final SymbolMap createSymbolMap(List<ElementSymbol> virtualElements,
                                                   List<? extends Expression> mappedCols) {
         Assertion.assertTrue(virtualElements.size() == mappedCols.size());

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ValueIteratorSource.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ValueIteratorSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/ValueIteratorSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,11 +22,10 @@
 
 package com.metamatrix.query.sql.util;
 
-import java.util.HashSet;
+import java.util.Set;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.query.sql.symbol.Expression;
 
 
@@ -45,11 +44,10 @@
      * @param valueExpression The expression we are retrieving an iterator for  
      * @return ValueIterator if ready, null otherwise
      * @throws MetaMatrixComponentException 
-     * @throws TupleSourceNotFoundException 
      * @since 5.0.1
      */
     ValueIterator getValueIterator(Expression valueExpression) throws MetaMatrixComponentException;
     
-    HashSet<Object> getCachedSet(Expression valueExpression) throws MetaMatrixComponentException, MetaMatrixProcessingException;
+    Set<Object> getCachedSet(Expression valueExpression) throws MetaMatrixComponentException, MetaMatrixProcessingException;
     
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/VariableContext.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/VariableContext.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/util/VariableContext.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -177,4 +177,12 @@
     	return this.variableMap.toString();
     }
     
+    public void clear() {
+    	this.variableMap.clear();
+    }
+    
+    public void putAll(VariableContext other) {
+    	this.variableMap.putAll(other.variableMap);
+    }
+    
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,9 +23,7 @@
 package com.metamatrix.query.sql.visitor;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import com.metamatrix.query.sql.LanguageObject;
 import com.metamatrix.query.sql.LanguageVisitor;
@@ -33,12 +31,10 @@
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.ExistsCriteria;
 import com.metamatrix.query.sql.lang.Insert;
-import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.SetQuery;
 import com.metamatrix.query.sql.lang.SubqueryCompareCriteria;
 import com.metamatrix.query.sql.lang.SubqueryFromClause;
 import com.metamatrix.query.sql.lang.SubquerySetCriteria;
-import com.metamatrix.query.sql.lang.UnaryFromClause;
 import com.metamatrix.query.sql.navigator.PreOrderNavigator;
 import com.metamatrix.query.sql.proc.AssignmentStatement;
 import com.metamatrix.query.sql.proc.CommandStatement;
@@ -55,23 +51,9 @@
  */
 public class CommandCollectorVisitor extends LanguageVisitor {
 
-	private enum Mode {
-		EMBEDDED,
-		NON_EMBEDDED
-	}
-	
     private List<Command> commands = new ArrayList<Command>();
-    private Set<Mode> modes;
 
     /**
-     * Construct a new visitor with the default collection type, which is a 
-     * {@link java.util.HashSet}.  
-     */
-    public CommandCollectorVisitor(Set<Mode> modes) { 
-        this.modes = modes;
-    }   
-
-    /**
      * Get the commands collected by the visitor.  This should best be called 
      * after the visitor has been run on the language object tree.
      * @return List of {@link com.metamatrix.query.sql.lang.Command}
@@ -84,27 +66,21 @@
      * @see com.metamatrix.query.sql.LanguageVisitor#visit(com.metamatrix.query.sql.lang.ExistsCriteria)
      */
     public void visit(ExistsCriteria obj) {
-        if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }
 
     /**
      * @see com.metamatrix.query.sql.LanguageVisitor#visit(com.metamatrix.query.sql.lang.ScalarSubquery)
      */
     public void visit(ScalarSubquery obj) {
-    	if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-    	}
+        this.commands.add(obj.getCommand());
     }
 
     /**
      * @see com.metamatrix.query.sql.LanguageVisitor#visit(com.metamatrix.query.sql.lang.SubqueryCompareCriteria)
      */
     public void visit(SubqueryCompareCriteria obj) {
-    	if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }
 
     /**
@@ -113,9 +89,7 @@
      * @param obj Language object
      */
     public void visit(SubqueryFromClause obj) {
-    	if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }
 
     /**
@@ -124,9 +98,7 @@
      * @param obj Language object
      */
     public void visit(SubquerySetCriteria obj) {
-    	if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }
 
     /**
@@ -135,9 +107,7 @@
      * @param obj Language object
      */
     public void visit(CommandStatement obj) {
-    	if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }    
 
     /**
@@ -146,7 +116,7 @@
      * @param obj Language object
      */
     public void visit(AssignmentStatement obj) {
-    	if(modes.contains(Mode.EMBEDDED) && obj.hasCommand()) {
+    	if(obj.hasCommand()) {
 	        this.commands.add(obj.getCommand());
     	}
     }
@@ -157,51 +127,20 @@
      * @param obj Language object
      */
     public void visit(LoopStatement obj) {
-        if (modes.contains(Mode.EMBEDDED)) {
-            this.commands.add(obj.getCommand());
-        }
+        this.commands.add(obj.getCommand());
     }
     
-    public void visit(UnaryFromClause obj) {
-        if (modes.contains(Mode.NON_EMBEDDED) && obj.getExpandedCommand() != null) {
-            this.commands.add(obj.getExpandedCommand());
-        }
-    }
-    
     public void visit(BatchedUpdateCommand obj) {
-        if (modes.contains(Mode.NON_EMBEDDED)) {
-            this.commands.addAll(obj.getUpdateCommands());
-        }
+        this.commands.addAll(obj.getUpdateCommands());
     }
     
-    public void visit(ProcedureContainer obj) {
-        if (modes.contains(Mode.NON_EMBEDDED) && obj.getSubCommand() != null) {
-            this.commands.add(obj.getSubCommand());
-        }
-    }
-    
     /**
      * Helper to quickly get the commands from obj
      * @param obj Language object
      * @param elements Collection to collect commands in
      */
-    public static final List<Command> getCommands(Command obj) {
-        return getCommands(obj, true, true);
-    }
-
-    public static final List<Command> getCommands(Command obj, boolean embeddedOnly) {
-        return getCommands(obj, true, !embeddedOnly);
-    }
-    
-    private static final List<Command> getCommands(Command command, boolean embedded, boolean nonEmbedded) {
-    	HashSet<Mode> modes = new HashSet<Mode>();
-    	if (embedded) {
-    		modes.add(Mode.EMBEDDED);
-    	}
-    	if (nonEmbedded) {
-    		modes.add(Mode.NON_EMBEDDED);
-    	}
-        CommandCollectorVisitor visitor = new CommandCollectorVisitor(modes);
+    public static final List<Command> getCommands(Command command) {
+        CommandCollectorVisitor visitor = new CommandCollectorVisitor();
         final boolean visitCommands = command instanceof SetQuery || command instanceof Insert;
         PreOrderNavigator navigator = new PreOrderNavigator(visitor) {
 
@@ -218,8 +157,4 @@
         return visitor.getCommands();
     }
     
-    public static final List<Command> getNonEmbeddedCommands(Command obj) {
-        return getCommands(obj, false, true);
-    }
-
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStore.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStore.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStore.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,8 +26,8 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
 import com.metamatrix.query.metadata.TempMetadataStore;
 import com.metamatrix.query.sql.lang.Command;
 
@@ -48,5 +48,5 @@
     
     public void removeTempTableByName(String tempTableName) throws MetaMatrixComponentException;
     
-    public TupleSourceID getTupleSourceID(String tempTableName);
+    public TupleBuffer getTupleSourceID(String tempTableName);
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStoreImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStoreImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/tempdata/TempTableStoreImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -37,20 +37,15 @@
 import com.metamatrix.api.exception.query.QueryProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
-import com.metamatrix.core.util.Assertion;
 import com.metamatrix.query.eval.Evaluator;
 import com.metamatrix.query.execution.QueryExecPlugin;
 import com.metamatrix.query.metadata.TempMetadataAdapter;
 import com.metamatrix.query.metadata.TempMetadataStore;
-import com.metamatrix.query.processor.proc.UpdateCountTupleSource;
+import com.metamatrix.query.processor.CollectionTupleSource;
 import com.metamatrix.query.processor.relational.RelationalNode;
-import com.metamatrix.query.processor.relational.TupleCollector;
 import com.metamatrix.query.resolver.util.ResolverUtil;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Create;
@@ -74,24 +69,22 @@
 	
     private abstract class UpdateTupleSource implements TupleSource {
 		private final String groupKey;
-		private final TupleSourceID tsId;
+		private final TupleBuffer oldBuffer;
 		private final TupleSource ts;
 		protected final Map lookup;
-		private final TupleCollector tc;
-		private final TupleSourceID newTs;
+		private final TupleBuffer newBuffer;
 		protected final Evaluator eval;
 		private final Criteria crit;
 		protected int updateCount = 0;
 		private boolean done;
 
-		private UpdateTupleSource(String groupKey, TupleSourceID tsId, Criteria crit) throws TupleSourceNotFoundException, MetaMatrixComponentException {
+		private UpdateTupleSource(String groupKey, TupleBuffer tsId, Criteria crit) throws MetaMatrixComponentException {
 			this.groupKey = groupKey;
-			this.tsId = tsId;
-			this.ts = buffer.getTupleSource(tsId);
-    		List columns = buffer.getTupleSchema(tsId);
+			this.oldBuffer = tsId;
+			this.ts = tsId.createIndexedTupleSource();
+    		List columns = tsId.getSchema();
 			this.lookup = RelationalNode.createLookupMap(columns);
-			this.newTs = buffer.createTupleSource(columns, sessionID, TupleSourceType.PROCESSOR);
-			this.tc = new TupleCollector(newTs, buffer);
+			this.newBuffer = buffer.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR);
 			this.eval = new Evaluator(lookup, null, null);
 			this.crit = crit;
 		}
@@ -112,23 +105,15 @@
 					tupleFailed(tuple);
 				}
 			}
-			tc.close();
-			groupToTupleSourceID.put(groupKey, newTs);
-			try {
-		        buffer.removeTupleSource(tsId);
-		    }catch(TupleSourceNotFoundException e) {
-		    	
-		    }
+			newBuffer.close();
+			groupToTupleSourceID.put(groupKey, newBuffer);
+	        oldBuffer.remove();
 		    done = true;
 			return Arrays.asList(updateCount);
 		}
 		
 		protected void addTuple(List<?> tuple) throws MetaMatrixComponentException {
-			try {
-				tc.addTuple(tuple);
-			} catch (TupleSourceNotFoundException e) {
-				throw new MetaMatrixComponentException(e);
-			}
+			newBuffer.addTuple(tuple);
 		}
 
 		protected abstract void tuplePassed(List<?> tuple) throws ExpressionEvaluationException, BlockedException, MetaMatrixComponentException;
@@ -148,7 +133,7 @@
 
 	private BufferManager buffer;
     private TempMetadataStore tempMetadataStore = new TempMetadataStore();
-    private Map<String, TupleSourceID> groupToTupleSourceID = new HashMap<String, TupleSourceID>();
+    private Map<String, TupleBuffer> groupToTupleSourceID = new HashMap<String, TupleBuffer>();
     private String sessionID;
     private TempTableStore parentTempTableStore;
     
@@ -169,23 +154,16 @@
         //add metadata
         tempMetadataStore.addTempGroup(tempTableName, columns, false, true);
         //create tuple source
-        TupleSourceID tsId = buffer.createTupleSource(columns, sessionID, TupleSourceType.PROCESSOR);
-        try {
-            buffer.setStatus(tsId, TupleSourceStatus.FULL);
-        }catch(TupleSourceNotFoundException e) {
-            //should never happen because the TupleSourceID is just created
-            Assertion.failed("Could not find local tuple source for inserting into temp table."); //$NON-NLS-1$
-        }
-        groupToTupleSourceID.put(tempTableName, tsId);
+        TupleBuffer tupleBuffer = buffer.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR);
+        tupleBuffer.setFinal(true); //final, but not closed so that we can append on insert
+        groupToTupleSourceID.put(tempTableName, tupleBuffer);
     }
 
     public void removeTempTableByName(String tempTableName) throws MetaMatrixComponentException {
         tempMetadataStore.removeTempGroup(tempTableName);
-        TupleSourceID tsId = this.groupToTupleSourceID.remove(tempTableName);
+        TupleBuffer tsId = this.groupToTupleSourceID.remove(tempTableName);
         if(tsId != null) {
-            try {
-                buffer.removeTupleSource(tsId);
-            }catch(TupleSourceNotFoundException e) {}
+            tsId.remove();
         }      
     }
     
@@ -200,12 +178,8 @@
             if (!group.isTempGroupSymbol()) {
             	return null;
             }
-            TupleSourceID tsId = getTupleSourceID(group.getNonCorrelationName().toUpperCase(), command);
-            try {
-                return buffer.getTupleSource(tsId);
-            }catch(TupleSourceNotFoundException e) {
-                throw new MetaMatrixComponentException(e);
-            }
+            TupleBuffer tsId = getTupleSourceID(group.getNonCorrelationName().toUpperCase(), command);
+            return tsId.createIndexedTupleSource();
         }
         if (command instanceof ProcedureContainer) {
         	GroupSymbol group = ((ProcedureContainer)command).getGroup();
@@ -213,65 +187,61 @@
         		return null;
         	}
         	final String groupKey = group.getNonCorrelationName().toUpperCase();
-            final TupleSourceID tsId = getTupleSourceID(groupKey, command);
+            final TupleBuffer tsId = getTupleSourceID(groupKey, command);
         	if (command instanceof Insert) {
         		return addTuple((Insert)command, tsId);
         	}
-        	try {
-	        	if (command instanceof Update) {
-	        		final Update update = (Update)command;
-	        		final Criteria crit = update.getCriteria();
-	        		return new UpdateTupleSource(groupKey, tsId, crit) {
-	        			@Override
-	        			protected void tuplePassed(List<?> tuple)
-	        					throws ExpressionEvaluationException,
-	        					BlockedException, MetaMatrixComponentException {
-	        				List<Object> newTuple = new ArrayList<Object>(tuple);
-		        			for (Map.Entry<ElementSymbol, Expression> entry : update.getChangeList().getClauseMap().entrySet()) {
-		        				newTuple.set((Integer)lookup.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple));
-		        			}
-		        			updateCount++;
-		        			addTuple(newTuple);
+        	if (command instanceof Update) {
+        		final Update update = (Update)command;
+        		final Criteria crit = update.getCriteria();
+        		return new UpdateTupleSource(groupKey, tsId, crit) {
+        			@Override
+        			protected void tuplePassed(List<?> tuple)
+        					throws ExpressionEvaluationException,
+        					BlockedException, MetaMatrixComponentException {
+        				List<Object> newTuple = new ArrayList<Object>(tuple);
+	        			for (Map.Entry<ElementSymbol, Expression> entry : update.getChangeList().getClauseMap().entrySet()) {
+	        				newTuple.set((Integer)lookup.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple));
 	        			}
-	        			
-	        			protected void tupleFailed(java.util.List<?> tuple) throws MetaMatrixComponentException {
-	        				addTuple(tuple);
-	        			}
-	        		};
-	        	}
-	        	if (command instanceof Delete) {
-	        		final Delete delete = (Delete)command;
-	        		final Criteria crit = delete.getCriteria();
-	        		if (crit == null) {
-	        			int rows = buffer.getRowCount(tsId);
-	                    addTempTable(groupKey, buffer.getTupleSchema(tsId), true);
-	                    return new UpdateCountTupleSource(rows);
-	        		}
-	        		return new UpdateTupleSource(groupKey, tsId, crit) {
-	        			@Override
-	        			protected void tuplePassed(List<?> tuple)
-	        					throws ExpressionEvaluationException,
-	        					BlockedException, MetaMatrixComponentException {
-	        				updateCount++;
-	        			}
-	        			
-	        			protected void tupleFailed(java.util.List<?> tuple) throws MetaMatrixComponentException {
-	        				addTuple(tuple);
-	        			}
-	        		};
-	        	}
-        	} catch (TupleSourceNotFoundException e) {
-        		throw new MetaMatrixComponentException(e);
+	        			updateCount++;
+	        			addTuple(newTuple);
+        			}
+        			
+        			protected void tupleFailed(java.util.List<?> tuple) throws MetaMatrixComponentException {
+        				addTuple(tuple);
+        			}
+        		};
         	}
+        	if (command instanceof Delete) {
+        		final Delete delete = (Delete)command;
+        		final Criteria crit = delete.getCriteria();
+        		if (crit == null) {
+        			int rows = tsId.getRowCount();
+                    addTempTable(groupKey, tsId.getSchema(), true);
+                    return CollectionTupleSource.createUpdateCountTupleSource(rows);
+        		}
+        		return new UpdateTupleSource(groupKey, tsId, crit) {
+        			@Override
+        			protected void tuplePassed(List<?> tuple)
+        					throws ExpressionEvaluationException,
+        					BlockedException, MetaMatrixComponentException {
+        				updateCount++;
+        			}
+        			
+        			protected void tupleFailed(java.util.List<?> tuple) throws MetaMatrixComponentException {
+        				addTuple(tuple);
+        			}
+        		};
+        	}
         }
     	if (command instanceof Create) {
     		addTempTable(((Create)command).getTable().getName().toUpperCase(), ((Create)command).getColumns(), false);
-            return new UpdateCountTupleSource(0);	
+            return CollectionTupleSource.createUpdateCountTupleSource(0);	
     	}
     	if (command instanceof Drop) {
     		String tempTableName = ((Drop)command).getTable().getName().toUpperCase();
             removeTempTableByName(tempTableName);
-            return new UpdateCountTupleSource(0);
+            return CollectionTupleSource.createUpdateCountTupleSource(0);
     	}
         return null;
     }
@@ -282,8 +252,8 @@
         }
     }
     
-    private TupleSourceID getTupleSourceID(String tempTableID, Command command) throws MetaMatrixComponentException, QueryProcessingException{
-        TupleSourceID tsID = groupToTupleSourceID.get(tempTableID);
+    private TupleBuffer getTupleSourceID(String tempTableID, Command command) throws MetaMatrixComponentException, QueryProcessingException{
+        TupleBuffer tsID = groupToTupleSourceID.get(tempTableID);
         if(tsID != null) {
             return tsID;
         }
@@ -317,31 +287,26 @@
         return groupToTupleSourceID.get(tempTableID);
     }
     
-    private TupleSource addTuple(Insert insert, TupleSourceID tsId) throws MetaMatrixComponentException, ExpressionEvaluationException {
+    private TupleSource addTuple(Insert insert, TupleBuffer tsId) throws MetaMatrixComponentException, ExpressionEvaluationException {
         GroupSymbol group = insert.getGroup();
         int tuplesAdded = 0;
         try {
-            int rowCount = buffer.getRowCount(tsId);
-            TupleBatch tupleBatch;
             List<ElementSymbol> elements = ResolverUtil.resolveElementsInGroup(group, new TempMetadataAdapter(null, tempMetadataStore));
             
             List<List<Object>> tuples = getBulkRows(insert, elements);
             
-            tuplesAdded = tuples.size();
-
-            // Buffer manager has 1 based index for the tuple sources
-            tupleBatch = new TupleBatch((++rowCount), tuples);
+            for (List<Object> list : tuples) {
+				tsId.addTuple(list);
+			}
+            //TODO: this leads to fragmented batches, which may require recreating the table
+            tsId.saveBatch(false);
             
-            buffer.addTupleBatch(tsId, tupleBatch);
-        } catch (TupleSourceNotFoundException err) {
-            throw new MetaMatrixComponentException(err);
-        } catch (BlockedException err) {
-            throw new MetaMatrixComponentException(err);
+            tuplesAdded = tuples.size();
         } catch (QueryMetadataException err) {
             throw new MetaMatrixComponentException(err);
         }        
         
-        return new UpdateCountTupleSource(tuplesAdded);
+        return CollectionTupleSource.createUpdateCountTupleSource(tuplesAdded);
     }
 
 	public static List<List<Object>> getBulkRows(Insert insert, List<ElementSymbol> elements) throws ExpressionEvaluationException, BlockedException, MetaMatrixComponentException {
@@ -403,7 +368,7 @@
         return new HashSet<String>(this.groupToTupleSourceID.keySet());
     }
     
-    public TupleSourceID getTupleSourceID(String tempTableName) {
+    public TupleBuffer getTupleSourceID(String tempTableName) {
     	return groupToTupleSourceID.get(tempTableName.toUpperCase());
     } 
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/util/CommandContext.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/util/CommandContext.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/util/CommandContext.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,12 +25,13 @@
 import java.io.Serializable;
 import java.util.Properties;
 import java.util.Random;
+import java.util.Set;
 import java.util.Stack;
 import java.util.TimeZone;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryProcessingException;
-import com.metamatrix.common.buffer.impl.BufferConfig;
+import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.core.util.ArgCheck;
 import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.eval.SecurityFunctionEvaluator;
@@ -48,60 +49,63 @@
  * framework.
  */
 public class CommandContext implements Cloneable {
+	
+	private static class GlobalState {
+	    /** Uniquely identify the command being processed */
+	    private Object processorID;
+	    
+	    /** Identify a group of related commands, which typically get cleaned up together */
+	    private String connectionID;
 
-    /** Uniquely identify the command being processed */
-    private Object processorID;
-    
-    /** Identify a group of related commands, which typically get cleaned up together */
-    private String connectionID;
+	    private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
+	    
+	    private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
 
-    private int processorBatchSize = BufferConfig.DEFAULT_PROCESSOR_BATCH_SIZE;
-    
-    private int connectorBatchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
+	    private String userName;
+	    
+	    private Serializable commandPayload;
+	    
+	    private String vdbName;
+	    
+	    private int vdbVersion;
+	    
+	    private Properties environmentProperties;
+	    
+	    /** Indicate whether data should be dumped for debugging purposes while processing the query */
+	    private boolean processDebug;  
+	        
+	    /** Indicate whether statistics should be collected for relational node processing*/
+	    private boolean collectNodeStatistics;
+	    
+	    private int streamingBatchSize;
+	    
+	    private Random random = null;
+	    
+	    private SecurityFunctionEvaluator securityFunctionEvaluator;
+	    
+	    private TimeZone timezone = TimeZone.getDefault();
+	    
+	    private PlanToProcessConverter planToProcessConverter;
+	    
+	    private QueryProcessor.ProcessorFactory queryProcessorFactory;
+	        
+	    private boolean sessionFunctionEvaluated;
+	    
+	    private Set<String> groups;
+	    
+	    private long timeSliceEnd = Long.MAX_VALUE;
+	    
+	    private long timeoutEnd = Long.MAX_VALUE;
+	}
+	
+	private GlobalState globalState = new GlobalState();
 
-    private String userName;
-    
-    private Serializable commandPayload;
-    
-    private String vdbName;
-    
-    private int vdbVersion;
-    
-    private Properties environmentProperties;
-    
-    /** Indicate whether data should be dumped for debugging purposes while processing the query */
-    private boolean processDebug;  
-        
-    /** Indicate whether statistics should be collected for relational node processing*/
-    private boolean collectNodeStatistics;
-    
-    private int streamingBatchSize;
-    
-    private Random random = null;
-    
-    private Stack<String> recursionStack = null;
-    
-    private boolean optimisticTransaction = false;
-    
-    private SecurityFunctionEvaluator securityFunctionEvaluator;
-    
-    private Object tempTableStore;
-    
-    private TimeZone timezone = TimeZone.getDefault();
-    
-    private PlanToProcessConverter planToProcessConverter;
-    
-    private QueryProcessor.ProcessorFactory queryProcessorFactory;
-    
     private VariableContext variableContext = new VariableContext();
-    
-    private CommandContext parent;
-    
-    private boolean sessionFunctionEvaluated;
-    
+    private Object tempTableStore;
+    private Stack<String> recursionStack;
+
     /**
      * Construct a new context.
-     * @param collectNodeStatistics TODO
      */
     public CommandContext(Object processorID, String connectionID, String userName, 
         Serializable commandPayload, String vdbName, int vdbVersion, Properties envProperties, boolean processDebug, boolean collectNodeStatistics) {
@@ -127,67 +131,30 @@
              
     }
 
-    protected CommandContext(CommandContext context) {
-        setConnectionID(context.connectionID);
-                
-        // Reuse existing processor ID - may be overridden
-        setProcessorID(context.processorID);
-            
-        setUserName(context.userName);
-        setCommandPayload(context.commandPayload);
-        setVdbName(context.vdbName);
-        setVdbVersion(context.vdbVersion);   
-        setEnvironmentProperties(context.environmentProperties); 
-        setProcessDebug(context.processDebug);
-        setProcessorBatchSize(context.processorBatchSize);
-        setConnectorBatchSize(context.connectorBatchSize);
-        setRandom(context.random);
-        if (context.recursionStack != null) {
-            this.recursionStack = (Stack)context.recursionStack.clone();
-        }
-        setOptimisticTransaction(context.isOptimisticTransaction());
-        this.setSecurityFunctionEvaluator(context.getSecurityFunctionEvaluator());
-        this.planToProcessConverter = context.planToProcessConverter;
-        this.queryProcessorFactory = context.queryProcessorFactory;
-        this.variableContext = context.variableContext;
-        this.parent = context;
-    }
-        
     public CommandContext() {        
     }
     
-    public CommandContext getParent() {
-		return parent;
-	}
-    
     public boolean isSessionFunctionEvaluated() {
-    	if (parent != null) {
-    		return parent.isSessionFunctionEvaluated();
-    	}
-		return sessionFunctionEvaluated;
+		return globalState.sessionFunctionEvaluated;
 	}
     
     public void setSessionFunctionEvaluated(boolean sessionFunctionEvaluated) {
-    	if (parent != null) {
-    		parent.setSessionFunctionEvaluated(sessionFunctionEvaluated);
-    	} else {
-    		this.sessionFunctionEvaluated = sessionFunctionEvaluated;
-    	}
+    	globalState.sessionFunctionEvaluated = sessionFunctionEvaluated;
 	}
     
     /**
      * @return
      */
     public Object getProcessorID() {
-        return processorID;
+        return globalState.processorID;
     }
 
     public boolean getProcessDebug() {
-        return this.processDebug;
+        return globalState.processDebug;
     }
     
     public void setProcessDebug(boolean processDebug) {
-        this.processDebug = processDebug;
+    	globalState.processDebug = processDebug;
     }
 
     /**
@@ -195,43 +162,49 @@
      */
     public void setProcessorID(Object object) {
         ArgCheck.isNotNull(object);
-        processorID = object;
+        globalState.processorID = object;
     }
 
     public Object clone() {
-    	return new CommandContext(this);
+    	CommandContext clone = new CommandContext();
+    	clone.globalState = this.globalState;
+    	clone.variableContext = this.variableContext;
+    	if (this.recursionStack != null) {
+            clone.recursionStack = (Stack<String>)this.recursionStack.clone();
+        }
+    	return clone;
     }
     
     public String toString() {
-        return "CommandContext: " + processorID; //$NON-NLS-1$
+        return "CommandContext: " + globalState.processorID; //$NON-NLS-1$
     }
 
     /**
      * @return String
      */
     public String getConnectionID() {
-        return connectionID;
+        return globalState.connectionID;
     }
 
     /**
      * @return String
      */
     public String getUserName() {
-        return userName;
+        return globalState.userName;
     }
 
     /**
      * @return String
      */
     public String getVdbName() {
-        return vdbName;
+        return globalState.vdbName;
     }
 
     /**
      * @return String
      */
     public int getVdbVersion() {
-        return vdbVersion;
+        return globalState.vdbVersion;
     }
 
     /**
@@ -239,7 +212,7 @@
      * @param connectionID The connectionID to set
      */
     public void setConnectionID(String connectionID) {
-        this.connectionID = connectionID;
+        this.globalState.connectionID = connectionID;
     }
 
     /**
@@ -247,7 +220,7 @@
      * @param userName The userName to set
      */
     public void setUserName(String userName) {
-        this.userName = userName;
+        this.globalState.userName = userName;
     }
 
     /**
@@ -255,7 +228,7 @@
      * @param vdbName The vdbName to set
      */
     public void setVdbName(String vdbName) {
-        this.vdbName = vdbName;
+        this.globalState.vdbName = vdbName;
     }
 
     /**
@@ -263,22 +236,22 @@
      * @param vdbVersion The vdbVersion to set
      */
     public void setVdbVersion(int vdbVersion) {
-        this.vdbVersion = vdbVersion;
+        this.globalState.vdbVersion = vdbVersion;
     }
 
     public Properties getEnvironmentProperties() {
-        return environmentProperties;
+        return globalState.environmentProperties;
     }
 
     public void setEnvironmentProperties(Properties properties) {
-        environmentProperties = properties;
+    	globalState.environmentProperties = properties;
     }
     
     public Serializable getCommandPayload() {
-        return this.commandPayload;
+        return this.globalState.commandPayload;
     }
     public void setCommandPayload(Serializable commandPayload) {
-        this.commandPayload = commandPayload;
+        this.globalState.commandPayload = commandPayload;
     }    
     
     /** 
@@ -286,64 +259,58 @@
      * @since 4.2
      */
     public void setCollectNodeStatistics(boolean collectNodeStatistics) {
-        this.collectNodeStatistics = collectNodeStatistics;
+        this.globalState.collectNodeStatistics = collectNodeStatistics;
     }
     
     public boolean getCollectNodeStatistics() {
-        return this.collectNodeStatistics;
+        return this.globalState.collectNodeStatistics;
     }
     
 	public int getStreamingBatchSize() {
-		return streamingBatchSize;
+		return globalState.streamingBatchSize;
 	}
 
 	public void setStreamingBatchSize(int streamingBatchSize) {
-		this.streamingBatchSize = streamingBatchSize;
+		this.globalState.streamingBatchSize = streamingBatchSize;
 	}
 
     
     public int getConnectorBatchSize() {
-        return this.connectorBatchSize;
+        return this.globalState.connectorBatchSize;
     }
 
     
     public void setConnectorBatchSize(int connectorBatchSize) {
-        this.connectorBatchSize = connectorBatchSize;
+        this.globalState.connectorBatchSize = connectorBatchSize;
     }
 
     
     public int getProcessorBatchSize() {
-        return this.processorBatchSize;
+        return this.globalState.processorBatchSize;
     }
 
     
     public void setProcessorBatchSize(int processorBatchSize) {
-        this.processorBatchSize = processorBatchSize;
+        this.globalState.processorBatchSize = processorBatchSize;
     }
     
     public double getNextRand() {
-    	if (parent != null) {
-    		return parent.getNextRand();
-    	}
-        if (random == null) {
-            random = new Random();
+        if (globalState.random == null) {
+        	globalState.random = new Random();
         }
-        return random.nextDouble();
+        return globalState.random.nextDouble();
     }
     
     public double getNextRand(long seed) {
-    	if (parent != null) {
-    		return parent.getNextRand(seed);
-    	}
-        if (random == null) {
-            random = new Random();
+        if (globalState.random == null) {
+        	globalState.random = new Random();
         }
-        random.setSeed(seed);
-        return random.nextDouble();
+        globalState.random.setSeed(seed);
+        return globalState.random.nextDouble();
     }
     
     void setRandom(Random random) {
-        this.random = random;
+        this.globalState.random = random;
     }
 
     public void pushCall(String value) throws QueryProcessingException {
@@ -370,31 +337,17 @@
     }
 
     /** 
-     * @param optimisticTransaction The optimisticTransaction to set.
-     */
-    public void setOptimisticTransaction(boolean optimisticTransaction) {
-        this.optimisticTransaction = optimisticTransaction;
-    }
-
-    /** 
-     * @return Returns the optimisticTransaction.
-     */
-    public boolean isOptimisticTransaction() {
-        return optimisticTransaction;
-    }
-
-    /** 
      * @return Returns the securityFunctionEvaluator.
      */
     public SecurityFunctionEvaluator getSecurityFunctionEvaluator() {
-        return this.securityFunctionEvaluator;
+        return this.globalState.securityFunctionEvaluator;
     }
     
     /** 
      * @param securityFunctionEvaluator The securityFunctionEvaluator to set.
      */
     public void setSecurityFunctionEvaluator(SecurityFunctionEvaluator securityFunctionEvaluator) {
-        this.securityFunctionEvaluator = securityFunctionEvaluator;
+        this.globalState.securityFunctionEvaluator = securityFunctionEvaluator;
     }
 
 	public Object getTempTableStore() {
@@ -406,23 +359,23 @@
 	}
 	
 	public TimeZone getServerTimeZone() {
-		return timezone;
+		return globalState.timezone;
 	}
 
 	public void setPlanToProcessConverter(PlanToProcessConverter planToProcessConverter) {
-		this.planToProcessConverter = planToProcessConverter;
+		this.globalState.planToProcessConverter = planToProcessConverter;
 	}
 
 	public PlanToProcessConverter getPlanToProcessConverter() {
-		return planToProcessConverter;
+		return globalState.planToProcessConverter;
 	}
 	
 	public QueryProcessor.ProcessorFactory getQueryProcessorFactory() {
-		return this.queryProcessorFactory;
+		return this.globalState.queryProcessorFactory;
 	}
 
 	public void setQueryProcessorFactory(QueryProcessor.ProcessorFactory queryProcessorFactory) {
-		this.queryProcessorFactory = queryProcessorFactory;
+		this.globalState.queryProcessorFactory = queryProcessorFactory;
 	}
 	
 	public VariableContext getVariableContext() {
@@ -449,4 +402,28 @@
 		return value;
 	}
 	
+	public Set<String> getGroups() {
+		return globalState.groups;
+	}
+	
+	public void setGroups(Set<String> groups) {
+		this.globalState.groups = groups;
+	}
+	
+	public long getTimeSliceEnd() {
+		return globalState.timeSliceEnd;
+	}
+	
+	public long getTimeoutEnd() {
+		return globalState.timeoutEnd;
+	}
+	
+	public void setTimeSliceEnd(long timeSliceEnd) {
+		globalState.timeSliceEnd = timeSliceEnd;
+	}
+	
+	public void setTimeoutEnd(long timeoutEnd) {
+		globalState.timeoutEnd = timeoutEnd;
+	}
+	
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -103,6 +103,7 @@
 import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
 import com.metamatrix.query.sql.visitor.PredicateCollectorVisitor;
 import com.metamatrix.query.sql.visitor.SQLStringVisitor;
+import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 import com.metamatrix.query.util.ErrorMessageKeys;
 
 public class ValidationVisitor extends AbstractValidationVisitor {
@@ -221,7 +222,7 @@
 
             //if it is select with no from, should not have ScalarSubQuery
             if(obj.getSelect() != null && obj.getFrom() == null){
-                if(!CommandCollectorVisitor.getCommands(obj).isEmpty()){
+                if(!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(obj.getSelect()).isEmpty()){
                     handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0067),obj);
                 }
             }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/validator/Validator.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/validator/Validator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/validator/Validator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -37,11 +37,11 @@
 public class Validator {
 
     public static final ValidatorReport validate(LanguageObject object, QueryMetadataInterface metadata) throws MetaMatrixComponentException {
-        ValidatorReport report1 = Validator.validate(object, metadata, new ValidationVisitor(), false);
+        ValidatorReport report1 = Validator.validate(object, metadata, new ValidationVisitor());
         return report1;
     }
 
-    public static final ValidatorReport validate(LanguageObject object, QueryMetadataInterface metadata, AbstractValidationVisitor visitor, boolean validateOnlyEmbedded)
+    public static final ValidatorReport validate(LanguageObject object, QueryMetadataInterface metadata, AbstractValidationVisitor visitor)
         throws MetaMatrixComponentException {
 
         // Construct combined runtime / query metadata if necessary
@@ -56,10 +56,10 @@
             }
             
             // Recursively validate subcommands
-            Iterator iter = CommandCollectorVisitor.getCommands((Command)object, validateOnlyEmbedded).iterator();
+            Iterator iter = CommandCollectorVisitor.getCommands((Command)object).iterator();
             while(iter.hasNext()) {
                 Command subCommand = (Command) iter.next();
-                validate(subCommand, metadata, visitor, validateOnlyEmbedded);
+                validate(subCommand, metadata, visitor);
             }
         }
 

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/XQueryExpression.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/XQueryExpression.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/XQueryExpression.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,10 +22,9 @@
 
 package com.metamatrix.query.xquery;
 
-import java.sql.SQLXML;
-
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.types.XMLTranslator;
 
 /**
  * An XQueryExpression - the object representation of
@@ -53,11 +52,10 @@
      * value is interpreted to mean that XQueries are not supported
      * by this engine.
      * @param compiledXQuery compiled XQueryExpression
-     * @return retuns a result SQLXML object.
      * @throws MetaMatrixProcessingException if xQueryString is
      * invalid and fails to compile
      */
-    public SQLXML evaluateXQuery(XQuerySQLEvaluator sqlEval)
+    public XMLTranslator evaluateXQuery(XQuerySQLEvaluator sqlEval)
     throws MetaMatrixProcessingException, MetaMatrixComponentException;
     
     

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXMLTranslator.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXMLTranslator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXMLTranslator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.xquery.saxon;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import net.sf.saxon.Configuration;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.query.QueryResult;
-
-import com.metamatrix.common.types.XMLTranslator;
-
-
-/** 
- * This converts the SAXOn based XML tree into another popular XMl formats like String,
- * DOM, SAX etc.
- */
-public class SaxonXMLTranslator implements XMLTranslator {
-    NodeInfo source;
-    Properties properties;
-    
-    public SaxonXMLTranslator(NodeInfo source, Properties props) {
-        this.source = source;
-        this.properties = props;
-    }
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getString()
-     */
-    public String getString() throws IOException {
-        StringWriter writer = new StringWriter();
-        Result result = new StreamResult(writer);
-        try {
-            QueryResult.serialize(source, result, this.properties, new Configuration());
-        } catch (TransformerException e) {
-            throw new IOException(e.getMessage());
-        }
-        StringBuffer buffer = writer.getBuffer();
-        return buffer.toString();
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getSource()
-     */
-    public Source getSource() throws IOException {
-        return getStreamSource();
-    }
-
-    /**
-     * Get a Stream source from the SAXON's tiny tree format.
-     */
-    private StreamSource getStreamSource() throws IOException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        Result result = new StreamResult(out);
-        try {
-            QueryResult.serialize(source, result, this.properties, new Configuration());
-        } catch (TransformerException e) {
-            throw new IOException(e.getMessage());
-        }
-        out.close();
-        return new StreamSource(new ByteArrayInputStream(out.toByteArray()));
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getReader()
-     */
-    public Reader getReader() throws IOException {
-        return new StringReader(getString());
-    }    
-    
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getInputStream()
-     */
-    public InputStream getInputStream() throws IOException {
-        return getStreamSource().getInputStream();
-    }
-
-    /** 
-     * @see com.metamatrix.common.types.XMLTranslator#getProperties()
-     */
-    public Properties getProperties() {
-        return this.properties;
-    }    
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXQueryExpression.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/xquery/saxon/SaxonXQueryExpression.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,8 @@
 
 package com.metamatrix.query.xquery.saxon;
 
+import java.io.IOException;
+import java.io.Writer;
 import java.sql.SQLException;
 import java.sql.SQLXML;
 import java.util.HashMap;
@@ -34,16 +36,18 @@
 
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamResult;
 
 import net.sf.saxon.Configuration;
 import net.sf.saxon.om.NodeInfo;
 import net.sf.saxon.query.DynamicQueryContext;
+import net.sf.saxon.query.QueryResult;
 import net.sf.saxon.query.StaticQueryContext;
 import net.sf.saxon.trans.XPathException;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.types.SQLXMLImpl;
+import com.metamatrix.common.types.XMLTranslator;
 import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.util.XMLFormatConstants;
 import com.metamatrix.query.xquery.XQueryExpression;
@@ -117,7 +121,7 @@
     /**
      * @see com.metamatrix.query.xquery.XQueryEngine#evaluateXQuery(com.metamatrix.query.xquery.XQueryExpression)
      */
-    public SQLXML evaluateXQuery(XQuerySQLEvaluator sqlEval) 
+    public XMLTranslator evaluateXQuery(XQuerySQLEvaluator sqlEval) 
     throws MetaMatrixProcessingException, MetaMatrixComponentException {
 
         Configuration config = new Configuration();
@@ -172,11 +176,22 @@
             
             // output
             if (obj instanceof NodeInfo){
-                Properties props = new Properties();                
+            	final NodeInfo nodeInfo = (NodeInfo)obj;
+                final Properties props = new Properties();                
                 if (XMLFormatConstants.XML_TREE_FORMAT.equals(this.xmlFormat)) {
                     props.setProperty("indent", "yes");//$NON-NLS-1$//$NON-NLS-2$
                 }                
-                return new SQLXMLImpl(new SaxonXMLTranslator((NodeInfo)obj, props));
+                return new XMLTranslator() {
+					
+					@Override
+					public void translate(Writer writer) throws IOException {
+				        try {
+				            QueryResult.serialize(nodeInfo, new StreamResult(writer), props, new Configuration());
+				        } catch (TransformerException e) {
+				            throw new IOException(e);
+				        }
+					}
+				};
             } 
         }        
         throw new MetaMatrixProcessingException(QueryPlugin.Util.getString("wrong_result_type")); //$NON-NLS-1$

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheID.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheID.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,95 +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.cache;
-
-import java.util.List;
-
-import com.metamatrix.core.util.HashCodeUtil;
-
-public class CacheID {
-	private String scopeID;
-	private String command;
-	private int hashCode;
-	private List preparedStatementValues;
-	private long size=0L;
-	
-	public CacheID(String scopeID, String command){
-		this(scopeID, command, null);
-	}
-	
-	public CacheID(String scopeID, String command, List preparedStatementValue){
-		this.scopeID = scopeID;
-		this.command = command;
-		this.preparedStatementValues = preparedStatementValue;
-		hashCode = HashCodeUtil.expHashCode(HashCodeUtil.hashCode(HashCodeUtil.hashCode(0, scopeID), command), preparedStatementValues);
-	}
-
-	public String getCommand() {
-		return command;
-	}
-	
-	public boolean equals(Object obj){
-        if(obj == this) {
-            return true;
-        } else if(obj == null || ! (obj instanceof CacheID)) {
-            return false;
-        } else {
-        	CacheID that = (CacheID)obj;
-            return this.scopeID.equals(that.scopeID)
-				&& this.command.equals(that.command)
-				&& compareParamValues(preparedStatementValues, that.preparedStatementValues);
-		}
-	}
-
-	private boolean compareParamValues(List thisPreparedStatementValues, List thatPreparedStatementValues) {
-		if(thisPreparedStatementValues == null && thatPreparedStatementValues == null){
-			return true;
-		}
-		if((thisPreparedStatementValues == null && thatPreparedStatementValues != null)
-				|| thisPreparedStatementValues != null && thatPreparedStatementValues == null){
-			return false;
-		}
-		int size = thisPreparedStatementValues.size();
-		if(size != thatPreparedStatementValues.size()){
-			return false;
-		}
-		for(int i=0; i< size; i++){
-			if(!thisPreparedStatementValues.get(i).equals(thatPreparedStatementValues.get(i))){
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public int hashCode() {
-        return hashCode;
-    }
-	
-	public long getMemorySize() {
-		return size;
-	}
-	
-	public void setMemorySize(long size) {
-		this.size = size;
-	}
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheResults.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheResults.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/CacheResults.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,148 +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.cache;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.sql.lang.Command;
-
-public class CacheResults {
-	private List[] results;
-	private List elements;
-	private AnalysisRecord analysisRecord;
-	private Command command;
-	private Map paramValues;
-	
-	private boolean isFinal;
-	private int firstRow = 1;
-    //size of this results in memory
-	private long size= -1;
-	private int finalRow = -1;
-		
-	public CacheResults(List[] results, int firstRow, boolean isFinal){
-		this(results, null, firstRow, isFinal);
-	}
-	
-	public CacheResults(List[] results, List elements, int firstRow, boolean isFinal){
-		this.results = results;
-		this.firstRow = firstRow;
-		this.isFinal = isFinal;
-		this.elements = elements;
-	}
-
-	public CacheResults(Map paramValues, boolean isFinal){
-		this.paramValues = paramValues;
-		this.isFinal = isFinal;
-	}
-	
-	public int getFirstRow() {
-		return firstRow;
-	}
-
-	public boolean isFinal() {
-		return isFinal;
-	}
-
-	public List[] getResults() {
-		return results;
-	}
-
-	public List getElements() {
-		return elements;
-	}
-
-	public Command getCommand() {
-		return command;
-	}
-
-	public void setCommand(Command command) {
-		this.command = command;
-	}
-
-	public long getSize() {
-		return size;
-	}
-
-	public void setSize(long size) {
-		this.size = size;
-	}
-
-	public AnalysisRecord getAnalysisRecord() {
-		return analysisRecord;
-	}
-
-	public void setAnalysisRecord(AnalysisRecord analysisRecord) {
-		this.analysisRecord = analysisRecord;
-	}
-
-	public int getFinalRow() {
-		return finalRow;
-	}
-
-	public void setFinalRow(int finalRow) {
-		this.finalRow = finalRow;
-	}
-
-	public Map getParamValues() {
-		return paramValues;
-	}
-
-	public void setParamValues(Map paramValues) {
-		if(this.paramValues == null){
-			this.paramValues = paramValues;
-		}else if(paramValues != null){
-			this.paramValues.putAll(paramValues);
-		}
-	}
-		
-    //add the results to the existing one, this is used
-    //when building the batched results
-	boolean addResults(CacheResults cacheResults){
-		if (this.firstRow + results.length != cacheResults.getFirstRow()) {
-			throw new MetaMatrixRuntimeException(DQPPlugin.Util.getString("ResultSetCache.1"));//$NON-NLS-1$
-		}
-		this.size += cacheResults.size;
-		List[] batchResults = cacheResults.getResults();
-		if (results == null) {
-			this.results = batchResults;
-		} else if (batchResults.length > 0){
-			this.results = Arrays.copyOf(this.results, this.results.length + batchResults.length);
-			System.arraycopy(batchResults, 0, this.results, this.results.length - batchResults.length, batchResults.length);
-		}
-			
-		if(cacheResults.isFinal()){
-			this.command = cacheResults.getCommand();
-			this.analysisRecord = cacheResults.getAnalysisRecord();
-			this.firstRow = 1;
-			this.isFinal = true;
-			this.finalRow = this.results.length;
-		}
-		return true;
-	}
-	
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCache.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCache.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCache.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,233 +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.cache;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import com.metamatrix.cache.Cache;
-import com.metamatrix.cache.CacheConfiguration;
-import com.metamatrix.cache.CacheFactory;
-import com.metamatrix.cache.Cache.Type;
-import com.metamatrix.cache.CacheConfiguration.Policy;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * Used to cache ResultSet based on the exact match of sql string.
- */
-public class ResultSetCache {
-	
-	static class TempKey {
-		CacheID cacheID;
-		Object requestID;
-
-		public TempKey(CacheID cacheID, Object requestID) {
-			this.cacheID = cacheID;
-			this.requestID = requestID;
-		}
-		@Override
-		public int hashCode() {
-			return HashCodeUtil.hashCode(cacheID.hashCode(), requestID.hashCode());
-		}
-		
-		@Override
-		public boolean equals(Object obj) {
-			if (this == obj) {
-				return true;
-			}
-			if (!(obj instanceof TempKey)) {
-				return false;
-			}
-			TempKey other = (TempKey) obj;
-			return (cacheID.equals(other.cacheID) && requestID.equals(other.requestID));
-		}
-	}
-	
-	//configurable parameters
-	public static final String RS_CACHE_MAX_SIZE = "maxSize"; //$NON-NLS-1$
-	public static final String RS_CACHE_MAX_AGE = "maxAge"; //$NON-NLS-1$
-	public static final String RS_CACHE_SCOPE = "scope"; //$NON-NLS-1$
-		
-	//constants
-	public static final String RS_CACHE_SCOPE_VDB = "vdb"; //$NON-NLS-1$
-	public static final String RS_CACHE_SCOPE_CONN = "connection"; //$NON-NLS-1$
-
-	private Cache<CacheID, CacheResults> cache; 
-	private String scope;
-	private Map<TempKey, CacheResults> tempBatchResults = new HashMap<TempKey, CacheResults>();
-	private int maxSize = 50 * 1024 * 1024; //bytes
-	private int maxAge = 60 * 60; // seconds
-	private int maxEntries = 20 * 1024; 
-	
-	public ResultSetCache(Properties props, CacheFactory cacheFactory) {
-		PropertiesUtils.setBeanProperties(this, props, null);
-		this.cache = cacheFactory.get(Type.RESULTSET, new CacheConfiguration(Policy.MRU, maxAge, maxEntries));
-	}
-	
-	public void setMaxSize(int maxSize) {
-		if (maxSize <= 0 ) {
-			this.maxSize = 0;
-			this.maxEntries = Integer.MAX_VALUE;
-		} else {
-			this.maxSize = maxSize * 1024 * 1024;
-			this.maxEntries = this.maxSize * 1024;
-		}
-	}
-	
-	public void setMaxAge(int maxAge) {
-		if (maxAge <= 0) {
-			this.maxAge = Integer.MAX_VALUE;
-		}
-		this.maxAge = Math.max(1, maxAge / 1000);
-	}
-	
-	public void setScope(String scope) {
-		this.scope = scope;
-	}
-		
-	//interval is 1 based. 
-	public final CacheResults getResults(CacheID cacheID, int[] interval){
-		CacheResults cacheResults = null;
-		cacheResults = cache.get(cacheID);
-		if(cacheResults == null){
-			return null;
-		}
-		int firstRow = interval[0] - 1;
-		int resultSize = cacheResults.getResults().length;
-		int finalRow = resultSize - 1;
-		int lastRow = Math.min(finalRow, interval[1] - 1);
-		if(resultSize == 0 || (firstRow ==0 && lastRow == finalRow)){
-			//the whole results
-			return cacheResults;
-		}
-		int batchSize = lastRow - firstRow + 1;
-		List<?>[] resultsPart = new List[batchSize];
-		System.arraycopy(cacheResults.getResults(), firstRow, resultsPart, 0, batchSize);
-		boolean isFinal = lastRow == finalRow;
-		CacheResults newCacheResults = new CacheResults(resultsPart, cacheResults.getElements(), firstRow + 1, lastRow == finalRow);
-		newCacheResults.setCommand(cacheResults.getCommand());
-		newCacheResults.setAnalysisRecord(cacheResults.getAnalysisRecord());
-		newCacheResults.setParamValues(cacheResults.getParamValues());
-        
-		if(isFinal){
-			newCacheResults.setFinalRow(resultSize);
-		}
-		return newCacheResults;
-	}
-	
-	public boolean hasResults(CacheID cacheID){
-		boolean hasResults = cache.get(cacheID) != null;
-		return hasResults;	
-	}
-	
-    /**
-     * if valueID is not null, it is lob (XML document) chunk
-     * @return true if the result was cachable 
-     */
-	public boolean setResults(CacheID cacheID, CacheResults cacheResults, Object requestID){	
-		List<?>[] results = cacheResults.getResults();
-		if(cacheResults.getSize() == -1){
-			cacheResults.setSize(ResultSetCacheUtil.getResultsSize(results, true));
-		}
-		
-		long currentCacheSize = getCacheSize();
-		
-		TempKey key = new TempKey(cacheID, requestID);
-		//do not cache if it is over cache limit
-		if(isOverCacheLimit(currentCacheSize, cacheResults.getSize())){
-			removeTempResults(key);
-			return false;
-		}
-	
-		synchronized(tempBatchResults){
-			CacheResults savedResults = tempBatchResults.get(key);
-			if(savedResults == null){
-				savedResults = cacheResults; 
-				tempBatchResults.put(key, cacheResults);
-			} else if(!savedResults.addResults(cacheResults)){
-				removeTempResults(key);
-				return false;
-			}
-			
-			//do not cache if it is over cache limit
-			if(isOverCacheLimit(currentCacheSize, savedResults.getSize())){
-				removeTempResults(key);
-				return false;
-			}
-		
-			if(savedResults.isFinal()){
-				tempBatchResults.remove(cacheID);
-				cacheID.setMemorySize(savedResults.getSize());
-				cache.put(cacheID, savedResults);
-			}
-		}
-		
-		return true;
-	}
-
-	private boolean isOverCacheLimit(long recentCacheSize, long sizeToAdd) {
-		if(maxSize == 0 || sizeToAdd == 0){
-			return false;
-		}
-		if(sizeToAdd + recentCacheSize > maxSize){
-			return true;
-		}
-		return false;
-	}
-	
-	public void removeTempResults(CacheID cacheID, Object requestID){
-		removeTempResults(new TempKey(cacheID, requestID));
-	}
-
-	public void removeTempResults(TempKey cacheID){
-		synchronized(tempBatchResults){
-			tempBatchResults.remove(cacheID);
-		}
-	}
-	
-	public void clear(){
-		cache.clear();
-		synchronized(tempBatchResults){
-			tempBatchResults.clear();
-		}
-	}
-
-	private long getCacheSize(){
-		long size = 0L;
-		for(CacheID key:cache.keySet()) {
-			size += key.getMemorySize();
-		}
-		return size;
-	}
-	
-	public void shutDown(){
-		clear();
-	}
-	
-	public String getCacheScope(){
-		return scope;
-	}
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCacheUtil.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCacheUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/cache/ResultSetCacheUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,62 +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.cache;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.common.buffer.impl.SizeUtility;
-import com.metamatrix.dqp.message.RequestMessage;
-
-public class ResultSetCacheUtil {
-	private static final char DELIMITOR = '.'; 
-	
-	public static CacheID createCacheID(RequestMessage request, ResultSetCache rsCache){
-		String scopeID = null;
-		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		if(ResultSetCache.RS_CACHE_SCOPE_VDB.equalsIgnoreCase(rsCache.getCacheScope())){
-			scopeID = workContext.getVdbName() + DELIMITOR + workContext.getVdbVersion();
-		}else{
-			scopeID = workContext.getConnectionID();
-		}
-		return new CacheID(scopeID, request.getCommandString(), request.getParameterValues());
-	}
-	
-//	public static boolean isQuery(String sql){
-//		return !SqlUtil.isUpdateSql(sql);
-//	}
-
-	public static long getResultsSize(Object[] results, boolean useEstimate){
-		if(results == null || results.length == 0){
-			return 0;
-		}
-		if(useEstimate){
-			//calculate the first row. Estimate the total
-			//by multiply the row count
-			Object row = results[0];
-			long rowSize = SizeUtility.getSize(row);
-			return rowSize * results.length;
-		}
-		return SizeUtility.getSize(results);
-	}
-
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -53,10 +53,8 @@
 import org.teiid.connector.metadata.runtime.MetadataFactory;
 import org.teiid.connector.metadata.runtime.MetadataStore;
 import org.teiid.dqp.internal.cache.DQPContextCache;
-import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.datamgr.CapabilitiesConverter;
 
-import com.metamatrix.cache.CacheFactory;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.log.LogManager;
@@ -87,14 +85,12 @@
 	private String connectorName;
 	    
     private StatsCapturingWorkManager workManager;
-    protected ResultSetCache rsCache;
     protected ConnectorWorkItemFactory workItemFactory;
     
     private volatile ConnectorStatus state = ConnectorStatus.NOT_INITIALIZED;
 
     //services acquired in start
     private BufferService bufferService;
-    private CacheFactory cacheFactory;
     
     // known requests
     private ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem> requestStates = new ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem>();
@@ -163,12 +159,6 @@
         }
     }
     
-    public void clearCache() {
-        if (rsCache != null) {
-        	rsCache.clear();
-        }
-    }
-     
     public void executeRequest(WorkManager workManager, ResultsReceiver<AtomicResultsMessage> receiver, AtomicRequestMessage message) throws ConnectorException {
         // Set the connector ID to be used; if not already set. 
     	checkStatus();
@@ -269,9 +259,6 @@
     	this.bufferService = service;
     }
     
-    public void setCacheFactory(CacheFactory cacheF) {
-    	this.cacheFactory = cacheF;
-    }
     /**
      * initialize this <code>ConnectorManager</code>.
      */
@@ -295,15 +282,7 @@
     		throw new ApplicationLifecycleException(DQPPlugin.Util.getString("ConnectorManager.xa_capbility_not_supported", this.connectorName)); //$NON-NLS-1$
     	}
 
-        //check result set cache
-        if(connectorEnv.isResultSetCacheEnabled()) {
-            Properties rsCacheProps = new Properties();
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, String.valueOf(connectorEnv.getResultSetCacheMaxSize())); 
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, String.valueOf(connectorEnv.getResultSetCacheMaxAge())); 
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, connectorEnv.getResultSetCacheScope()); 
-    		this.rsCache = new ResultSetCache(rsCacheProps, this.cacheFactory);
-        }
-		this.workItemFactory = new ConnectorWorkItemFactory(this, this.rsCache, connectorEnv.isSynchWorkers());
+		this.workItemFactory = new ConnectorWorkItemFactory(this, connectorEnv.isSynchWorkers());
     	this.state = ConnectorStatus.OPEN;
     }
     /**
@@ -330,10 +309,6 @@
         	}
 		}
         
-        if (this.rsCache != null) {
-        	this.rsCache.shutDown();
-        	this.rsCache = null;
-        }
     }
 
     /**

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItemFactory.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItemFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItemFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,153 +22,31 @@
 
 package org.teiid.dqp.internal.datamgr.impl;
 
-import java.util.Arrays;
 
+
 import javax.resource.spi.work.WorkManager;
 
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.dqp.internal.cache.CacheID;
-import org.teiid.dqp.internal.cache.CacheResults;
-import org.teiid.dqp.internal.cache.ResultSetCache;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.util.LogConstants;
-import com.metamatrix.query.sql.lang.Command;
 
 public class ConnectorWorkItemFactory {
 	
-    private final static char DELIMITER = '.';
-
-	private ResultSetCache rsCache;
 	private ConnectorManager manager;
 	private boolean synchWorkers;
 
-	/**
-	 * A work item that can get results from cache.
-	 */
-	private final class CachedResultsConnectorWorkItem extends
-			AsynchConnectorWorkItem {
-		private final CacheID cacheID;
-
-		private CachedResultsConnectorWorkItem(AtomicRequestMessage message,
-				ConnectorManager manager,
-				ResultsReceiver<AtomicResultsMessage> resultsReceiver,
-				CacheID cacheID, WorkManager wm) throws ConnectorException {
-			super(message, manager, resultsReceiver, wm);
-			this.cacheID = cacheID;
-		}
-
-		@Override
-		protected void createExecution()
-				throws MetaMatrixComponentException,
-				ConnectorException {
-		}
-		
-		@Override
-		protected void processNewRequest() throws ConnectorException {
-			handleBatch();
-		}
-
-		@Override
-		protected void handleBatch() throws ConnectorException {
-			int firstRow = rowCount + 1;
-			//already in cache
-			CacheResults results = rsCache.getResults(cacheID, new int[]{firstRow, firstRow + requestMsg.getFetchSize() -1});
-			this.rowCount = rowCount + results.getResults().length;
-			if(results.isFinal()){
-				this.lastBatch = true;
-			}
-
-		    LogManager.logTrace(LogConstants.CTX_DQP, 
-		                        new Object[] { "CacheSynchQueryExecution - returnning batch from cache, startRow =",  //$NON-NLS-1$
-		                                       new Integer(firstRow),
-		                                       ", endRow =", //$NON-NLS-1$
-		                                       new Integer(rowCount)});
-		    sendResults(Arrays.asList(results.getResults()));
-		}
-	}
-
-	/**
-	 * Intercepts results for cachable commands
-	 */
-	public class CachedResultsReceiver implements ResultsReceiver<AtomicResultsMessage> {
-		
-		private ResultsReceiver<AtomicResultsMessage> actual;
-		private AtomicRequestID requestId;
-		private CacheID cacheID;
-		private int firstRow = 1;
-		
-		public CachedResultsReceiver(ResultsReceiver<AtomicResultsMessage> actual,
-				CacheID cacheID, AtomicRequestID requestId) {
-			this.actual = actual;
-			this.cacheID = cacheID;
-			this.requestId = requestId;
-		}
-
-		@Override
-		public void receiveResults(AtomicResultsMessage results) {
-			boolean isFinal = results.getFinalRow() >= 0;
-			if (results.isRequestClosed()) {
-				rsCache.removeTempResults(cacheID, requestId);
-			} else {
-				CacheResults cr = new CacheResults(results.getResults(), firstRow, isFinal);
-				firstRow += results.getResults().length;
-				rsCache.setResults(cacheID, cr, requestId);
-			}
-			actual.receiveResults(results);
-		}
-
-		@Override
-		public void exceptionOccurred(Throwable e) {
-			rsCache.removeTempResults(cacheID, requestId);
-			actual.exceptionOccurred(e);
-		}
-
-	}
-	
-	public ConnectorWorkItemFactory(ConnectorManager manager,
-			ResultSetCache rsCache, boolean synchWorkers) {
+	public ConnectorWorkItemFactory(ConnectorManager manager, boolean synchWorkers) {
 		this.manager = manager;
-		this.rsCache = rsCache;
 		this.synchWorkers = synchWorkers;
 	}
 	
 	public ConnectorWorkItem createWorkItem(AtomicRequestMessage message, ResultsReceiver<AtomicResultsMessage> receiver, WorkManager wm) throws ConnectorException {
-    	if (this.rsCache != null && message.useResultSetCache()) {
-        	final CacheID cacheID = createCacheID(message);
-
-        	if (cacheID != null) {
-	        	if (rsCache.hasResults(cacheID)) {
-	        		return new CachedResultsConnectorWorkItem(message, manager,receiver, cacheID, wm);
-	        	}
-        		receiver = new CachedResultsReceiver(receiver, cacheID, message.getAtomicRequestID());
-        	}
-    	}
-    	
     	if (synchWorkers) {
     		return new SynchConnectorWorkItem(message, manager, receiver);
     	} 
     	return new AsynchConnectorWorkItem(message, manager, receiver, wm);
 	}
 	
-	private CacheID createCacheID(AtomicRequestMessage message) {
-		Command command = message.getCommand();
-		if (!command.areResultsCachable()) {
-			return null;
-		}
-		String scope = rsCache.getCacheScope();
-		String scopeId = null;
-		if(ResultSetCache.RS_CACHE_SCOPE_VDB.equalsIgnoreCase(scope)){
-			scopeId = message.getWorkContext().getVdbName() + DELIMITER + message.getWorkContext().getVdbVersion();
-		}else{
-			scopeId = message.getWorkContext().getConnectionID();
-		}
-		return new CacheID(scopeId, command.toString());
-	}
-
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -36,7 +36,7 @@
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.cache.Cache;
-import com.metamatrix.common.buffer.impl.BufferConfig;
+import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.core.util.HashCodeUtil;
 import com.metamatrix.dqp.DQPPlugin;
 
@@ -68,7 +68,7 @@
     private boolean isTransactional;
     private DQPContextCache contextCache;
     
-    private int batchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
+    private int batchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
 	private List<Exception> warnings = new LinkedList<Exception>();
     
     public ExecutionContextImpl(String vdbName, int vdbVersion,  Serializable executionPayload, 

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,96 +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.List;
-
-import org.teiid.dqp.internal.cache.CacheResults;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.dqp.message.RequestID;
-import com.metamatrix.dqp.message.RequestMessage;
-import com.metamatrix.dqp.message.ResultsMessage;
-import com.metamatrix.query.sql.lang.Command;
-
-public class CachedRequestWorkItem extends RequestWorkItem {
-
-	public CachedRequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext, Command originalCommand) {
-		super(dqpCore, requestMsg, request, receiver, requestID, workContext);
-		this.originalCommand = originalCommand;
-	}
-	
-	@Override
-	protected void processNew() throws MetaMatrixComponentException, MetaMatrixProcessingException  {
-		request.initMetadata();
-    	request.validateAccess(originalCommand);
-    	this.request = null;
-	}
-	
-	@Override
-	protected void processMore() throws BlockedException,
-			MetaMatrixCoreException {
-		//do nothing
-	}
-
-	
-	@Override
-	protected void sendResultsIfNeeded(TupleBatch batch)
-			throws BlockedOnMemoryException, MetaMatrixComponentException,
-			TupleSourceNotFoundException {
-		synchronized (this.resultsCursor) {
-			if (!this.resultsCursor.resultsRequested) {
-				return;
-			}
-		}
-		CacheResults cResult = rsCache.getResults(cid, new int[] {this.resultsCursor.begin, this.resultsCursor.end});
-		List results[] = cResult.getResults();
-		int firstRow = cResult.getFirstRow();
-
-        ResultsMessage response = createResultsMessage(requestMsg, results, cResult.getElements(), cResult.getAnalysisRecord());
-        response.setFirstRow(firstRow);
-        response.setLastRow(firstRow + results.length - 1);
-
-        boolean isFinal = cResult.isFinal();
-        if(isFinal){
-            response.setFinalRow(cResult.getFinalRow());
-        }
-        
-        this.resultsCursor.resultsSent();
-        this.resultsReceiver.receiveResults(response);
-	}
-	
-	@Override
-	protected void attemptClose() {
-		this.isClosed = true;
-		dqpCore.logMMCommand(this, false, false, -1);
-		this.dqpCore.removeRequest(this);
-	}
-	
-}
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -43,10 +43,7 @@
 import org.teiid.adminapi.impl.RequestMetadata;
 import org.teiid.adminapi.impl.SessionMetadata;
 import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.dqp.internal.cache.CacheID;
 import org.teiid.dqp.internal.cache.DQPContextCache;
-import org.teiid.dqp.internal.cache.ResultSetCache;
-import org.teiid.dqp.internal.cache.ResultSetCacheUtil;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -59,6 +56,7 @@
 import com.metamatrix.common.lob.LobChunk;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.queue.StatsCapturingWorkManager;
+import com.metamatrix.common.types.Streamable;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.common.xa.MMXid;
 import com.metamatrix.common.xa.XATransactionException;
@@ -83,7 +81,6 @@
 import com.metamatrix.platform.security.api.service.SessionService;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.tempdata.TempTableStoreImpl;
 
 /**
@@ -147,7 +144,7 @@
     private ProcessorDataManager dataTierMgr;
     private PreparedPlanCache prepPlanCache;
     private TransactionService transactionService;
-    private ResultSetCache rsCache;
+    //private ResultSetCache rsCache;
     private AuthorizationService authorizationService;
     private BufferService bufferService;
     private SessionService sessionService;
@@ -157,9 +154,8 @@
     private int processorTimeslice = DEFAULT_PROCESSOR_TIMESLICE;
     private boolean processorDebugAllowed;
     
+    private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
     
-    private int chunkSize = 0;
-    
 	private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();			
 	private Map<String, ClientState> clientState = Collections.synchronizedMap(new HashMap<String, ClientState>());
 	private DQPContextCache contextCache;
@@ -265,24 +261,8 @@
 				state.tempTableStoreImpl, workContext,
 				chunkSize, connectorManagerRepository);
 		
-        RequestWorkItem workItem = null;
-        
         ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
-        
-        if (areResultsInCache(requestMsg)) {
-            CacheID cID = ResultSetCacheUtil.createCacheID(requestMsg, this.rsCache);
-            Command command = this.rsCache.getResults(cID, new int[]{1, 1}).getCommand();
-        	workItem = new CachedRequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext, command);
-        }
-        else {            
-//        	if (request.transactionContext != null && request.transactionContext.isInTransaction()) {
-        		workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
-//        	}
-//        	else {
-//        		workItem = new AsyncRequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
-//        	}
-        }
-        
+        RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
     	logMMCommand(workItem, true, false, 0); 
         addRequest(requestID, workItem, state);
         
@@ -316,17 +296,6 @@
     	contextCache.removeRequestScopedCache(workItem.requestID.toString());
     }
            
-    boolean areResultsInCache(final RequestMessage requestMsg) {
-        if(this.rsCache == null){
-            return false;
-        }
-        if(!requestMsg.useResultSetCache()){
-            return false;
-        }
-        CacheID cID = ResultSetCacheUtil.createCacheID(requestMsg, this.rsCache);
-        return rsCache.hasResults(cID);        
-    }
-           
     void addWork(Work work) {
     	try {
 			this.processWorkerPool.scheduleWork(this.workManager, work);
@@ -433,13 +402,6 @@
 	        }
         }
         
-        // cleanup the buffer manager
-        try {
-            bufferManager.removeTupleSources(sessionId);
-        } catch (Exception e) {
-            LogManager.logWarning(LogConstants.CTX_DQP, e, "Failed to remove buffered tuples for connection " + sessionId); //$NON-NLS-1$
-        }
-        
         if (transactionService != null) {
             try {
                 transactionService.cancelTransactions(sessionId, false);
@@ -478,7 +440,7 @@
         return markCancelled;
     }
     
-	public ResultsFuture<?> closeRequest(long requestId) throws MetaMatrixProcessingException {
+	public ResultsFuture<?> closeRequest(long requestId) throws MetaMatrixProcessingException, MetaMatrixComponentException {
         DQPWorkContext workContext = DQPWorkContext.getWorkContext();
         closeRequest(workContext.getRequestID(requestId));
         return null;
@@ -487,8 +449,9 @@
     /**
      * Close the request with given ID 
      * @param requestID
+     * @throws MetaMatrixComponentException 
      */
-    void closeRequest(RequestID requestID) {
+    void closeRequest(RequestID requestID) throws MetaMatrixComponentException {
         if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
             LogManager.logDetail(LogConstants.CTX_DQP, "closeQuery for requestID=" + requestID); //$NON-NLS-1$
         }
@@ -513,9 +476,9 @@
     
 	private void clearResultSetCache() {
 		//clear cache in server
-		if(rsCache != null){
+		/*if(rsCache != null){
 			rsCache.clear();
-		}
+		}*/
 	}
 	
 	
@@ -637,9 +600,9 @@
 		return transactionService;
 	}
 
-	ResultSetCache getRsCache() {
+	/*ResultSetCache getRsCache() {
 		return rsCache;
-	}
+	}*/
 	
 	int getProcessorTimeSlice() {
 		return this.processorTimeslice;
@@ -660,16 +623,14 @@
         this.maxCodeTables = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.MAX_CODE_TABLES, DEFAULT_MAX_CODE_TABLES);
         this.maxCodeRecords = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.MAX_CODE_TABLE_RECORDS, DEFAULT_MAX_CODE_RECORDS);
         
-        this.chunkSize = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.STREAMING_BATCH_SIZE, 10) * 1024;
+        this.chunkSize = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.STREAMING_BATCH_SIZE, 100) * 1024;
         
         //result set cache
-        if(PropertiesUtils.getBooleanProperty(props, DQPEmbeddedProperties.USE_RESULTSET_CACHE, false)){ 
-        	Properties rsCacheProps = new Properties();
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, props.getProperty(DQPEmbeddedProperties.MAX_RESULTSET_CACHE_SIZE, DEFAULT_MAX_RESULTSET_CACHE_SIZE));
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, props.getProperty(DQPEmbeddedProperties.MAX_RESULTSET_CACHE_AGE, DEFAULT_MAX_RESULTSET_CACHE_AGE));
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, props.getProperty(DQPEmbeddedProperties.RESULTSET_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB)); 
-			this.rsCache = new ResultSetCache(rsCacheProps, cacheFactory);
-        }
+        /*if(PropertiesUtils.getBooleanProperty(props, DQPEmbeddedProperties.USE_RESULTSET_CACHE, false)){ 
+			this.rsCache = new ResultSetCache();
+			PropertiesUtils.setBeanProperties(this.rsCache, props, "ResultSetCache"); //$NON-NLS-1$
+			this.rsCache.start(cacheFactory);
+        }*/
 
         //prepared plan cache
         int maxSizeTotal = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.MAX_PLAN_CACHE_SIZE, PreparedPlanCache.DEFAULT_MAX_SIZE_TOTAL);
@@ -783,7 +744,7 @@
 	public MetadataResult getMetadata(long requestID)
 			throws MetaMatrixComponentException, MetaMatrixProcessingException {
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache);
+		MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache,  workContext.getVdbName(), workContext.getVdbVersion());
 		return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
 	}
 
@@ -791,7 +752,7 @@
 			boolean allowDoubleQuotedVariable)
 			throws MetaMatrixComponentException, MetaMatrixProcessingException {
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache);
+		MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
 		return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
 	}
 	

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -61,7 +61,6 @@
 import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.buffer.TupleSource;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.log.LogManager;
 import com.metamatrix.core.CoreConstants;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.DQPPlugin;
@@ -72,7 +71,7 @@
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.service.BufferService;
-import com.metamatrix.dqp.util.LogConstants;
+import com.metamatrix.query.processor.CollectionTupleSource;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.QueryProcessor;
 import com.metamatrix.query.sql.ReservedWords;
@@ -81,7 +80,6 @@
 import com.metamatrix.query.sql.lang.StoredProcedure;
 import com.metamatrix.query.sql.lang.UnaryFromClause;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 import com.metamatrix.query.util.CommandContext;
 
 public class DataTierManagerImpl implements ProcessorDataManager {
@@ -106,37 +104,6 @@
 		GETVDBRESOURCEPATHS
 	}
 	
-	private class CollectionTupleSource implements TupleSource {
-		
-		private Iterator<List<Object>> tuples;
-		private List<SingleElementSymbol> schema;
-		
-		public CollectionTupleSource(Iterator<List<Object>> tuples,
-				List<SingleElementSymbol> schema) {
-			this.tuples = tuples;
-			this.schema = schema;
-		}
-
-		@Override
-		public List<?> nextTuple() throws MetaMatrixComponentException,
-				MetaMatrixProcessingException {
-			if (tuples.hasNext()) {
-				return tuples.next();
-			}
-			return null;
-		}
-		
-		@Override
-		public List<SingleElementSymbol> getSchema() {
-			return schema;
-		}
-		
-		@Override
-		public void closeSource() throws MetaMatrixComponentException {
-			
-		}
-	}
-
 	// Resources
 	private DQPCore requestMgr;
     private BufferService bufferService;
@@ -295,11 +262,11 @@
 							break;
 						case REFERENCEKEYCOLUMNS:
 							for (ForeignKey key : table.getForeignKeys()) {
-								int postition = 0;
+								short postition = 0;
 								for (Column column : key.getColumns()) {
 									Table pkTable = key.getPrimaryKey().getTable();
 									rows.add(Arrays.asList(vdbName, pkTable.getSchema().getName(), pkTable.getName(), key.getPrimaryKey().getColumns().get(postition).getName(), vdbName, schema.getName(), table.getName(), column.getName(),
-											++postition, (short)DatabaseMetaData.importedKeyNoAction, (short)DatabaseMetaData.importedKeyNoAction, key.getName(), key.getPrimaryKey().getName(), (short)DatabaseMetaData.importedKeyInitiallyDeferred));
+											++postition, DatabaseMetaData.importedKeyNoAction, DatabaseMetaData.importedKeyNoAction, key.getName(), key.getPrimaryKey().getName(), DatabaseMetaData.importedKeyInitiallyDeferred));
 								}
 							}
 							break;
@@ -461,19 +428,16 @@
         final CacheKey codeRequestId = this.codeTableCache.createCacheRequest(codeTableName, returnElementName, keyElementName, context);
 
         boolean success = false;
-        QueryProcessor processor = null;
         try {
-            processor = context.getQueryProcessorFactory().createQueryProcessor(query, codeTableName.toUpperCase(), context);
-
-            processor.setBatchHandler(new QueryProcessor.BatchHandler() {
-            	@Override
-            	public void batchProduced(TupleBatch batch) throws MetaMatrixProcessingException {
-               		codeTableCache.loadTable(codeRequestId, batch.getAllTuples());
+        	QueryProcessor processor = context.getQueryProcessorFactory().createQueryProcessor(query, codeTableName.toUpperCase(), context);
+        	processor.setNonBlocking(true); //process lookup as fully blocking
+            while (true) {
+            	TupleBatch batch = processor.nextBatch();
+            	codeTableCache.loadTable(codeRequestId, batch.getAllTuples());	
+            	if (batch.getTerminationFlag()) {
+            		break;
             	}
-            });
-
-        	//process lookup as fully blocking
-        	processor.process();
+            }
         	success = true;
         } finally {
         	Collection requests = null;
@@ -483,13 +447,6 @@
         		requests = codeTableCache.errorLoadingCache(codeRequestId);        		
         	}
         	notifyWaitingCodeTableRequests(requests);
-        	if (processor != null) {
-	            try {
-	            	this.bufferService.getBufferManager().removeTupleSource(processor.getResultsID());
-	    		} catch (MetaMatrixComponentException e1) {
-	    			LogManager.logDetail(LogConstants.CTX_DQP, "Exception closing code table request"); //$NON-NLS-1$
-	    		}
-        	}
         }
     }
 

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobChunkStream.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobChunkStream.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobChunkStream.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,83 +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.IOException;
-import java.nio.charset.Charset;
-import java.sql.SQLException;
-
-import com.metamatrix.common.lob.ByteLobChunkStream;
-import com.metamatrix.common.lob.LobChunk;
-import com.metamatrix.common.lob.LobChunkProducer;
-import com.metamatrix.common.lob.ReaderInputStream;
-import com.metamatrix.common.types.BlobType;
-import com.metamatrix.common.types.ClobType;
-import com.metamatrix.common.types.Streamable;
-import com.metamatrix.common.types.XMLType;
-
-/** 
- * A Lob Stream builder class. Given the Lob object this object can build 
- * an object which can produce a stream lob chunks, which can be sent to the
- * client one by one.  
- */
-class LobChunkStream implements LobChunkProducer {
-
-    LobChunkProducer internalStream = null;
-    
-    public LobChunkStream(Streamable<?> streamable, int chunkSize) 
-        throws IOException {
-        
-        try {
-            if (streamable instanceof XMLType) {
-                XMLType xml = (XMLType)streamable;
-                this.internalStream = new ByteLobChunkStream(new ReaderInputStream(xml.getCharacterStream(), Charset.forName("UTF-16")), chunkSize); //$NON-NLS-1$
-            }
-            else if (streamable instanceof ClobType) {
-                ClobType clob = (ClobType)streamable;
-                this.internalStream = new ByteLobChunkStream(new ReaderInputStream(clob.getCharacterStream(), Charset.forName("UTF-16")), chunkSize); //$NON-NLS-1$            
-            } 
-            else if (streamable instanceof BlobType) {
-                BlobType blob = (BlobType)streamable;
-                this.internalStream = new ByteLobChunkStream(blob.getBinaryStream(), chunkSize);                        
-            }
-        } catch(SQLException e) {
-            IOException ex = new IOException();
-            ex.initCause(e);
-            throw ex;
-        }
-    }
-    
-    /** 
-     * @see com.metamatrix.common.lob.LobChunkProducer#getNextChunk(int)
-     */
-    public LobChunk getNextChunk() throws IOException {
-        return internalStream.getNextChunk();
-    }
-
-    /** 
-     * @see com.metamatrix.common.lob.LobChunkProducer#close()
-     */
-    public void close() throws IOException {
-        internalStream.close();
-    }    
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,39 +23,38 @@
 package org.teiid.dqp.internal.process;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
+import java.sql.SQLException;
 
 import javax.resource.spi.work.Work;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
+import com.metamatrix.common.lob.ByteLobChunkStream;
 import com.metamatrix.common.lob.LobChunk;
+import com.metamatrix.common.lob.ReaderInputStream;
 import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.types.BlobType;
+import com.metamatrix.common.types.ClobType;
 import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLType;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.util.LogConstants;
 
 public class LobWorkItem implements Work {
 	
 	private RequestWorkItem parent;
-    private RequestID requestID; 
-    
-	private DQPCore dqpCore;
 	private int chunkSize; 
     
 	/* private work item state */
 	private String streamId; 
-    private LobChunkStream stream;
+    private ByteLobChunkStream stream;
     private int streamRequestId;
     private ResultsReceiver<LobChunk> resultsReceiver;
 	
 	public LobWorkItem(RequestWorkItem parent, DQPCore dqpCore, String streamId, int streamRequestId) {
 		this.chunkSize = dqpCore.getChunkSize();
-		this.dqpCore = dqpCore;
-		this.requestID = parent.requestID;
 		this.streamId = streamId;
 		this.parent = parent;
 		this.streamRequestId = streamRequestId;
@@ -76,13 +75,6 @@
             // now get the chunk from stream
             chunk = stream.getNextChunk();
             shouldClose = chunk.isLast();
-    	} catch (BlockedOnMemoryException e) {
-			LogManager.logDetail(LogConstants.CTX_DQP, new Object[] {"Reenqueueing LOB chunk request due to lack of available memory ###########", requestID}); //$NON-NLS-1$ //$NON-NLS-2$
-			this.dqpCore.addWork(this);
-			return;
-    	} catch (TupleSourceNotFoundException e) {
-            LogManager.logWarning(LogConstants.CTX_DQP, e, DQPPlugin.Util.getString("BufferManagerLobChunkStream.no_tuple_source", streamId)); //$NON-NLS-1$
-            ex = e;
         } catch (MetaMatrixComponentException e) {            
             LogManager.logWarning(LogConstants.CTX_DQP, e, DQPPlugin.Util.getString("ProcessWorker.LobError")); //$NON-NLS-1$
             ex = e;
@@ -116,13 +108,27 @@
      * Create a object which can create a sequence of LobChunk objects on a given
      * LOB object 
      */
-    private LobChunkStream createLobStream(String referenceStreamId) 
-        throws BlockedOnMemoryException, MetaMatrixComponentException, IOException, TupleSourceNotFoundException {
+    private ByteLobChunkStream createLobStream(String referenceStreamId) 
+        throws MetaMatrixComponentException, IOException {
         
         // get the reference object in the buffer manager, and try to stream off
         // the original sources.
-        Streamable<?> streamable = dqpCore.getBufferManager().getStreamable(parent.resultsID, referenceStreamId);
-        return new LobChunkStream(streamable, chunkSize);                        
+        Streamable<?> streamable = parent.resultsBuffer.getLobReference(referenceStreamId);
+        
+        try {
+            if (streamable instanceof XMLType) {
+                XMLType xml = (XMLType)streamable;
+                return new ByteLobChunkStream(new ReaderInputStream(xml.getCharacterStream(), Charset.forName(Streamable.ENCODING)), chunkSize);
+            }
+            else if (streamable instanceof ClobType) {
+                ClobType clob = (ClobType)streamable;
+                return new ByteLobChunkStream(new ReaderInputStream(clob.getCharacterStream(), Charset.forName(Streamable.ENCODING)), chunkSize);            
+            } 
+            BlobType blob = (BlobType)streamable;
+            return new ByteLobChunkStream(blob.getBinaryStream(), chunkSize);                        
+        } catch(SQLException e) {
+            throw new IOException(e);
+        }
     }
     
     synchronized void setResultsReceiver(ResultsReceiver<LobChunk> resultsReceiver) {

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -79,9 +79,11 @@
     private int vdbVersion;
     private RequestID requestID;
     
-    public MetaDataProcessor(DQPCore requestManager, PreparedPlanCache planCache) {
+    public MetaDataProcessor(DQPCore requestManager, PreparedPlanCache planCache, String vdbName, int vdbVersion) {
         this.requestManager = requestManager;
         this.planCache = planCache;
+        this.vdbName = vdbName;
+        this.vdbVersion = vdbVersion;
     }
         
     /**
@@ -95,8 +97,6 @@
      */
     MetadataResult processMessage(RequestID requestId, DQPWorkContext workContext, String preparedSql, boolean allowDoubleQuotedVariable) throws MetaMatrixComponentException, MetaMatrixProcessingException {
         this.requestID = requestId;
-        this.vdbName = workContext.getVdbName();
-        this.vdbVersion = workContext.getVdbVersion();
         
         this.metadata = workContext.getVDB().getAttachment(QueryMetadataInterface.class);
         
@@ -211,14 +211,14 @@
             command = plan.getCommand();
         } else {
         	command = QueryParser.getQueryParser().parseCommand(sql, info);
-            QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, false, this.metadata, AnalysisRecord.createNonRecordingRecord());                        
+            QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, this.metadata, AnalysisRecord.createNonRecordingRecord());                        
         }
         return getMetadataForCommand(command);            
     }
 
     private Map createXMLColumnMetadata(Query xmlCommand) {
         GroupSymbol doc = (GroupSymbol) xmlCommand.getFrom().getGroups().get(0);
-        Map xmlMetadata = getDefaultColumn(vdbName, vdbVersion, doc.getName(), ResultsMetadataDefaults.XML_COLUMN_NAME, XMLType.class);
+        Map xmlMetadata = getDefaultColumn(doc.getName(), ResultsMetadataDefaults.XML_COLUMN_NAME, XMLType.class);
 
         // Override size as XML may be big        
         xmlMetadata.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.XML_COLUMN_LENGTH);
@@ -227,7 +227,7 @@
     }
 
     private Map createXQueryColumnMetadata(XQuery xqueryCommand) {
-        Map xqueryMetadata = getDefaultColumn(vdbName, vdbVersion, null, ResultsMetadataDefaults.XML_COLUMN_NAME, XMLType.class);
+        Map xqueryMetadata = getDefaultColumn(null, ResultsMetadataDefaults.XML_COLUMN_NAME, XMLType.class);
 
         // Override size as XML may be big        
         xqueryMetadata.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.XML_COLUMN_LENGTH);
@@ -324,7 +324,7 @@
     }
 
     private Map createTypedMetadata(String shortColumnName, SingleElementSymbol symbol) {
-        return getDefaultColumn(vdbName, vdbVersion, null, shortColumnName, symbol.getType());
+        return getDefaultColumn(null, shortColumnName, symbol.getType());
     }
     
     private int getColumnPrecision(Class dataType, Object elementID) throws QueryMetadataException, MetaMatrixComponentException {
@@ -394,10 +394,10 @@
        return ResultsMetadataDefaults.getMaxDisplaySize(dataType);
     }
 
-    public Map getDefaultColumn(String vdbName, int vdbVersion, 
-        String tableName, String columnName, Class javaType) {
+    public Map<Integer, Object> getDefaultColumn(String tableName, String columnName, 
+        Class javaType) {
             
-        Map column = new HashMap();
+        Map<Integer, Object> column = new HashMap<Integer, Object>();
         
         // set defaults
         column.put(ResultsMetadataConstants.VIRTUAL_DATABASE_NAME, vdbName);

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlanCache.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlanCache.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlanCache.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -131,7 +131,6 @@
 	static class PreparedPlan{
 		private ProcessorPlan plan;
 		private Command command;
-		private Command rewritenCommand;
 		private List<Reference> refs;
 		private AnalysisRecord analysisRecord;
 		
@@ -191,14 +190,6 @@
 			refs = refsValue;
 		}
 		
-		public void setRewritenCommand(Command rewritenCommand) {
-			this.rewritenCommand = rewritenCommand;
-		}
-		
-		public Command getRewritenCommand() {
-			return rewritenCommand;
-		}
-					
 	}
 
 	//for testing purpose 

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import org.teiid.dqp.internal.process.PreparedPlanCache.CacheID;
+import org.teiid.dqp.internal.process.PreparedPlanCache.PreparedPlan;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.ExpressionEvaluationException;
@@ -41,10 +42,8 @@
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.query.QueryPlugin;
 import com.metamatrix.query.eval.Evaluator;
-import com.metamatrix.query.optimizer.CommandTreeNode;
 import com.metamatrix.query.optimizer.batch.BatchedUpdatePlanner;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
-import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.relational.AccessNode;
 import com.metamatrix.query.processor.relational.RelationalPlan;
@@ -64,7 +63,7 @@
  */
 public class PreparedStatementRequest extends Request {
     private PreparedPlanCache prepPlanCache;
-    private PreparedPlanCache.PreparedPlan prepPlan;
+    private PreparedPlan prepPlan;
     
     public PreparedStatementRequest(PreparedPlanCache prepPlanCache) {
     	this.prepPlanCache = prepPlanCache;
@@ -131,20 +130,20 @@
      * @throws QueryPlannerException 
      * @see org.teiid.dqp.internal.process.Request#generatePlan()
      */
-    protected Command generatePlan() throws QueryPlannerException, QueryParserException, QueryResolverException, QueryValidatorException, MetaMatrixComponentException {
+    protected void generatePlan() throws QueryPlannerException, QueryParserException, QueryResolverException, QueryValidatorException, MetaMatrixComponentException {
     	String sqlQuery = requestMsg.getCommands()[0];
     	CacheID id = new PreparedPlanCache.CacheID(this.workContext, Request.createParseInfo(this.requestMsg), sqlQuery);
         prepPlan = prepPlanCache.getPreparedPlan(id);
         if (prepPlan == null) {
             //if prepared plan does not exist, create one
-            prepPlan = new PreparedPlanCache.PreparedPlan();
+            prepPlan = new PreparedPlan();
             LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Query does not exist in cache: ", sqlQuery}); //$NON-NLS-1$
         }
 
         ProcessorPlan cachedPlan = prepPlan.getPlan();
         
         if (cachedPlan == null) {
-        	prepPlan.setRewritenCommand(super.generatePlan());
+	        super.generatePlan();
         	if (!this.addedLimit) { //TODO: this is a little problematic
             	prepPlan.setCommand(this.userCommand);
 		        // Defect 13751: Clone the plan in its current state (i.e. before processing) so that it can be used for later queries
@@ -170,7 +169,6 @@
 	
 	    	PreparedStatementRequest.resolveParameterValues(params, values, this.context);
         }
-        return prepPlan.getRewritenCommand();
     }
 
     /**
@@ -193,16 +191,17 @@
 			throw new QueryValidatorException("No batch values sent for prepared batch update"); //$NON-NLS-1$
 		}
 		boolean supportPreparedBatchUpdate = false;
-		if (this.processPlan instanceof RelationalPlan && this.prepPlan.getRewritenCommand().getSubCommands().isEmpty()) {
+		Command command = null;
+		if (this.processPlan instanceof RelationalPlan) {
 			RelationalPlan rPlan = (RelationalPlan)this.processPlan;
 			if (rPlan.getRootNode() instanceof AccessNode) {
 				AccessNode aNode = (AccessNode)rPlan.getRootNode();
 				String modelName = aNode.getModelName();
+				command = aNode.getCommand();
 		        SourceCapabilities caps = capabilitiesFinder.findCapabilities(modelName);
 		        supportPreparedBatchUpdate = caps.supportsCapability(SourceCapabilities.Capability.BULK_UPDATE);
 			}
 		}
-		CommandTreeNode ctn = new CommandTreeNode();
 		List<Command> commands = new LinkedList<Command>();
 		List<VariableContext> contexts = new LinkedList<VariableContext>();
 		List<List<Object>> multiValues = new ArrayList<List<Object>>(this.prepPlan.getReferences().size());
@@ -219,14 +218,13 @@
 					List<Object> multiValue = multiValues.get(i);
 					multiValue.add(values.get(i));
 				}
-				continue; 
+			} else { //just accumulate copies of the command/plan - clones are not necessary
+				if (command == null) {
+					command = this.prepPlan.getCommand();
+					command.setProcessorPlan(this.processPlan);
+				}
+				commands.add(command);
 			}
-			Command c = (Command)this.prepPlan.getRewritenCommand().clone();
-			commands.add(c);
-			CommandTreeNode child = new CommandTreeNode();
-			child.setCommand(c);
-			child.setProcessorPlan((ProcessorPlan)this.processPlan.clone());
-			ctn.addLastChild(child);
 		}
 		
 		if (paramValues.size() > 1) {
@@ -247,10 +245,9 @@
 		}
 		
 		BatchedUpdateCommand buc = new BatchedUpdateCommand(commands);
-		ctn.setCommand(buc);
-		ctn.setProperty(RelationalPlanner.VARIABLE_CONTEXTS, contexts);
+		buc.setVariableContexts(contexts);
 		BatchedUpdatePlanner planner = new BatchedUpdatePlanner();
-		this.processPlan = planner.optimize(ctn, idGenerator, metadata, capabilitiesFinder, analysisRecord, context);
+		this.processPlan = planner.optimize(buc, idGenerator, metadata, capabilitiesFinder, analysisRecord, context);
 	}
 
 	/** 

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -281,7 +281,7 @@
                 
         // Create generic sql validation visitor
         AbstractValidationVisitor visitor = new ValidationVisitor();
-        validateWithVisitor(visitor, metadata, command, false);
+        validateWithVisitor(visitor, metadata, command);
     }
     
     private Command parseCommand() throws QueryParserException {
@@ -308,12 +308,11 @@
     public static void validateWithVisitor(
         AbstractValidationVisitor visitor,
         QueryMetadataInterface metadata,
-        Command command,
-        boolean validateOnlyEmbedded)
+        Command command)
         throws QueryValidatorException, MetaMatrixComponentException {
 
         // Validate with visitor
-        ValidatorReport report = Validator.validate(command, metadata, visitor, validateOnlyEmbedded);
+        ValidatorReport report = Validator.validate(command, metadata, visitor);
         if (report.hasItems()) {
             ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
             throw new QueryValidatorException(firstFailure.getMessage());
@@ -337,21 +336,15 @@
             
             boolean startAutoWrapTxn = false;
             
-            if(ExecutionProperties.AUTO_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){ 
+            if(ExecutionProperties.TXN_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){ 
                 startAutoWrapTxn = true;
             } else if ( processingCommand.updatingModelCount(metadata) > 1) { 
-                if (ExecutionProperties.AUTO_WRAP_OPTIMISTIC.equals(requestMsg.getTxnAutoWrapMode())){ 
-                    String msg = DQPPlugin.Util.getString("Request.txn_needed_wrong_mode", requestId); //$NON-NLS-1$
-                    throw new MetaMatrixComponentException(msg);
-                } else if (ExecutionProperties.AUTO_WRAP_PESSIMISTIC.equals(requestMsg.getTxnAutoWrapMode())){
+                if (ExecutionProperties.TXN_WRAP_AUTO.equals(requestMsg.getTxnAutoWrapMode())){
                     startAutoWrapTxn = true;
-                } else if (ExecutionProperties.AUTO_WRAP_OFF.equals(requestMsg.getTxnAutoWrapMode())) {
+                } else if (ExecutionProperties.TXN_WRAP_OFF.equals(requestMsg.getTxnAutoWrapMode())) {
                     LogManager.logDetail(LogConstants.CTX_DQP, DQPPlugin.Util.getString("Request.potentially_unsafe")); //$NON-NLS-1$ 
                 }
             } 
-            if(ExecutionProperties.AUTO_WRAP_OPTIMISTIC.equals(requestMsg.getTxnAutoWrapMode())){
-                this.context.setOptimisticTransaction(true);
-            }
             
             if (startAutoWrapTxn) {
                 if (transactionService == null) {
@@ -404,7 +397,7 @@
      * @throws QueryResolverException
      * @throws QueryValidatorException
      */
-    protected Command generatePlan() throws MetaMatrixComponentException, QueryPlannerException, QueryParserException, QueryResolverException, QueryValidatorException {
+    protected void generatePlan() throws MetaMatrixComponentException, QueryPlannerException, QueryParserException, QueryResolverException, QueryValidatorException {
         Command command = parseCommand();
 
         List<Reference> references = ReferenceCollectorVisitor.getReferences(command);
@@ -420,7 +413,7 @@
         
         validateQuery(command);
         
-        command = QueryRewriter.rewrite(command, null, metadata, context);
+        command = QueryRewriter.rewrite(command, metadata, context);
         
         /*
          * Adds a row limit to a query if Statement.setMaxRows has been called and the command
@@ -443,6 +436,11 @@
                 finder = new MultiSourceCapabilitiesFinder(finder, this.multiSourceModels);
             }
             
+            boolean debug = analysisRecord.recordDebug();
+    		if(debug) {
+    			analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
+                analysisRecord.println("USER COMMAND:\n" + command);		 //$NON-NLS-1$
+            }
             // Run the optimizer
             try {
                 processPlan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, finder, analysisRecord, context);
@@ -463,7 +461,6 @@
             String msg = DQPPlugin.Util.getString("DQPCore.Unknown_query_metadata_exception_while_registering_query__{0}.", params); //$NON-NLS-1$
             throw new QueryPlannerException(e, msg);
         }
-        return command;
     }
 
     private void setSchemasForXMLPlan(Command command, QueryMetadataInterface metadata)
@@ -513,7 +510,7 @@
         }
     }
 
-    private void createAnalysisRecord(Command command) throws QueryValidatorException{
+    private void createAnalysisRecord(Command command) {
         Option option = command.getOption();
         boolean getPlan = requestMsg.getShowPlan();
         boolean debug = false;
@@ -522,11 +519,6 @@
             debug = option.getDebug();
         }
         
-        if (getPlan && !requestMsg.isQueryPlanAllowed()){
-          	final String message = DQPPlugin.Util.getString("Request.query_plan_not_allowed"); //$NON-NLS-1$
-            throw new QueryValidatorException(message);
-        }       
-        
         this.analysisRecord = new AnalysisRecord(getPlan, getPlan, debug);
     }
 
@@ -537,13 +529,13 @@
     	
         initMetadata();
         
-        Command processingCommand = generatePlan();
+        generatePlan();
         
         validateAccess(userCommand);
         
         setSchemasForXMLPlan(userCommand, metadata);
         
-        createProcessor(processingCommand);
+        createProcessor(userCommand);
     }
     
 	public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext) throws MetaMatrixProcessingException, MetaMatrixComponentException {
@@ -571,7 +563,7 @@
         	copy.pushCall(recursionGroup);
         }
         
-        newCommand = QueryRewriter.rewrite(newCommand, null, metadata, copy);
+        newCommand = QueryRewriter.rewrite(newCommand, metadata, copy);
         ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, capabilitiesFinder, analysisRecord, copy);
         return new QueryProcessor(plan, copy, bufferManager, processorDataManager);
 	}
@@ -579,6 +571,6 @@
 	protected void validateAccess(Command command) throws QueryValidatorException, MetaMatrixComponentException {
 		// See if entitlement checking is turned on
 		AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.authService);
-		validateWithVisitor(visitor, this.metadata, command, true);
+		validateWithVisitor(visitor, this.metadata, command);
 	}
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -34,22 +34,13 @@
 
 import org.teiid.ContainerHelper;
 import org.teiid.ContainerUtil;
-import org.teiid.dqp.internal.cache.CacheID;
-import org.teiid.dqp.internal.cache.CacheResults;
-import org.teiid.dqp.internal.cache.ResultSetCache;
-import org.teiid.dqp.internal.cache.ResultSetCacheUtil;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.lob.LobChunk;
 import com.metamatrix.common.log.LogManager;
@@ -71,8 +62,9 @@
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.analysis.QueryAnnotation;
 import com.metamatrix.query.execution.QueryExecPlugin;
+import com.metamatrix.query.processor.BatchCollector;
 import com.metamatrix.query.processor.QueryProcessor;
-import com.metamatrix.query.processor.QueryProcessor.BatchHandler;
+import com.metamatrix.query.processor.BatchCollector.BatchHandler;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Option;
 import com.metamatrix.query.sql.lang.SPParameter;
@@ -81,35 +73,6 @@
 
 public class RequestWorkItem extends AbstractWorkItem {
 	
-	protected static class ResultsCursor {
-		int begin;
-		int end;
-		boolean resultsRequested;
-		
-		/**
-		 * Ask for results.
-		 * @param beginRow
-		 * @param endRow
-		 * @param isPoll
-		 */
-		synchronized void requestResults(int beginRow, int endRow, boolean isPoll) {
-			if (this.resultsRequested) {
-				if (!isPoll) {
-					throw new IllegalStateException("Results already requested"); //$NON-NLS-1$\
-				} else if (begin != beginRow || end != endRow) {
-					throw new IllegalStateException("Polling for different results than previously requested"); //$NON-NLS-1$
-				}
-			}
-			this.begin = beginRow;
-			this.end = endRow;
-			this.resultsRequested = true;
-		}
-		
-		synchronized void resultsSent() {
-			this.resultsRequested = false;
-		}
-	}
-	
 	private enum ProcessingState {NEW, PROCESSING, CLOSE}
 	private ProcessingState state = ProcessingState.NEW;
     
@@ -123,22 +86,26 @@
     final RequestMessage requestMsg;    
     final RequestID requestID;
     protected Request request; //provides the processing plan, held on a temporary basis
-    final private BufferManager bufferMgr;
     final private int processorTimeslice;
-    protected ResultSetCache rsCache;
-	protected CacheID cid;
+    //protected ResultSetCache rsCache;
+	//protected CacheID cid;
 	final private TransactionService transactionService;
 	final DQPWorkContext dqpWorkContext;
-	ResultsReceiver<ResultsMessage> resultsReceiver;
+	
+	//results request
+	private ResultsReceiver<ResultsMessage> resultsReceiver;
+	private int begin;
+	private int end;
         
     /*
      * obtained during new
      */
     private volatile QueryProcessor processor;
+    private BatchCollector collector;
     protected Command originalCommand;
     private AnalysisRecord analysisRecord;
     private TransactionContext transactionContext;
-    protected TupleSourceID resultsID;
+    protected TupleBuffer resultsBuffer;
     private Collection schemas;     // These are schemas associated with XML results
     private boolean returnsUpdateCount;
     
@@ -155,28 +122,37 @@
     private volatile boolean isCanceled;
     private volatile boolean closeRequested;
     
-    /** Range of rows requested by the client */
-    protected ResultsCursor resultsCursor = new ResultsCursor();
-    
     private Map<Integer, LobWorkItem> lobStreams = Collections.synchronizedMap(new HashMap<Integer, LobWorkItem>(4));
     
     public RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext) {
         this.requestMsg = requestMsg;
         this.requestID = requestID;
-        this.resultsCursor.requestResults(1, requestMsg.getFetchSize(), false);
-        this.bufferMgr = dqpCore.getBufferManager();
         this.processorTimeslice = dqpCore.getProcessorTimeSlice();
-        this.rsCache = dqpCore.getRsCache();
+        /*this.rsCache = dqpCore.getRsCache();
         if (this.rsCache != null) {
-        	this.cid = ResultSetCacheUtil.createCacheID(requestMsg, rsCache);
-        }
+        	this.cid = this.rsCache.createCacheID(workContext, requestMsg.getCommandString(), requestMsg.getParameterValues());
+        }*/
         this.transactionService = dqpCore.getTransactionService();
         this.dqpCore = dqpCore;
         this.request = request;
-        this.resultsReceiver = receiver;
         this.dqpWorkContext = workContext;
+        this.requestResults(1, requestMsg.getFetchSize(), receiver);
     }
         
+	/**
+	 * Ask for results.
+	 * @param beginRow
+	 * @param endRow
+	 */
+    synchronized void requestResults(int beginRow, int endRow, ResultsReceiver<ResultsMessage> receiver) {
+		if (this.resultsReceiver != null) {
+			throw new IllegalStateException("Results already requested"); //$NON-NLS-1$\
+		}
+		this.resultsReceiver = receiver;
+		this.begin = beginRow;
+		this.end = endRow;
+	}
+    
 	@Override
 	protected boolean isDoneProcessing() {
 		return isClosed;
@@ -208,17 +184,10 @@
             		this.state = ProcessingState.CLOSE;
             	}
             }                  	            
-        } catch (BlockedOnMemoryException e) {
-            moreWork(false);
-        	LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on", requestID, "- reenqueueing for more processing due to lack of available memory ###########"); //$NON-NLS-1$ //$NON-NLS-2$
         } catch (BlockedException e) {
             LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on", requestID, "- processor blocked ###########"); //$NON-NLS-1$ //$NON-NLS-2$
         } catch (Throwable e) {
         	LogManager.logDetail(LogConstants.CTX_DQP, e, "############# PW EXITING on", requestID, "- error occurred ###########"); //$NON-NLS-1$ //$NON-NLS-2$
-            //if there is a cache, remove temp results if there is any
-            if(this.rsCache != null){
-            	rsCache.removeTempResults(cid, requestID);
-            }
             
             if (!isCanceled()) {
             	logCommandError();
@@ -256,13 +225,21 @@
     }
 
 	protected void processMore() throws BlockedException, MetaMatrixCoreException {
+		this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() + this.processorTimeslice);
 		if (!doneProducingBatches) {
 			sendResultsIfNeeded(null);
-		    doneProducingBatches = processor.process(this.processorTimeslice);
+			collector.collectTuples();
+		    doneProducingBatches = collector.isDone();
 		}
 		if (doneProducingBatches) {
+            /*if(rsCache != null && requestMsg.useResultSetCache() && originalCommand.areResultsCachable()){
+            	boolean sessionScope = this.processor.getContext().isSessionFunctionEvaluated();
+                CacheResults cr = new CacheResults();
+            	cr.setCommand(originalCommand);
+                cr.setAnalysisRecord(analysisRecord);
+            }*/
 			if (this.transactionState == TransactionState.ACTIVE) {
-				boolean end = true;
+				boolean endState = true;
 				/*
 				 * TEIID-14 if we are done producing batches, then proactively close transactional 
 				 * executions even ones that were intentionally kept alive. this may 
@@ -272,10 +249,10 @@
 	        	for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
 	        		if (connectorRequest.isTransactional()) {
 	        			connectorRequest.fullyCloseSource();
-	        			end = false;
+	        			endState = false;
 	        		}
 	            }
-				if (end) {
+				if (endState) {
 					this.transactionState = TransactionState.END;
 				}
 			}
@@ -297,28 +274,20 @@
 	 * Any errors that occur will not make it to the client, instead we just log them here.
 	 */
 	protected void attemptClose() {
-		if (this.resultsID != null) {
+		if (this.resultsBuffer != null) {
 			try {
-				if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
-			        LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
-			    }
-			    this.dqpCore.getBufferManager().removeTupleSource(resultsID);
-			} catch(TupleSourceNotFoundException e) {
-			    // ignore 
-			} catch (MetaMatrixComponentException e) {
-				LogManager.logDetail(LogConstants.CTX_DQP, e, e.getMessage());
-			}
-			
-			try {
 				this.processor.closeProcessing();
-			} catch (TupleSourceNotFoundException e) {
-				// ignore
 			} catch (MetaMatrixComponentException e) {
 				if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
 					LogManager.logDetail(LogConstants.CTX_DQP, e, e.getMessage());
 				}
 			}
 			
+			if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+		        LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
+		    }
+		    resultsBuffer.remove();
+			
 			for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
 				try {
 					connectorRequest.fullyCloseSource();
@@ -329,7 +298,7 @@
 				}
 		    }
 
-			this.resultsID = null;
+			this.resultsBuffer = null;
 		}
 
 		if (this.transactionState == TransactionState.ACTIVE) {
@@ -363,25 +332,13 @@
 		request.processRequest();
 		originalCommand = request.userCommand;
 		processor = request.processor;
-		processor.setBatchHandler(new BatchHandler() {
-			public void batchProduced(TupleBatch batch) throws BlockedOnMemoryException, TupleSourceNotFoundException, MetaMatrixComponentException {
-	            //if there is a cache, and it is a query, save it
-	            if(rsCache != null && requestMsg.useResultSetCache() && originalCommand.areResultsCachable() && transactionState == TransactionState.NONE && !rsCache.hasResults(cid)){
-            		CacheResults cr = new CacheResults(batch.getAllTuples(), processor.getProcessorPlan().getOutputElements(), batch.getBeginRow(), !doneProducingBatches);
-                    cr.setCommand(originalCommand);
-                    cr.setSize(batch.getSize());
-                    if(batch.getSize() != TupleBatch.UNKNOWN_SIZE){
-                    	cr.setSize(batch.getSize());
-                    }
-                    cr.setAnalysisRecord(analysisRecord);
-            		if (!rsCache.setResults(cid, cr, requestID)) {
-            			rsCache = null; //disable caching if we are over size
-            		}
-	            }
+		collector = processor.createBatchCollector();
+		collector.setBatchHandler(new BatchHandler() {
+			public void batchProduced(TupleBatch batch) throws MetaMatrixComponentException {
 			    sendResultsIfNeeded(batch);
 			}
 		});
-		resultsID = processor.getResultsID();
+		resultsBuffer = collector.getTupleBuffer();
 		analysisRecord = request.analysisRecord;
 		schemas = request.schemas;
 		transactionContext = request.transactionContext;
@@ -391,7 +348,7 @@
 		Option option = originalCommand.getOption();
 		if (option != null && option.getPlanOnly()) {
 		    doneProducingBatches = true;
-            this.bufferMgr.setStatus(resultsID, TupleSourceStatus.FULL);
+            resultsBuffer.close();
 		}
 		
 	    if (analysisRecord.recordQueryPlan()) {
@@ -404,88 +361,77 @@
 	/**
 	 * Send results if they have been requested.  This should only be called from the processing thread.
 	 */
-	protected void sendResultsIfNeeded(TupleBatch batch) throws BlockedOnMemoryException,
-			MetaMatrixComponentException, TupleSourceNotFoundException {
+	protected void sendResultsIfNeeded(TupleBatch batch) throws MetaMatrixComponentException {
+		ResultsMessage response = null;
+		ResultsReceiver<ResultsMessage> receiver = null;
 		
-		synchronized (resultsCursor) {
-			if (!this.resultsCursor.resultsRequested
-					|| (this.resultsCursor.begin > this.processor.getHighestRow() && !doneProducingBatches)
+		synchronized (this) {
+			if (this.resultsReceiver == null
+					|| (this.begin > this.processor.getHighestRow() && !doneProducingBatches)
 					|| (this.transactionState == TransactionState.ACTIVE)) {
 				return;
 			}
 		}
-		
 		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
-			LogManager.logDetail(LogConstants.CTX_DQP, "[RequestWorkItem.sendResultsIfNeeded] requestID: " + requestID + " resultsID: " + this.resultsID + " done: " + doneProducingBatches );   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			LogManager.logDetail(LogConstants.CTX_DQP, "[RequestWorkItem.sendResultsIfNeeded] requestID: " + requestID + " resultsID: " + this.resultsBuffer + " done: " + doneProducingBatches );   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		}
 
-	    boolean pinned = false;
-	    
-        try {
-        	if (batch == null || batch.getBeginRow() > this.resultsCursor.begin) {
-        		batch = this.bufferMgr.pinTupleBatch(resultsID, resultsCursor.begin);
-        		pinned = true;
-        		//TODO: support fetching more than 1 batch
-        		int count = this.resultsCursor.end - this.resultsCursor.begin + 1;
-        		if (batch.getRowCount() > count) {
-        			int beginRow = Math.min(this.resultsCursor.begin, batch.getEndRow() - count + 1);
-        			int endRow = Math.min(beginRow + count - 1, batch.getEndRow());
-            		int firstOffset = beginRow - batch.getBeginRow();
-                    List[] memoryRows = batch.getAllTuples();
-                    List[] rows = new List[count];
-                    System.arraycopy(memoryRows, firstOffset, rows, 0, endRow - beginRow + 1);
-                    batch = new TupleBatch(beginRow, rows);
-        		}
-        	}
-            int finalRowCount = doneProducingBatches?this.processor.getHighestRow():-1;
-            
-            ResultsMessage response = createResultsMessage(requestMsg, batch.getAllTuples(), this.processor.getProcessorPlan().getOutputElements(), analysisRecord);
-            response.setFirstRow(batch.getBeginRow());
-            response.setLastRow(batch.getEndRow());
-            response.setUpdateResult(this.returnsUpdateCount);
-            // set final row
-            response.setFinalRow(finalRowCount);
+    	if (batch == null || batch.getBeginRow() > this.begin) {
+    		batch = resultsBuffer.getBatch(begin);
+    		//TODO: support fetching more than 1 batch
+    		int count = this.end - this.begin + 1;
+    		if (batch.getRowCount() > count) {
+    			int beginRow = Math.min(this.begin, batch.getEndRow() - count + 1);
+    			int endRow = Math.min(beginRow + count - 1, batch.getEndRow());
+        		int firstOffset = beginRow - batch.getBeginRow();
+                List[] memoryRows = batch.getAllTuples();
+                List[] rows = new List[count];
+                System.arraycopy(memoryRows, firstOffset, rows, 0, endRow - beginRow + 1);
+                batch = new TupleBatch(beginRow, rows);
+    		}
+    	}
+        int finalRowCount = doneProducingBatches?this.processor.getHighestRow():-1;
+        
+        response = createResultsMessage(requestMsg, batch.getAllTuples(), this.processor.getProcessorPlan().getOutputElements(), analysisRecord);
+        response.setFirstRow(batch.getBeginRow());
+        response.setLastRow(batch.getEndRow());
+        response.setUpdateResult(this.returnsUpdateCount);
+        // set final row
+        response.setFinalRow(finalRowCount);
 
-            // send any schemas associated with the results
-            response.setSchemas(this.schemas);
-            
-            // send any warnings with the response object
-            List<Throwable> responseWarnings = new ArrayList<Throwable>();
-    		List<Exception> currentWarnings = processor.getAndClearWarnings();
-    	    if (currentWarnings != null) {
-    	    	responseWarnings.addAll(currentWarnings);
-    	    }
-    	    synchronized (warnings) {
-            	responseWarnings.addAll(this.warnings);
-            	this.warnings.clear();
-    	    }
-            response.setWarnings(responseWarnings);
-            
-            // If it is stored procedure, set parameters
-            if (originalCommand instanceof StoredProcedure) {
-            	StoredProcedure proc = (StoredProcedure)originalCommand;
-            	if (proc.returnParameters()) {
-            		response.setParameters(getParameterInfo(proc));
-            	}
-            }
-
-            /*
-             * mark the results sent at this point.
-             * communication exceptions will be treated as non-recoverable 
-             */
-            this.resultsCursor.resultsSent();
-            this.resultsReceiver.receiveResults(response);
-        } catch (MemoryNotAvailableException e) {
-            throw BlockedOnMemoryException.INSTANCE;
-        } finally {
-            try {
-                if (pinned) {
-                    this.bufferMgr.unpinTupleBatch(this.resultsID, batch.getBeginRow());
-                }
-            } catch (Exception e) {
-                // ignore - nothing more we can do
-            }
+        // send any schemas associated with the results
+        response.setSchemas(this.schemas);
+        
+        // send any warnings with the response object
+        List<Throwable> responseWarnings = new ArrayList<Throwable>();
+		List<Exception> currentWarnings = processor.getAndClearWarnings();
+	    if (currentWarnings != null) {
+	    	responseWarnings.addAll(currentWarnings);
+	    }
+	    synchronized (warnings) {
+        	responseWarnings.addAll(this.warnings);
+        	this.warnings.clear();
+	    }
+        response.setWarnings(responseWarnings);
+        
+        // If it is stored procedure, set parameters
+        if (originalCommand instanceof StoredProcedure) {
+        	StoredProcedure proc = (StoredProcedure)originalCommand;
+        	if (proc.returnParameters()) {
+        		response.setParameters(getParameterInfo(proc));
+        	}
         }
+        /*
+         * mark the results sent at this point.
+         * communication exceptions will be treated as non-recoverable 
+         */
+        synchronized (this) {
+            receiver = this.resultsReceiver;
+            this.resultsReceiver = null;    
+		}
+
+        receiver.receiveResults(response);
+        
 	}
     
     public static ResultsMessage createResultsMessage(RequestMessage message, List[] batch, List columnSymbols, AnalysisRecord analysisRecord) {
@@ -529,7 +475,13 @@
 	}
 
     private void sendError() {
-		LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sedning error to client", requestID); //$NON-NLS-1$
+    	synchronized (this) {
+    		if (this.resultsReceiver == null) {
+    			LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Unable to send error to client as results were already sent.", requestID); //$NON-NLS-1$
+    			return;
+    		}
+    	}
+		LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sending error to client", requestID); //$NON-NLS-1$
         ResultsMessage response = new ResultsMessage(requestMsg);
         response.setException(processingException);
         setAnalysisRecords(response, analysisRecord);
@@ -617,23 +569,22 @@
         return false;
     }
     
-    public synchronized void requestClose() {
-    	if (this.state == ProcessingState.CLOSE || this.closeRequested) {
-    		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
-    			LogManager.logDetail(LogConstants.CTX_DQP, "Request already closing" + requestID); //$NON-NLS-1$
-    		}
-    		return;
-    	}
+    public void requestClose() throws MetaMatrixComponentException {
+    	synchronized (this) {
+        	if (this.state == ProcessingState.CLOSE || this.closeRequested) {
+        		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+        			LogManager.logDetail(LogConstants.CTX_DQP, "Request already closing" + requestID); //$NON-NLS-1$
+        		}
+        		return;
+        	}
+		}
     	this.closeRequested = true;
-    	if (this.processor != null) {
-    		this.processor.requestClosed();
-    	}
+    	this.requestCancel(); //pending work should be canceled for fastest clean up
     	this.moreWork();
     }
     
     public void requestMore(int batchFirst, int batchLast, ResultsReceiver<ResultsMessage> receiver) {
-    	this.resultsReceiver = receiver;
-    	this.resultsCursor.requestResults(batchFirst, batchLast, false);
+    	this.requestResults(batchFirst, batchLast, receiver);
     	this.moreWork(); 
     }
     

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -102,7 +102,7 @@
 
             // Rewrite the command now that criteria may have been simplified
             try {
-                command = QueryRewriter.rewrite(command, null, metadata, null);                    
+                command = QueryRewriter.rewrite(command, metadata, null);                    
                 instanceNode.setCommand(command);
             } catch(QueryValidatorException e) {
                 // ignore and use original command

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -53,8 +53,8 @@
 
         // (connection -> transaction for global and local)
         private Map<String, TransactionContext> threadToTransactionContext = new HashMap<String, TransactionContext>();
-        // (MMXid -> global transactions keyed) using the XID as string due to management api where XID could not be passed correctly to client
-        private Map<String, TransactionContext> xidToTransactionContext = new HashMap<String, TransactionContext>();
+        // (MMXid -> global transactions keyed) 
+        private Map<Integer, TransactionContext> xidToTransactionContext = new HashMap<Integer, TransactionContext>();
         
         public synchronized TransactionContext getOrCreateTransactionContext(String threadId) {
             TransactionContext tc = threadToTransactionContext.get(threadId);
@@ -73,20 +73,20 @@
         }
 
         public synchronized TransactionContext getTransactionContext(MMXid xid) {
-            return xidToTransactionContext.get(xid);
+            return xidToTransactionContext.get(xid.hashCode());
         }
         
-        public synchronized TransactionContext getTransactionContextByXid(String xid) {
-            return xidToTransactionContext.get(xid);
-        }        
-
+        public synchronized TransactionContext getTransactionContext(int hash) {
+            return xidToTransactionContext.get(hash);
+        }
+        
         public synchronized TransactionContext removeTransactionContext(String threadId) {
             return threadToTransactionContext.remove(threadId);
         }
 
         public synchronized void removeTransactionContext(TransactionContext tc) {
             if (tc.getXid() != null) {
-                this.xidToTransactionContext.remove(tc.getXid());
+                this.xidToTransactionContext.remove(tc.getXid().hashCode());
             }
             if (tc.getThreadId() != null) {
                 this.threadToTransactionContext.remove(tc.getThreadId());
@@ -95,7 +95,7 @@
         
         public synchronized void addTransactionContext(TransactionContext tc) {
             if (tc.getXid() != null) {
-                this.xidToTransactionContext.put(tc.getXid().toString(), tc);
+                this.xidToTransactionContext.put(tc.getXid().hashCode(), tc);
             }
             if (tc.getThreadId() != null) {
                 this.threadToTransactionContext.put(tc.getThreadId(), tc);
@@ -525,7 +525,7 @@
 		if (xid == null) {
 			return;
 		}
-		TransactionContext context = this.transactions.getTransactionContextByXid(xid);
+		TransactionContext context = this.transactions.getTransactionContext(xid.hashCode());
 		context.setRollbackOnly();
 		
 		try {

Modified: branches/JCA/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -71,6 +71,7 @@
 import com.metamatrix.query.mapping.xml.MappingLoader;
 import com.metamatrix.query.mapping.xml.MappingNode;
 import com.metamatrix.query.metadata.BasicQueryMetadata;
+import com.metamatrix.query.metadata.GroupInfo;
 import com.metamatrix.query.metadata.StoredProcedureInfo;
 import com.metamatrix.query.metadata.SupportConstants;
 import com.metamatrix.query.sql.lang.SPParameter;
@@ -99,7 +100,8 @@
     /*
      * TODO: move caching to jboss cache structure
      */
-    private final Map<String, Object> metadataCache = Collections.synchronizedMap(new LRUCache<String, Object>(500));
+    private final Map<String, Object> metadataCache = Collections.synchronizedMap(new LRUCache<String, Object>(250));
+    private final Map<String, Object> groupInfoCache = Collections.synchronizedMap(new LRUCache<String, Object>(250));
     private final Map<String, Collection<Table>> partialNameToFullNameCache = Collections.synchronizedMap(new LRUCache<String, Collection<Table>>(1000));
     private final Map<String, Collection<StoredProcedureInfo>> procedureCache = Collections.synchronizedMap(new LRUCache<String, Collection<StoredProcedureInfo>>(200));
     /**
@@ -300,7 +302,7 @@
                     String runtimeType = paramRecord.getRuntimeType();
                     int direction = this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType());
                     // create a parameter and add it to the procedure object
-                    SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getName());
+                    SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getFullName());
                     spParam.setMetadataID(paramRecord);
                     spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
                     procInfo.addParameter(spParam);
@@ -311,7 +313,7 @@
                     ColumnSet<ProcedureRecordImpl> resultRecord = procRecord.getResultSet();
                     // resultSet is the last parameter in the procedure
                     int lastParamIndex = procInfo.getParameters().size() + 1;
-                    SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET, resultRecord.getName());
+                    SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET, resultRecord.getFullName());
                     param.setClassType(java.sql.ResultSet.class);           
                     param.setMetadataID(resultRecord);
 
@@ -1058,7 +1060,11 @@
 	public Object addToMetadataCache(Object metadataID, String key, Object value)
 			throws MetaMatrixComponentException, QueryMetadataException {
         ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID);
+        boolean groupInfo = key.startsWith(GroupInfo.CACHE_PREFIX);
         key = getCacheKey(key, (AbstractMetadataRecord)metadataID);
+        if (groupInfo) {
+        	return this.groupInfoCache.put(key, value); 
+        }
     	return this.metadataCache.put(key, value); 
 	}
 
@@ -1066,7 +1072,11 @@
 	public Object getFromMetadataCache(Object metadataID, String key)
 			throws MetaMatrixComponentException, QueryMetadataException {
         ArgCheck.isInstanceOf(AbstractMetadataRecord.class, metadataID);
+        boolean groupInfo = key.startsWith(GroupInfo.CACHE_PREFIX);
         key = getCacheKey(key, (AbstractMetadataRecord)metadataID);
+        if (groupInfo) {
+        	return this.groupInfoCache.get(key); 
+        }
     	return this.metadataCache.get(key);
 	}
 

Modified: branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
===================================================================
--- branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties	2010-01-10 00:19:53 UTC (rev 1727)
@@ -375,9 +375,8 @@
 Request.txn.info.resume=Resumed transaction "{0}".
 Request.txn.info.export=Exported transaction "{0}".
 Request.txn.info.suspend=Suspended transaction "{0}".
-Request.txn_needed_wrong_mode=Detected request "{0}" with multiple updates when using txnAutoWrap=OPTIMISTIC.  If you are using MetaMatrix Enterprise, you can set txnAutoWrap=OFF to avoid using a transaction or txnAutoWrap=PESSIMISTIC to automatically create a transaction when needed. If you are not using MetaMatrix Enterprise, no transaction manager is provided and transactions are not supported.  In that case, you can set txnAutoWrap=OFF to allow transaction methods to be called and ignored without actual transaction support. WARNING: Setting txnAutowrap=OFF and using transaction methods is risky because transactions will not be executed atomically and rollback will not occur!
 Request.transaction_not_supported=Autowrap transaction required, but transaction support is disabled
-Request.potentially_unsafe=The request is modifying more than 1 model without any containing transaction (txnAutoWrap = OFF).  This is potentially unsafe as the updates cannot be rolled back as a single unit.
+Request.potentially_unsafe=The request is modifying more than 1 model without any containing transaction (autoCommitTxn = OFF).  This is potentially unsafe as the updates cannot be rolled back as a single unit.
 Request.no_result_set=Statement does not return a result set.
 Request.result_set=Statement returns a result set, not an update count.
 Request.wsdl_user_not_authorized=The anonymous user is not authorized for this action.
@@ -409,28 +408,9 @@
 ResultBatch.update_count_unavailable=Unable to retrieve an update count from this batch.
 ServerConnectionInfo.invalid_context=Invalid portable context string. Unable to reinstantiate a ServerConnectionInfo from the string :{0}
 ServerConnectionInfo.invalid_url=The url "{0}" is invalid and could not be parsed. The url should be of the form mm[s]://host[,host2,host3...]:port[,port2,port3...]
-ServerFacadeImpl.invalid_txnautowrap=Invalid transaction autowrap mode "{0}"
-ServerFacadeImpl.invalid_beginRow=Invalid beginRow {0}: beginRow must be >= 1
-ServerFacadeImpl.invalid_endRow=Invalid maxEndRow {0}: beginRow must be <= maxEndRow
-ServerFacadeImpl.invalid_waitTime=Invalid waitTime {0}: waitTime must be >= 0
-ServerFacadeImpl.invalid_connInfo=The server facade expects an instance of ServerConnectionInfo.
-ServerFacadeImpl.null_requestInfo=The request info must not be null.
-ServerFacadeImpl.invalid_requestInfo=The server facade expects an instance of ServerRequest.
-ServerFacadeImpl.invalid_cursorType=The cursor type must be one of {ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE}.
-ServerFacadeImpl.invalid_fetchSize=The fetch size must be >= 0
-ServerFacadeImpl.invalid_requestType=The request type must be one of {RequestInfo.REQUEST_TYPE_STATEMENT,RequestInfo.REQUEST_TYPE_PREPARED_STATEMENT,RequestInfo.REQUEST_TYPE_CALLABLE_STATEMENT}.
-ServerFacadeImpl.invalid_sql=The SQL command must not be null.
-ServerFacadeImpl.invalid_txnAutowrap=The transaction autowrap mode must be one of {RequestInfo.AUTOWRAP_OFF,RequestInfo.AUTOWRAP_ON,RequestInfo.AUTOWRAP_OPTIMISTIC,RequestInfo.AUTOWRAP_PESSIMISTIC}.
 ServerSessionContext.invalid_context=Invalid portable context string. Unable to reinstantiate a server session context from the string :{0}
 ServerSessionContext.null_context=The portable session context should not be null.
 ServerConnectionInfo.invalid_encoding=Invalid encoded object within the portable string. Unable to reinstantiate an object from the encoded string :{0}
-ServerFacadeImpl.timeout=Timed out while waiting for a response.
-ServerFacadeImpl.null_connInfo=The connection info must not be null.
-ServerFacadeImpl.null_URL=The server URL must not be null.
-ServerFacadeImpl.null_user=The user name must not be null.
-ServerFacadeImpl.null_pwd=The password must not be null.
-ServerFacadeImpl.null_vdb=The VDB name must not be null.
-ServerFacadeImpl.updates_not_supported=The server facade does not support metadata requests for INSERT, UPDATE, DELETE, or SELECT...INTO statements.
 ResultBatch.not_last_batch=This method can only be called on the last batch of results.
 ResultBatch.not_out_param=The parameter at index {0} must be of type RETURN, OUT, or INOUT
 CacheResults.Trying_to_cache_unexpected_results=Trying to cache unexpected results. Expected request ID "{0}"; Got request ID "{1}"
@@ -499,7 +479,7 @@
 TransformationMetadata.Multiple_transformation_records_found_for_the_group___1=Multiple transformation records found for the group: 
 TransformationMetadata.Multiple_annotation_records_found_for_the_entity_{0}_1=Multiple annotation records found for the entity {0}
 TransformationMetadata.No_metadata_info_available_for_the_index_with_UUID_{0}._1=No metadata info available for the index with UUID {0}.
-TransformationMetadata.Ambigous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambigous index with UUID {0}, found multiple indexes with the given UUID.
+TransformationMetadata.Ambiguous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambiguous index with UUID {0}, found multiple indexes with the given UUID.
 TransformationMetadata.Invalid_type=Invalid type: {0}.
 TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine fullname for element
 TransformationMetadata.does_not_exist._1=does not exist.
@@ -530,6 +510,8 @@
 TransformationMetadata.Multiple_transformation_records_found_for_the_group___1=Multiple transformation records found for the group: 
 TransformationMetadata.Multiple_annotation_records_found_for_the_entity_{0}_1=Multiple annotation records found for the entity {0}
 TransformationMetadata.No_metadata_info_available_for_the_index_with_UUID_{0}._1=No metadata info available for the index with UUID {0}.
-TransformationMetadata.Ambigous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambigous index with UUID {0}, found multiple indexes with the given UUID.
+TransformationMetadata.Ambiguous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambiguous index with UUID {0}, found multiple indexes with the given UUID.
 TransformationMetadata.Invalid_type=Invalid type: {0}.
-TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine fullname for element
\ No newline at end of file
+TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine fullname for element
+
+CachedRequestWorkItem.not_available=Cache result is no longer available.
\ No newline at end of file

Modified: branches/JCA/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties
===================================================================
--- branches/JCA/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties	2010-01-10 00:19:53 UTC (rev 1727)
@@ -150,7 +150,7 @@
 XMLPlanner.Criteria_{0}_contains_conflicting_row_limits=The criteria ''{0}'' contains conflicting row limits for an XML mapping class.
 BatchedUpdatePlan.cannot_connect_tuplesource=Unable to deliver results for nodeID {0}
 AccessNode.rewrite_failed=Failed to rewrite the command: {0}
-BatchedUpdateNode.unexpected_end_of_batch=Unexpectedly reached the end of the batched update counts.
+BatchedUpdateNode.unexpected_end_of_batch=Unexpectedly reached the end of the batched update counts at {0}, expected {1}.
 DependentAccessNode.Cannot_apply_required_criteria=Cannot apply required criteria to meet the access pattern because the number of values exceeds the "Set Criteria Max Size" property of model "{0}".
 DuplicateFilter.remoteException=Received RemoteException from BufferManager, but shouldn''t have: {0}
 AbstractProcessorEnvironment.No_ts_found=No tuple source {0} found during processing

Modified: branches/JCA/engine/src/main/resources/com/metamatrix/query/i18n.properties
===================================================================
--- branches/JCA/engine/src/main/resources/com/metamatrix/query/i18n.properties	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/main/resources/com/metamatrix/query/i18n.properties	2010-01-10 00:19:53 UTC (rev 1727)
@@ -845,7 +845,8 @@
 FunctionMethods.cant_execute_relate=The relate function may only be used in XML queries.
 FunctionMethods.cant_execute_relateSource=The relateSource function may only be used in XML relationship models and queries.
 FunctionMethods.cant_execute_relateTarget=The relateTarget function may only be used in XML relationship models and queries.
-ExecResolver.invalid_named_params=Invalid param name(s): {0}
+ExecResolver.invalid_named_params=Invalid param name(s): {0}.  Name(s) of params without explicit values: {1}  
+ExecResolver.duplicate_named_params=Duplicate named param ''{0}''
 ResolverUtil.required_param=Required parameter ''{0}'' has no value was set or is an invalid parameter.
 ResolverUtil.duplicateName=Cannot create group ''{0}'' with multiple columns named ''{1}''
 ResolverUtil.error_converting_value_type=Exception converting value {0} of type {1} to expected type {2}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/BufferManagerFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/BufferManagerFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/BufferManagerFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,14 +22,11 @@
 
 package com.metamatrix.common.buffer;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
-import com.metamatrix.query.execution.QueryExecPlugin;
+import com.metamatrix.common.buffer.impl.MemoryStorageManager;
 
 /**
  * <p>Factory for BufferManager instances.  One method will get
@@ -44,75 +41,6 @@
  */
 public class BufferManagerFactory {
 	
-	public static class MemoryStorageManager implements StorageManager {
-	    
-	    // TupleSourceID -> List<TupleBatch> (ordered by startRow)
-	    private Map<TupleSourceID, Map<Integer, TupleBatch>> storage = Collections.synchronizedMap(new HashMap<TupleSourceID, Map<Integer, TupleBatch>>());
-
-	    /**
-	     * @see StorageManager#initialize(Properties)
-	     */
-	    public void initialize(Properties props) throws MetaMatrixComponentException {
-	    }
-
-	    /**
-	     * @see StorageManager#addBatch(TupleSourceID, TupleBatch)
-	     */
-	    public void addBatch(TupleSourceID storageID, TupleBatch batch, String[] types)
-	        throws MetaMatrixComponentException {
-
-	    	Map<Integer, TupleBatch> batches = null;
-	        synchronized(this.storage) {
-	            batches = storage.get(storageID);
-	            if(batches == null) {
-	                batches = new HashMap<Integer, TupleBatch>();
-	                this.storage.put(storageID, batches);
-	            }
-	        }
-
-	        synchronized(batches) {
-	            batches.put(batch.getBeginRow(), batch);
-	        }
-	    }
-
-	    /**
-	     * @see StorageManager#getBatch(TupleSourceID, int, int)
-	     */
-	    public TupleBatch getBatch(TupleSourceID storageID, int beginRow, String[] types)
-	        throws TupleSourceNotFoundException, MetaMatrixComponentException {
-
-	    	Map<Integer, TupleBatch> batches = storage.get(storageID);
-
-	        if(batches == null) {
-	           	throw new TupleSourceNotFoundException(QueryExecPlugin.Util.getString("BufferManagerImpl.tuple_source_not_found", storageID)); //$NON-NLS-1$
-	        }
-
-	        synchronized(batches) {
-	            TupleBatch batch = batches.get(beginRow);
-	            if(batch == null) {
-	            	throw new MetaMatrixComponentException("unknown batch"); //$NON-NLS-1$
-	            }
-                return batch;
-	        }
-	    }
-
-	    /**
-	     * @see StorageManager#removeStorageArea(TupleSourceID)
-	     */
-	    public void removeBatches(TupleSourceID storageID) throws MetaMatrixComponentException {
-	        storage.remove(storageID);
-	    }
-
-	    /**
-	     * @see StorageManager#shutdown()
-	     */
-	    public void shutdown() {
-	        this.storage.clear();
-	        this.storage = null;
-	    }
-
-	}
-
 	private static BufferManager INSTANCE;
 	
     /**
@@ -122,13 +50,9 @@
      */
     public static BufferManager getStandaloneBufferManager() throws MetaMatrixComponentException {
     	if (INSTANCE == null) {
-	        BufferManager bufferMgr = new BufferManagerImpl();
+	        BufferManagerImpl bufferMgr = new BufferManagerImpl();
 	        Properties props = new Properties();
-	        props.setProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE, String.valueOf(Long.MAX_VALUE));
-	        props.setProperty(BufferManagerPropertyNames.SESSION_USE_PERCENTAGE, "100"); //$NON-NLS-1$
-	        props.setProperty(BufferManagerPropertyNames.LOG_STATS_INTERVAL, "0"); //$NON-NLS-1$
-	        props.setProperty(BufferManagerPropertyNames.MANAGEMENT_INTERVAL, "0"); //$NON-NLS-1$
-	        bufferMgr.initialize("local", props); //$NON-NLS-1$
+	        bufferMgr.initialize(props);
 	
 	        // Add unmanaged memory storage manager
 	        bufferMgr.setStorageManager(new MemoryStorageManager());

Deleted: branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/TestTupleSourceID.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/TestTupleSourceID.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/common/buffer/TestTupleSourceID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,298 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.buffer;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.core.util.UnitTestUtil;
-
-/**
- */
-public class TestTupleSourceID extends TestCase {
-
-    private static final String ID_VALUE = "idValue"; //$NON-NLS-1$
-    private static final String LOCATION_VALUE = "location"; //$NON-NLS-1$
-    private TupleSourceID objWithIdAndLocation;
-    private TupleSourceID objWithId;
-    private TupleSourceID objWithLocation;
-
-    /**
-     * Constructor for TestTupleSourceID.
-     * @param name
-     */
-    public TestTupleSourceID(String name) {
-        super(name);
-    }
-
-    /**
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.objWithId = new TupleSourceID(ID_VALUE,null);
-        this.objWithIdAndLocation = new TupleSourceID(ID_VALUE,LOCATION_VALUE);
-        this.objWithLocation = new TupleSourceID("",LOCATION_VALUE); //$NON-NLS-1$
-    }
-
-    /**
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    // =========================================================================
-    //                      H E L P E R   M E T H O D S
-    // =========================================================================
-
-    public TupleSourceID helpTestConstructor( final String location, final String id,
-                                          final boolean shouldSucceed ) {
-        try {
-            final TupleSourceID channelId = new TupleSourceID(location,id);
-            // Make sure that we were supposed to have succeeded
-            if ( !shouldSucceed ) {
-                fail("Did not expect to construct successfully"); //$NON-NLS-1$
-            }
-            return channelId;
-        } catch ( Throwable t ) {
-            if ( shouldSucceed ) {
-            	throw new RuntimeException(t);
-            }
-        }
-        return null;
-    }
-
-    public TupleSourceID helpTestConstructor( final String idValue,
-                                          final boolean shouldSucceed ) {
-        try {
-            final TupleSourceID channelId = new TupleSourceID(idValue);
-            // Make sure that we were supposed to have succeeded
-            if ( !shouldSucceed ) {
-                fail("Did not expect to construct successfully"); //$NON-NLS-1$
-            }
-            return channelId;
-        } catch ( Throwable t ) {
-            if ( shouldSucceed ) {
-            	throw new RuntimeException(t);
-            }
-        }
-        return null;
-    }
-
-    public void helpCheckStringId( final TupleSourceID id, final String expected ) {
-        final String actual = id.getStringID();
-        assertEquals(expected, actual);
-    }
-
-    public void helpCheckId( final TupleSourceID id, final String expected ) {
-        final String actual = id.getIDValue();
-        assertEquals(expected, actual);
-    }
-
-    public void helpCheckLocation( final TupleSourceID id, final String expected ) {
-        final String actual = id.getLocation();
-        assertEquals(expected, actual);
-    }
-
-    // =========================================================================
-    //                         T E S T     C A S E S
-    // =========================================================================
-
-    /*
-     * Test for void TupleSourceID(String)
-     */
-    public void testTupleSourceIDStringWithIdAndNoLocation() {
-        final String idValue = "SingleIdWithoutDelimiter"; //$NON-NLS-1$
-        final TupleSourceID id = helpTestConstructor(idValue, true);
-        helpCheckId(id,idValue);
-        helpCheckStringId(id, idValue);
-        helpCheckLocation(id, null);
-    }
-
-    /*
-     * Test for void TupleSourceID(String, String)
-     */
-    public void testTupleSourceIDStringWithIdAndLocation() {
-        final String idValue = "SingleId"; //$NON-NLS-1$
-        final String location = "Location"; //$NON-NLS-1$
-        final String stringId = location + ":" + idValue; //$NON-NLS-1$
-        final TupleSourceID id = helpTestConstructor(stringId, true);
-        helpCheckId(id,idValue);
-        helpCheckStringId(id, stringId);
-        helpCheckLocation(id, location);
-    }
-
-    /*
-     * Test for void TupleSourceID(String, String)
-     */
-    public void testTupleSourceIDStringWithNullIdAndLocation() {
-        final String idValue = ""; //$NON-NLS-1$
-        final String location = "Location"; //$NON-NLS-1$
-        final String stringId = location + ":" + idValue; //$NON-NLS-1$
-        final TupleSourceID id = helpTestConstructor(stringId, true);
-        helpCheckId(id,idValue);
-        helpCheckStringId(id, stringId);
-        helpCheckLocation(id, location);
-    }
-
-    /*
-     * Test for void TupleSourceID(String, String)
-     */
-    public void testTupleSourceIDStringWithIdAndNullLocation() {
-        final String idValue = "SingleId"; //$NON-NLS-1$
-        final String location = ""; //$NON-NLS-1$
-        final String stringId = location + ":" + idValue; //$NON-NLS-1$
-        final TupleSourceID id = helpTestConstructor(stringId, true);
-        helpCheckId(id,idValue);
-        helpCheckStringId(id, stringId);
-        helpCheckLocation(id, location);
-    }
-
-    public void testIllegalTupleSourceIDString() {
-        final String stringId = null;
-        helpTestConstructor(stringId, false);
-    }
-
-    public void testHashCode1() {
-        assertEquals(objWithId.hashCode(), ID_VALUE.hashCode());
-    }
-
-    public void testHashCode2() {
-        assertEquals(objWithLocation.hashCode(), "".hashCode()); //$NON-NLS-1$
-    }
-
-    public void testHashCode3() {
-        assertEquals(objWithIdAndLocation.hashCode(), ID_VALUE.hashCode());
-    }
-
-    public void testGetLocation1() {
-        assertEquals(objWithId.getLocation(), null);
-    }
-
-    public void testGetLocation2() {
-        assertEquals(objWithLocation.getLocation(), LOCATION_VALUE);
-    }
-
-    public void testGetLocation3() {
-        assertEquals(objWithIdAndLocation.getLocation(), LOCATION_VALUE);
-    }
-
-    public void testGetIDValue1() {
-        assertEquals(objWithId.getIDValue(), ID_VALUE);
-    }
-
-    public void testGetIDValue2() {
-        assertEquals(objWithLocation.getIDValue(), ""); //$NON-NLS-1$
-    }
-
-    public void testGetIDValue3() {
-        assertEquals(objWithIdAndLocation.getIDValue(), ID_VALUE);
-    }
-
-    public void testGetStringID1() {
-        assertEquals(objWithId.getStringID(), ID_VALUE);
-    }
-
-    public void testGetStringID2() {
-        assertEquals(objWithLocation.getStringID(), LOCATION_VALUE + ":"); //$NON-NLS-1$
-    }
-
-    public void testGetStringID3() {
-        assertEquals(objWithIdAndLocation.getStringID(), LOCATION_VALUE + ":" + ID_VALUE); //$NON-NLS-1$
-    }
-
-    /*
-     * Test for boolean equals(Object)
-     */
-    public void testEqualsSameObject1() {
-        assertTrue(objWithId.equals(objWithId));
-    }
-
-    public void testEqualsSameObject2() {
-        assertTrue(objWithLocation.equals(objWithLocation));
-    }
-
-    public void testEqualsSameObject3() {
-        assertTrue(objWithIdAndLocation.equals(objWithIdAndLocation));
-    }
-
-    public void testEqualsSimilarObject1() {
-        assertTrue(objWithId.equals(new TupleSourceID(ID_VALUE, null)));
-    }
-
-    public void testEqualsSimilarObject2() {
-        assertTrue(objWithLocation.equals(new TupleSourceID("", LOCATION_VALUE))); //$NON-NLS-1$
-    }
-
-    public void testEqualsSimilarObject3() {
-        assertTrue(objWithIdAndLocation.equals(new TupleSourceID(ID_VALUE, LOCATION_VALUE)));
-    }
-
-    /*
-     * Test for String toString()
-     */
-    public void testToString1() {
-        assertEquals(objWithId.toString(), ID_VALUE);
-    }
-
-    public void testToString2() {
-        assertEquals(objWithLocation.toString(), LOCATION_VALUE + ":"); //$NON-NLS-1$
-    }
-
-    public void testToString3() {
-        assertEquals(objWithIdAndLocation.toString(), LOCATION_VALUE + ":" + ID_VALUE); //$NON-NLS-1$
-    }
-
-    public void testRoundtrip1() {
-        TupleSourceID expectedID = new TupleSourceID("1", "mymachine,100"); //$NON-NLS-1$ //$NON-NLS-2$
-        String stringID = expectedID.getStringID();
-        TupleSourceID actualID = new TupleSourceID(stringID);
-
-        assertEquals("Different ID after roundtrip: ", expectedID.getIDValue(), actualID.getIDValue()); //$NON-NLS-1$
-        assertEquals("Different location after roundtrip: ", expectedID.getIDValue(), actualID.getIDValue()); //$NON-NLS-1$
-    }
-
-    public void testRoundtrip2() {
-        TupleSourceID expectedID = new TupleSourceID("1"); //$NON-NLS-1$
-        String stringID = expectedID.getStringID();
-        TupleSourceID actualID = new TupleSourceID(stringID);
-
-        assertEquals("Different ID after roundtrip: ", expectedID.getIDValue(), actualID.getIDValue()); //$NON-NLS-1$
-        assertEquals("Different location after roundtrip: ", expectedID.getIDValue(), actualID.getIDValue()); //$NON-NLS-1$
-    }
-
-    public void testStandard1() {
-        UnitTestUtil.helpTestEquivalence(0, new TupleSourceID("1"), new TupleSourceID("1"));     //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testStandard2() {
-        UnitTestUtil.helpTestEquivalence(0, new TupleSourceID("1"), new TupleSourceID("1", "mymachine,100"));    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testNotEquals() {
-        TupleSourceID id1 = new TupleSourceID("1"); //$NON-NLS-1$
-        TupleSourceID id2 = new TupleSourceID("2"); //$NON-NLS-1$
-        assertTrue("Differing IDs compare as equal", ! id1.equals(id2)); //$NON-NLS-1$
-    }
-}
-

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,7 +22,7 @@
 
 package com.metamatrix.query.optimizer;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 import com.metamatrix.query.optimizer.TestOptimizer.ComparisonMode;
 import com.metamatrix.query.processor.ProcessorPlan;
@@ -31,69 +31,69 @@
 import com.metamatrix.query.validator.TestValidator;
 
 
-public class TestAccessPatterns extends TestCase {
+public class TestAccessPatterns {
     
     /**
      * The virtual access patterns should get satisfied 
      */
-    public void testVirtualAccessPatternPassing() {
+    @Test public void testVirtualAccessPatternPassing() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup2 where e0=1 and e1='2'"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), new String[] {"SELECT test.\"group\".e0, test.\"group\".e2 FROM test.\"group\" WHERE (test.\"group\".e0 = 1) AND (test.\"group\".e1 = '2')"}); //$NON-NLS-1$
     }
 
-    public void testVirtualAccessPatternPassing1() {
+    @Test public void testVirtualAccessPatternPassing1() {
         String sql = "delete from vm1.g37 where e1 = 1"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {});
     }
     
-    public void testVirtualAccessPatternFailing() {
+    @Test public void testVirtualAccessPatternFailing() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup2 where e0=1"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     }
     
-    public void testVirtualAccessPatternFailing1() {
+    @Test public void testVirtualAccessPatternFailing1() {
         String sql = "delete from vm1.g37"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, null, null, TestOptimizer.SHOULD_FAIL);
     }
 
-    public void testAccessPattern1() throws Exception {
+    @Test public void testAccessPattern1() throws Exception {
         String sql = "SELECT e0, e2 FROM vTest.vGroup where e0=1 and e1='2'"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, 
                                TestValidator.exampleMetadata4(), 
                                new String[] {"SELECT g_0.e0, g_0.e2 FROM test.\"group\" AS g_0 WHERE (g_0.e0 = 1) AND (g_0.e1 = '2')" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
     }
     
-    public void testAccessPattern2() {
+    @Test public void testAccessPattern2() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup where e0=1"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     }
     
-    public void testAccessPattern3() {
+    @Test public void testAccessPattern3() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup where e0=1 and e2='2'"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     } 
     
-    public void testAccessPattern4() throws Exception {
+    @Test public void testAccessPattern4() throws Exception {
         String sql = "(SELECT e0, e2 FROM vTest.vGroup where e0=1 and e1='2') union all (SELECT e0, e2 FROM vTest.vGroup where e0=1 and e1='2')"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), new String[] {"SELECT g_0.e0, g_0.e2 FROM test.\"group\" AS g_0 WHERE (g_0.e0 = 1) AND (g_0.e1 = '2')"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
     } 
     
-    public void testAccessPattern5() {
+    @Test public void testAccessPattern5() {
         String sql = "(SELECT e0, e2 FROM vTest.vGroup where e0=1 and e1='2') union all (SELECT e0, e2 FROM vTest.vGroup where e0=1)"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     } 
     
-    public void testAccessPattern6() {
+    @Test public void testAccessPattern6() {
         String sql = "SELECT e0, e2 FROM test.group where e1 IN (SELECT e2 FROM vTest.vGroup where e0=1 and e1='2')"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), new String[] {"SELECT e1, e0, e2 FROM test.\"group\""}); //$NON-NLS-1$
     }   
     
-    public void testAccessPattern7() {
+    @Test public void testAccessPattern7() {
         String sql = "SELECT e0, e2 FROM test.group where e1 IN (SELECT e2 FROM vTest.vGroup where e0=1)"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     } 
     
-    public void testAccessPattern8() {
+    @Test public void testAccessPattern8() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     } 
@@ -102,7 +102,7 @@
      * Tests two access nodes, each with access patterns, but one already
      * satisfied by user criteria - the other should be made dependent
      */
-    public void testNodesBothHaveAccessPatterns1() throws Exception {
+    @Test public void testNodesBothHaveAccessPatterns1() throws Exception {
         ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g2 where pm4.g2.e5 = 'abc' and pm4.g1.e1 = pm4.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE g_0.e5 = 'abc'"}, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
         TestDependentJoins.checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
@@ -113,7 +113,7 @@
      * satisfied by user criteria - the other should be made dependent
      * (same query written slightly different).
      */
-    public void testNodesBothHaveAccessPatterns1a() throws Exception {
+    @Test public void testNodesBothHaveAccessPatterns1a() throws Exception {
         ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g2, pm4.g1 where pm4.g2.e1 = pm4.g1.e1 and pm4.g2.e5 = 'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE g_0.e5 = 'abc'"}, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
         TestDependentJoins.checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
@@ -123,7 +123,7 @@
      * Self join - tests that both access nodes are satisfied by the select
      * criteria (therefore merge join should be used)
      */
-    public void testSelfJoinAccessPatterns() throws Exception {
+    @Test public void testSelfJoinAccessPatterns() throws Exception {
         ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g1 as g1A where pm4.g1.e1 = 'abc' and g1A.e1 = 'abc' and pm4.g1.e2 = g1A.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT g1A.e2 FROM pm4.g1 AS g1A WHERE g1A.e1 = 'abc'", "SELECT pm4.g1.e2, pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }, TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -145,41 +145,41 @@
         });         
     }
 
-    public void testAccessPatternsFails() {
+    @Test public void testAccessPatternsFails() {
         TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2, pm4.g2 as g2A where pm4.g2.e2 = 123 and pm4.g2.e1 = g2A.e5", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             null, null, null,
             TestOptimizer.SHOULD_FAIL);
     }
 
-    public void testAccessPatternsFails2() {
+    @Test public void testAccessPatternsFails2() {
         TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             null, null, null,
             TestOptimizer.SHOULD_FAIL);
     }
 
-    public void testUnionWithAccessPatternFails() {
+    @Test public void testUnionWithAccessPatternFails() {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION select pm4.g1.e1 from pm4.g1 where pm4.g1.e2 = 1", //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
             null, null, null, TestOptimizer.SHOULD_FAIL);
     }
 
-    public void testUnionWithAccessPatternFails2() {
+    @Test public void testUnionWithAccessPatternFails2() {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION select pm4.g1.e1 from pm4.g1", //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
             null, null, null, TestOptimizer.SHOULD_FAIL);
     }
     
-    public void testUnionWithAccessPattern() {
+    @Test public void testUnionWithAccessPattern() {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testUnionWithAccessPattern2() {
+    @Test public void testUnionWithAccessPattern2() {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc' and pm4.g1.e2 = 1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm4.g1.e1 FROM pm4.g1 WHERE (pm4.g1.e1 = 'abc') AND (pm4.g1.e2 = 1)" }); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testAccessPatternPartialMatch() throws Exception {
+    @Test public void testAccessPatternPartialMatch() throws Exception {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e1 and pm4.g2.e2 = 123", //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
             new String[] { "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE (g_0.e2 = 123) AND (g_0.e1 IN (<dependent values>))", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
@@ -190,7 +190,7 @@
      * completely different query plan which can't satisfy the access pattern.
      * @see #testAccessPatternPartialMatch
      */
-    public void testAccessPatternFails3() {
+    @Test public void testAccessPatternFails3() {
         TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e1 or pm4.g2.e2 = 123",             //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
             null, null, null,
@@ -201,7 +201,7 @@
      * Access patterns on models that support joins requires that the access patterns are satisfied prior to
      * RulePlanJoins
      */
-    public void testAccessPatternsGroupsInSameModelFails() {
+    @Test public void testAccessPatternsGroupsInSameModelFails() {
         TestOptimizer.helpPlan("select pm5.g1.e1 from pm5.g1, pm5.g2 where pm5.g1.e1 = pm5.g2.e1",              //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
             null, null, null, TestOptimizer.SHOULD_FAIL);
@@ -211,7 +211,7 @@
     // ACCESS PATTERNS
     // ==================================================================================
 
-    public void testPushingCriteriaThroughFrameAccessPattern0() {
+    @Test public void testPushingCriteriaThroughFrameAccessPattern0() {
         TestOptimizer.helpPlan("select * from vm1.g9 where vm1.g9.e1='abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'", //$NON-NLS-1$
                             "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" } ); //$NON-NLS-1$
@@ -220,17 +220,17 @@
     /**
      * pm4.g2.e5 or pm4.g2.e2 also need to be in criteria
      */
-    public void testPushingCriteriaThroughFrameAccessPattern1() { 
+    @Test public void testPushingCriteriaThroughFrameAccessPattern1() { 
         TestOptimizer.helpPlan("select * from vm1.g1, vm1.g10 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g10.e1", FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
             null, TestOptimizer.SHOULD_FAIL );
     }
 
-    public void testPushingCriteriaThroughFrameAccessPattern2() { 
+    @Test public void testPushingCriteriaThroughFrameAccessPattern2() { 
         TestOptimizer.helpPlan("select e1 from vm1.g11 where vm1.g11.e1='abc' and vm1.g11.e2=123", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm4.g2.e1 FROM pm4.g2 WHERE (pm4.g2.e1 = 'abc') AND (pm4.g2.e2 = 123)" }); //$NON-NLS-1$
     }
 
-    public void testPushingCriteriaThroughFrameAccessPattern3() {
+    @Test public void testPushingCriteriaThroughFrameAccessPattern3() {
         TestOptimizer.helpPlan("select * from vm1.g1, vm1.g9 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g9.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] {"SELECT pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'", //$NON-NLS-1$
                           "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", //$NON-NLS-1$
@@ -240,7 +240,7 @@
     /**
      * pm4.g2.e5 or pm4.g2.e2 also need to be in criteria
      */
-    public void testPushingCriteriaThroughFrameAccessPattern4() { 
+    @Test public void testPushingCriteriaThroughFrameAccessPattern4() { 
         TestOptimizer.helpPlan("select * from vm1.g10 where vm1.g10.e1='abc'", FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
            null, TestOptimizer.SHOULD_FAIL );
     }
@@ -248,7 +248,7 @@
     /**
      * TODO: in this case we should perform a criteria optimization to create set criteria
      */
-    public void testCase6425() {
+    @Test public void testCase6425() {
         String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR e1 = '2'"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
@@ -258,7 +258,7 @@
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
     }
         
-    public void testCase6425_2() {
+    @Test public void testCase6425_2() {
         String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR (e1 = '2' AND e2 = 3)"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
@@ -268,7 +268,7 @@
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
     }
         
-    public void testCase6425_4() throws Exception {
+    @Test public void testCase6425_4() throws Exception {
         String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR e2 = '2'"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
@@ -279,7 +279,7 @@
     /*
      * Criteria was preventing rule choose dependent from creating the appropriate dependent join
      */
-    public void testMultiAccessPatternWithCriteria() throws Exception {
+    @Test public void testMultiAccessPatternWithCriteria() throws Exception {
     	String sql = "SELECT pm1.g1.* FROM pm4.g1, pm5.g1, pm1.g1 where pm4.g1.e1 = pm1.g1.e1 and pm5.g1.e1 = pm1.g1.e1 and pm5.g1.e2 like '%x' "; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -49,6 +49,7 @@
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
         caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
         caps.setCapabilitySupport(Capability.QUERY_HAVING, true);
+        caps.setCapabilitySupport(Capability.ROW_LIMIT, true);
 		return caps;
 	}
 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestDependentJoins.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestDependentJoins.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestDependentJoins.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,7 +23,6 @@
 package com.metamatrix.query.optimizer;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -41,7 +40,6 @@
 import com.metamatrix.query.processor.relational.RelationalNode;
 import com.metamatrix.query.processor.relational.RelationalPlan;
 import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.Option;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
 import com.metamatrix.query.unittest.FakeMetadataFacade;
@@ -137,13 +135,7 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
         
-        Command command = TestOptimizer.helpGetCommand("select pm1.g1.e1 from pm1.g1, pm2.g1 where pm1.g1.e1 = pm2.g1.e1", FakeMetadataFactory.example1Cached(), Collections.EMPTY_LIST); //$NON-NLS-1$
-
-        Option option = new Option();
-        option.addDependentGroup("pm2.g1"); //$NON-NLS-1$
-        command.setOption(option);
-        
-        ProcessorPlan plan = TestOptimizer.helpPlanCommand(command, FakeMetadataFactory.example1Cached(), capFinder,
+        ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm2.g1 where pm1.g1.e1 = pm2.g1.e1 option makedep pm2.g1", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
 
         checkDependentGroups(plan, new String[] {"pm2.g1"}); //$NON-NLS-1$
@@ -173,11 +165,9 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
         
-        Command command = TestOptimizer.helpGetCommand("select pm1.g1.e1, pm2.g1.e1 from pm1.g1 MAKEDEP INNER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e1 = pm2.g1.e1", FakeMetadataFactory.example1Cached(), Collections.EMPTY_LIST); //$NON-NLS-1$
+        ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1, pm2.g1.e1 from pm1.g1 MAKEDEP INNER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e1 = pm2.g1.e1", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+                new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm2.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
 
-        ProcessorPlan plan = TestOptimizer.helpPlanCommand(command, FakeMetadataFactory.example1Cached(), capFinder,
-            new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm2.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
-
         checkDependentGroups(plan, new String[] {"pm1.g1"}); //$NON-NLS-1$
         checkNotDependentGroups(plan, new String[] {"pm2.g1"}); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestInlineView.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestInlineView.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestInlineView.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,44 +22,72 @@
 
 package com.metamatrix.query.optimizer;
 
+import static com.metamatrix.query.optimizer.TestOptimizer.*;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
+import com.metamatrix.query.optimizer.TestOptimizer.ComparisonMode;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.unittest.FakeMetadataFacade;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
 
-public class TestInlineView extends TestCase {
+public class TestInlineView  {
+    
+    public static FakeMetadataFacade createInlineViewMetadata(FakeCapabilitiesFinder capFinder) {
+        FakeMetadataFacade metadata = FakeMetadataFactory.exampleBQTCached();
 
-	public void testANSIJoinInlineView()  throws Exception {
+        BasicSourceCapabilities caps = getTypicalCapabilities();
+        caps.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
+        caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+        caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
+        caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
+        caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+        caps.setCapabilitySupport(Capability.QUERY_UNION, true);
+        caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, true);
+        caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
+        caps.setFunctionSupport("concat", true); //$NON-NLS-1$
+        caps.setFunctionSupport("convert", true); //$NON-NLS-1$
+        caps.setFunctionSupport("case", true); //$NON-NLS-1$
+        caps.setFunctionSupport("+", true); //$NON-NLS-1$
+        capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+        capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
+        
+        return metadata;
+    }
+
+	@Test public void testANSIJoinInlineView()  throws Exception {
 		runTest(createANSIJoinInlineView());
 	}	
 	
-	public void testInlineView()  throws Exception {
+	@Test public void testInlineView()  throws Exception {
 		runTest(createInlineView());
 	}
 	
-	public void testInlineViewWithDistinctAndOrderBy() throws Exception {
+	@Test public void testInlineViewWithDistinctAndOrderBy() throws Exception {
 		runTest(createInlineViewWithDistinctAndOrderBy());
 	}	
 	
-	public void testInlineViewOfVirtual() throws Exception{
+	@Test public void testInlineViewOfVirtual() throws Exception{
 		runTest(createInlineViewOfVirtual());
 	}
 	
-	public void testInlineViewWithOuterOrderAndGroup() throws Exception {
+	@Test public void testInlineViewWithOuterOrderAndGroup() throws Exception {
 		runTest(createInlineViewWithOuterOrderAndGroup());
 	}
 	
-	public void testInlineViewsInUnions() throws Exception {
+	@Test public void testInlineViewsInUnions() throws Exception {
 		runTest(crateInlineViewsInUnions());
 	}
 	
-	public void testUnionInInlineView() throws Exception{
+	@Test public void testUnionInInlineView() throws Exception{
 		runTest(createUnionInInlineView());
 	}	
 	
@@ -83,8 +111,6 @@
 				sourceQueries, expectedResults);
         
 	}
-
-
 	
 	public static InlineViewCase createInlineView()  throws Exception {
 		String userQuery = "select bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa from (select count(bqt1.smalla.intkey) as aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, bqt1.smallb " + //$NON-NLS-1$
@@ -106,8 +132,6 @@
         return new InlineViewCase("testInlineView", userQuery, optimizedQuery,  //$NON-NLS-1$
 				sourceQueries, expectedResults);        
 	}	
-
-
 	
 	public static InlineViewCase createInlineViewWithDistinctAndOrderBy() throws Exception {
 		String userQuery = "select Q1.a from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2"; //$NON-NLS-1$
@@ -130,7 +154,6 @@
         
 	}	
 	
-	
 	public static InlineViewCase createInlineViewOfVirtual() throws Exception{
 		String userQuery = "select q1.A from (select count(intkey) as a, intkey, stringkey from vqt.smalla group by intkey, stringkey) q1 inner join vqt.smallb as q2 on q1.intkey = q2.a12345 where q1.a = 2"; //$NON-NLS-1$
 		String optimizedQuery = "SELECT v_0.c_1 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.IntKey, g_0.StringKey HAVING COUNT(g_0.IntKey) = 2) AS v_0, BQT1.SmallA AS g_1 WHERE v_0.c_0 = Concat(g_1.StringKey, g_1.StringNum)"; //$NON-NLS-1$
@@ -147,8 +170,6 @@
         return new InlineViewCase("testInlineViewOfVirtual", userQuery, optimizedQuery, //$NON-NLS-1$
 				sourceQueries, expectedResults);        
 	}	
-
-
 	
 	public static InlineViewCase createInlineViewWithOuterOrderAndGroup() throws Exception {
 		String userQuery = "select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b"; //$NON-NLS-1$
@@ -170,8 +191,6 @@
 				sourceQueries, expectedResults);        
 	}
 	
-	
-	
 	public static InlineViewCase crateInlineViewsInUnions() throws Exception {
 		String userQuery = "select q1.a from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 left outer join bqt1.smallb on q1.a = bqt1.smallb.intkey where q1.intkey = 1 union all (select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b)"; //$NON-NLS-1$
 		String optimizedQuery = "SELECT v_1.c_0 FROM (SELECT COUNT(g_2.intkey) AS c_0 FROM bqt1.smalla AS g_2 WHERE g_2.intkey = 1 GROUP BY g_2.intkey) AS v_1 LEFT OUTER JOIN bqt1.smallb AS g_3 ON v_1.c_0 = g_3.intkey UNION ALL SELECT COUNT(v_0.c_0) AS c_0 FROM (SELECT DISTINCT COUNT(g_0.IntKey) AS c_0, g_0.IntKey AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.IntKey HAVING ((COUNT(g_0.IntKey) + g_0.IntKey) = 2) AND (COUNT(g_0.IntKey) = 1)) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_1 = g_1.intkey GROUP BY v_0.c_0"; //$NON-NLS-1$
@@ -196,8 +215,6 @@
 		
 	}
 	
-
-	
 	public static InlineViewCase createUnionInInlineView() throws Exception{
 		
 	    String userQuery = "select t1.intkey from (select case when q1.a=1 then 2 else 1 end as a from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 left outer join bqt1.smallb on q1.a = bqt1.smallb.intkey where q1.intkey = 1 union all (select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b)) as q3, bqt1.smallb as t1 where q3.a = t1.intkey order by t1.intkey"; //$NON-NLS-1$
@@ -228,7 +245,7 @@
 	
 	protected void runTest(InlineViewCase testCase) throws Exception {
 		FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-    	FakeMetadataFacade metadata = TestOptimizer.createInlineViewMetadata(capFinder);
+    	FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
     	
 		ProcessorPlan plan = TestOptimizer.helpPlan(testCase.userQuery, metadata, null, capFinder, new String[] {testCase.optimizedQuery}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); 
 
@@ -236,4 +253,60 @@
             
         TestOptimizer.checkSubPlanCount(plan, 0);
 	}	
+	
+    @Test public void testAliasCreationWithInlineView() {
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
+        
+        ProcessorPlan plan = helpPlan("select a, b from (select distinct count(intNum) a, count(stringKey), bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intkey) q1 order by q1.a", //$NON-NLS-1$
+                metadata, null, capFinder, new String[] {"SELECT a, b FROM (SELECT DISTINCT COUNT(intNum) AS a, COUNT(stringKey) AS count1, bqt1.smalla.intkey AS b FROM bqt1.smalla GROUP BY bqt1.smalla.intkey) AS q1 ORDER BY a"}, true); //$NON-NLS-1$
+
+        checkNodeTypes(plan, FULL_PUSHDOWN);    
+            
+        checkSubPlanCount(plan, 0);
+    }
+    
+    @Test public void testAliasPreservationWithInlineView() {
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
+        
+        ProcessorPlan plan = helpPlan("select q1.a + 1, q1.b from (select count(bqt1.smalla.intNum) as a, bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intNum, bqt1.smalla.intkey order by b) q1 where q1.a = 1", //$NON-NLS-1$
+                metadata, null, capFinder, new String[] {"SELECT (q1.a + 1), q1.b FROM (SELECT COUNT(bqt1.smalla.intNum) AS a, bqt1.smalla.intkey AS b FROM bqt1.smalla GROUP BY bqt1.smalla.intNum, bqt1.smalla.intkey HAVING COUNT(bqt1.smalla.intNum) = 1) AS q1"}, true); //$NON-NLS-1$
+
+        checkNodeTypes(plan, FULL_PUSHDOWN);    
+            
+        checkSubPlanCount(plan, 0);
+    }
+    
+    /**
+     * Order by's will be added to the atomic queries
+     */
+    @Test public void testCrossSourceInlineView() throws Exception {
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
+        
+        ProcessorPlan plan = helpPlan("select * from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 inner join (select count(bqt2.smallb.intkey) as a, bqt2.smallb.intkey from bqt2.smallb group by bqt2.smallb.intkey) as q2 on q1.intkey = q2.intkey where q1.a = 1", //$NON-NLS-1$
+                metadata, null, capFinder, new String[] {"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt2.smallb AS g_0 GROUP BY g_0.intkey) AS v_0 ORDER BY c_0", //$NON-NLS-1$
+                                                         "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey HAVING COUNT(g_0.intkey) = 1) AS v_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+        checkNodeTypes(plan, new int[] {
+                2,      // Access
+                0,      // DependentAccess
+                0,      // DependentSelect
+                0,      // DependentProject
+                0,      // DupRemove
+                0,      // Grouping
+                0,      // Join
+                1,      // MergeJoin
+                0,      // Null
+                0,      // PlanExecution
+                1,      // Project
+                0,      // Select
+                0,      // Sort
+                0       // UnionAll
+            });    
+            
+        checkSubPlanCount(plan, 0);
+    }
+
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,16 +22,16 @@
 
 package com.metamatrix.query.optimizer;
 
+import static org.junit.Assert.*;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import junit.framework.TestCase;
-
+import org.junit.Test;
 import org.teiid.connector.api.SourceSystemFunctions;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -88,7 +88,7 @@
 import com.metamatrix.query.validator.Validator;
 import com.metamatrix.query.validator.ValidatorReport;
 
-public class TestOptimizer extends TestCase {
+public class TestOptimizer {
 
     public interface DependentJoin {}
     public interface DependentSelectNode {}
@@ -118,12 +118,6 @@
     public static final boolean SHOULD_SUCCEED = true;
     public static final boolean SHOULD_FAIL = false;
 
-	// ################################## FRAMEWORK ################################
-	
-	public TestOptimizer(String name) { 
-		super(name);
-	}	
-
 	// ################################## TEST HELPERS ################################
 
     public static BasicSourceCapabilities getTypicalCapabilities() {        
@@ -187,13 +181,13 @@
             throw new MetaMatrixRuntimeException(err);
         }
 
-        return helpPlanCommand(command, md, capFinder, expectedAtomic, shouldSucceed ? ComparisonMode.CORRECTED_COMMAND_STRING : ComparisonMode.FAILED_PLANNING);
+        return helpPlanCommand(command, md, capFinder, null, expectedAtomic, shouldSucceed ? ComparisonMode.CORRECTED_COMMAND_STRING : ComparisonMode.FAILED_PLANNING);
     } 
     
     public static ProcessorPlan helpPlan(String sql, QueryMetadataInterface md, List bindings, CapabilitiesFinder capFinder, String[] expectedAtomic, ComparisonMode mode) throws QueryParserException, QueryResolverException, QueryValidatorException, MetaMatrixComponentException {
         Command command = helpGetCommand(sql, md, bindings);
 
-        return helpPlanCommand(command, md, capFinder, expectedAtomic, mode);
+        return helpPlanCommand(command, md, capFinder, null, expectedAtomic, mode);
     } 
 
     
@@ -218,18 +212,18 @@
         }                       	
 
 		// rewrite
-		command = QueryRewriter.rewrite(command, null, md, new CommandContext());
+		command = QueryRewriter.rewrite(command, md, new CommandContext());
 
         return command;
     }
 
-    public static ProcessorPlan helpPlanCommand(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, String[] expectedAtomic, ComparisonMode mode) {
+    public static ProcessorPlan helpPlanCommand(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, String[] expectedAtomic, ComparisonMode mode) {
         if (capFinder == null){
             capFinder = getGenericFinder();
         }
         
         // Collect atomic queries
-        ProcessorPlan plan = getPlan(command, md, capFinder, mode != ComparisonMode.FAILED_PLANNING);
+        ProcessorPlan plan = getPlan(command, md, capFinder, analysisRecord, mode != ComparisonMode.FAILED_PLANNING);
                
         if (mode == ComparisonMode.CORRECTED_COMMAND_STRING) {
             checkAtomicQueries(expectedAtomic, plan, md, capFinder);
@@ -242,14 +236,14 @@
     
     public static void checkAtomicQueries(String[] expectedAtomic,
                                           ProcessorPlan plan) {
-       Set actualQueries = getAtomicQueries(plan);
+       Set<String> actualQueries = getAtomicQueries(plan);
        
        if (actualQueries.size() != 1 || expectedAtomic.length != 1) {
            // Compare atomic queries
            HashSet<String> expectedQueries = new HashSet<String>(Arrays.asList(expectedAtomic));
            assertEquals("Did not get expected atomic queries: ", expectedQueries, actualQueries); //$NON-NLS-1$
        } else {
-           assertEquals("Did not get expected atomic query: ", expectedAtomic[0], (String)actualQueries.iterator().next()); //$NON-NLS-1$
+           assertEquals("Did not get expected atomic query: ", expectedAtomic[0], actualQueries.iterator().next()); //$NON-NLS-1$
        }
    }
 
@@ -279,10 +273,12 @@
         assertEquals("Did not get expected atomic queries: ", expectedQueries, actualQueries); //$NON-NLS-1$
     }
     
-    public static ProcessorPlan getPlan(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, boolean shouldSucceed) {
+    static ProcessorPlan getPlan(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, boolean shouldSucceed) {
 		// plan
 		ProcessorPlan plan = null;
-        AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+		if (analysisRecord == null) {
+        	analysisRecord = new AnalysisRecord(false, false, DEBUG);
+		}
 		if (shouldSucceed) {
 			try {
 				//do planning
@@ -323,27 +319,22 @@
 		return plan;
 	}
     
-    public static Set getAtomicQueries(ProcessorPlan plan) {
-        Iterator atomicQueries = getAtomicCommands(plan).iterator();
+    public static Set<String> getAtomicQueries(ProcessorPlan plan) {
+    	Set<Command> atomicQueries = new HashSet<Command>();        
+        if(plan instanceof RelationalPlan) {
+            getAtomicCommands( ((RelationalPlan)plan).getRootNode(), atomicQueries );    
+        } 
         
-        Set stringQueries = new HashSet();
+        Set<String> stringQueries = new HashSet<String>();
         
-        while (atomicQueries.hasNext()) {
-           stringQueries.add(atomicQueries.next().toString());
+        for (Command command : atomicQueries) {
+           stringQueries.add(command.toString());
         }
         
         return stringQueries;
     }
     
-    public static Set getAtomicCommands(ProcessorPlan plan) {
-        Set atomicQueries = new HashSet();        
-        if(plan instanceof RelationalPlan) {
-            getAtomicCommands( ((RelationalPlan)plan).getRootNode(), atomicQueries );    
-        }   
-        return atomicQueries;        
-    }
-    
-    private static void getAtomicCommands(RelationalNode node, Set atomicQueries) {
+    private static void getAtomicCommands(RelationalNode node, Set<Command> atomicQueries) {
         if(node instanceof AccessNode) {
             AccessNode accessNode = (AccessNode) node;
             atomicQueries.add( accessNode.getCommand());   
@@ -402,7 +393,7 @@
      * @param relationalNode
      * @return int[]
      */
-    public static void collectCounts(RelationalNode relationalNode, int[] counts, Class<?>[] types) {
+    static void collectCounts(RelationalNode relationalNode, int[] counts, Class<?>[] types) {
         Class<?> nodeType = relationalNode.getClass();
         if(nodeType.equals(JoinNode.class)) {
         	JoinStrategy strategy = ((JoinNode)relationalNode).getJoinStrategy();
@@ -613,7 +604,7 @@
 			new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
         List vm1g4e = FakeMetadataFactory.createElements(vm1g4, 
-            new String[] { "e1", "e1" }, //$NON-NLS-1$ //$NON-NLS-2$
+            new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
         List vm1g5e = FakeMetadataFactory.createElements(vm1g5, 
             new String[] { "e1" }, //$NON-NLS-1$
@@ -758,12 +749,12 @@
 	/**
 	 * Test defect 8096 - query a virtual group with subquery of another virtual group 
 	 */
-	public void testVirtualSubqueryINClause_8096() { 
+	@Test public void testVirtualSubqueryINClause_8096() { 
 		helpPlan("SELECT * FROM vm1.sub1", example1(), //$NON-NLS-1$
 			new String[] {"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
 	}
 
-	public void testQueryPhysical() { 
+	@Test public void testQueryPhysical() { 
 		ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] {"SELECT pm1.g1.e1, e2, pm1.g1.e3, e4 FROM pm1.g1"} ); //$NON-NLS-1$
 
@@ -772,58 +763,58 @@
         checkSubPlanCount(plan, 0);
 	}
     
-	public void testSelectStarPhysical() { 
+	@Test public void testSelectStarPhysical() { 
 		ProcessorPlan plan = helpPlan("SELECT * FROM pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
 	}
 
-	public void testQuerySingleSourceVirtual() { 
+	@Test public void testQuerySingleSourceVirtual() { 
 		ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
 	}
 	
-	public void testQueryMultiSourceVirtual() { 
+	@Test public void testQueryMultiSourceVirtual() { 
 		ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "SELECT g_0.e1, g_0.e2, g_1.e3, g_1.e4 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
 	}
 
-	public void testPhysicalVirtualJoinWithCriteria() throws Exception { 
+	@Test public void testPhysicalVirtualJoinWithCriteria() throws Exception { 
 		ProcessorPlan plan = helpPlan("SELECT vm1.g2.e1 from vm1.g2, pm1.g3 where vm1.g2.e1=pm1.g3.e1 and vm1.g2.e2 > 0", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g3 AS g_2 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = g_2.e1) AND (g_0.e2 > 0)" }, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
 	}
     
-    public void testQueryWithExpression() { 
+    @Test public void testQueryWithExpression() { 
         helpPlan("SELECT e4 FROM pm3.g1 WHERE e4 < convert('2001-11-01 10:30:40.42', timestamp)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "SELECT e4 FROM pm3.g1 WHERE e4 < {ts'2001-11-01 10:30:40.42'}"} ); //$NON-NLS-1$
     }
     
-    public void testInsert() { 
+    @Test public void testInsert() { 
         helpPlan("Insert into pm1.g1 (pm1.g1.e1, pm1.g1.e2) values ('MyString', 1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES ('MyString', 1)"} ); //$NON-NLS-1$
     }
     
-    public void testUpdate1() { 
+    @Test public void testUpdate1() { 
       	helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e3= 'true'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e3 = TRUE"} ); //$NON-NLS-1$
   	}
   	
-    public void testUpdate2() { 
+    @Test public void testUpdate2() { 
         helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"} ); //$NON-NLS-1$
     }
     
-    public void testDelete() { 
+    @Test public void testDelete() { 
     	helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
 			new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = cast(pm1.g1.e2 AS string)"} ); //$NON-NLS-1$
   	}
 
 	// ############################# TESTS ON EXAMPLE 1 ############################
 	
-    public void testCopyInAcrossJoin() throws Exception {
+    @Test public void testCopyInAcrossJoin() throws Exception {
         ProcessorPlan plan = helpPlan("select pm1.g1.e1, pm2.g2.e1 from pm1.g1, pm2.g2 where pm1.g1.e1=pm2.g2.e1 and pm1.g1.e1 IN ('a', 'b')", example1(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 AS c_0 FROM pm2.g2 AS g_0 WHERE g_0.e1 IN ('a', 'b') ORDER BY c_0", //$NON-NLS-1$
         				   "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN ('a', 'b') ORDER BY c_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -846,75 +837,75 @@
         }); 
     }
 
-    public void testCopyMatchAcrossJoin() throws Exception {
+    @Test public void testCopyMatchAcrossJoin() throws Exception {
         helpPlan("select pm1.g1.e1, pm2.g2.e1 from pm1.g1, pm2.g2 where pm1.g1.e1=pm2.g2.e1 and pm1.g1.e1 LIKE '%1'", example1(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 WHERE g_0.e1 LIKE '%1' ORDER BY c_0", //$NON-NLS-1$
         					"SELECT g_0.e1 AS c_0 FROM pm2.g2 AS g_0 WHERE g_0.e1 LIKE '%1' ORDER BY c_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
     }
  
-    public void testCopyOrAcrossJoin() throws Exception {
+    @Test public void testCopyOrAcrossJoin() throws Exception {
         helpPlan("select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g2 where pm1.g1.e1=pm1.g2.e1 and (pm1.g1.e1 = 'abc' OR pm1.g1.e1 = 'def')", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1 WHERE (pm1.g1.e1 = 'abc') OR (pm1.g1.e1 = 'def')", //$NON-NLS-1$
                             "SELECT pm1.g2.e1 FROM pm1.g2 WHERE (pm1.g2.e1 = 'abc') OR (pm1.g2.e1 = 'def')" }, getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$
     }
  
-    public void testCopyMultiElementCritAcrossJoin() throws Exception {
+    @Test public void testCopyMultiElementCritAcrossJoin() throws Exception {
         helpPlan("select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g2 where pm1.g1.e1=pm1.g2.e1 and pm1.g1.e2=pm1.g2.e2 and (pm1.g1.e1 = 'abc' OR pm1.g1.e2 = 5)", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g2.e1, pm1.g2.e2 FROM pm1.g2 WHERE (pm1.g2.e1 = 'abc') OR (pm1.g2.e2 = 5)", "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE (pm1.g1.e1 = 'abc') OR (pm1.g1.e2 = 5)" }, getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testCantCopyAcrossJoin1() throws Exception {
+    @Test public void testCantCopyAcrossJoin1() throws Exception {
         helpPlan("select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g2 where pm1.g1.e1=pm1.g2.e1 and concat(pm1.g1.e1, pm1.g1.e2) = 'abc'", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT pm1.g2.e1 FROM pm1.g2" }, getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$
     }
 
-    public void testCantCopyAcrossJoin2() throws Exception {
+    @Test public void testCantCopyAcrossJoin2() throws Exception {
         helpPlan("select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g2 where pm1.g1.e1=pm1.g2.e1 and (pm1.g1.e1 = 'abc' OR pm1.g1.e2 = 5)", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1 WHERE (pm1.g1.e1 = 'abc') OR (pm1.g1.e2 = 5)", //$NON-NLS-1$
                             "SELECT pm1.g2.e1 FROM pm1.g2" }, getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$
     }
 
-    public void testPushingCriteriaThroughFrame1() { 
+    @Test public void testPushingCriteriaThroughFrame1() { 
     	helpPlan("select * from vm1.g1, vm1.g2 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g2.e1", example1(), //$NON-NLS-1$
 			new String[] { "SELECT g1__1.e1, g1__1.e2, g1__1.e3, g1__1.e4 FROM pm1.g1 AS g1__1 WHERE g1__1.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" } ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughFrame2() throws Exception { 
+    @Test public void testPushingCriteriaThroughFrame2() throws Exception { 
     	helpPlan("select * from vm1.g1, vm1.g3 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g3.e1", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2 WHERE pm1.g2.e1 = 'abc'",  //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" }, getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughFrame3() { 
+    @Test public void testPushingCriteriaThroughFrame3() { 
     	helpPlan("select * from vm1.g1, vm1.g2, vm1.g1 as a where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g2.e1 and vm1.g1.e1=a.e1", example1(), //$NON-NLS-1$
 			new String[] { "SELECT g1__1.e1, g1__1.e2, g1__1.e3, g1__1.e4 FROM pm1.g1 AS g1__1 WHERE g1__1.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT g1__2.e1, g1__2.e2, g1__2.e3, g1__2.e4 FROM pm1.g1 AS g1__2 WHERE g1__2.e1 = 'abc'" } ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughUnion1() { 
+    @Test public void testPushingCriteriaThroughUnion1() { 
     	helpPlan("select e1 from vm1.u1 where e1='abc'", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g3.e1, pm1.g3.e2, pm1.g3.e3, pm1.g3.e4 FROM pm1.g3 WHERE pm1.g3.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2 WHERE pm1.g2.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" } ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughUnion2() { 
+    @Test public void testPushingCriteriaThroughUnion2() { 
     	helpPlan("select e1 from vm1.u2 where e1='abc'", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2 WHERE pm1.g2.e1 = 'abc'", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" } ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughUnion3() { 
+    @Test public void testPushingCriteriaThroughUnion3() { 
     	helpPlan("select e1 from vm1.u1 where e1='abc' and e2=5", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g3.e1, pm1.g3.e2, pm1.g3.e3, pm1.g3.e4 FROM pm1.g3 WHERE (pm1.g3.e1 = 'abc') AND (pm1.g3.e2 = 5)", //$NON-NLS-1$
 							"SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2 WHERE (pm1.g2.e1 = 'abc') AND (pm1.g2.e2 = 5)", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE (pm1.g1.e1 = 'abc') AND (pm1.g1.e2 = 5)" } ); //$NON-NLS-1$
   	}
 
-    public void testPushingCriteriaThroughUnion4() { 
+    @Test public void testPushingCriteriaThroughUnion4() { 
     	helpPlan("select e1 from vm1.u1 where e1='abc' or e2=5", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g3.e1, pm1.g3.e2, pm1.g3.e3, pm1.g3.e4 FROM pm1.g3 WHERE (pm1.g3.e1 = 'abc') OR (pm1.g3.e2 = 5)", //$NON-NLS-1$
 							"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE (pm1.g1.e1 = 'abc') OR (pm1.g1.e2 = 5)", //$NON-NLS-1$
@@ -922,38 +913,38 @@
   	}
 
 	// expression in a subquery of the union
-    public void testPushingCriteriaThroughUnion5() { 
+    @Test public void testPushingCriteriaThroughUnion5() { 
     	helpPlan("select e1 from vm1.u3 where e1='abc'", example1(), //$NON-NLS-1$
 			new String[] { "SELECT DISTINCT e1 FROM pm1.g1 WHERE e1 = 'abc'" } ); //$NON-NLS-1$
   	}
 
     /** defect #4956 */
-    public void testPushCriteriaThroughUnion6() { 
+    @Test public void testPushCriteriaThroughUnion6() { 
         helpPlan("select v1 from vm1.u4 where vm1.u4.v1='x'", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT e1 FROM pm1.g2 WHERE e1 = 'x'" } ); //$NON-NLS-1$
     }
 
-    public void testPushCriteriaThroughUnion7() { 
+    @Test public void testPushCriteriaThroughUnion7() { 
         helpPlan("select v1 from vm1.u5 where vm1.u5.v1='x'", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT e1 FROM pm1.g2" } ); //$NON-NLS-1$
     }
 
-    public void testPushCriteriaThroughUnion8() { 
+    @Test public void testPushCriteriaThroughUnion8() { 
         helpPlan("select v1 from vm1.u5 where length(v1) > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT e1 FROM pm1.g2" } ); //$NON-NLS-1$
     }
     
-    public void testPushCriteriaThroughUnion11() {
+    @Test public void testPushCriteriaThroughUnion11() {
         helpPlan("select * from vm1.u8 where const = 's3' or e1 is null", example1(), //$NON-NLS-1$
             new String[] { "SELECT 's3', e1 FROM pm1.g3", //$NON-NLS-1$
                             "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
                             "SELECT 's1', e1 FROM pm1.g1 WHERE e1 IS NULL" } );     //$NON-NLS-1$
     }
 
-    public void testPushCriteriaThroughUnion12() {
+    @Test public void testPushCriteriaThroughUnion12() {
         helpPlan("select * from vm1.u8 where const = 's1' or e1 is null", example1(), //$NON-NLS-1$
             new String[] { "SELECT 's3', e1 FROM pm1.g3 WHERE e1 IS NULL", //$NON-NLS-1$
                             "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
@@ -961,7 +952,7 @@
     }
 
     /** defect #4997 */
-    public void testCountStarNoRows() { 
+    @Test public void testCountStarNoRows() { 
         ProcessorPlan plan = helpPlan("select count(*) from vm1.u4", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g2",  //$NON-NLS-1$
                             "SELECT e1 FROM pm1.g1" } ); //$NON-NLS-1$
@@ -983,7 +974,7 @@
         }); 
     }
 
-    public void testPushingCriteriaWithCopy() { 
+    @Test public void testPushingCriteriaWithCopy() { 
     	ProcessorPlan plan = helpPlan("select vm1.u1.e1 from vm1.u1, pm1.g1 where vm1.u1.e1='abc' and vm1.u1.e1=pm1.g1.e1", example1(), //$NON-NLS-1$
 			new String[] { "SELECT pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", //$NON-NLS-1$
                             "SELECT pm1.g3.e1, pm1.g3.e2, pm1.g3.e3, pm1.g3.e4 FROM pm1.g3 WHERE pm1.g3.e1 = 'abc'", //$NON-NLS-1$
@@ -1007,84 +998,84 @@
         }); 
   	}
 
-    public void testVirtualGroupWithAliasedElement() {
+    @Test public void testVirtualGroupWithAliasedElement() {
         helpPlan("select elem FROM vm1.u6 where elem='abc' and const='xyz'", example1(), //$NON-NLS-1$
             new String[] { "SELECT x1.e1 FROM pm1.g1 AS x1 WHERE x1.e1 = 'abc'" } );     //$NON-NLS-1$
     }
 
-    public void testPushThroughGroup1() {
+    @Test public void testPushThroughGroup1() {
         helpPlan("select * FROM vm1.a1 WHERE e1 = 'x'", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = 'x'" } );     //$NON-NLS-1$
     }
  
-    public void testPushThroughGroup2() {
+    @Test public void testPushThroughGroup2() {
         helpPlan("select * FROM vm1.a2 WHERE e1 = 'x'", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = 'x'" } );     //$NON-NLS-1$
     }
 
-    public void testPushThroughGroup3() {
+    @Test public void testPushThroughGroup3() {
         helpPlan("select * FROM vm1.a3 WHERE sum_e2 > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT e2 FROM pm1.g1" } );     //$NON-NLS-1$
     }
 
-    public void testPushMultiGroupCriteria() { 
+    @Test public void testPushMultiGroupCriteria() { 
         ProcessorPlan plan = helpPlan("select pm2.g1.e1 from pm2.g1, pm2.g2 where pm2.g1.e1 = pm2.g2.e1 and (pm2.g1.e2 = 1 OR pm2.g2.e2 = 2)", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1 FROM pm2.g1, pm2.g2 WHERE (pm2.g1.e1 = pm2.g2.e1) AND ((pm2.g1.e2 = 1) OR (pm2.g2.e2 = 2))" } ); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }   
 
-    public void testSimpleCrossJoin1() throws Exception {
+    @Test public void testSimpleCrossJoin1() throws Exception {
         helpPlan("select pm1.g1.e1 FROM pm1.g1, pm1.g2", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", //$NON-NLS-1$
                 "SELECT pm1.g2.e1 FROM pm1.g2" }, new DefaultCapabilitiesFinder(), ComparisonMode.EXACT_COMMAND_STRING );     //$NON-NLS-1$
     }
 
-    public void testSimpleCrossJoin2() {
+    @Test public void testSimpleCrossJoin2() {
         helpPlan("select pm2.g1.e1 FROM pm2.g1, pm2.g2", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1 FROM pm2.g1, pm2.g2"} ); //$NON-NLS-1$
                
     }
 
-    public void testSimpleCrossJoin3() {
+    @Test public void testSimpleCrossJoin3() {
         helpPlan("select pm2.g1.e1 FROM pm2.g1 CROSS JOIN pm2.g2", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1 FROM pm2.g1, pm2.g2"} ); //$NON-NLS-1$
                
     }
 
-    public void testMultiSourceCrossJoin() throws Exception {
+    @Test public void testMultiSourceCrossJoin() throws Exception {
         helpPlan("select pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", //$NON-NLS-1$
                 "SELECT pm1.g2.e1 FROM pm1.g2", //$NON-NLS-1$
                 "SELECT pm1.g3.e1 FROM pm1.g3" }, new DefaultCapabilitiesFinder(), ComparisonMode.EXACT_COMMAND_STRING );     //$NON-NLS-1$
     }
 
-    public void testSingleSourceCrossJoin() {
+    @Test public void testSingleSourceCrossJoin() {
         helpPlan("select pm2.g1.e1 FROM pm2.g1, pm2.g2, pm2.g3", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1 FROM pm2.g1, pm2.g2, pm2.g3"} ); //$NON-NLS-1$
     }
 
-    public void testSelfJoins() {
+    @Test public void testSelfJoins() {
         helpPlan("select pm2.g1.e1 FROM pm2.g1 JOIN pm2.g1 AS x ON pm2.g1.e1=x.e1", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1 FROM pm2.g1 order by e1", //$NON-NLS-1$
                 "SELECT x.e1 FROM pm2.g1 AS x order by e1" } );     //$NON-NLS-1$
     }
 
-    public void testDefect5282_1() {
+    @Test public void testDefect5282_1() {
         helpPlan("select * FROM vm1.a4 WHERE vm1.a4.count > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1" } );     //$NON-NLS-1$
     }
 
-    public void testDefect5282_2() {
+    @Test public void testDefect5282_2() {
         helpPlan("select count(*) FROM vm1.a4", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1" } );     //$NON-NLS-1$
     }
 
-    public void testDefect5282_3() {
+    @Test public void testDefect5282_3() {
         helpPlan("select * FROM vm1.a5 WHERE vm1.a5.count > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1" } );     //$NON-NLS-1$
     }
     
-    public void testDepJoinHintBaseline() throws Exception {
+    @Test public void testDepJoinHintBaseline() throws Exception {
         ProcessorPlan plan = helpPlan("select * FROM vm1.g4", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT pm1.g2.e1 FROM pm1.g2" }, new DefaultCapabilitiesFinder(), ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
@@ -1106,37 +1097,37 @@
         }); 
     }
     
-    public void testDefect6425_1() {
+    @Test public void testDefect6425_1() {
         helpPlan("select * from vm1.u9", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1, e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT e1, e1 FROM pm1.g2" } );     //$NON-NLS-1$
     }
 
-    public void testDefect6425_2() {
+    @Test public void testDefect6425_2() {
         helpPlan("select count(*) from vm1.u9", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT e1 FROM pm1.g2" } );     //$NON-NLS-1$
     }
     
-    public void testPushMatchCritWithReference() {
+    @Test public void testPushMatchCritWithReference() {
         List bindings = new ArrayList();
         bindings.add("pm1.g2.e1"); //$NON-NLS-1$
         helpPlan("select e1 FROM pm1.g1 WHERE e1 LIKE ?", example1(), bindings, null,  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 LIKE ?" }, true ); //$NON-NLS-1$
     }
     
-    public void testDefect6517() {
+    @Test public void testDefect6517() {
         helpPlan("select count(*) from vm1.g5", example1(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm1.g1.e1 FROM pm1.g1" });     //$NON-NLS-1$
     }
     
-    public void testDefect5283() {        
+    @Test public void testDefect5283() {        
         helpPlan("select * from vm1.a6", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1", //$NON-NLS-1$
                             "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2" } ); //$NON-NLS-1$
     }
     
-    public void testManyJoinsOverThreshold() throws Exception {
+    @Test public void testManyJoinsOverThreshold() throws Exception {
         long begin = System.currentTimeMillis();
         helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3, pm1.g4, pm1.g5, pm1.g6, pm1.g7, pm1.g8, pm1.g1 AS x, pm1.g2 AS y WHERE pm1.g1.e1 = pm1.g2.e1 AND pm1.g2.e1 = pm1.g3.e1 AND pm1.g3.e1 = pm1.g4.e1 AND pm1.g4.e1 = pm1.g5.e1 AND pm1.g5.e1=pm1.g6.e1 AND pm1.g6.e1=pm1.g7.e1 AND pm1.g7.e1=pm1.g8.e1", //$NON-NLS-1$
             example1(), 
@@ -1155,7 +1146,7 @@
         assertTrue("Did not plan many join query in reasonable time frame: " + elapsed + " ms", elapsed < 4000); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testAggregateWithoutGroupBy() {
+    @Test public void testAggregateWithoutGroupBy() {
         ProcessorPlan plan = helpPlan("select count(e2) from pm1.g1", example1(), //$NON-NLS-1$
             new String[] { "SELECT e2 FROM pm1.g1" } );         //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1176,7 +1167,7 @@
         }); 
     }
     
-    public void testHavingWithoutGroupBy() {
+    @Test public void testHavingWithoutGroupBy() {
         ProcessorPlan plan = helpPlan("select count(e2) from pm1.g1 HAVING count(e2) > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT e2 FROM pm1.g1" } );         //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1197,7 +1188,7 @@
         }); 
     }
 
-    public void testHavingAndGroupBy() {
+    @Test public void testHavingAndGroupBy() {
         ProcessorPlan plan = helpPlan("select e1, count(e2) from pm1.g1 group by e1 having count(e2) > 0 and sum(e2) > 0", example1(), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1" } );         //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1218,7 +1209,7 @@
         }); 
     }
     
-    public void testAllJoinsInSingleClause() throws Exception {
+    @Test public void testAllJoinsInSingleClause() throws Exception {
         ProcessorPlan plan = helpPlan("select pm1.g1.e1 FROM pm1.g1 join (pm1.g2 right outer join pm1.g3 on pm1.g2.e1=pm1.g3.e1) on pm1.g1.e1=pm1.g3.e1", example1(),  //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1",  //$NON-NLS-1$
                             "SELECT pm1.g2.e1 FROM pm1.g2", //$NON-NLS-1$
@@ -1241,7 +1232,7 @@
         }); 
     }
 
-    public void testSelectCountStarFalseCriteria() {
+    @Test public void testSelectCountStarFalseCriteria() {
         ProcessorPlan plan = helpPlan("Select count(*) from pm1.g1 where 1=0", example1(),  //$NON-NLS-1$
             new String[] { });
         checkNodeTypes(plan, new int[] {
@@ -1262,31 +1253,31 @@
         }); 
     }
 
-    public void testSubquery1() {
+    @Test public void testSubquery1() {
         ProcessorPlan plan = helpPlan("Select e1 from (select e1 FROM pm1.g1) AS x", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testSubquery2() {
+    @Test public void testSubquery2() {
         ProcessorPlan plan = helpPlan("Select e1, a from (select e1 FROM pm1.g1) AS x, (select e1 as a FROM pm1.g2) AS y WHERE x.e1=y.a", example1(),  //$NON-NLS-1$
             new String[] { "SELECT g_0.e1, g_1.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 = g_1.e1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-	public void testSubquery3() {
+	@Test public void testSubquery3() {
 		ProcessorPlan plan = helpPlan("Select e1 from (select e1 FROM pm1.g1) AS x WHERE x.e1 = 'a'", example1(), //$NON-NLS-1$
 			new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = 'a'" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-	public void testSubquery4() {
+	@Test public void testSubquery4() {
 		ProcessorPlan plan = helpPlan("Select e1 from (select e1 FROM pm1.g1 WHERE e1 = 'a') AS x", example1(), //$NON-NLS-1$
 			new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = 'a'" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testSubqueryInClause1() {
+    @Test public void testSubqueryInClause1() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1307,7 +1298,7 @@
         }); 
     }
 
-    public void testCompareSubquery1() {
+    @Test public void testCompareSubquery1() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 < any (select e1 FROM pm2.g1)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1328,7 +1319,7 @@
         }); 
     }
 
-    public void testCompareSubquery2() {
+    @Test public void testCompareSubquery2() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 <= some (select e1 FROM pm2.g1)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1349,7 +1340,7 @@
         }); 
     }
 
-    public void testCompareSubquery3() {
+    @Test public void testCompareSubquery3() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 >= all (select e1 FROM pm2.g1)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1370,7 +1361,7 @@
         }); 
     }
 
-    public void testCompareSubquery4() {
+    @Test public void testCompareSubquery4() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 > (select e1 FROM pm2.g1 where e2 = 13)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1391,7 +1382,7 @@
         }); 
     }
 
-    public void testExistsSubquery1() {
+    @Test public void testExistsSubquery1() {
         ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where exists (select e1 FROM pm2.g1)", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1412,7 +1403,7 @@
         }); 
     }
     
-    public void testScalarSubquery1() {
+    @Test public void testScalarSubquery1() {
         ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where e1 = 'x') from pm1.g1", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1433,7 +1424,7 @@
         }); 
     }    
 
-    public void testScalarSubquery2() {
+    @Test public void testScalarSubquery2() {
         ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where e1 = 'x') as X from pm1.g1", example1(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1454,7 +1445,7 @@
         }); 
     } 
     
-    public void testTempGroup() {
+    @Test public void testTempGroup() {
         ProcessorPlan plan = helpPlan("select e1 from tm1.g1 where e1 = 'x'", FakeMetadataFactory.example1Cached(),  //$NON-NLS-1$
             new String[] { "SELECT e1 FROM tm1.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1475,7 +1466,7 @@
         }); 
     }
     
-    public void testNotPushDistinct() throws Exception {
+    @Test public void testNotPushDistinct() throws Exception {
         ProcessorPlan plan = helpPlan("select distinct e1 from pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1 FROM pm1.g1" }, new DefaultCapabilitiesFinder(), ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1496,73 +1487,73 @@
         }); 
     }
 
-    public void testPushDistinct() {
+    @Test public void testPushDistinct() {
         ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT e1 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctSort() {
+    @Test public void testPushDistinctSort() {
         ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 order by e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT e1 FROM pm3.g1 ORDER BY e1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctWithCriteria() {
+    @Test public void testPushDistinctWithCriteria() {
         ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 where e1 = 'x'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT e1 FROM pm3.g1 WHERE e1 = 'x'" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual1() {
+    @Test public void testPushDistinctVirtual1() {
         ProcessorPlan plan = helpPlan("select * from vm1.g12", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual2() {
+    @Test public void testPushDistinctVirtual2() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual3() {
+    @Test public void testPushDistinctVirtual3() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual4() {
+    @Test public void testPushDistinctVirtual4() {
         ProcessorPlan plan = helpPlan("select * from vm1.g13", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual5() {
+    @Test public void testPushDistinctVirtual5() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual6() {
+    @Test public void testPushDistinctVirtual6() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual7() {
+    @Test public void testPushDistinctVirtual7() {
         ProcessorPlan plan = helpPlan("select * from vm1.g14", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual8() {
+    @Test public void testPushDistinctVirtual8() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushDistinctVirtual9() {
+    @Test public void testPushDistinctVirtual9() {
         ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN); 
@@ -1571,7 +1562,7 @@
     /**
      * Defect #7819
      */
-    public void testPushDistinctWithExpressions() {
+    @Test public void testPushDistinctWithExpressions() {
         ProcessorPlan plan = helpPlan("SELECT DISTINCT * FROM vm1.g15", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm3.g1" }); //$NON-NLS-1$
         checkNodeTypes(plan, new int[] {
@@ -1592,7 +1583,7 @@
         }); 
     }
 
-    public void testNestedSubquery() {
+    @Test public void testNestedSubquery() {
         ProcessorPlan plan = helpPlan("SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum, DoubleNum FROM BQT2.SmallA ) AS x ) AS y ORDER BY IntKey", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] { "SELECT IntKey, LongNum FROM BQT2.SmallA order by intkey" }); //$NON-NLS-1$
 
@@ -1600,7 +1591,7 @@
     }
 
     /** Tests a user's order by is pushed to the source */
-    public void testPushOrderBy() {
+    @Test public void testPushOrderBy() {
         ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1 FROM pm3.g1 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm3.g1.e1 FROM pm3.g1 ORDER BY pm3.g1.e1"}); //$NON-NLS-1$
 
@@ -1608,7 +1599,7 @@
     }
     
     /** Tests an order by is not pushed to source due to join */
-    public void testDontPushOrderByWithJoin() {
+    @Test public void testDontPushOrderByWithJoin() {
         ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 INNER JOIN pm2.g2 ON pm3.g1.e1 = pm2.g2.e1 ORDER BY pm3.g1.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 ORDER BY pm3.g1.e1", //$NON-NLS-1$
                            "SELECT pm2.g2.e1 FROM pm2.g2 ORDER BY pm2.g2.e1"}); //$NON-NLS-1$
@@ -1635,7 +1626,7 @@
      * Tests that user's order by gets pushed to the source, but query
      * transformation order by is discarded 
      */
-    public void testPushOrderByThroughFrame() {
+    @Test public void testPushOrderByThroughFrame() {
         ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g14 ORDER BY e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 ORDER BY pm3.g1.e2"}); //$NON-NLS-1$
 
@@ -1645,7 +1636,7 @@
     /** 
      * Tests that query transformation order by is discarded by
      */
-    public void testPushOrderByThroughFrame2() {
+    @Test public void testPushOrderByThroughFrame2() {
         ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g1 ORDER BY e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 order by e2"}); //$NON-NLS-1$
 
@@ -1657,7 +1648,7 @@
      * user order by, and that user order by is discarded because
      * of the function in the query transformation 
      */
-    public void testPushOrderByThroughFrame3() {
+    @Test public void testPushOrderByThroughFrame3() {
         ProcessorPlan plan = helpPlan("SELECT e, e2 FROM vm1.g16 ORDER BY e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm3.g1"}); //$NON-NLS-1$
 
@@ -1683,7 +1674,7 @@
      * Tests that a user's order by does not get pushed to the source
      * if there is a UNION in the query transformation 
      */
-    public void testPushOrderByThroughFrame4_Union() {
+    @Test public void testPushOrderByThroughFrame4_Union() {
         ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g17 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1", //$NON-NLS-1$
                            "SELECT pm3.g2.e1, pm3.g2.e2 FROM pm3.g2"}); //$NON-NLS-1$
@@ -1707,7 +1698,7 @@
     }
 
     /** Tests outer join defect #7945 - see also defect #10050*/
-    public void testOuterJoinDefect7945() {
+    @Test public void testOuterJoinDefect7945() {
         ProcessorPlan plan = helpPlan(
             "SELECT BQT1.SmallA.IntKey AS SmallA_IntKey, BQT2.MediumB.IntKey AS MediumB_IntKey, BQT3.MediumB.IntKey AS MediumC_IntKey " +  //$NON-NLS-1$
             "FROM (BQT1.SmallA RIGHT OUTER JOIN BQT2.MediumB ON BQT1.SmallA.IntKey = BQT2.MediumB.IntKey) " +  //$NON-NLS-1$
@@ -1738,7 +1729,7 @@
     }    
 
     /** Tests outer join defect #7945 */
-    public void testFunctionSimplification1() {
+    @Test public void testFunctionSimplification1() {
         ProcessorPlan plan = helpPlan(
             "SELECT x FROM vm1.g18 WHERE x = 92.0",   //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
@@ -1763,7 +1754,7 @@
         });                                    
     }    
             
-    public void testCantPushJoin1() {
+    @Test public void testCantPushJoin1() {
         ProcessorPlan plan = helpPlan(
             "SELECT a.e1, b.e2 FROM pm1.g1 a, pm1.g2 b WHERE a.e1 = b.e1",  //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
@@ -1789,7 +1780,7 @@
         });                                    
     }
 
-    public void testCantPushJoin2() {
+    @Test public void testCantPushJoin2() {
         ProcessorPlan plan = helpPlan(
             "SELECT a.e1, b.e2 FROM pm1.g1 a, pm1.g2 b, pm2.g1 c WHERE a.e1 = b.e1 AND b.e1 = c.e1",  //$NON-NLS-1$
             FakeMetadataFactory.example1Cached(),
@@ -1817,7 +1808,7 @@
         });                                    
     }
     
-    public void testPushSelfJoin1() {
+    @Test public void testPushSelfJoin1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -1838,7 +1829,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
 
-    public void testPushSelfJoin2() {
+    @Test public void testPushSelfJoin2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -1874,7 +1865,7 @@
         });                                    
     }
         
-    public void testPushOuterJoin1() {
+    @Test public void testPushOuterJoin1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -1894,7 +1885,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
 
-    public void testPushOuterJoin2() {
+    @Test public void testPushOuterJoin2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -1929,7 +1920,7 @@
     }
 
     // With join expression that can't be pushed
-    public void testPushOuterJoin3() {
+    @Test public void testPushOuterJoin3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -1966,7 +1957,7 @@
                                
     }
 
-    public void testPushGroupBy1() {
+    @Test public void testPushGroupBy1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -1983,7 +1974,7 @@
                                
     }
 
-    public void testPushGroupBy2() {
+    @Test public void testPushGroupBy2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2001,7 +1992,7 @@
                                
     }
 
-    public void testPushGroupBy3() {
+    @Test public void testPushGroupBy3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
@@ -2033,7 +2024,7 @@
                                
     }
 
-    public void testPushGroupBy4() {
+    @Test public void testPushGroupBy4() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2066,7 +2057,7 @@
                                
     }
     
-    public void testPushHaving1() {
+    @Test public void testPushHaving1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2084,7 +2075,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                                  
     }
 
-    public void testPushHaving2() {
+    @Test public void testPushHaving2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
@@ -2115,7 +2106,7 @@
         });                                                                  
     }
 
-    public void testPushHaving3() {
+    @Test public void testPushHaving3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2147,7 +2138,7 @@
         });                                                                  
     }
 
-    public void testPushAggregate1() {
+    @Test public void testPushAggregate1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2164,7 +2155,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                                  
     }
     
-    public void testPushAggregate2() {
+    @Test public void testPushAggregate2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2181,7 +2172,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                                  
     }
 
-    public void testPushAggregate3() {
+    @Test public void testPushAggregate3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2198,7 +2189,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                                  
     }
 
-    public void testPushAggregate4() {
+    @Test public void testPushAggregate4() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
@@ -2220,7 +2211,7 @@
     /**
      * Can't push aggs due to not being able to push COUNT in the HAVING clause.
      */
-    public void testPushAggregate5() {
+    @Test public void testPushAggregate5() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
@@ -2257,7 +2248,7 @@
     /**
      * Can't push aggs due to not being able to push function inside the aggregate
      */
-    public void testPushAggregate6() {
+    @Test public void testPushAggregate6() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2292,7 +2283,7 @@
     /**
      * Can't push aggs due to not being able to push function inside having
      */
-    public void testPushAggregate7() {
+    @Test public void testPushAggregate7() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -2327,7 +2318,7 @@
     /**
      * BQT query that is failing
      */
-    public void testPushAggregate8() {
+    @Test public void testPushAggregate8() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2357,7 +2348,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                                  
     }
     
-    public void testQueryManyJoin() throws Exception { 
+    @Test public void testQueryManyJoin() throws Exception { 
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 JOIN ((pm1.g2 JOIN pm1.g3 ON pm1.g2.e1=pm1.g3.e1) JOIN pm1.g4 ON pm1.g3.e1=pm1.g4.e1) ON pm1.g1.e1=pm1.g4.e1",  //$NON-NLS-1$
             metadata,
@@ -2365,7 +2356,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
     
-    public void testPushSelectDistinct() { 
+    @Test public void testPushSelectDistinct() { 
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         ProcessorPlan plan = helpPlan("SELECT DISTINCT e1 FROM pm3.g1",  //$NON-NLS-1$
             metadata,
@@ -2373,7 +2364,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);         
     }
 
-    public void testPushFunctionInCriteria1() {
+    @Test public void testPushFunctionInCriteria1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2393,7 +2384,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
 
-    public void testPushFunctionInSelect1() {
+    @Test public void testPushFunctionInSelect1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2415,7 +2406,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
 
-    public void testPushFunctionInSelect2() {
+    @Test public void testPushFunctionInSelect2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2437,7 +2428,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
     
-    public void testPushFunctionInSelect3() {
+    @Test public void testPushFunctionInSelect3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2473,7 +2464,7 @@
         });                                    
     }    
 
-    public void testPushFunctionInSelect4() {
+    @Test public void testPushFunctionInSelect4() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2495,7 +2486,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }    
 
-    public void testPushFunctionInSelect5() {
+    @Test public void testPushFunctionInSelect5() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2517,7 +2508,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }    
 
-    public void testPushFunctionInSelect6_defect_10081() {
+    @Test public void testPushFunctionInSelect6_defect_10081() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setFunctionSupport("upper", true); //$NON-NLS-1$
@@ -2552,7 +2543,7 @@
         });                                    
     }
             
-    public void testPushFunctionInSelectWithOrderBy1() {
+    @Test public void testPushFunctionInSelectWithOrderBy1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2576,7 +2567,7 @@
     }
 
     /** defect 13336 */
-    public void testPushFunctionInSelectWithOrderBy1a() {
+    @Test public void testPushFunctionInSelectWithOrderBy1a() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2600,7 +2591,7 @@
     }    
     
     /** defect 13336 */
-    public void testPushFunctionInSelectWithOrderBy2() {
+    @Test public void testPushFunctionInSelectWithOrderBy2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2623,7 +2614,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
     
-    public void testPushFunctionInJoin1() {
+    @Test public void testPushFunctionInJoin1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2645,7 +2636,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }    
 
-    public void testPushFunctionInJoin2() {
+    @Test public void testPushFunctionInJoin2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2683,7 +2674,7 @@
         });                                    
     }    
 
-    public void testPushFunctionInJoin3() {
+    @Test public void testPushFunctionInJoin3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -2721,7 +2712,7 @@
         });                                    
     }    
 
-    public void testUnionOverFunctions() {
+    @Test public void testUnionOverFunctions() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2760,7 +2751,7 @@
         });                                    
     }    
 
-    public void testDefect9827() { 
+    @Test public void testDefect9827() { 
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleBQTCached();
         
         ProcessorPlan plan = helpPlan("SELECT intkey, c FROM (SELECT DISTINCT b.intkey, b.intnum, a.stringkey AS c FROM bqt1.smalla AS a, bqt1.smallb AS b WHERE a.INTKEY = b.INTKEY) AS x ORDER BY x.intkey", metadata, //$NON-NLS-1$
@@ -2789,7 +2780,7 @@
      * but instead is cleaned up properly later
      * See defect 9865
      */
-    public void testCrossJoinNoElementCriteriaOptimization2() {
+    @Test public void testCrossJoinNoElementCriteriaOptimization2() {
         ProcessorPlan plan = helpPlan("select Y.e1, Y.e2 FROM vm1.g1 X, vm1.g1 Y where {b'true'} = {b'true'}", example1(),  //$NON-NLS-1$
             new String[]{"SELECT g1__1.e1 FROM pm1.g1 AS g1__1", "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"}); //$NON-NLS-1$ //$NON-NLS-2$
         checkNodeTypes(plan, new int[] {
@@ -2813,7 +2804,7 @@
     /**
      * <p>This tests that a SELECT node with no groups is not pushed down without the capability to have a subquery in the where clause.
      */
-    public void testCrossJoinNoElementCriteriaOptimization3() {
+    @Test public void testCrossJoinNoElementCriteriaOptimization3() {
         ProcessorPlan plan = helpPlan("select Y.e1, Y.e2 FROM vm1.g1 X, vm1.g1 Y where {b'true'} in (select e3 FROM vm1.g1)", example1(),  //$NON-NLS-1$
             new String[]{"SELECT g1__1.e1 FROM pm1.g1 AS g1__1", "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"}); //$NON-NLS-1$ //$NON-NLS-2$
         checkNodeTypes(plan, new int[] {
@@ -2837,7 +2828,7 @@
     /**
      * <p>This tests that a SELECT node with no groups is pushed down.
      */
-    public void testCrossJoinNoElementCriteriaOptimization4() {
+    @Test public void testCrossJoinNoElementCriteriaOptimization4() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -2867,7 +2858,7 @@
     /**
      * Criteria should be copied across this join
      */
-    public void testCopyCriteriaWithOuterJoin_defect10050(){
+    @Test public void testCopyCriteriaWithOuterJoin_defect10050(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1 left outer join pm2.g2 on pm2.g1.e1=pm2.g2.e1 where pm2.g1.e1 IN ('a', 'b')", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1, pm2.g2.e1 FROM pm2.g1 LEFT OUTER JOIN pm2.g2 ON pm2.g1.e1 = pm2.g2.e1 AND pm2.g2.e1 IN ('a', 'b') WHERE pm2.g1.e1 IN ('a', 'b')" }); //$NON-NLS-1$
@@ -2877,7 +2868,7 @@
     /**
      * Criteria should be copied across this join
      */
-    public void testCopyCriteriaWithOuterJoin2_defect10050(){
+    @Test public void testCopyCriteriaWithOuterJoin2_defect10050(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1 left outer join pm2.g2 on pm2.g1.e1=pm2.g2.e1 and pm2.g1.e2=pm2.g2.e2 where pm2.g1.e1 = 'a' and pm2.g1.e2 = 1", example1(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1, g_1.e1 FROM pm2.g1 AS g_0 LEFT OUTER JOIN pm2.g2 AS g_1 ON g_0.e1 = g_1.e1 AND g_0.e2 = g_1.e2 AND g_1.e2 = 1 AND g_1.e1 = 'a' WHERE (g_0.e1 = 'a') AND (g_0.e2 = 1)" }); //$NON-NLS-1$
@@ -2887,7 +2878,7 @@
     /**
      * See also case 2912.
      */
-    public void testCopyCriteriaWithOuterJoin5_defect10050(){
+    @Test public void testCopyCriteriaWithOuterJoin5_defect10050(){
         
         ProcessorPlan plan = helpPlan(
             "select pm2.g1.e1, pm2.g2.e1, pm2.g3.e1 from ( (pm2.g1 right outer join pm2.g2 on pm2.g1.e1=pm2.g2.e1) right outer join pm2.g3 on pm2.g2.e1=pm2.g3.e1) where pm2.g3.e1 = 'a'", example1(), //$NON-NLS-1$
@@ -2898,7 +2889,7 @@
     /**
      * 
      */
-    public void testCopyCriteriaWithOuterJoin6_defect10050(){
+    @Test public void testCopyCriteriaWithOuterJoin6_defect10050(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1 left outer join pm2.g2 on pm2.g2.e1=pm2.g1.e1 where pm2.g1.e1 IN ('a', 'b')", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1, pm2.g2.e1 FROM pm2.g1 LEFT OUTER JOIN pm2.g2 ON pm2.g2.e1 = pm2.g1.e1 AND pm2.g2.e1 IN ('a', 'b') WHERE pm2.g1.e1 IN ('a', 'b')" }); //$NON-NLS-1$
@@ -2908,28 +2899,28 @@
     /**
      * Same as previous test, only right outer join
      */
-    public void testCopyCriteriaWithOuterJoin7_defect10050(){
+    @Test public void testCopyCriteriaWithOuterJoin7_defect10050(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1 right outer join pm2.g2 on pm2.g2.e1=pm2.g1.e1 where pm2.g2.e1 IN ('a', 'b')", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1, pm2.g2.e1 FROM pm2.g2 LEFT OUTER JOIN pm2.g1 ON pm2.g2.e1 = pm2.g1.e1 AND pm2.g1.e1 IN ('a', 'b') WHERE pm2.g2.e1 IN ('a', 'b')" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN);         
     }         
     
-    public void testCleanCriteria(){
+    @Test public void testCleanCriteria(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1, pm2.g2 where pm2.g1.e1=pm2.g2.e1 and pm2.g1.e2 IN (1, 2)", example1(), //$NON-NLS-1$
             new String[] { "SELECT pm2.g1.e1, pm2.g2.e1 FROM pm2.g1, pm2.g2 WHERE (pm2.g1.e1 = pm2.g2.e1) AND (pm2.g1.e2 IN (1, 2))" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN);         
     }
 
-    public void testCleanCriteria2(){
+    @Test public void testCleanCriteria2(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1, pm2.g2 where pm2.g1.e1=pm2.g2.e1 and pm2.g1.e1 = 'a'", example1(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1, g_1.e1 FROM pm2.g1 AS g_0, pm2.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = 'a') AND (g_1.e1 = 'a')" }); //$NON-NLS-1$
         checkNodeTypes(plan, FULL_PUSHDOWN);         
     }
 
-    public void testCleanCriteria3(){
+    @Test public void testCleanCriteria3(){
         
         ProcessorPlan plan = helpPlan("select pm2.g1.e1, pm2.g2.e1 from pm2.g1 inner join pm2.g2 on pm2.g1.e1=pm2.g2.e1 where pm2.g1.e1 = 'a'", example1(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1, g_1.e1 FROM pm2.g1 AS g_0, pm2.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = 'a') AND (g_1.e1 = 'a')" }); //$NON-NLS-1$
@@ -2937,7 +2928,7 @@
     }
     
     
-    public void testPushSubqueryInWhereClause1() {
+    @Test public void testPushSubqueryInWhereClause1() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
@@ -2949,7 +2940,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
 
-    public void testPushSubqueryInWhereClause2() {
+    @Test public void testPushSubqueryInWhereClause2() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
@@ -2966,7 +2957,7 @@
     /**
      * Check that subquery is pushed if the subquery selects a function that is pushed
      */
-    public void testPushSubqueryInWhereClause3() {
+    @Test public void testPushSubqueryInWhereClause3() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -2985,7 +2976,7 @@
     /**
      * Check that subquery is pushed if the subquery selects an aliased function that is pushed
      */
-    public void testPushSubqueryInWhereClause4() {
+    @Test public void testPushSubqueryInWhereClause4() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -3003,7 +2994,7 @@
     }   
 
     /** Case 1456, defect 10492*/
-    public void testAliasingDefect1(){
+    @Test public void testAliasingDefect1(){
         // Create query
         String sql = "SELECT e1 FROM vm1.g1 X WHERE e2 = (SELECT MAX(e2) FROM vm1.g1 Y WHERE X.e1 = Y.e1)";//$NON-NLS-1$
 
@@ -3026,7 +3017,7 @@
     }   
 
     /** Case 1456, defect 10492*/
-    public void testAliasingDefect2(){
+    @Test public void testAliasingDefect2(){
         // Create query
         String sql = "SELECT X.e1 FROM vm1.g1 X, vm1.g1 Z WHERE X.e2 = (SELECT MAX(e2) FROM vm1.g1 Y WHERE X.e1 = Y.e1 AND Y.e2 = Z.e2) AND X.e1 = Z.e1";//$NON-NLS-1$
 
@@ -3051,7 +3042,7 @@
     }   
 
     /** Case 1456, defect 10492*/
-    public void testAliasingDefect3(){
+    @Test public void testAliasingDefect3(){
         // Create query
         String sql = "SELECT X.e1 FROM pm1.g2, vm1.g1 X WHERE X.e2 = ANY (SELECT MAX(e2) FROM vm1.g1 Y WHERE X.e1 = Y.e1) AND X.e1 = pm1.g2.e1";//$NON-NLS-1$
 
@@ -3077,7 +3068,7 @@
     }
         
     /** Should use merge join since neither access node is "strong" - order by's pushed to source */
-    public void testUseMergeJoin3(){
+    @Test public void testUseMergeJoin3(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
 
@@ -3114,7 +3105,7 @@
     }    
 
     /** Model supports order by, should be pushed to the source */
-    public void testUseMergeJoin4(){
+    @Test public void testUseMergeJoin4(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
 
@@ -3153,7 +3144,7 @@
     } 
 
     /** Should use merge join, since costs are not known, neither access node is "strong" */
-    public void testUseMergeJoin5_CostsNotKnown(){
+    @Test public void testUseMergeJoin5_CostsNotKnown(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
 
@@ -3187,7 +3178,7 @@
     }
     
     /** one side of join supports order by, the other doesn't*/
-    public void testUseMergeJoin7(){
+    @Test public void testUseMergeJoin7(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE pm1.g1.e1 = pm2.g2.e1";//$NON-NLS-1$
 
@@ -3228,7 +3219,7 @@
     }     
 
     /** reverse of testUseMergeJoin7 */
-    public void testUseMergeJoin7a(){
+    @Test public void testUseMergeJoin7a(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE pm1.g1.e1 = pm2.g2.e1";//$NON-NLS-1$
 
@@ -3269,7 +3260,7 @@
     }   
 
     /** function on one side of join should prevent order by from being pushed down*/
-    public void testUseMergeJoin8(){
+    @Test public void testUseMergeJoin8(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE concat(pm1.g1.e1, 'x') = pm2.g2.e1";//$NON-NLS-1$
 
@@ -3311,7 +3302,7 @@
     }
 
     /** Model supports order by, functions in join criteria */
-    public void testUseMergeJoin9(){
+    @Test public void testUseMergeJoin9(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE concat(pm1.g1.e1, 'x') = concat(pm1.g2.e1, 'x')";//$NON-NLS-1$
 
@@ -3352,7 +3343,7 @@
     } 
 
     /** should be one dependent join */
-    public void testMultiMergeJoin1(){
+    @Test public void testMultiMergeJoin1(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3 WHERE pm1.g1.e1 = pm1.g2.e1 AND pm1.g2.e1 = pm1.g3.e1";//$NON-NLS-1$
 
@@ -3393,7 +3384,7 @@
         });         
     } 
 
-    public void testLargeSetCriteria() {
+    @Test public void testLargeSetCriteria() {
         //      Create query
         String sql = "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA INNER JOIN BQT2.SmallB ON BQT1.SmallA.IntKey = BQT2.SmallB.IntKey WHERE BQT1.SmallA.IntKey IN (1,2,3,4,5)";     //$NON-NLS-1$
 
@@ -3427,7 +3418,7 @@
         });            
     }
     
-    public void testMergeJoin_defect11236(){
+    @Test public void testMergeJoin_defect11236(){
         // Create query
         String sql = "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA, BQT1.SmallB WHERE BQT1.SmallA.IntKey = (BQT1.SmallB.IntKey + 1)";     //$NON-NLS-1$
 
@@ -3464,7 +3455,7 @@
         });         
     }
         
-    public void testNoFrom() { 
+    @Test public void testNoFrom() { 
         ProcessorPlan plan = helpPlan("SELECT 1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] {} ); 
 
@@ -3486,7 +3477,7 @@
         });                                    
     }
 
-    public void testINCriteria_defect10718(){
+    @Test public void testINCriteria_defect10718(){
         // Create query
         String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
 
@@ -3528,7 +3519,7 @@
         });         
     }
     
-    public void testDefect10711(){
+    @Test public void testDefect10711(){
         ProcessorPlan plan = helpPlan("SELECT * from vm1.g1a as X", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] {"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
 
@@ -3537,7 +3528,7 @@
     }
     
     // SELECT 5, SUM(IntKey) FROM BQT1.SmallA
-    public void testAggregateNoGroupByWithExpression() {
+    @Test public void testAggregateNoGroupByWithExpression() {
         ProcessorPlan plan = helpPlan("SELECT 5, SUM(IntKey) FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] { "SELECT IntKey FROM BQT1.SmallA"  }); //$NON-NLS-1$
 
@@ -3560,7 +3551,7 @@
     }
     
     /** defect 11630 - note that the lookup function is not pushed down, it will actually be evaluated before being sent to the connector */
-    public void testLookupFunction() {
+    @Test public void testLookupFunction() {
 
         ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1', 'e1', 'e2', 1) IS NULL"  }); //$NON-NLS-1$
@@ -3570,7 +3561,7 @@
     }
     
     /** case 5213 - note here that the lookup cannot be pushed down since it is dependent upon an element symbol*/
-    public void testLookupFunction2() throws Exception {
+    @Test public void testLookupFunction2() throws Exception {
 
         ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', e2) IS NULL", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT g_0.e2, g_0.e1 FROM pm1.g2 AS g_0"  }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -3595,7 +3586,7 @@
     }
     
     /** defect 21965 */
-    public void testLookupFunctionInSelect() {
+    @Test public void testLookupFunctionInSelect() {
         ProcessorPlan plan = helpPlan("SELECT e1, LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT e1, LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2"  }); //$NON-NLS-1$
 
@@ -3603,7 +3594,7 @@
     }
     
     // SELECT * FROM (SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT DISTINCT IntNum FROM BQT1.SmallA) AS x WHERE IntKey = 0
-    public void testCase1649() {
+    @Test public void testCase1649() {
         ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT DISTINCT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA) AS x WHERE IntKey = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] { "SELECT DISTINCT IntKey FROM BQT1.SmallA WHERE IntKey = 0", "SELECT IntNum FROM BQT1.SmallA WHERE IntNum = 0"  }); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -3625,7 +3616,7 @@
         });                                    
     }   
 
-    public void testDefect12298() throws Exception {      
+    @Test public void testDefect12298() throws Exception {      
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -3666,7 +3657,7 @@
     }
     
     // SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0
-    public void testCase1727_1() {
+    @Test public void testCase1727_1() {
         ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] { 
                 "SELECT IntKey, IntNum FROM BQT1.SmallA WHERE IntNum = 0", //$NON-NLS-1$
@@ -3691,7 +3682,7 @@
     }
 
     // SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0
-    public void testCase1727_2() {
+    @Test public void testCase1727_2() {
         ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntKey b FROM BQT1.SmallA UNION ALL SELECT IntKey, IntNum FROM BQT1.SmallA) as x WHERE b = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] { 
                 "SELECT IntKey, IntNum FROM BQT1.SmallA WHERE IntNum = 0", //$NON-NLS-1$
@@ -3715,7 +3706,7 @@
         });                                    
     }
     
-    public void testCountStarOverSelectDistinct() {
+    @Test public void testCountStarOverSelectDistinct() {
         ProcessorPlan plan = helpPlan("SELECT COUNT(*) FROM (SELECT DISTINCT IntNum, Intkey FROM bqt1.smalla) AS x", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
                                       new String[] { 
                                           "SELECT DISTINCT IntNum, Intkey FROM bqt1.smalla" }); //$NON-NLS-1$ 
@@ -3739,14 +3730,14 @@
     }
 
     //virtual group with two elements. One selectable, one not
-    public void testVirtualGroup1() {
+    @Test public void testVirtualGroup1() {
         ProcessorPlan plan = helpPlan("select e2 from vm1.g35", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] { "SELECT e2 FROM pm1.g1" } ); //$NON-NLS-1$
 
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);     
     }
     
-    public void testBQT9500_126() {
+    @Test public void testBQT9500_126() {
         String sql = "SELECT IntKey, LongNum, expr FROM (SELECT IntKey, LongNum, concat(LongNum, 'abc') FROM BQT2.SmallA ) AS x ORDER BY IntKey"; //$NON-NLS-1$
         ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), 
                                       new String[] { 
@@ -3837,39 +3828,39 @@
     /**
      * Query has union but no order by and no capabilities.
      */
-    public void testUnionPushdown1() {
+    @Test public void testUnionPushdown1() {
         helpTestUnionPushdown(false, false, false);
     }
 
     /**
      * Query has union but no order by and only union capability.
      */
-    public void testUnionPushdown2() {
+    @Test public void testUnionPushdown2() {
         helpTestUnionPushdown(false, true, false);
     }
 
     /**
      * Query has union with order by and no capabilities.
      */
-    public void testUnionPushdown3() {
+    @Test public void testUnionPushdown3() {
         helpTestUnionPushdown(true, false, false);
     }
 
     /**
      * Query has union with order by and just union capability.
      */
-    public void testUnionPushdown4() {
+    @Test public void testUnionPushdown4() {
         helpTestUnionPushdown(true, true, false);
     }
 
     /**
      * Query has union with order by and both capabilities.
      */
-    public void testUnionPushdown5() {
+    @Test public void testUnionPushdown5() {
         helpTestUnionPushdown(true, true, true);
     }
 
-    public void testUnionPushdownWithSelectNoFrom() {        
+    @Test public void testUnionPushdownWithSelectNoFrom() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -3899,7 +3890,7 @@
         });                                                   
     }
 
-    public void testUnionPushdownWithSelectNoFromFirstBranch() {        
+    @Test public void testUnionPushdownWithSelectNoFromFirstBranch() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -3929,7 +3920,7 @@
         });                                                   
     }
 
-    public void testUnionPushdownWithSelectNoFromSecondBranch() {        
+    @Test public void testUnionPushdownWithSelectNoFromSecondBranch() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -3959,7 +3950,7 @@
         });                                                   
     }
     
-    public void testUnionPushdownMultipleBranches() {        
+    @Test public void testUnionPushdownMultipleBranches() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -3976,7 +3967,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
     
-    public void testUnionPushdownMultipleBranchesMixedModels1() {        
+    @Test public void testUnionPushdownMultipleBranchesMixedModels1() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4009,7 +4000,7 @@
         });                                                   
     }
     
-    public void testUnionPushdownMultipleBranchesNoDupRemoval() {        
+    @Test public void testUnionPushdownMultipleBranchesNoDupRemoval() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4026,7 +4017,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
     
-    public void testAggregateOverUnionPushdown() {        
+    @Test public void testAggregateOverUnionPushdown() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4058,7 +4049,7 @@
         });                                                   
     }
 
-    public void testUnionPushdownWithFunctionsAndAliases() {        
+    @Test public void testUnionPushdownWithFunctionsAndAliases() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -4077,7 +4068,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
     
-    public void testUnionPushdownWithInternalOrderBy() {        
+    @Test public void testUnionPushdownWithInternalOrderBy() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4096,7 +4087,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }    
 
-    public void testUnionPushdownWithInternalDistinct() {        
+    @Test public void testUnionPushdownWithInternalDistinct() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4117,7 +4108,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     } 
     
-    public void testUnionNoAllPushdownInInlineView() {        
+    @Test public void testUnionNoAllPushdownInInlineView() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -4151,7 +4142,7 @@
         });                                                   
     }
 
-    public void testUnionAllPushdownInInlineView() {        
+    @Test public void testUnionAllPushdownInInlineView() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4169,7 +4160,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
 
-    public void testUnionAllPushdownVirtualGroup() {        
+    @Test public void testUnionAllPushdownVirtualGroup() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -4188,7 +4179,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
 
-    public void testUnionAllPushdownVirtualGroup2() {        
+    @Test public void testUnionAllPushdownVirtualGroup2() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4205,7 +4196,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
 
-    public void testUnionAllPushdownVirtualGroup3() {        
+    @Test public void testUnionAllPushdownVirtualGroup3() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4239,7 +4230,7 @@
     }
 
     // Allow pushing literals
-    public void testUnionAllPushdownVirtualGroup4() {        
+    @Test public void testUnionAllPushdownVirtualGroup4() {        
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -4258,7 +4249,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                                   
     }
 
-    public void testPushCaseInSelect() {
+    @Test public void testPushCaseInSelect() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -4267,8 +4258,7 @@
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        // Add join capability to pm1
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
          
         ProcessorPlan plan = helpPlan(
             "SELECT CASE WHEN e1 = 'a' THEN 10 ELSE 0 END FROM pm1.g1",  //$NON-NLS-1$
@@ -4280,15 +4270,14 @@
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);                                    
     }
     
-    public void testCantPushCaseInSelectWithFunction() {
+    @Test public void testCantPushCaseInSelectWithFunction() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
         caps.setCapabilitySupport(Capability.QUERY_CASE, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        // Add join capability to pm1
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
          
         ProcessorPlan plan = helpPlan(
             "SELECT CASE e1 WHEN 'a' THEN 10 ELSE (e2+0) END FROM pm1.g1",  //$NON-NLS-1$
@@ -4315,7 +4304,7 @@
         });                                    
     }
 
-    public void testPushSearchedCaseInSelect() {
+    @Test public void testPushSearchedCaseInSelect() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -4323,8 +4312,7 @@
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        // Add join capability to pm1
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
          
         ProcessorPlan plan = helpPlan(
             "SELECT CASE WHEN e1 = 'a' THEN 10 ELSE 0 END FROM pm1.g1",  //$NON-NLS-1$
@@ -4336,15 +4324,14 @@
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);                                    
     }
 
-    public void testCantPushSearchedCaseInSelectWithFunction() {
+    @Test public void testCantPushSearchedCaseInSelectWithFunction() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        // Add join capability to pm1
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
          
         ProcessorPlan plan = helpPlan(
             "SELECT CASE WHEN e1 = 'a' THEN 10 ELSE (e2+0) END FROM pm1.g1",  //$NON-NLS-1$
@@ -4371,7 +4358,7 @@
         });                                    
     }
 
-    public void testPushdownFunctionNotEvaluated() {
+    @Test public void testPushdownFunctionNotEvaluated() {
         FakeFunctionMetadataSource.setupFunctionLibrary();
         
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -4394,7 +4381,7 @@
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);                                    
     }
 
-    public void testNoSourceQuery() {
+    @Test public void testNoSourceQuery() {
         ProcessorPlan plan = helpPlan("SELECT * FROM (select parsetimestamp(x,'yyyy-MM-dd') as c1 from (select '2004-10-20' as x) as y) as z " +//$NON-NLS-1$ 
                                       "WHERE c1= '2004-10-20 00:00:00.0'", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
             new String[] {  }); 
@@ -4418,7 +4405,7 @@
     }
     
     /** defect 14510 */
-    public void testDefect14510LookupFunction() {
+    @Test public void testDefect14510LookupFunction() {
 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -4461,7 +4448,7 @@
     }    
 
     /** defect 14510 */
-    public void testDefect14510LookupFunction2() {
+    @Test public void testDefect14510LookupFunction2() {
 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -4505,7 +4492,7 @@
     }
 
     /** defect 14510 */
-    public void testDefect14510LookupFunction3() {
+    @Test public void testDefect14510LookupFunction3() {
 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -4548,7 +4535,7 @@
         });
     }    
     
-    public void testCase2125() throws Exception {
+    @Test public void testCase2125() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -4596,7 +4583,7 @@
                                     });
     }
     
-    public void testPushdownLiteralInSelectUnderAggregate() {  
+    @Test public void testPushdownLiteralInSelectUnderAggregate() {  
         String sql = "SELECT COUNT(*) FROM (SELECT '' AS y, a.IntKey FROM BQT1.SmallA a union all select '', b.intkey from bqt1.smallb b) AS x"; //$NON-NLS-1$
 
         // Plan query
@@ -4635,7 +4622,7 @@
                                     });
     }
 
-    public void testPushdownLiteralInSelectUnderAggregate2() {  
+    @Test public void testPushdownLiteralInSelectUnderAggregate2() {  
         String sql = "SELECT SUM(z) FROM (SELECT '' AS y, a.IntKey as z FROM BQT1.SmallA a union all select b.stringkey, 0 from bqt1.smallb b) AS x group by z"; //$NON-NLS-1$
 
         // Plan query
@@ -4674,7 +4661,7 @@
                                     });
     }
 
-    public void testPushdownLiteralInSelectUnderAggregate3() {  
+    @Test public void testPushdownLiteralInSelectUnderAggregate3() {  
         String sql = "SELECT code, SUM(ID) FROM (SELECT IntKey AS ID, '' AS Code FROM BQT1.SmallA union all select intkey, stringkey from bqt1.smallb b) AS x group by code"; //$NON-NLS-1$
 
         // Plan query
@@ -4713,7 +4700,7 @@
                                     });
     }
 
-    public void testPushdownLiteralInSelectWithOrderBy() {  
+    @Test public void testPushdownLiteralInSelectWithOrderBy() {  
         String sql = "SELECT 1, concat('a', 'b' ) AS X FROM BQT1.SmallA where intkey = 0 " +  //$NON-NLS-1$
             "UNION ALL " +  //$NON-NLS-1$
             "select 2, 'Hello2' from BQT1.SmallA where intkey = 1 order by X desc"; //$NON-NLS-1$
@@ -4736,7 +4723,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);
     }
     
-    public void testUpdateWithElement() {
+    @Test public void testUpdateWithElement() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -4754,7 +4741,7 @@
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }            
     
-    public void testCase2187() {
+    @Test public void testCase2187() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -4781,7 +4768,7 @@
         checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }        
     
-    public void testMultiUnionMergeVirtual() throws Exception {
+    @Test public void testMultiUnionMergeVirtual() throws Exception {
         String sql = "SELECT * FROM " +  //$NON-NLS-1$
             "(SELECT IntKey, 'a' AS s FROM (SELECT intkey, stringkey from BQT1.SmallA) as a union all " +  //$NON-NLS-1$
             "select IntKey, 'b' FROM (SELECT intkey, stringkey from BQT1.SmallA) as b union all " +  //$NON-NLS-1$
@@ -4806,7 +4793,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);        
     }
     
-    public void testDefect16848_groupAliasNotSupported_1() {
+    @Test public void testDefect16848_groupAliasNotSupported_1() {
         String sql = "SELECT sa.intkey, sa.objectvalue FROM bqt1.smalla AS sa WHERE (sa.intkey = 46) AND (sa.stringkey IN (46)) AND (sa.datevalue = (SELECT MAX(sb.datevalue) FROM bqt1.smalla AS sb WHERE (sb.intkey = sa.intkey) AND (sa.stringkey = sb.stringkey) ))"; //$NON-NLS-1$
 
         // Plan query
@@ -4845,7 +4832,7 @@
         ProcessorPlan subplan = (ProcessorPlan) subplans.iterator().next();
         
         // Collect atomic queries
-        Set actualQueries = getAtomicQueries(subplan);
+        Set<String> actualQueries = getAtomicQueries(subplan);
         
         // Compare atomic queries
         HashSet<String> expectedQueries = new HashSet<String>(Arrays.asList(new String[] { "SELECT bqt1.smalla.datevalue FROM bqt1.smalla WHERE (bqt1.smalla.intkey = bqt1.smalla.intkey) AND (bqt1.smalla.stringkey = bqt1.smalla.stringkey)"})); //$NON-NLS-1$
@@ -4870,7 +4857,7 @@
 
     }
 
-    public void testFunctionOfAggregate1() {
+    @Test public void testFunctionOfAggregate1() {
         String sql = "SELECT SUM(IntKey) + 1 AS x FROM BQT1.SmallA GROUP BY IntKey"; //$NON-NLS-1$
 
         // Plan query
@@ -4891,7 +4878,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);        
     }
 
-    public void testFunctionOfAggregateCantPush1() {
+    @Test public void testFunctionOfAggregateCantPush1() {
         String sql = "SELECT SUM(IntKey) + 1 AS x FROM BQT1.SmallA GROUP BY IntKey"; //$NON-NLS-1$
 
         // Plan query
@@ -4923,7 +4910,7 @@
                                     });        
     }
 
-    public void testFunctionOfAggregateCantPush3() {
+    @Test public void testFunctionOfAggregateCantPush3() {
         String sql = "SELECT avg(intkey) * 2 FROM BQT1.SmallA "; //$NON-NLS-1$
 
         // Plan query
@@ -5023,7 +5010,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);          
     }
     
-    public void testCase2589() throws Exception {  
+    @Test public void testCase2589() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
         
@@ -5032,7 +5019,7 @@
         helpTestCase2589(sql, expected);
     }     
 
-    public void testCase2589a() throws Exception {  
+    @Test public void testCase2589a() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589a ON MediumA.IntKey = SmallA_2589a.IntKey"; //$NON-NLS-1$
         
@@ -5040,7 +5027,7 @@
         helpTestCase2589(sql, expected);
     }    
 
-    public void testCase2589b() throws Exception {  
+    @Test public void testCase2589b() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey"; //$NON-NLS-1$
         
@@ -5048,7 +5035,7 @@
         helpTestCase2589(sql, expected);
     }     
     
-    public void testCase2589c() throws Exception {  
+    @Test public void testCase2589c() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumB, BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey " + //$NON-NLS-1$
                      "WHERE BQT1.MediumB.IntKey = BQT1.MediumA.IntKey"; //$NON-NLS-1$
@@ -5057,7 +5044,7 @@
         helpTestCase2589(sql, expected);
     }    
 
-    public void testCase2589d() throws Exception {  
+    @Test public void testCase2589d() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumB INNER JOIN " + //$NON-NLS-1$
                      "(BQT1.MediumA LEFT OUTER JOIN VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey) " + //$NON-NLS-1$
                      "ON BQT1.MediumB.IntKey = BQT1.MediumA.IntKey"; //$NON-NLS-1$
@@ -5066,7 +5053,7 @@
         helpTestCase2589(sql, expected);
     }     
     
-    public void testCase2589e() throws Exception {  
+    @Test public void testCase2589e() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumB LEFT OUTER JOIN " +  //$NON-NLS-1$
                      "(BQT1.MediumA LEFT OUTER JOIN VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey) " +  //$NON-NLS-1$
                      "ON BQT1.MediumB.IntKey = BQT1.MediumA.IntKey"; //$NON-NLS-1$
@@ -5075,7 +5062,7 @@
         helpTestCase2589(sql, expected);
     }     
     
-    public void testCase2589f() throws Exception {  
+    @Test public void testCase2589f() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumB LEFT OUTER JOIN " + //$NON-NLS-1$
                      "(BQT1.MediumA INNER JOIN VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey) " + //$NON-NLS-1$
                      "ON BQT1.MediumB.IntKey = BQT1.MediumA.IntKey"; //$NON-NLS-1$
@@ -5084,7 +5071,7 @@
         helpTestCase2589(sql, expected);
     }    
 
-    public void testCase2589g() throws Exception {  
+    @Test public void testCase2589g() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumB LEFT OUTER JOIN " + //$NON-NLS-1$ 
                      "(BQT1.MediumA INNER JOIN VQT.SmallA_2589c ON MediumA.IntKey = SmallA_2589c.IntKey) " + //$NON-NLS-1$ 
                      "ON BQT1.MediumB.IntKey = BQT1.MediumA.IntKey"; //$NON-NLS-1$
@@ -5097,7 +5084,7 @@
         helpTestCase2589(sql, expected);
     }    
     
-    public void testCase2589h() throws Exception {  
+    @Test public void testCase2589h() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN VQT.SmallA_2589c " + //$NON-NLS-1$ 
                      "ON MediumA.IntKey = SmallA_2589c.IntKey"; //$NON-NLS-1$
         
@@ -5105,7 +5092,7 @@
         helpTestCase2589(sql, expected);
     }
     
-    public void testCase2589i() throws Exception {  
+    @Test public void testCase2589i() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN VQT.SmallA_2589d " + //$NON-NLS-1$ 
                      "ON MediumA.IntKey = SmallA_2589d.IntKey"; //$NON-NLS-1$
         
@@ -5116,7 +5103,7 @@
     /**
      * Test optimization doesn't happen if an outer join isn't involved 
      */
-    public void testCase2589j() throws Exception {  
+    @Test public void testCase2589j() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA INNER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
         
@@ -5128,7 +5115,7 @@
     /**
      * Test optimization doesn't happen if an outer join isn't involved 
      */
-    public void testCase2589k() throws Exception {  
+    @Test public void testCase2589k() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA INNER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey"; //$NON-NLS-1$
 
@@ -5141,7 +5128,7 @@
     /**
      * Same as testCase2589 except right outer join
      */
-    public void testCase2589l() throws Exception {  
+    @Test public void testCase2589l() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM VQT.SmallA_2589 RIGHT OUTER JOIN " + //$NON-NLS-1$
                      "BQT1.MediumA ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
         
@@ -5154,7 +5141,7 @@
      * Same as testCase2589 except full outer join - criteria "below" full outer join cannot be
      * raised into the join criteria, so basically the virtual groups cannot be merged in this test.
      */
-    public void testCase2589m() {  
+    @Test public void testCase2589m() {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM VQT.SmallA_2589 FULL OUTER JOIN " + //$NON-NLS-1$
                      "BQT1.MediumA ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
         
@@ -5169,7 +5156,7 @@
     /**
      * Same as testCase2589b except full outer join
      */
-    public void testCase2589n() {  
+    @Test public void testCase2589n() {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA FULL OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589b ON MediumA.IntKey = SmallA_2589b.IntKey"; //$NON-NLS-1$
         
@@ -5184,7 +5171,7 @@
     /**
      * Same as testCase2589 except with two virtual layers instead of one 
      */
-    public void testCase2589o() throws Exception {  
+    @Test public void testCase2589o() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589f ON MediumA.IntKey = SmallA_2589f.IntKey"; //$NON-NLS-1$
         
@@ -5196,7 +5183,7 @@
     /**
      * Same as testCase2589b except with two virtual layers instead of one 
      */
-    public void testCase2589p() throws Exception {  
+    @Test public void testCase2589p() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589g ON MediumA.IntKey = SmallA_2589g.IntKey"; //$NON-NLS-1$
         
@@ -5208,7 +5195,7 @@
      * Test 3 frames, where top frame has outer join, middle frame has inner join, and
      * bottom frame has criteria that must be made into join criteria.  
      */
-    public void testCase2589q() throws Exception {  
+    @Test public void testCase2589q() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589h ON MediumA.IntKey = SmallA_2589h.IntKey"; //$NON-NLS-1$
         
@@ -5220,7 +5207,7 @@
      * Similar to testCase2589b, except virtual transformation has criteria on an 
      * element from each physical table
      */
-    public void testCase2589r() throws Exception {  
+    @Test public void testCase2589r() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589i ON MediumA.IntKey = SmallA_2589i.IntKey"; //$NON-NLS-1$
         
@@ -5231,7 +5218,7 @@
     /**
      * Test user criteria that should NOT be moved into join clause 
      */
-    public void testCase2589s() throws Exception {  
+    @Test public void testCase2589s() throws Exception {  
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey " + //$NON-NLS-1$
                      "WHERE BQT1.MediumA.IntNum = 10"; //$NON-NLS-1$
@@ -5243,7 +5230,7 @@
     /**
      * Test user criteria that should NOT be moved into join clause 
      */
-    public void testCase2589t() throws Exception {  
+    @Test public void testCase2589t() throws Exception {  
         String sql = "SELECT z.IntKey FROM (SELECT IntKey FROM BQT1.MediumA WHERE BQT1.MediumA.IntNum = 10) as z " + //$NON-NLS-1$
                      "LEFT OUTER JOIN " + //$NON-NLS-1$
                      "VQT.SmallA_2589 ON z.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
@@ -5258,7 +5245,7 @@
      * that the same results are produced?  More specifically, where should the criteria
      * go - WHERE clause or FROM clause? 
      */
-    public void testCase2589u() throws Exception {  
+    @Test public void testCase2589u() throws Exception {  
         String sql = "SELECT z.IntKey FROM (SELECT IntKey FROM BQT1.MediumA WHERE IntNum = 10) as z " + //$NON-NLS-1$
                      "LEFT OUTER JOIN " + //$NON-NLS-1$
                      "(SELECT IntKey FROM BQT1.SmallA WHERE StringNum = '10') as y " + //$NON-NLS-1$
@@ -5272,7 +5259,7 @@
      * Same sql as testCase2589, but the model doesn't support outer joins, so 
      * case 2589 optimization shouldn't happen. 
      */
-    public void testCase2589v() {  
+    @Test public void testCase2589v() {  
 
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
         "VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
@@ -5324,7 +5311,7 @@
     /**
      * Same as previous testCase2589v, but with full outer join. 
      */
-    public void testCase2589w() {  
+    @Test public void testCase2589w() {  
 
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA FULL OUTER JOIN " + //$NON-NLS-1$
         "VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey"; //$NON-NLS-1$
@@ -5379,7 +5366,7 @@
      * to be put in the join criteria, not the where clause, of the second atomic
      * query, because in the user query it is on the inner side of an outer join.
      */
-    public void testCase2589x() throws Exception {  
+    @Test public void testCase2589x() throws Exception {  
 
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT2.SmallA INNER JOIN " + //$NON-NLS-1$
         "(BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
@@ -5469,7 +5456,7 @@
      *  MedB   MedA           
      * </pre>
      */
-    public void testCase2589y() throws Exception {  
+    @Test public void testCase2589y() throws Exception {  
         String sql = "SELECT L.IntKey, y.IntKey, z.IntKey " + //$NON-NLS-1$
                      "FROM (BQT1.MediumB as L LEFT OUTER JOIN " + //$NON-NLS-1$
                      "(SELECT IntKey FROM BQT1.MediumA as M WHERE M.IntNum = 4) as y ON y.IntKey = L.IntKey) " + //$NON-NLS-1$
@@ -5491,7 +5478,7 @@
      * to be put in the join criteria, not the where clause, of the second atomic
      * query, because in the user query it is on the inner side of an outer join.
      */
-    public void testCase2589z() {  
+    @Test public void testCase2589z() {  
 
         String sql = "SELECT BQT1.MediumA.IntKey FROM BQT2.SmallA INNER JOIN " + //$NON-NLS-1$
         "(BQT1.MediumA LEFT OUTER JOIN " + //$NON-NLS-1$
@@ -5548,7 +5535,7 @@
     /**
      * Union with multiple joins underneath 
      */
-    public void testCase2589aa() throws Exception {  
+    @Test public void testCase2589aa() throws Exception {  
         String sql = "SELECT * FROM (SELECT z.IntKey FROM (SELECT IntKey FROM BQT1.MediumA WHERE IntNum = 10) as z " + //$NON-NLS-1$
                      "LEFT OUTER JOIN " + //$NON-NLS-1$
                      "(SELECT IntKey FROM BQT1.SmallA WHERE StringNum = '10') as y " + //$NON-NLS-1$
@@ -5565,7 +5552,7 @@
     /**
      * Since can now guarantee unique select column names, it's ok to have repeated entries in the order by clause.
      */
-    public void testOrderByDuplicates() throws Exception {
+    @Test public void testOrderByDuplicates() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -5593,7 +5580,7 @@
     }
 
     //Test use of OrderBy with expression
-    public void testCase2507() {
+    @Test public void testCase2507() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -5623,7 +5610,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);
     }
     
-    public void testCase2507A() {
+    @Test public void testCase2507A() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -5652,7 +5639,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);
     }  
     
-    public void testCase2507B() {
+    @Test public void testCase2507B() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -5685,7 +5672,7 @@
      * RulePlanJoins does not initially allow the cross join push.
      * The subsequent RuleRaiseAccess does since we believe it was the intent of the user
      */
-    public void testPushCrossJoins() throws Exception {
+    @Test public void testPushCrossJoins() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -5712,7 +5699,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);        
     }
     
-    public void testCase3023() {
+    @Test public void testCase3023() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -5739,7 +5726,7 @@
                                       SHOULD_SUCCEED );
     }
     
-    public void testCase3367() {
+    @Test public void testCase3367() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         FakeMetadataFacade metadata = example1();
 
@@ -5763,7 +5750,7 @@
      * of a virtual table containing a join in it's transformation.  All virtual 
      * models use the same physical model pm1.
      */
-    public void testCase3778() throws Exception {
+    @Test public void testCase3778() throws Exception {
     	
     	FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
@@ -5775,7 +5762,7 @@
                 
         ProcessorPlan plan = helpPlan(
         		"select a.e1, b.e1 from vm2.g1 a, vm2.g1 b where a.e1 = b.e1 and a.e2 in (select e2 from vm1.g1)",  //$NON-NLS-1$
-        		metadata, null, capFinder, new String[] {"SELECT g_1.e1, g_3.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g1 AS g_2, pm1.g2 AS g_3 WHERE (g_2.e2 = g_3.e2) AND (g_0.e2 = g_1.e2) AND (g_1.e1 = g_3.e1) AND (g_1.e2 IN (SELECT g_4.e2 FROM pm1.g1 AS g_4))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+        		metadata, null, capFinder, new String[] {"SELECT g_0.e1, g_2.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g1 AS g_2, pm1.g2 AS g_3 WHERE (g_2.e2 = g_3.e2) AND (g_0.e2 = g_1.e2) AND (g_0.e1 = g_2.e1) AND (g_0.e2 IN (SELECT g_4.e2 FROM pm1.g1 AS g_4))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
 
         checkNodeTypes(plan, FULL_PUSHDOWN);    
         
@@ -5785,7 +5772,7 @@
     /** 
      * Ensures that order by expressions are not repeated when multiple criteria span a merge join 
      */ 
-    public void testCase3832() throws Exception { 
+    @Test public void testCase3832() throws Exception { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = new BasicSourceCapabilities(); 
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true); 
@@ -5815,7 +5802,7 @@
     /*
      * Functions containing exec statements should not be evaluated
      */
-    public void testDefect21972() { 
+    @Test public void testDefect21972() { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = new BasicSourceCapabilities(); 
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -5835,7 +5822,7 @@
              
     }
     
-    public void testExpressionSymbolPreservation() throws Exception { 
+    @Test public void testExpressionSymbolPreservation() throws Exception { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder(); 
         BasicSourceCapabilities caps = new BasicSourceCapabilities(); 
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true); 
@@ -5856,74 +5843,9 @@
                                       ComparisonMode.EXACT_COMMAND_STRING ); 
              
     } 
-    
-    public static FakeMetadataFacade createInlineViewMetadata(FakeCapabilitiesFinder capFinder) {
-        FakeMetadataFacade metadata = FakeMetadataFactory.exampleBQTCached();
-
-        BasicSourceCapabilities caps = getTypicalCapabilities();
-        caps.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
-        caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
-        caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
-        caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
-        caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
-        caps.setCapabilitySupport(Capability.QUERY_UNION, true);
-        caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, true);
-        caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
-        caps.setFunctionSupport("concat", true); //$NON-NLS-1$
-        caps.setFunctionSupport("convert", true); //$NON-NLS-1$
-        caps.setFunctionSupport("case", true); //$NON-NLS-1$
-        caps.setFunctionSupport("+", true); //$NON-NLS-1$
-        capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
-        capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
-        
-        return metadata;
-    }
             
-    /**
-     * Order by's will be added to the atomic queries
-     */
-    public void testCrossSourceInlineView() throws Exception {
-        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
-        
-        ProcessorPlan plan = helpPlan("select * from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 inner join (select count(bqt2.smallb.intkey) as a, bqt2.smallb.intkey from bqt2.smallb group by bqt2.smallb.intkey) as q2 on q1.intkey = q2.intkey where q1.a = 1", //$NON-NLS-1$
-                metadata, null, capFinder, new String[] {"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt2.smallb AS g_0 GROUP BY g_0.intkey) AS v_0 ORDER BY c_0", //$NON-NLS-1$
-                                                         "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey HAVING COUNT(g_0.intkey) = 1) AS v_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
-
-        checkNodeTypes(plan, new int[] {
-                2,      // Access
-                0,      // DependentAccess
-                0,      // DependentSelect
-                0,      // DependentProject
-                0,      // DupRemove
-                0,      // Grouping
-                0,      // Join
-                1,      // MergeJoin
-                0,      // Null
-                0,      // PlanExecution
-                1,      // Project
-                0,      // Select
-                0,      // Sort
-                0       // UnionAll
-            });    
-            
-        checkSubPlanCount(plan, 0);
-    }
-    
-    public void testAliasPreservationWithInlineView() {
-        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
-        
-        ProcessorPlan plan = helpPlan("select q1.a + 1, q1.b from (select count(bqt1.smalla.intNum) as a, bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intNum, bqt1.smalla.intkey order by b) q1 where q1.a = 1", //$NON-NLS-1$
-                metadata, null, capFinder, new String[] {"SELECT (q1.a + 1), q1.b FROM (SELECT COUNT(bqt1.smalla.intNum) AS a, bqt1.smalla.intkey AS b FROM bqt1.smalla GROUP BY bqt1.smalla.intNum, bqt1.smalla.intkey HAVING COUNT(bqt1.smalla.intNum) = 1) AS q1"}, true); //$NON-NLS-1$
-
-        checkNodeTypes(plan, FULL_PUSHDOWN);    
-            
-        checkSubPlanCount(plan, 0);
-    }
-    
     //since this does not support convert, it should not be collapsed
-    public void testBadCollapseUnion() {
+    @Test public void testBadCollapseUnion() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -5954,8 +5876,8 @@
         
     }
     
-    public void testCase3966() {
-        ProcessorPlan plan = helpPlan("insert into vm1.g37 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )", FakeMetadataFactory.example1(), //$NON-NLS-1$
+    @Test public void testCase3966() {
+        ProcessorPlan plan = helpPlan("insert into vm1.g37 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
                                       new String[] {} ); 
 
         checkNodeTypes(plan, new int[] {
@@ -5981,7 +5903,7 @@
     /*
      * Select literals created by runtime evaluation should not be pushed down.
      */
-    public void testCase4017() throws Exception {
+    @Test public void testCase4017() throws Exception {
         
         String sql = "SELECT env('soap_host') AS HOST, intkey from bqt2.smalla"; //$NON-NLS-1$
         
@@ -5993,7 +5915,7 @@
      * Test of RuleCopyCriteria.  Criteria should NOT be copied across a join if the join has any other operator
      * other than an equality operator, but if the single group criteria is equality, then we can copy into a join criteria   
      */
-    public void testCase4265() throws Exception {
+    @Test public void testCase4265() throws Exception {
         String sql = "SELECT X.intkey, Y.intkey FROM BQT1.SmallA X, BQT1.SmallA Y WHERE X.IntKey <> Y.IntKey and Y.IntKey = 1"; //$NON-NLS-1$
 
         ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), 
@@ -6024,7 +5946,7 @@
      * Test of RuleCopyCriteria.  Criteria should be copied across a join only for an equality operator in
      * the join criteria.
      */
-    public void testCase4265ControlTest() throws Exception {
+    @Test public void testCase4265ControlTest() throws Exception {
         String sql = "SELECT X.intkey, Y.intkey FROM BQT1.SmallA X, BQT1.SmallA Y WHERE X.IntKey = Y.IntKey and Y.IntKey = 1"; //$NON-NLS-1$
 
         ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), 
@@ -6053,7 +5975,7 @@
     /**
      * The bug was in FrameUtil.convertCriteria() method, where ExistsCriteria was not being checked for. 
      */
-    public void testExistsCriteriaInSelect() {
+    @Test public void testExistsCriteriaInSelect() {
         String sql = "select intkey, case when exists (select stringkey from bqt1.smallb) then 'nuge' end as a from vqt.smalla"; //$NON-NLS-1$
 
         ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), 
@@ -6082,7 +6004,7 @@
     /**
      * Try substituting "is not null" for "exists" criteria 
      */
-    public void testScalarSubQueryInSelect() {
+    @Test public void testScalarSubQueryInSelect() {
         String sql = "select intkey, case when (select stringkey from bqt1.smallb) is not null then 'nuge' end as a from vqt.smalla"; //$NON-NLS-1$
 
         ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), 
@@ -6108,7 +6030,7 @@
         
     }
     
-    public void testCase4263() {
+    @Test public void testCase4263() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         FakeMetadataFacade metadata = example1();
         
@@ -6129,7 +6051,7 @@
         checkSubPlanCount(plan, 0);        
     }
     
-    public void testCase4263b() {
+    @Test public void testCase4263b() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         FakeMetadataFacade metadata = example1();
         
@@ -6165,7 +6087,7 @@
         checkSubPlanCount(plan, 1);        
     }
     
-    public void testCase4279() throws Exception {
+    @Test public void testCase4279() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         FakeMetadataFacade metadata = example1();
         
@@ -6187,7 +6109,7 @@
         checkSubPlanCount(plan, 0);        
     }
     
-    public void testCase4312() {
+    @Test public void testCase4312() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
@@ -6200,7 +6122,7 @@
 
     }    
     
-    public void testCase2507_2(){
+    @Test public void testCase2507_2(){
 
         String sql = "SELECT a FROM (SELECT concat(BQT1.SmallA.StringKey, BQT1.SmallA.StringNum) as a " +  //$NON-NLS-1$
                      "FROM BQT1.SmallA, BQT1.SmallB WHERE SmallA.IntKey = SmallB.IntKey) as X ORDER BY X.a"; //$NON-NLS-1$
@@ -6263,7 +6185,7 @@
     }
     
     //Test use of OrderBy with Alias
-    public void testCase2430D() {
+    @Test public void testCase2430D() {
         String sql = "SELECT bqt1.smalla.longnum + bqt1.smalla.longnum as c1234567890123456789012345678901234567890, " + //$NON-NLS-1$
                      "bqt1.smalla.doublenum as EXPR FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890, EXPR "; //$NON-NLS-1$
 
@@ -6276,7 +6198,7 @@
      * If expressionsymbol comparison would ignore expression names then this should just select a single column,
      * but for now it will select 2.
      */
-    public void testCase2430E() {
+    @Test public void testCase2430E() {
         String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as c1234567890123456789012345678901234567890, " + //$NON-NLS-1$
                      "CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS EXPR FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890, EXPR "; //$NON-NLS-1$
 
@@ -6285,7 +6207,7 @@
         helpTestCase2430and2507(sql, expected);
     }     
     
-    public void testCase2430G() {
+    @Test public void testCase2430G() {
         String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as c1234567890123456789012345678901234567890, " + //$NON-NLS-1$
                      "CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS EXPR FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890"; //$NON-NLS-1$
 
@@ -6294,7 +6216,7 @@
         helpTestCase2430and2507(sql, expected);
     }  
     
-    public void testCase2507_1(){
+    @Test public void testCase2507_1(){
 
         String sql = "SELECT a FROM (SELECT concat(BQT1.SmallA.StringKey, BQT1.SmallA.StringNum) as a " +  //$NON-NLS-1$
                      "FROM BQT1.SmallA) as X ORDER BY X.a"; //$NON-NLS-1$
@@ -6325,7 +6247,7 @@
      * This is taken from testPushCorrelatedSubquery1.  However this subquery is not expected to be pushed down since the correlated
      * reference expression cannot be evaluated by the source.
      */
-    public void testDefect23614() {
+    @Test public void testDefect23614() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -6366,7 +6288,7 @@
      * Normally the following queries would plan as if they were federated, but setting the connector_id source property
      * allows them to be planned as if they were the same source. 
      */
-    public void testSameConnector() {
+    @Test public void testSameConnector() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -6402,7 +6324,7 @@
     /**
      * Test changes to RuleCollapseSource for removing aliases 
      */
-    public void testCase4898() {
+    @Test public void testCase4898() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -6421,7 +6343,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN);                                    
     }
     
-    public void testDefect13971() {
+    @Test public void testDefect13971() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
@@ -6455,7 +6377,7 @@
     /**
      * Ensures that aliases are not stripped from projected symbols if they might conflict with an order by element
      */
-    public void testCase5067() {
+    @Test public void testCase5067() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -6473,7 +6395,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
         
-    public void testDontPushConvertObject() {
+    @Test public void testDontPushConvertObject() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -6508,7 +6430,7 @@
         });                                    
     }
     
-    public void testDontPushConvertClobToString() {
+    @Test public void testDontPushConvertClobToString() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
@@ -6543,7 +6465,7 @@
         });                                    
     }
     
-    public void testSelectIntoWithDistinct() throws Exception {
+    @Test public void testSelectIntoWithDistinct() throws Exception {
         String sql = "select distinct e1 into #temp from pm1.g1"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
@@ -6558,7 +6480,7 @@
     /**
      * previously the subqueries were being pushed too far and then not having the appropriate correlated references
      */
-    public void testCorrelatedSubqueryOverJoin() {
+    @Test public void testCorrelatedSubqueryOverJoin() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
@@ -6579,7 +6501,7 @@
     /**
      * see testSimpleCrossJoin3
      */
-    public void testMaxFromGroups() {
+    @Test public void testMaxFromGroups() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setSourceProperty(Capability.MAX_QUERY_FROM_GROUPS, new Integer(1));
@@ -6590,7 +6512,7 @@
                
     }
     
-    public void testCase6249() {
+    @Test public void testCase6249() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -6612,7 +6534,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
         
-    public void testCase6181() throws Exception {
+    @Test public void testCase6181() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -6651,7 +6573,7 @@
         }); 
     }
     
-    public void testCase6325() {
+    @Test public void testCase6325() {
         String sql = "select e1 into #temp from pm4.g1 where e1='1'"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
@@ -6660,20 +6582,8 @@
         
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
-    
-    public void testAliasCreationWithInlineView() {
-        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        FakeMetadataFacade metadata = createInlineViewMetadata(capFinder);
         
-        ProcessorPlan plan = helpPlan("select a, b from (select distinct count(intNum) a, count(stringKey), bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intkey) q1 order by q1.a", //$NON-NLS-1$
-                metadata, null, capFinder, new String[] {"SELECT a, b FROM (SELECT DISTINCT COUNT(intNum) AS a, COUNT(stringKey) AS count1, bqt1.smalla.intkey AS b FROM bqt1.smalla GROUP BY bqt1.smalla.intkey) AS q1 ORDER BY a"}, true); //$NON-NLS-1$
-
-        checkNodeTypes(plan, FULL_PUSHDOWN);    
-            
-        checkSubPlanCount(plan, 0);
-    }
-    
-    public void testCase6364() {
+    @Test public void testCase6364() {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
@@ -6690,7 +6600,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }
     
-    public void testExceptPushdown() throws Exception {
+    @Test public void testExceptPushdown() throws Exception {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_EXCEPT, true);
@@ -6704,7 +6614,7 @@
         checkNodeTypes(plan, FULL_PUSHDOWN); 
     }    
    
-    public void testCase6597() { 
+    @Test public void testCase6597() { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.CRITERIA_LIKE, true);
@@ -6735,7 +6645,7 @@
         }); 
     }
     
-    public void testCopyCriteriaWithIsNull() {
+    @Test public void testCopyCriteriaWithIsNull() {
     	String sql = "select * from (select a.intnum, a.intkey y, b.intkey from bqt1.smalla a, bqt2.smalla b where a.intkey = b.intkey) x where intkey is null"; //$NON-NLS-1$
     	
     	helpPlan(sql, FakeMetadataFactory.exampleBQT(), new String[] {});
@@ -6750,7 +6660,7 @@
      * <p>
      * SELECT * FROM pm1.g1 WHERE e2 BETWEEN 1 AND 2
      */
-    public void testBetween() { 
+    @Test public void testBetween() { 
         helpPlan("select * from pm1.g1 where e2 between 1 and 2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
     			new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE (e2 >= 1) AND (e2 <= 2)"} ); //$NON-NLS-1$
     }
@@ -6765,7 +6675,7 @@
      * <p>
      * SELECT CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END FROM pm1.g1
      */
-    public void testBetweenInCase() { 
+    @Test public void testBetweenInCase() { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
@@ -6787,7 +6697,7 @@
      * <p>
      * SELECT SUM(CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END) FROM pm1.g1
      */
-    public void testBetweenInCaseInSum() { 
+    @Test public void testBetweenInCaseInSum() { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
@@ -6812,7 +6722,7 @@
      * SELECT e1, SUM(CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END) 
      * FROM pm1.g1 GROUP BY e1
      */
-    public void testBetweenInCaseInSumWithGroupBy() { 
+    @Test public void testBetweenInCaseInSumWithGroupBy() { 
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
         caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
@@ -6826,6 +6736,108 @@
     			TestOptimizer.SHOULD_SUCCEED);
     }
 
-	private static final boolean DEBUG = false;
+    /**
+     * Test the query optimizer's ability to properly plan and optimize a query 
+     * that uses ambiguous alias names in the top level query and its sub-query.
+     * <p>
+     * No source table is being used.  For example, <code>SELECT A.e2 FROM 
+     * (SELECT e2 FROM (SELECT 1 AS e2) AS A) AS A</code>
+     * <p>
+     * The test is to ensure that A.e2 from the top level is not confused with 
+     * e2 in the second level.
+     * <p>
+     * Related Defects: JBEDSP-1137
+     */
+    @Test public void testAmbiguousAliasInSubQueryNoSource() {
+        // Create query
+    	String sql = "SELECT A.e2 AS e2 FROM (" + //$NON-NLS-1$
+    	"	SELECT e2 AS e2 FROM (" + //$NON-NLS-1$
+    	"		SELECT 5 AS e2" + //$NON-NLS-1$
+    	"	) AS A" + //$NON-NLS-1$
+    	") AS A"; //$NON-NLS-1$
 
+        helpPlan(sql, FakeMetadataFactory.example1(), new String[] {});
+    }
+         
+    /**
+     * Test the query optimizer's ability to properly plan and optimize a query 
+     * that uses ambiguous alias names in the top level query and its sub-query
+     * and uses columns belonging to the alias as a parameter to a function.
+     * <p>
+     * No source table is being used.  For example, <code>SELECT CONVERT(A.e2, 
+     * biginteger) AS e2 FROM (SELECT CONVERT(e2, long) AS e2 FROM (SELECT 1 AS 
+     * e2) AS A) AS A</code>
+     * <p>
+     * The test is to ensure that A.e2 from the top level is not confused with 
+     * e2 in the second level.
+     * <p>
+     * Related Defects: JBEDSP-1137
+     */
+    @Test public void testAmbiguousAliasFunctionInSubQueryNoSource() {
+        // Create query
+    	String sql = "SELECT CONVERT(A.e2, biginteger) AS e2 FROM (" + //$NON-NLS-1$
+    	"	SELECT CONVERT(e2, long) AS e2 FROM (" + //$NON-NLS-1$
+    	"		SELECT 5 AS e2" + //$NON-NLS-1$
+    	"	) AS A" + //$NON-NLS-1$
+    	") AS A"; //$NON-NLS-1$
+
+    	helpPlan(sql, FakeMetadataFactory.example1(), new String[] {});
+    }
+
+    /**
+     * Test the query optimizer's ability to properly plan and optimize a query 
+     * that uses ambiguous alias names in the top level query and its sub-query.
+     * <p>
+     * For example, <code>SELECT A.e2 FROM (SELECT e12FROM pm1.g1 AS A) AS A</code>
+     * <p>
+     * The test is to ensure that A.e2 from the top level is not confused with 
+     * e2 in the second level.
+     * <p>
+     * Related Defects: JBEDSP-1137
+     */
+    @Test public void testAmbiguousAliasInSubQuerySource() {
+        // Create query
+    	String sql = "SELECT A.e2 AS e2 FROM (" + //$NON-NLS-1$
+    	"   SELECT e2 AS e2 FROM pm1.g1 AS A" + //$NON-NLS-1$
+    	") AS A"; //$NON-NLS-1$
+
+        helpPlan(sql, FakeMetadataFactory.example1(), new String[] {"SELECT e2 FROM pm1.g1 AS A"}); //$NON-NLS-1$
+    }
+         
+    /**
+     * Test the query optimizer's ability to properly plan and optimize a query 
+     * that uses ambiguous alias names in the top level query and its sub-query
+     * and uses columns belonging to the alias as a parameter to a function.
+     * <p>
+     * For example, <code>SELECT CONVERT(A.e2, biginteger) AS e2 FROM (SELECT 
+     * CONVERT(e2, long) AS e2 FROM pm1.g1 AS A) AS A</code>
+     * <p>
+     * The test is to ensure that A.e2 from the top level is not confused with 
+     * e2 in the second level.
+     * <p>
+     * Related Defects: JBEDSP-1137
+     */
+    @Test public void testAmbiguousAliasFunctionInSubQuerySource() {
+        // Create query
+    	String sql = "SELECT CONVERT(A.e2, biginteger) AS e2 FROM (" + //$NON-NLS-1$
+    	"   SELECT CONVERT(e2, long) AS e2 FROM pm1.g1 AS A" + //$NON-NLS-1$
+    	") AS A"; //$NON-NLS-1$
+
+        helpPlan(sql, FakeMetadataFactory.example1(), new String[] {"SELECT e2 FROM pm1.g1 AS A"}); //$NON-NLS-1$
+
+        // Add convert capability to pm1 and try it again
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+        caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+        caps.setFunctionSupport("convert", true); //$NON-NLS-1$
+        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+        helpPlan(sql, metadata, null, capFinder,
+            new String[] {"SELECT CONVERT(CONVERT(e2, long), biginteger) FROM pm1.g1 AS A"}, //$NON-NLS-1$
+            SHOULD_SUCCEED );
+    }
+
+	public static final boolean DEBUG = false;
+
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -518,7 +518,7 @@
 		ProcessorPlan plan = TestOptimizer
 				.helpPlan(
 						"select distinct * from (SELECT pm1.g1.e3 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) order by e3 limit 10) x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
-						new String[] { "SELECT DISTINCT g_0.e3 AS c_0 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1 ORDER BY c_0" }); //$NON-NLS-1$
+						new String[] { "SELECT g_0.e3 AS c_0 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1 ORDER BY c_0" }); //$NON-NLS-1$
 
 		TestOptimizer.checkNodeTypes(plan, new int[] { 
 				1, // Access

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestStoredProcedurePlanning.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestStoredProcedurePlanning.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/TestStoredProcedurePlanning.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,19 +22,21 @@
 
 package com.metamatrix.query.optimizer;
 
-import junit.framework.TestCase;
+import org.junit.Ignore;
+import org.junit.Test;
 
 import com.metamatrix.query.metadata.TempMetadataAdapter;
 import com.metamatrix.query.metadata.TempMetadataStore;
 import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.unittest.FakeMetadataFactory;
 
-public class TestStoredProcedurePlanning extends TestCase {
+public class TestStoredProcedurePlanning {
     
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 1a
      */
-    public void testStoredQuery1() {
+	@Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery1() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -44,7 +46,8 @@
     /**
      * Test planning stored queries
      */
-    public void testStoredQuery2() {
+	@Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery2() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -53,19 +56,20 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 1b
      */
-    public void testStoredQuery3() {
+	@Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery3() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq2('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
     }
-    
-    public void testStoredQuery4() {
+	@Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery4() {
         ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sq1()) as x", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
     }
 
-    public void testStoredQuery5() {
+    @Test public void testStoredQuery5() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -86,7 +90,7 @@
         }); 
     }
     
-    public void testStoredQuery6() {
+    @Test public void testStoredQuery6() {
         ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sp1()) as x", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -107,7 +111,8 @@
         }); 
     }
     
-    public void testStoredQuery7() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery7() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sqsp1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -131,7 +136,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 1c
      */
-    public void testStoredQuery8() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery8() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq3('1', 1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'", "SELECT e1, e2 FROM pm1.g1 WHERE e2 = 1" }); //$NON-NLS-1$ //$NON-NLS-2$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -155,7 +161,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 5a
      */
-    public void testStoredQuery9() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery9() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq4()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] {"SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -164,7 +171,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 5b
      */
-    public void testStoredQuery10() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery10() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq5('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'"}); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -173,7 +181,8 @@
      /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 5c
      */
-    public void testStoredQuery11() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery11() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq6()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] {"SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -182,7 +191,8 @@
      /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 6a
      */
-    public void testStoredQuery12() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery12() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq7()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -191,7 +201,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 6c
      */
-    public void testStoredQuery13() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery13() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq8('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -200,7 +211,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 6b
      */
-    public void testStoredQuery14() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery14() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq9('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -209,7 +221,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 6d
      */
-    public void testStoredQuery15() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery15() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq10('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT e1 FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN); 
@@ -218,7 +231,7 @@
     /**
      * Test planning stored queries. 
      */
-    public void testStoredQuery16() {
+    @Test public void testStoredQuery16() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp2(1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp2(1)" }); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -242,7 +255,8 @@
     /**
      * Test planning stored queries. GeminiStoredQueryTestPlan - 6d
      */
-    public void testStoredQuery17() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery17() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq11(1, 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp2(?)" }); //$NON-NLS-1$
 
@@ -265,7 +279,8 @@
     }
     
     //GeminiStoredQueryTestPlan - 2a, 2b
-    public void testStoredQuery18() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery18() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq12('1', 1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 1)" }); //$NON-NLS-1$
 
@@ -273,7 +288,8 @@
     }
     
     //GeminiStoredQueryTestPlan - 2c
-    public void testStoredQuery19() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery19() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq13('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 2)" }); //$NON-NLS-1$
 
@@ -281,7 +297,8 @@
     }
     
     //GeminiStoredQueryTestPlan - 3c
-    public void testStoredQuery20() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery20() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq14('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "UPDATE pm1.g1 SET e1 = '1' WHERE e2 = 2" }); //$NON-NLS-1$
 
@@ -289,14 +306,16 @@
     }
     
     //GeminiStoredQueryTestPlan - 4b
-    public void testStoredQuery21() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery21() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "DELETE FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
 
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);               
     }
     
-    public void testStoredQuery22() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery22() {
         ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from (EXEC pm1.sq1()) as x where e1='a' union (select e1 from vm1.g2 where e1='b')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 = 'a'", "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = 'b') AND (g_1.e1 = 'b')" }); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -318,36 +337,38 @@
         });               
     }
     
-    public void testStoredQuery23() {
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery23() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq16()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 2)" }); //$NON-NLS-1$
             
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);               
     }
     
-    public void testStoredQuery24() {
+    @Test public void testStoredQuery24() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp3()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp3()" }); //$NON-NLS-1$
 
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);               
     }
 
-    // test implicit type conversion of argument 
-    public void testStoredQuery25() {
+    // test implicit type conversion of argument
+    @Ignore("stored procedure wrapper removal logic has been removed")
+    @Test public void testStoredQuery25() {
         ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15(1, 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "DELETE FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
 
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }
 
-    public void testStoredQueryXML1() {
+    @Test public void testStoredQueryXML1() {
         TestOptimizer.helpPlan("EXEC pm1.sq18()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), new String[] { }); //$NON-NLS-1$
     }
     
     /**
      * union of two stored procs - case #1466
      */
-    public void testStoredProc1() {
+    @Test public void testStoredProc1() {
         ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT * FROM (EXEC pm1.sp2(2)) AS y", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp2(1)", "EXEC pm1.sp2(2)" }); //$NON-NLS-1$ //$NON-NLS-2$
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -371,7 +392,7 @@
     /**
      * union of stored proc and query - case #1466
      */
-    public void testStoredProc2() {
+    @Test public void testStoredProc2() {
         ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT e1, e2 FROM pm1.g1", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
             new String[] { "EXEC pm1.sp2(1)", "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$ //$NON-NLS-2$
         TestOptimizer.checkNodeTypes(plan, new int[] {

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -67,9 +67,9 @@
         super(name);
     }
     
-    public static List helpGetCommands(String[] sql, QueryMetadataInterface md) throws QueryParserException, QueryResolverException, MetaMatrixComponentException, QueryValidatorException  { 
+    public static List<Command> helpGetCommands(String[] sql, QueryMetadataInterface md) throws QueryParserException, QueryResolverException, MetaMatrixComponentException, QueryValidatorException  { 
         if(DEBUG) System.out.println("\n####################################\n" + sql);  //$NON-NLS-1$
-        List commands = new ArrayList(sql.length);
+        List<Command> commands = new ArrayList<Command>(sql.length);
         for (int i = 0; i < sql.length; i++) {
             Command command = QueryParser.getQueryParser().parseCommand(sql[i]);
             QueryResolver.resolveCommand(command, md);
@@ -80,7 +80,7 @@
                 fail("Exception during validation (" + repo); //$NON-NLS-1$
             }                    
             
-            command = QueryRewriter.rewrite(command, null, md, null);
+            command = QueryRewriter.rewrite(command, md, null);
             commands.add(command);
         }
         return commands;

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -80,7 +80,7 @@
             ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
             throw new QueryValidatorException(firstFailure.getMessage());
         }
-        userCommand = QueryRewriter.rewrite(userCommand, null, metadata, null);
+        userCommand = QueryRewriter.rewrite(userCommand, metadata, null);
         
         AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
         

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -45,7 +45,7 @@
                           boolean aliasGroups,
                           QueryMetadataInterface metadata) throws QueryValidatorException {
         Command command = TestResolver.helpResolve(sql, metadata, null);
-        command = QueryRewriter.rewrite(command, null, metadata, null);
+        command = QueryRewriter.rewrite(command, metadata, null);
         command.acceptVisitor(new AliasGenerator(aliasGroups));
         assertEquals(expected, command.toString());
         return command;

Copied: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java (from rev 1724, trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java)
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java	                        (rev 0)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.optimizer.relational;
+
+import static com.metamatrix.query.optimizer.TestOptimizer.*;
+import static org.junit.Assert.*;
+
+import java.util.Collection;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.analysis.QueryAnnotation;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.optimizer.TestOptimizer;
+import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
+
+public class TestMaterialization {
+	
+    @Test public void testMaterializedTransformation() throws Exception {
+        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.e1 FROM MatTable.MatTable AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+        Collection annotations = analysis.getAnnotations();
+        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
+        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
+        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+    }
+
+    @Ignore("we no longer auto detect this case, if we need this logic it will have to be added to the rewriter since it changes select into to an insert")
+    @Test public void testMaterializedTransformationLoading() throws Exception {
+        String userSql = "SELECT MATVIEW.E1 INTO MatTable.MatStage FROM MATVIEW"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+        Collection annotations = analysis.getAnnotations();
+        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
+        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
+        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+    }    
+    
+    @Test public void testMaterializedTransformationNoCache() throws Exception {
+        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE MatView.MatView"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+        
+        Collection annotations = analysis.getAnnotations();
+        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
+        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
+        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+    }
+    
+    //related to defect 14423
+    @Test public void testMaterializedTransformationNoCache2() throws Exception {
+        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+        
+        Collection annotations = analysis.getAnnotations();
+        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
+        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
+        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+    }
+    
+    @Test public void testNoCacheInTransformation() throws Exception {
+        String userSql = "SELECT VGROUP.E1 FROM VGROUP"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+    }
+    
+    @Test public void testTableNoCacheDoesntCascade() throws Exception {
+        String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache matview.matview1"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.e1 FROM MatTable.MatTable AS g_0 WHERE g_0.e1 = '1'"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+    }
+    
+    @Test public void testNoCacheCascade() throws Exception {
+        String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
+        AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+        
+        Command command = helpGetCommand(userSql, metadata, null);
+        
+        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0 WHERE g_0.x = '1'"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+    }
+
+}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCalculateCostUtil.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCalculateCostUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCalculateCostUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -34,7 +34,7 @@
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.TestOptimizer;
 import com.metamatrix.query.optimizer.TestOptimizer.ComparisonMode;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
 import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
@@ -82,7 +82,7 @@
     
     void helpTestEstimateCost(String critString, float childCost, float expectedResult, QueryMetadataInterface metadata) throws Exception {
         Criteria crit = helpGetCriteria(critString, metadata);
-        PlanNode select = GenerateCanonical.createSelectNode(crit, false);
+        PlanNode select = RelationalPlanner.createSelectNode(crit, false);
         
         float resultCost = NewCalculateCostUtil.recursiveEstimateCostOfCriteria(childCost, select, crit, metadata);
         assertEquals((int)expectedResult, (int)resultCost);

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,10 +22,12 @@
 
 package com.metamatrix.query.optimizer.relational.rules;
 
+import static org.junit.Assert.*;
+
 import java.util.ArrayList;
 import java.util.Collection;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
@@ -35,7 +37,6 @@
 import com.metamatrix.query.optimizer.TestOptimizer;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
 import com.metamatrix.query.optimizer.relational.OptimizerRule;
 import com.metamatrix.query.optimizer.relational.PlanHints;
 import com.metamatrix.query.optimizer.relational.RelationalPlanner;
@@ -47,33 +48,19 @@
 import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
 import com.metamatrix.query.unittest.FakeMetadataFacade;
 import com.metamatrix.query.unittest.FakeMetadataFactory;
+import com.metamatrix.query.util.CommandContext;
 
 /**
  * Tests {@link RuleChooseAccessPattern}
  */
-public class TestRuleAccessPatternValidation extends TestCase {
+public class TestRuleAccessPatternValidation {
 
-    private static final FakeMetadataFacade METADATA = FakeMetadataFactory.example1();
+    private static final FakeMetadataFacade METADATA = FakeMetadataFactory.example1Cached();
 
-    private PlanHints planHints;
-    
     private static final boolean DEBUG = false;
-   
-    // ################################## FRAMEWORK ################################
-    
-    /**
-     * Constructor for TestRuleChooseAccessPattern.
-     */
-    public TestRuleAccessPatternValidation(String name) {
-        super(name);
-    }
 
-    public void setUp() {
-    	this.planHints = new PlanHints();
-    }
-
-    // ################################## TEST HELPERS ################################
-
+	private static CapabilitiesFinder FINDER = new DefaultCapabilitiesFinder(TestOptimizer.getTypicalCapabilities());
+   
 	/**
 	 * @param command the query to be turned into a test query plan
 	 * @param expectedChosenPredicates expected criteria predicates that should
@@ -106,9 +93,11 @@
 		GroupCollectorVisitor.getGroups(query, groups);
 		
 		//Generate canonical plan
-		PlanNode planNode = GenerateCanonical.generatePlan(query, planHints, METADATA);
+    	RelationalPlanner p = new RelationalPlanner();
+    	p.initialize(query, null, METADATA, FINDER, null, null);
+    	PlanNode planNode = p.generatePlan(query);
 
-		final RuleStack rules = RelationalPlanner.buildRules(planHints);
+		final RuleStack rules = RelationalPlanner.buildRules(new PlanHints());
 
 		PlanNode testPlan = helpExecuteRules(rules, planNode, METADATA, DEBUG);
 		
@@ -120,7 +109,7 @@
 	 */
 	private static PlanNode helpExecuteRules(RuleStack rules, PlanNode plan, QueryMetadataInterface metadata, boolean debug)
 		throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
+		CommandContext context = new CommandContext();
 		while(! rules.isEmpty()) {
 			if(debug) {
 				System.out.println("\n============================================================================"); //$NON-NLS-1$
@@ -129,9 +118,8 @@
 			if(debug) {
 				System.out.println("EXECUTING " + rule); //$NON-NLS-1$
 			}
-
-            CapabilitiesFinder finder = new DefaultCapabilitiesFinder(TestOptimizer.getTypicalCapabilities());             
-            plan = rule.execute(plan, metadata, finder, rules, new AnalysisRecord(false, false, debug), null);
+             
+            plan = rule.execute(plan, metadata, FINDER, rules, new AnalysisRecord(false, false, debug), context);
 			if(debug) {
 				System.out.println("\nAFTER: \n" + plan); //$NON-NLS-1$
 			}
@@ -146,7 +134,7 @@
      * This test demonstrates that APs are ignored for inserts
      * CASE 3966
      */
-    public void testInsertWithAccessPattern_Case3966() throws Exception {
+    @Test public void testInsertWithAccessPattern_Case3966() throws Exception {
         this.helpTestAccessPatternValidation( "insert into pm4.g1 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )" ); //$NON-NLS-1$
     }
     
@@ -154,7 +142,7 @@
      * This test demonstrates that a satisfied AP does not fail.  
      * Found testing fix for 3966.
      */
-    public void testDeleteWithAccessPattern_Case3966() throws Exception {
+    @Test public void testDeleteWithAccessPattern_Case3966() throws Exception {
         this.helpTestAccessPatternValidation( "delete from pm4.g1 where e1 = 'test' and e2 = 1" ); //$NON-NLS-1$ 
     }
     
@@ -162,7 +150,7 @@
      * This test demonstrates that unsatisfied AP fails.  
      * Found testing fix for 3966.
      */
-    public void testDeleteWithAccessPattern_Case3966_2() throws Exception {
+    @Test public void testDeleteWithAccessPattern_Case3966_2() throws Exception {
         try {
             this.helpTestAccessPatternValidation( "delete from pm4.g1" ); //$NON-NLS-1$ 
             fail("Expected QueryPlannerException, but did not get one"); //$NON-NLS-1$
@@ -174,7 +162,7 @@
         }
     }
     
-    public void testUpdateWithAccessPattern_Case3966() throws Exception {
+    @Test public void testUpdateWithAccessPattern_Case3966() throws Exception {
         this.helpTestAccessPatternValidation( "update pm4.g1 set e1 = 'test1' where e1 = 'test' and e2 = 1" ); //$NON-NLS-1$ 
     }
     
@@ -182,7 +170,7 @@
      * This test demonstrates that unsatisfied AP fails.  
      * Found testing fix for 3966.
      */
-    public void testUpdateWithAccessPattern_Case3966_2() throws Exception {
+    @Test public void testUpdateWithAccessPattern_Case3966_2() throws Exception {
         try {
             this.helpTestAccessPatternValidation( "update pm4.g1 set e1 = 'test'" ); //$NON-NLS-1$ 
             fail("Expected QueryPlannerException, but did not get one"); //$NON-NLS-1$
@@ -198,7 +186,7 @@
      * This test demonstrates that APs are ignored for inserts through a virtual layer
      * CASE 3966
      */
-    public void testInsertWithAccessPattern_Case3966_VL() throws Exception {
+    @Test public void testInsertWithAccessPattern_Case3966_VL() throws Exception {
         this.helpTestAccessPatternValidation( "insert into vm1.g37 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )" ); //$NON-NLS-1$
     }
     
@@ -207,7 +195,7 @@
      * through a virtual layer does not fail.  
      * Found testing fix for 3966.
      */
-    public void testDeleteWithAccessPattern_Case3966_VL() throws Exception {
+    @Test public void testDeleteWithAccessPattern_Case3966_VL() throws Exception {
         this.helpTestAccessPatternValidation( "delete from vm1.g37 where e1 = 'test' and e2 = 1" ); //$NON-NLS-1$ 
     }
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -71,7 +71,7 @@
     /* Make Neither Side Dependent */
     private static final int NEITHER_SIDE = 3;
 
-    private FakeMetadataFacade metadata;
+    private FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
     
     // ################################## FRAMEWORK ################################
     
@@ -79,15 +79,6 @@
         super(name);
     }    
 
-    public void setUp() {
-        // set up resolver metadata
-        metadata = FakeMetadataFactory.example1();
-    }
-
-    public void tearDown() {
-        metadata = null;
-    }
-
     // ################################## TEST HELPERS ################################
     
     public PlanNode createAccessNode(Collection groupSymbols) {

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePlaceAccess.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePlaceAccess.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePlaceAccess.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,8 +26,6 @@
 
 import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
@@ -41,7 +39,7 @@
 
 public class TestRulePlaceAccess extends TestCase {
 
-    private static final QueryMetadataInterface METADATA = FakeMetadataFactory.example1();
+    private static final QueryMetadataInterface METADATA = FakeMetadataFactory.example1Cached();
 
     // ################################## FRAMEWORK ################################
 
@@ -58,7 +56,7 @@
      * Object element ids) for a physical group will be found and added
      * as a property of an ACCESS node.
      */
-    public void testAddAccessPatterns2(){
+    public void testAddAccessPatterns2() throws Exception {
         Query query = new Query();
         
         From from = new From();
@@ -70,31 +68,17 @@
         select.addSymbol(new AllSymbol());
         query.setSelect(select);
 
-        try {
-            group.setMetadataID(METADATA.getGroupID("pm4.g2")); //$NON-NLS-1$
-        } catch (QueryMetadataException e) {
-            fail(e.getMessage());
-        } catch (MetaMatrixComponentException e) {
-            fail(e.getMessage());
-        }
+        group.setMetadataID(METADATA.getGroupID("pm4.g2")); //$NON-NLS-1$
                 
         PlanNode n1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
         n1.setProperty(NodeConstants.Info.ATOMIC_REQUEST, query);
         n1.addGroup(group);
         
-        try {
-            RulePlaceAccess.addAccessPatternsProperty(n1, METADATA);
-        } catch (QueryMetadataException e) {
-            fail(e.getMessage());
-        } catch (MetaMatrixComponentException e) {
-            fail(e.getMessage());
-        }
+        RulePlaceAccess.addAccessPatternsProperty(n1, METADATA);
 
         Collection accessPatterns = (Collection)n1.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
         assertNotNull(accessPatterns);
         assertTrue("Expected two access patterns, got " + accessPatterns.size(), accessPatterns.size() == 2); //$NON-NLS-1$
-//        assertTrue(accessPatterns.contains(FakeMetadata.ELEMENT_IDS_1));
-//        assertTrue(accessPatterns.contains(FakeMetadata.ELEMENT_IDS_2));
     }   
     
 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -32,10 +32,12 @@
 import org.junit.Test;
 
 import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.metadata.TempMetadataAdapter;
+import com.metamatrix.query.metadata.TempMetadataStore;
 import com.metamatrix.query.optimizer.TestOptimizer;
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
-import com.metamatrix.query.optimizer.relational.GenerateCanonical;
-import com.metamatrix.query.optimizer.relational.PlanHints;
+import com.metamatrix.query.optimizer.relational.RelationalPlanner;
 import com.metamatrix.query.optimizer.relational.RuleStack;
 import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
 import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
@@ -47,7 +49,6 @@
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.SingleElementSymbol;
 import com.metamatrix.query.sql.util.SymbolMap;
-import com.metamatrix.query.unittest.FakeMetadataFacade;
 import com.metamatrix.query.unittest.FakeMetadataFactory;
 import com.metamatrix.query.util.CommandContext;
 
@@ -66,14 +67,16 @@
     }
     
     @Test public void testPushAcrossFrameWithAccessNode() throws Exception {
-    	FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+    	QueryMetadataInterface metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore());
     	Command command = TestOptimizer.helpGetCommand("select * from (select * from pm1.g1 union select * from pm1.g2) x where e1 = 1", metadata, null); //$NON-NLS-1$
     	Command subCommand = TestOptimizer.helpGetCommand("select * from pm1.g1 union select * from pm1.g2", metadata, null); //$NON-NLS-1$
-    	PlanNode root = GenerateCanonical.generatePlan(command, new PlanHints(), metadata);
-    	PlanNode child = GenerateCanonical.generatePlan(subCommand, new PlanHints(), metadata);
+    	RelationalPlanner p = new RelationalPlanner();
+    	p.initialize(command, null, metadata, null, null, null);
+    	PlanNode root = p.generatePlan(command);
+    	PlanNode child = p.generatePlan(subCommand);
     	PlanNode sourceNode = NodeEditor.findNodePreOrder(root, NodeConstants.Types.SOURCE);
     	sourceNode.addFirstChild(child);
-        sourceNode.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(sourceNode.getGroups().iterator().next(), (List<SingleElementSymbol>)child.getFirstChild().getProperty(Info.PROJECT_COLS)));
+        sourceNode.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(sourceNode.getGroups().iterator().next(), (List<SingleElementSymbol>)child.getFirstChild().getProperty(Info.PROJECT_COLS), metadata));
     	//add a dummy access node
         PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
         accessNode.addGroups(child.getFirstChild().getGroups());

Deleted: branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParseCommandType.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParseCommandType.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParseCommandType.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.parser;
-
-import com.metamatrix.query.sql.lang.*;
-import junit.framework.*;
-
-public class TestParseCommandType extends TestCase {
-
-	// ################################## FRAMEWORK ################################
-	
-	public TestParseCommandType(String name) { 
-		super(name);
-	}	
-	
-	// ################################## TEST HELPERS ################################
-	
-	private void helpTest(String sql, int expectedType) {
-	    int actualType = QueryParser.getCommandType(sql);		    
-	    assertEquals("Did not get expected type", expectedType, actualType); //$NON-NLS-1$
-	}
-	
-	// ################################## ACTUAL TESTS ################################
-	
-	public void testQuery1() {
-		helpTest("SELECT a FROM g", Command.TYPE_QUERY);		 //$NON-NLS-1$
-	}
-
-	public void testQuery2() {
-		helpTest("select a FROM g", Command.TYPE_QUERY);		 //$NON-NLS-1$
-	}
-
-	public void testQuery3() {
-		helpTest("select", Command.TYPE_QUERY);		 //$NON-NLS-1$
-	}
-
-	public void testSetQuery1() {
-		helpTest("SELECT a FROM g UNION SELECT b from z", Command.TYPE_QUERY);		 //$NON-NLS-1$
-	}
-
-	public void testSetQuery2() {
-		helpTest("(Select a FROM g UNION SELECT b from z) union select c from r order by s", Command.TYPE_QUERY);		 //$NON-NLS-1$
-	}
-	
-	public void testInsert() {
-		helpTest("insert g (b) values (1)", Command.TYPE_INSERT);     //$NON-NLS-1$
-	}
-
-	public void testUpdate() {
-		helpTest("update g set b=1", Command.TYPE_UPDATE);     //$NON-NLS-1$
-	}
-
-	public void testDelete() {
-		helpTest("delete from g where x=1", Command.TYPE_DELETE);     //$NON-NLS-1$
-	}
-	
-	public void testUnknown1() {
-		helpTest("", Command.TYPE_UNKNOWN);     //$NON-NLS-1$
-	}
-
-	public void testUnknown2() {
-		helpTest("abc select", Command.TYPE_UNKNOWN);     //$NON-NLS-1$
-	}
-
-	public void testUnknown3() {
-		helpTest("selec", Command.TYPE_UNKNOWN);		 //$NON-NLS-1$
-	}
-
-	public void testUnknown4() {
-		helpTest("selec ", Command.TYPE_UNKNOWN);		 //$NON-NLS-1$
-	}
-}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParser.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/parser/TestParser.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,6 +24,7 @@
 
 import static org.junit.Assert.*;
 
+import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -139,66 +140,30 @@
         }       
     }
     
-    private void helpBlockTest(String block, String expectedString, Block expectedBlock) {
-        Block actualBlock = null;
-        String actualString = null;
-        try {
-            actualBlock = QueryParser.getQueryParser().parseBlock(block);
-            actualString = actualBlock.toString();
-                
-        } catch(Throwable e) { 
-            fail("Exception during parsing (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
+    private void helpBlockTest(String block, String expectedString, Block expectedBlock) throws ParseException {
+        Block actualBlock = new SQLParser(new StringReader(block)).block(new ParseInfo());
+        String actualString = actualBlock.toString();
         assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
         assertEquals("Block does not match: ", expectedBlock, actualBlock);              //$NON-NLS-1$
     }
     
-    private void helpCriteriaSelectorTest(String selector, String expectedString, CriteriaSelector expectedSelector) {
-        
-        CriteriaSelector actualSelector = null;
-        String actualString = null;
-        try {
-            actualSelector = QueryParser.getQueryParser().parseCriteriaSelector(selector);
-            actualString = actualSelector.toString();
-                             
-        } catch(Throwable e) { 
-            fail("Exception during parsing (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
+    private void helpCriteriaSelectorTest(String selector, String expectedString, CriteriaSelector expectedSelector) throws ParseException {
+        CriteriaSelector actualSelector = new SQLParser(new StringReader(selector)).criteriaSelector();
+        String actualString = actualSelector.toString();
         assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
         assertEquals("CriteriaSelector does not match: ", expectedSelector, actualSelector);              //$NON-NLS-1$
     }
 	
-    private void helpCriteriaTest(String crit, String expectedString, Criteria expectedCrit) {
-               
-        Criteria actualCrit = null;
-        String actualString = null;
-        try {
-            //actualCrit = QueryParser.getQueryParser().parsePredicateCriteria(crit);
-            actualCrit = QueryParser.getQueryParser().parseCriteria(crit);
-            actualString = actualCrit.toString();
-                
-        } catch(Throwable e) { 
-            fail("Exception during parsing (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
+    private void helpCriteriaTest(String crit, String expectedString, Criteria expectedCrit) throws QueryParserException {
+        Criteria actualCrit = QueryParser.getQueryParser().parseCriteria(crit);
+        String actualString = actualCrit.toString();
         assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
         assertEquals("Criteria does not match: ", expectedCrit, actualCrit);              //$NON-NLS-1$
-        
     }
     
-    private void helpStmtTest(String stmt, String expectedString, Statement expectedStmt) {
-        Statement actualStmt = null;
-        String actualString = null;
-        try {
-            actualStmt = QueryParser.getQueryParser().parseStatement(stmt);
-            actualString = actualStmt.toString();
-                
-        } catch(Throwable e) { 
-            fail("Exception during parsing (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
+    private void helpStmtTest(String stmt, String expectedString, Statement expectedStmt) throws ParseException {
+        Statement actualStmt = new SQLParser(new StringReader(stmt)).statement(new ParseInfo());
+        String actualString = actualStmt.toString();
         assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
         assertEquals("Language objects do not match: ", expectedStmt, actualStmt);              //$NON-NLS-1$
     }
@@ -3184,10 +3149,8 @@
     /** 
      * Try nesting subquery in double parentheses - parsing fails.  'exec' is not handled as
      * robustly as other types of commands that can appear in a from clause subquery. 
-     * 
-     * deferred, not important enough 
      */
-    public void DEFERRED_testStoredQuerySubqueryMultipleParens(){
+    public void testStoredQuerySubqueryMultipleParens(){
         StoredProcedure storedQuery = new StoredProcedure();
         storedQuery.setProcedureName("proc1"); //$NON-NLS-1$
         SPParameter parameter = new SPParameter(1, new Constant("param1")); //$NON-NLS-1$
@@ -3205,14 +3168,14 @@
         helpTest("SELECT X.A FROM ((exec proc1('param1'))) AS X", "SELECT X.A FROM (EXEC proc1('param1')) AS X", query); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    @Test public void testErrorStatement(){
+    @Test public void testErrorStatement() throws Exception {
         RaiseErrorStatement errStmt = new RaiseErrorStatement(new Constant("Test only")); //$NON-NLS-1$
                  
         helpStmtTest("ERROR 'Test only';", "ERROR 'Test only';", //$NON-NLS-1$ //$NON-NLS-2$
             errStmt);           
     }
     
-    @Test public void testIfStatement(){
+    @Test public void testIfStatement() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String shortType = new String("short"); //$NON-NLS-1$
         Statement ifStmt = new DeclareStatement(a, shortType);
@@ -3264,7 +3227,7 @@
              stmt);     
     }*/   
     
-    @Test public void testCriteriaSelector0(){
+    @Test public void testCriteriaSelector0() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3274,7 +3237,7 @@
         helpCriteriaSelectorTest("IS NULL CRITERIA ON (a)", "IS NULL CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector1(){
+    @Test public void testCriteriaSelector1() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3284,7 +3247,7 @@
         helpCriteriaSelectorTest("= CRITERIA ON (a)", "= CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector2(){
+    @Test public void testCriteriaSelector2() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3294,7 +3257,7 @@
         helpCriteriaSelectorTest("<> CRITERIA ON (a)", "<> CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector3(){
+    @Test public void testCriteriaSelector3() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3304,7 +3267,7 @@
         helpCriteriaSelectorTest("< CRITERIA ON (a)", "< CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector4(){
+    @Test public void testCriteriaSelector4() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3314,7 +3277,7 @@
         helpCriteriaSelectorTest("> CRITERIA ON (a)", "> CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector5(){
+    @Test public void testCriteriaSelector5() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3324,7 +3287,7 @@
         helpCriteriaSelectorTest(">= CRITERIA ON (a)", ">= CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector6(){
+    @Test public void testCriteriaSelector6() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3334,7 +3297,7 @@
         helpCriteriaSelectorTest("<= CRITERIA ON (a)", "<= CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector7(){
+    @Test public void testCriteriaSelector7() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3345,7 +3308,7 @@
     }
     
     
-    @Test public void testCriteriaSelector8(){
+    @Test public void testCriteriaSelector8() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3355,7 +3318,7 @@
         helpCriteriaSelectorTest("IN CRITERIA ON (a)", "IN CRITERIA ON (a)", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    @Test public void testCriteriaSelector9(){
+    @Test public void testCriteriaSelector9() throws Exception {
         //ElementSymbol a = new ElementSymbol("a");
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3365,7 +3328,7 @@
         helpCriteriaSelectorTest("CRITERIA", "CRITERIA", critSelector);     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testCriteriaSelector10(){
+    @Test public void testCriteriaSelector10() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         
         CriteriaSelector critSelector = new CriteriaSelector();
@@ -3376,7 +3339,7 @@
     }
 
     /**HAS IS NULL CRITERIA ON (a)*/    
-    @Test public void testHasIsNullCriteria(){
+    @Test public void testHasIsNullCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3393,7 +3356,7 @@
     }   
     
     /**HAS LIKE CRITERIA ON (a)*/    
-    @Test public void testHasLikeCriteria(){
+    @Test public void testHasLikeCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3409,7 +3372,7 @@
             hasSelector);
     }  
             
-    @Test public void testHasEQCriteria(){
+    @Test public void testHasEQCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3425,7 +3388,7 @@
             hasSelector);
     }    
     
-    @Test public void testHasNECriteria(){
+    @Test public void testHasNECriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3442,7 +3405,7 @@
     }    
     
     /**HAS IN CRITERIA ON (a)*/    
-    @Test public void testHasInCriteria(){
+    @Test public void testHasInCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3459,7 +3422,7 @@
     }   
      
     /**HAS COMPARE_LT CRITERIA ON (a)*/    
-    @Test public void testHasLTCriteria(){
+    @Test public void testHasLTCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3476,7 +3439,7 @@
     }   
     
     /**HAS COMPARE_LE CRITERIA ON (a)*/    
-    @Test public void testHasLECriteria(){
+    @Test public void testHasLECriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3493,7 +3456,7 @@
     }   
     
     /**HAS COMPARE_GT CRITERIA ON (a)*/    
-    @Test public void testHasGTCriteria(){
+    @Test public void testHasGTCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3510,7 +3473,7 @@
     }   
        
     /**HAS COMPARE_GE CRITERIA ON (a)*/    
-    @Test public void testHasGECriteria(){
+    @Test public void testHasGECriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3527,7 +3490,7 @@
     }   
          
     /**HAS BETWEEN CRITERIA ON (a)*/    
-    @Test public void testHasBetweenCriteria(){
+    @Test public void testHasBetweenCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3543,7 +3506,7 @@
             hasSelector);
     }   
          
-    @Test public void testTranslateCriteria(){
+    @Test public void testTranslateCriteria() throws Exception {
         ElementSymbol a = new ElementSymbol("a");              //$NON-NLS-1$
         List elements = new ArrayList();
         elements.add(a);
@@ -3569,7 +3532,7 @@
             
     }
     
-    @Test public void testAssignStatement(){
+    @Test public void testAssignStatement() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
        
         List symbols = new ArrayList();
@@ -3600,7 +3563,7 @@
         helpStmtTest("a = 'aString';", "a = 'aString';", exprStmt);      //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-     @Test public void testAssignStatement2(){
+     @Test public void testAssignStatement2() throws Exception {
         Insert insert = new Insert();
         insert.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
         List vars = new ArrayList();
@@ -3619,7 +3582,7 @@
            
     }
     
-    @Test public void testDeclareStatement(){
+    @Test public void testDeclareStatement() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String type = new String("short"); //$NON-NLS-1$
         DeclareStatement stmt = new DeclareStatement(a, type);
@@ -3627,7 +3590,7 @@
         helpStmtTest("DECLARE short a;","DECLARE short a;", stmt); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testDeclareStatementWithAssignment(){
+    @Test public void testDeclareStatementWithAssignment() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String type = new String("short"); //$NON-NLS-1$
         DeclareStatement stmt = new DeclareStatement(a, type, new Constant(null));
@@ -3635,7 +3598,7 @@
         helpStmtTest("DECLARE short a = null;","DECLARE short a = null;", stmt); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testDeclareStatementWithAssignment1(){
+    @Test public void testDeclareStatementWithAssignment1() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String type = new String("string"); //$NON-NLS-1$
         DeclareStatement stmt = new DeclareStatement(a, type, sampleQuery());
@@ -3643,7 +3606,7 @@
         helpStmtTest("DECLARE string a = SELECT a1 FROM g WHERE a2 = 5;","DECLARE string a = SELECT a1 FROM g WHERE a2 = 5;", stmt); //$NON-NLS-1$ //$NON-NLS-2$
     }
       
-    @Test public void testStatement() {
+    @Test public void testStatement() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String type = new String("short"); //$NON-NLS-1$
         DeclareStatement declStmt = new DeclareStatement(a, type);
@@ -3653,7 +3616,7 @@
             stmt);
     }
         
-    @Test public void testBlock() {
+    @Test public void testBlock() throws Exception {
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
         String type = new String("short"); //$NON-NLS-1$
         DeclareStatement declStmt = new DeclareStatement(a, type);
@@ -3664,7 +3627,7 @@
             block);
     }
        
-    @Test public void testCommandStatement(){
+    @Test public void testCommandStatement() throws Exception {
         Query query = sampleQuery();
         
         Command sqlCmd = query;
@@ -3695,7 +3658,7 @@
         return query;
     }
     
-    @Test public void testDynamicCommandStatement(){
+    @Test public void testDynamicCommandStatement() throws Exception {
         List symbols = new ArrayList();
 
         ElementSymbol a1 = new ElementSymbol("a1"); //$NON-NLS-1$
@@ -3718,7 +3681,7 @@
     }
     
     //sql is a variable, also uses the as, into, and update clauses
-    @Test public void testDynamicCommandStatement1(){
+    @Test public void testDynamicCommandStatement1() throws Exception {
         List symbols = new ArrayList();
         
         ElementSymbol a1 = new ElementSymbol("a1"); //$NON-NLS-1$
@@ -3746,7 +3709,7 @@
         cmdStmt);       
     }
     
-    @Test public void testDynamicCommandStatementWithUsing(){
+    @Test public void testDynamicCommandStatementWithUsing() throws Exception {
         SetClauseList using = new SetClauseList();
         
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
@@ -5478,7 +5441,7 @@
         helpTest(sql, sqlExpected, query);        
     }      
       
-    @Test public void testLoopStatement(){
+    @Test public void testLoopStatement() throws Exception {
         GroupSymbol g = new GroupSymbol("m.g"); //$NON-NLS-1$
         From from = new From();
         from.addGroup(g);
@@ -5510,7 +5473,7 @@
              +"\n"+"END", loopStmt);      //$NON-NLS-1$ //$NON-NLS-2$
     }  
 
-    @Test public void testLoopStatementWithOrderBy(){
+    @Test public void testLoopStatementWithOrderBy() throws Exception {
         GroupSymbol g = new GroupSymbol("m.g"); //$NON-NLS-1$
         From from = new From();
         from.addGroup(g);
@@ -5546,7 +5509,7 @@
              +"\n"+"END", loopStmt);      //$NON-NLS-1$ //$NON-NLS-2$
     }  
     
-    @Test public void testWhileStatement(){
+    @Test public void testWhileStatement() throws Exception {
         ElementSymbol x = new ElementSymbol("x", false); //$NON-NLS-1$
         Function f = new Function("+", new Expression[] { x, new Constant(new Integer(1)) }); //$NON-NLS-1$
         Statement assignmentStmt = new AssignmentStatement(x, f);
@@ -5560,12 +5523,12 @@
                      +"\n"+"END", whileStmt); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testBreakStatement(){
+    @Test public void testBreakStatement() throws Exception {
         Statement breakStmt = new BreakStatement();
         helpStmtTest("break;", "BREAK;", breakStmt); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test public void testContinueStatement(){
+    @Test public void testContinueStatement() throws Exception {
         Statement contStmt = new ContinueStatement();
         helpStmtTest("continue;", "CONTINUE;", contStmt); //$NON-NLS-1$ //$NON-NLS-2$
     }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,7 +38,6 @@
 import com.metamatrix.query.metadata.TempMetadataID;
 import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
 import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.CommandContainer;
 import com.metamatrix.query.sql.lang.Delete;
 import com.metamatrix.query.sql.lang.From;
 import com.metamatrix.query.sql.lang.Insert;
@@ -77,18 +76,26 @@
 
     // Track history to verify it later
     private List<String> queries = new ArrayList<String>();
+    private boolean recordingCommands = true;
     
-	public FakeDataManager() {
-	}
-    
     /**
      * Return string form of all queries run against this FDM 
-     * @return List<String>
+     * @return List<String> recorded commands
      */
     public List<String> getQueries() {
         return this.queries;
     }
 	        
+    /**
+     * Clears the list of recorded commands and returns a copy
+     * @return a copy of the recorded commands prior to clearing the list
+     */
+    public List<String> clearQueries() {
+    	List<String> rc = new ArrayList<String>(this.getQueries());
+    	this.queries.clear();
+    	return rc;
+    }
+	        
 	public void registerTuples(Object groupID, List elements, List[] data) {
 		tuples.put(groupID, new Object[] { elements, data });
 	}
@@ -102,17 +109,10 @@
         
         LogManager.logTrace(LOG_CONTEXT, new Object[]{"Register Request:", command, ",processorID:", processorID, ",model name:", modelName,",TupleSourceID nodeID:",new Integer(nodeID)}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 
-        
-        if ( command instanceof CommandContainer ) {
-        	if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 ) {
-            	for ( Iterator<Command> it = ((CommandContainer) command).getContainedCommands().iterator(); it.hasNext(); ) {
-            		this.queries.add(it.next().toString());
-            	}
-        	} else {
-        		this.queries.add(command.toString());
-        	}
-        } else {
-        	this.queries.add(command.toString());
+        if (this.recordingCommands) {
+            if (! (command instanceof BatchedUpdateCommand) ) {
+            	this.queries.add(command.toString());
+            }
         }
 
         if (ReferenceCollectorVisitor.getReferences(command).size() > 0) {
@@ -128,11 +128,14 @@
 		} else if (command instanceof ProcedureContainer) {
 			group = ((ProcedureContainer) command).getGroup();
 		} else if ( command instanceof BatchedUpdateCommand ) {
-        	if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 ) {
-        		if ( command.getSubCommands().get(0) instanceof Update ) {
-        			group = ((Update)command.getSubCommands().get(0)).getGroup();
-        		}
-        	}
+    		if ( command.getSubCommands().get(0) instanceof Update ) {
+    			group = ((Update)command.getSubCommands().get(0)).getGroup();
+    		}
+    		if (this.recordingCommands) {
+            	for ( Iterator<Command> it = ((BatchedUpdateCommand) command).getUpdateCommands().iterator(); it.hasNext(); ) {
+            		this.queries.add(it.next().toString());
+            	}
+    		}
 		}
 		
 		Object groupID = group.getMetadataID();
@@ -184,10 +187,8 @@
 			// add single update command to a list to be executed
 			updateCommands.add(command);
 		} else if ( command instanceof BatchedUpdateCommand ) {
-        	if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 ) {
-				// add all update commands to a list to be executed
-        		updateCommands.addAll(((CommandContainer) command).getContainedCommands());
-        	}
+			// add all update commands to a list to be executed
+    		updateCommands.addAll(((BatchedUpdateCommand) command).getUpdateCommands());
 		}
 		
 		// if we had update commands added to the list, execute them now
@@ -360,8 +361,31 @@
     }
     
     @Override
-    public void clearCodeTables() {
-    	
-    }
+    public void clearCodeTables() {/* does nothing */}
 
+    /**
+     * Are commands/queries that are registered with the data manager being 
+     * recorded?
+     * <p>
+     * Recorded commands can be retrieved by {@link #getQueries()}
+     * 
+	 * @return whether or not commands should be recorded
+	 */
+	public boolean isRecordingCommands() {
+		return recordingCommands;
+	}
+
+	/**
+	 * Indicate whether or not commands/queries registered with the data 
+	 * manager are to be recorded in {@link #queries}.
+	 * <p>
+	 * Recorded commands can be retrieved by {@link #getQueries()}
+     * 
+	 * @param shouldRecord should commands be recorded?
+	 */
+	public void setRecordingCommands(boolean shouldRecord) {
+		this.recordingCommands = shouldRecord;
+	}
+
+
 }
\ No newline at end of file

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,21 +22,32 @@
 
 package com.metamatrix.query.processor;
 
-import java.util.*;
+import static org.junit.Assert.*;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.*;
+import com.metamatrix.common.buffer.BlockedException;
+import com.metamatrix.common.buffer.BufferManager;
+import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.util.CommandContext;
 
 /**
  */
-public class FakeProcessorPlan extends BaseProcessorPlan {
+public class FakeProcessorPlan extends ProcessorPlan {
 
     private List outputElements;
     private List batches;
     int batchIndex = 0;
     private int nextBatchRow = 1;
-
+    private boolean opened = false;
+    
     /**
      * Constructor for FakeProcessorPlan.
      * @param batches List of things to return in response to nextBatch() - typically 
@@ -47,11 +58,26 @@
         this.outputElements = outputElements;
         this.batches = batches;
     }
+    
+    public FakeProcessorPlan(int counts) {
+    	List[] rows = new List[counts];
+    	for (int i = 0; i < counts; i++) {
+            rows[i] = Arrays.asList(new Object[] {new Integer(1)});
+        }
+        TupleBatch batch = new TupleBatch(1, rows);
+        batch.setTerminationFlag(true);
+        this.batches = Arrays.asList(batch);
+        this.outputElements = Command.getUpdateCommandSymbol();
+    }
+    
+    public boolean isOpened() {
+		return opened;
+	}
 
     /**
      * @see java.lang.Object#clone()
      */
-    public Object clone() {
+    public FakeProcessorPlan clone() {
         throw new UnsupportedOperationException();
     }
 
@@ -67,13 +93,6 @@
     }
 
     /**
-     * @see com.metamatrix.query.processor.ProcessorPlan#connectTupleSource(com.metamatrix.common.buffer.TupleSource, com.metamatrix.common.buffer.TupleSourceID)
-     */
-    public void connectTupleSource(TupleSource source, int dataRequestID) {
-        // nothing
-    }
-
-    /**
      * @see com.metamatrix.query.processor.ProcessorPlan#getOutputElements()
      */
     public List getOutputElements() {
@@ -84,7 +103,8 @@
      * @see com.metamatrix.query.processor.ProcessorPlan#open()
      */
     public void open() throws MetaMatrixComponentException {
-        // nothing
+    	assertFalse("ProcessorPlan.open() should not be called more than once", opened); //$NON-NLS-1$
+        opened = true;
     }
 
     /**
@@ -122,14 +142,6 @@
         return this.outputElements;
     }
 
-    /* (non-Javadoc)
-     * @see com.metamatrix.query.processor.ProcessorPlan#getUpdateCount()
-     */
-    public int getUpdateCount() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
     public Map getDescriptionProperties() {
         return new HashMap();
     }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -33,6 +33,7 @@
 
 import com.metamatrix.query.optimizer.TestAggregatePushdown;
 import com.metamatrix.query.optimizer.TestOptimizer;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.unittest.FakeMetadataFacade;
@@ -243,31 +244,58 @@
     	
     	dataManager.addData("SELECT v_0.c_0, COUNT(v_0.c_1), MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$ 
     			new List[] {
-    				Arrays.asList("a", Integer.valueOf(2), Boolean.TRUE), //$NON-NLS-1$
-    				Arrays.asList("b", null, null) //$NON-NLS-1$
+    				Arrays.asList("a", Integer.valueOf(2), Integer.valueOf(1)), //$NON-NLS-1$
     			});
     	dataManager.addData("SELECT v_0.c_0, COUNT(v_0.c_1), MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$ 
     			new List[] {
-    				Arrays.asList("a", Integer.valueOf(3), Boolean.FALSE), //$NON-NLS-1$
-    				Arrays.asList("b", null, null) //$NON-NLS-1$
+    				Arrays.asList("a", Integer.valueOf(3), Integer.valueOf(2)), //$NON-NLS-1$
     			});
     	dataManager.addData("SELECT g_0.e1, g_0.e2 FROM pm2.g1 AS g_0", //$NON-NLS-1$ 
     			new List[] {
-    				Arrays.asList("a", Boolean.FALSE), //$NON-NLS-1$
-    				Arrays.asList("xyz", Boolean.FALSE), //$NON-NLS-1$
-    				Arrays.asList(null, Boolean.TRUE),
+    				Arrays.asList("a", Integer.valueOf(3)), //$NON-NLS-1$
+    				Arrays.asList("xyz", Integer.valueOf(4)), //$NON-NLS-1$
+    				Arrays.asList(null, Integer.valueOf(5)),
     			});
     	
     	ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
     	
     	List[] expected = new List[] { 
-                Arrays.asList(null, Integer.valueOf(1), Boolean.TRUE),
-                Arrays.asList("a", Integer.valueOf(6), Boolean.TRUE), //$NON-NLS-1$
-                Arrays.asList("b", null, null), //$NON-NLS-1$
-                Arrays.asList("xyz", Integer.valueOf(1), Boolean.FALSE) //$NON-NLS-1$
+                Arrays.asList(null, Integer.valueOf(1), Integer.valueOf(5)),
+                Arrays.asList("a", Integer.valueOf(6), Integer.valueOf(3)), //$NON-NLS-1$
+                Arrays.asList("xyz", Integer.valueOf(1), Integer.valueOf(4)) //$NON-NLS-1$
             };    
     	
     	helpProcess(plan, dataManager, expected);
     }
+    
+	@Test public void testUnionAggregatePushdown() {
+    	Command command = helpParse("select count(*), max(e3) from (select e1, e2, e3 from pm1.g1 union all (select convert(e2, string) as a, e2, e3 from pm2.g2 order by a limit 10)) x group by e1, e2"); //$NON-NLS-1$
+    	
+    	FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+    	capFinder.addCapabilities("pm1", TestAggregatePushdown.getAggregateCapabilities()); //$NON-NLS-1$
+    	BasicSourceCapabilities bac = TestAggregatePushdown.getAggregateCapabilities();
+    	bac.setFunctionSupport("convert", true); //$NON-NLS-1$
+    	capFinder.addCapabilities("pm2", bac); //$NON-NLS-1$
+    	HardcodedDataManager dataManager = new HardcodedDataManager();
+    	
+    	dataManager.addData("SELECT v_0.c_1, v_0.c_0, COUNT(*), MAX(v_0.c_2) FROM (SELECT g_0.e2 AS c_0, g_0.e1 AS c_1, g_0.e3 AS c_2 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0, v_0.c_1", //$NON-NLS-1$ 
+    			new List[] {
+    				Arrays.asList("2", Integer.valueOf(2), Integer.valueOf(2), Boolean.FALSE), //$NON-NLS-1$
+    				Arrays.asList("1", Integer.valueOf(1), Integer.valueOf(3), Boolean.TRUE), //$NON-NLS-1$
+    			});
+    	dataManager.addData("SELECT v_0.c_1, v_0.c_0, COUNT(*), MAX(v_0.c_2) FROM (SELECT g_0.e2 AS c_0, convert(g_0.e2, string) AS c_1, g_0.e3 AS c_2 FROM pm2.g2 AS g_0 ORDER BY c_1 LIMIT 10) AS v_0 GROUP BY v_0.c_0, v_0.c_1", //$NON-NLS-1$ 
+    			new List[] {
+    				Arrays.asList("1", Integer.valueOf(1), Integer.valueOf(4), Boolean.FALSE), //$NON-NLS-1$
+    			});
+    	
+    	ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+    	
+    	List[] expected = new List[] { 
+                Arrays.asList(Integer.valueOf(7), Boolean.TRUE),
+                Arrays.asList(Integer.valueOf(2), Boolean.FALSE),
+            };    
+    	
+    	helpProcess(plan, dataManager, expected);
+    }
 
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestBaseProcessorPlan.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestBaseProcessorPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestBaseProcessorPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,21 +22,12 @@
 
 package com.metamatrix.query.processor;
 
-import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.query.util.CommandContext;
 
 public class TestBaseProcessorPlan extends TestCase {
 
@@ -45,7 +36,7 @@
     }
 
     public void testGetAndClearWarnings() {        
-        FakeProcessorPlan plan = new FakeProcessorPlan();
+        FakeProcessorPlan plan = new FakeProcessorPlan(Collections.emptyList(), Collections.emptyList());
         MetaMatrixException warning = new MetaMatrixException("test"); //$NON-NLS-1$
         plan.addWarning(warning);
         
@@ -54,80 +45,4 @@
         assertEquals("Did not get expected warning", warning, warnings.get(0)); //$NON-NLS-1$
         assertNull("Did not clear warnings from plan", plan.getAndClearWarnings());         //$NON-NLS-1$
     }
-
-
-
-    private static class FakeProcessorPlan extends BaseProcessorPlan {
-            
-        
-            /**
-         * @see java.lang.Object#clone()
-         */
-        public Object clone() {
-            return null;
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#close()
-         */
-        public void close() throws MetaMatrixComponentException {
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#connectTupleSource(com.metamatrix.common.buffer.TupleSource, int)
-         */
-        public void connectTupleSource(TupleSource source, int dataRequestID) {
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#getOutputElements()
-         */
-        public List getOutputElements() {
-            return null;
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#initialize(com.metamatrix.query.processor.ProcessorDataManager, java.lang.Object, com.metamatrix.common.buffer.BufferManager, java.lang.String, int)
-         */
-        public void initialize(
-            CommandContext context,
-            ProcessorDataManager dataMgr,
-            BufferManager bufferMgr) {
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#nextBatch()
-         */
-        public TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException {
-            return null;
-        }
-
-        /**
-         * @see com.metamatrix.query.processor.ProcessorPlan#open()
-         */
-        public void open() throws MetaMatrixComponentException {
-        }
-
-        /* (non-Javadoc)
-         * @see com.metamatrix.query.processor.ProcessorPlan#getUpdateCount()
-         */
-        public int getUpdateCount() {
-            // TODO Auto-generated method stub
-            return 0;
-        }
-
-        public Map getDescriptionProperties() {
-            return new HashMap();
-        }
-        
-        /** 
-         * @see com.metamatrix.query.processor.ProcessorPlan#getChildPlans()
-         * @since 4.2
-         */
-        public Collection getChildPlans() {
-            return Collections.EMPTY_LIST;
-        }
-        
-
-    }
 }

Copied: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestCollectionTupleSource.java (from rev 1724, trunk/engine/src/test/java/com/metamatrix/query/processor/TestCollectionTupleSource.java)
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestCollectionTupleSource.java	                        (rev 0)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestCollectionTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.processor;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
+/**
+ */
+public class TestCollectionTupleSource {
+
+    @Test public void testNullSource() {
+        List<SingleElementSymbol> elements = new ArrayList<SingleElementSymbol>();
+        elements.add(new ElementSymbol("x")); //$NON-NLS-1$
+        elements.add(new ElementSymbol("y")); //$NON-NLS-1$
+        CollectionTupleSource nts = CollectionTupleSource.createNullTupleSource(elements);   
+        
+        // Check schema
+        assertEquals("Didn't get expected schema", elements, nts.getSchema()); //$NON-NLS-1$
+        
+        // Walk it and get no data
+        List tuple = nts.nextTuple();
+        nts.closeSource();
+
+        assertEquals("Didn't get termination tuple for first tuple", null, tuple);             //$NON-NLS-1$
+    }
+    
+    @Test public void testUpdateCountSource() {
+        CollectionTupleSource nts = CollectionTupleSource.createUpdateCountTupleSource(5);   
+        
+        // Check schema
+        assertEquals("Didn't get expected schema", Command.getUpdateCommandSymbol(), nts.getSchema()); //$NON-NLS-1$
+        
+        // Walk it and get no data
+        List tuple = nts.nextTuple();
+        nts.closeSource();
+
+        assertEquals("Didn't get termination tuple for first tuple", Arrays.asList(5), tuple);             //$NON-NLS-1$
+    }
+
+
+}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestDependentJoins.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestDependentJoins.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestDependentJoins.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -642,7 +642,7 @@
 
         // Slightly modify metadata to set max set size to just a few rows - this
         // will allow us to test the dependent overflow case
-        FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
 
         // Plan query
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -711,8 +711,6 @@
         capFinder.addCapabilities("pm4", depcaps); //$NON-NLS-1$
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
-        // Slightly modify metadata to set max set size to just a few rows - this
-        // will allow us to test the dependent overflow case
         FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
 
         Command command = TestProcessor.helpParse(sql);

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -100,7 +100,7 @@
 
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
 
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
         HardcodedDataManager dataManager = new HardcodedDataManager();
 
@@ -259,7 +259,7 @@
 
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
 
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
         HardcodedDataManager dataManager = new HardcodedDataManager();
 
@@ -340,7 +340,7 @@
 
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$ 
 
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
         HardcodedDataManager dataManager = new HardcodedDataManager();
 

Deleted: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestNullTupleSource.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestNullTupleSource.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestNullTupleSource.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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 com.metamatrix.query.processor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.query.sql.symbol.ElementSymbol;
-
-/**
- */
-public class TestNullTupleSource extends TestCase {
-
-    /**
-     * Constructor for TestNullTupleSource.
-     * @param name
-     */
-    public TestNullTupleSource(String name) {
-        super(name);
-    }
-
-    public void testSource() {
-        List elements = new ArrayList();
-        elements.add(new ElementSymbol("x")); //$NON-NLS-1$
-        elements.add(new ElementSymbol("y")); //$NON-NLS-1$
-        NullTupleSource nts = new NullTupleSource(elements);   
-        
-        // Check schema
-        assertEquals("Didn't get expected schema", elements, nts.getSchema()); //$NON-NLS-1$
-        
-        // Walk it and get no data
-        nts.openSource();
-        List tuple = nts.nextTuple();
-        nts.closeSource();
-
-        assertEquals("Didn't get termination tuple for first tuple", null, tuple);             //$NON-NLS-1$
-    }
-
-}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -738,4 +738,20 @@
                
     }
     
+    @Test public void testProcRelationalWithNoInputs() {
+    	String sql = "select e1 from pm1.vsp2 order by e1 desc limit 1"; //$NON-NLS-1$
+
+        // Create expected results
+        List[] expected = new List[] {
+        		Arrays.asList("c") //$NON-NLS-1$
+        };        
+        // Construct data manager with data
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);       
+        // Plan query
+        ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());  
+        // Run query
+        TestProcessor.helpProcess(plan, dataManager, expected);
+    }
+    
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -48,9 +48,8 @@
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.XMLType;
@@ -152,13 +151,12 @@
 	        if (failures.size() > 0){
 	            fail("Exception during validation (" + repo); //$NON-NLS-1$
 	        }        
-			command = QueryRewriter.rewrite(command, null, metadata, createCommandContext());
+			command = QueryRewriter.rewrite(command, metadata, createCommandContext());
 	        ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
 			if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
 	        //per defect 10022, clone this plan before processing, just to make sure
 	        //a cloned plan with correlated subquery references (or any cloned plan) can be processed
-	        ProcessorPlan cloned = (ProcessorPlan)process.clone();
-	        process = cloned;
+	        process = process.clone();
 	        
 	        assertNotNull("Output elements of process plan are null", process.getOutputElements()); //$NON-NLS-1$
 
@@ -184,7 +182,7 @@
     
     public static void helpProcess(ProcessorPlan plan, CommandContext context, ProcessorDataManager dataManager, List[] expectedResults) {
         try {
-            ProcessorPlan clonePlan = (ProcessorPlan) plan.clone();
+            ProcessorPlan clonePlan = plan.clone();
             
             // Process twice to test reset and clone
             doProcess(plan, dataManager, expectedResults, context);
@@ -198,19 +196,20 @@
         }
     }
 
-    private void helpProcessException(ProcessorPlan plan, ProcessorDataManager dataManager) throws TupleSourceNotFoundException, MetaMatrixComponentException {
+    private void helpProcessException(ProcessorPlan plan, ProcessorDataManager dataManager) {
         helpProcessException(plan, dataManager, null);
     }
     
-    private void helpProcessException(ProcessorPlan plan, ProcessorDataManager dataManager, String expectedErrorMessage) throws TupleSourceNotFoundException, MetaMatrixComponentException {
-    	TupleSourceID tsId = null;
+    private void helpProcessException(ProcessorPlan plan, ProcessorDataManager dataManager, String expectedErrorMessage) {
+    	TupleBuffer tsId = null;
     	BufferManager bufferMgr = null;
         try {   
             bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
             CommandContext context = new CommandContext("0", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
             QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-            tsId = processor.getResultsID();
-            processor.process();
+            processor.setNonBlocking(true);
+            BatchCollector collector = processor.createBatchCollector();
+            tsId = collector.collectTuples();
             fail("Expected error during processing, but got none."); //$NON-NLS-1$
         } catch(MetaMatrixCoreException e) {
             // ignore - this is expected
@@ -218,24 +217,30 @@
                 assertEquals(expectedErrorMessage, e.getMessage());
             }
         } finally {
-        	bufferMgr.removeTupleSource(tsId);
+        	if (tsId != null) {
+        		tsId.remove();
+        	}
         }
     }
         
     public static void doProcess(ProcessorPlan plan, ProcessorDataManager dataManager, List[] expectedResults, CommandContext context) throws Exception {
         BufferManagerImpl bufferMgr = (BufferManagerImpl)BufferManagerFactory.getStandaloneBufferManager();
-        bufferMgr.getConfig().setProcessorBatchSize(context.getProcessorBatchSize());
-        bufferMgr.getConfig().setConnectorBatchSize(context.getProcessorBatchSize());
+        bufferMgr.setProcessorBatchSize(context.getProcessorBatchSize());
+        bufferMgr.setConnectorBatchSize(context.getProcessorBatchSize());
         context.getNextRand(0);
-        TupleSourceID id = null;
+        TupleBuffer id = null;
         try {
             QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-            id = processor.getResultsID();
-    		processor.process();
-            assertEquals(0, bufferMgr.getPinnedCount());
-            if ( expectedResults != null ) examineResults(expectedResults, bufferMgr, processor.getResultsID());
+            processor.setNonBlocking(true);
+            BatchCollector collector = processor.createBatchCollector();
+            id = collector.collectTuples();
+            if ( expectedResults != null ) {
+            	examineResults(expectedResults, bufferMgr, id);
+            }
         } finally {
-            bufferMgr.removeTupleSource(id);
+        	if (id != null) {
+        		id.remove();
+        	}
         }
     }
 
@@ -247,16 +252,16 @@
      * @throws MetaMatrixProcessingException 
      * @since 4.3
      */
-    static void examineResults(List[] expectedResults,BufferManager bufferMgr,TupleSourceID tsID) 
+    static void examineResults(List[] expectedResults,BufferManager bufferMgr,TupleBuffer tsID) 
         throws MetaMatrixComponentException,SQLException, MetaMatrixProcessingException {
         
         // Create QueryResults from TupleSource
-        TupleSource ts = bufferMgr.getTupleSource(tsID);
-        int count = bufferMgr.getFinalRowCount(tsID);   
+        TupleSource ts = tsID.createIndexedTupleSource();
+        int count = tsID.getRowCount();   
 
 		if(DEBUG) {
-            System.out.println("\nResults:\n" + bufferMgr.getTupleSchema(tsID)); //$NON-NLS-1$
-            TupleSource ts2 = bufferMgr.getTupleSource(tsID);
+            System.out.println("\nResults:\n" + tsID.getSchema()); //$NON-NLS-1$
+            TupleSource ts2 = tsID.createIndexedTupleSource();
             for(int j=0; j<count; j++) {
                 System.out.println("" + j + ": " + ts2.nextTuple());	 //$NON-NLS-1$ //$NON-NLS-2$
             }    
@@ -276,6 +281,7 @@
             	if(cellValue instanceof XMLType){
                     XMLType id =  (XMLType)cellValue; 
                     String actualDoc = id.getString(); 
+                    record = new ArrayList(record);
                     record.set(0, actualDoc);
             	}
             }
@@ -369,9 +375,8 @@
                     Arrays.asList(new Object[] { "c",   new Integer(2),     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
                     } );                                     
                                      
-        } catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }                  
 
@@ -425,9 +430,8 @@
                     Arrays.asList(new Object[] { "cc",   new Integer(2),     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
                     } );              
             
-        } catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }    
     
@@ -481,9 +485,8 @@
                     } );       
             
             
-        } catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }    
     
@@ -505,9 +508,8 @@
                 new List[] { 
                     Arrays.asList(new Object[] { new Integer(1) }),                    
                     } );    
-        }catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        }catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }
 
@@ -530,9 +532,8 @@
                     } );       
 
                                      
-        } catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }     
     
@@ -572,9 +573,8 @@
         
             dataMgr.registerTuples(groupID, elementSymbols, tuples);
 
-        }catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }
 
@@ -604,9 +604,8 @@
                 dataMgr.registerTuples(groupID, elementSymbols, tuples);
             }
 
-        }catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }
     
@@ -649,9 +648,8 @@
         
             dataMgr.registerTuples(groupID, elementSymbols, tuples);
 
-        }catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }    
 
@@ -675,9 +673,8 @@
         
             dataMgr.registerTuples(groupID, elementSymbols, tuples);
 
-        }catch(Throwable e) { 
-            e.printStackTrace();
-            fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage());    //$NON-NLS-1$ //$NON-NLS-2$
+        } catch(MetaMatrixException e) { 
+        	throw new RuntimeException(e);
         }
     }
 
@@ -1990,7 +1987,7 @@
 		sampleData1(dataManager);
 
 		// Plan query
-		ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1());
+		ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
 
 		// Run query
 		helpProcess(plan, dataManager, expected);
@@ -3915,7 +3912,7 @@
         sampleData1(dataManager);
 
         // Plan query
-        ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1());
+        ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
 
         // Run query
         helpProcess(plan, dataManager, expected);
@@ -6515,7 +6512,7 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
         
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
         
         Command command = helpParse(sql);   
         ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -7512,6 +7509,55 @@
         
         helpProcess(plan, dataManager, expected);
     }
+
+    /**
+     * Test a query that uses ambiguous alias names in the top level query and 
+     * its sub-query and uses columns belonging to the alias as a parameter to a 
+     * function.
+     * <p>
+     * For example, <code>SELECT CONVERT(A.e2, biginteger) AS e2 FROM (SELECT 
+     * CONVERT(e2, long) AS e2 FROM pm1.g1 AS A) AS A</code>
+     * <p>
+     * The test is to ensure that A.e2 from the top level is not confused with 
+     * e2 in the second level.
+     * <p>
+     * Related Defects: JBEDSP-1137
+     */
+    @Test public void testAliasReuseInFunctionInSubQuery() throws Exception {
+        // Create query
+    	String sql = "SELECT CONVERT(A.e2, biginteger) AS e2 FROM (" + //$NON-NLS-1$
+    	"   SELECT CONVERT(e2, long) AS e2 FROM pm1.g1 AS A WHERE e1 = 'a'" + //$NON-NLS-1$
+    	") AS A"; //$NON-NLS-1$
+        
+        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+        
+        ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
+        
+        List[] expected = new List[] {
+            Arrays.asList(new Object[] { new BigInteger("0") }), //$NON-NLS-1$
+            Arrays.asList(new Object[] { new BigInteger("3") }), //$NON-NLS-1$ 
+            Arrays.asList(new Object[] { new BigInteger("0") }), //$NON-NLS-1$ 
+        };
+
+        FakeDataManager manager = new FakeDataManager();
+        sampleData1(manager);
+        helpProcess(plan, manager, expected);
+    }
     
+    @Test public void testOrderByDescAll() {
+        String sql = "SELECT distinct e1 from pm1.g2 order by e1 desc limit 1"; //$NON-NLS-1$
+        
+        List[] expected = new List[] { 
+            Arrays.asList("c"),
+        };    
+    
+        FakeDataManager dataManager = new FakeDataManager();
+        sampleData1(dataManager);
+        
+        ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+        
+        helpProcess(plan, dataManager, expected);
+    }
+
     private static final boolean DEBUG = false;
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -29,13 +29,12 @@
 
 import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
 import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
 import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.util.CommandContext;
@@ -58,22 +57,21 @@
 
         CommandContext context = new CommandContext("pid", "group", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
         QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-                 
+        BatchCollector collector = processor.createBatchCollector();
+        TupleBuffer tsID = null;
         while(true) {
             try {
-                boolean done = processor.process(timeslice);
-                if(done) {
-                    break;
-                }
+                tsID = collector.collectTuples();         
+                break;
             } catch(BlockedException e) {
             }
         }
         
         // Compare # of rows in actual and expected
-        assertEquals("Did not get expected # of rows", expectedResults.length, bufferMgr.getFinalRowCount(processor.getResultsID())); //$NON-NLS-1$
+        assertEquals("Did not get expected # of rows", expectedResults.length, tsID.getRowCount()); //$NON-NLS-1$
         
         // Compare actual with expected results
-        TupleSource actual = bufferMgr.getTupleSource(processor.getResultsID());
+        TupleSource actual = tsID.createIndexedTupleSource();
         if(expectedResults.length > 0) {
             for(int i=0; i<expectedResults.length; i++) {
                 List actRecord = actual.nextTuple();
@@ -81,6 +79,7 @@
                 assertEquals("Did not match row at row index " + i, expRecord, actRecord); //$NON-NLS-1$
             }
         }
+        tsID.remove();
     }
     
     public void testNoResults() throws Exception {
@@ -137,59 +136,4 @@
         FakeProcessorPlan plan = new FakeProcessorPlan(elements, batches);
         helpTestProcessor(plan, 1000, expectedResults);                    
     }
-    
-    public void testProcessWhenClientNeedsBatch() throws Exception {
-        List elements = new ArrayList();
-        elements.add(new ElementSymbol("a")); //$NON-NLS-1$
-                
-        HashSet blocked = new HashSet(Arrays.asList(new Integer[] { new Integer(2)}));
-        int numBatches = 5;
-        int batchRow = 1;        
-        int rowsPerBatch = 10;
-        List[] expectedResults = new List[rowsPerBatch*(numBatches-blocked.size())];
-        List batches = new ArrayList();
-        for(int b=0; b<numBatches; b++) {
-            if(blocked.contains(new Integer(b))) {
-                batches.add(BlockedException.INSTANCE);
-            } else {    
-                List[] rows = new List[rowsPerBatch];
-                for(int i=0; i<rowsPerBatch; i++) {
-                    rows[i] = new ArrayList();
-                    rows[i].add(new Integer(batchRow));
-                    expectedResults[batchRow-1] = rows[i];
-                    batchRow++;
-                }
-                                                
-                TupleBatch batch = new TupleBatch(batchRow-rows.length, rows);
-                if(b == numBatches-1) {
-                    batch.setTerminationFlag(true);
-                } 
-                batches.add(batch);
-            }
-        }
-        
-        final FakeProcessorPlan plan = new FakeProcessorPlan(elements, batches);
-        
-        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
-        FakeDataManager dataManager = new FakeDataManager();
-
-        CommandContext context = new CommandContext("pid", "group", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
-        final QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-        
-        processor.setBatchHandler(new QueryProcessor.BatchHandler() {
-        	
-        	int count = 0;
-        	
-			public void batchProduced(TupleBatch batch) throws TupleSourceNotFoundException, MetaMatrixComponentException {
-		
-				assertEquals(++count, plan.batchIndex);
-				if (count == 2) {
-					processor.closeProcessing();
-				}
-			}
-        });
-        
-        // Give the processor plenty of time to process
-        processor.process(30000);
-    }
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestVirtualDepJoin.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestVirtualDepJoin.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/TestVirtualDepJoin.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -38,10 +38,9 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.BufferManagerPropertyNames;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManagerFactory.MemoryStorageManager;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
+import com.metamatrix.common.buffer.impl.MemoryStorageManager;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.query.mapping.relational.QueryNode;
 import com.metamatrix.query.optimizer.TestOptimizer;
@@ -154,7 +153,7 @@
         FakeMetadataObject accounts = FakeMetadataFactory.createVirtualGroup("Accounts.Accounts", vAccts, accountsPlan); //$NON-NLS-1$
         List accountsElem = FakeMetadataFactory.createElements(accounts, 
                                             new String[] { "customer_id", "account_id", "transaction_id", "txn_type", "amount", "source" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-                                            new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.STRING });
+                                            new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.STRING });
         
         FakeMetadataObject master = FakeMetadataFactory.createVirtualModel("Master"); //$NON-NLS-1$
         QueryNode masterPlan = new QueryNode("Master.Transactions", //$NON-NLS-1$
@@ -162,7 +161,7 @@
         FakeMetadataObject transactions = FakeMetadataFactory.createVirtualGroup("Master.Transactions", master, masterPlan); //$NON-NLS-1$
         List transactionsElem = FakeMetadataFactory.createElements(transactions, 
                                             new String[] { "CustomerID", "First", "Last", "AccountID", "TransactionID", "TxnCode", "Amount" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-                                            new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
+                                            new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL });
         
         FakeMetadataStore store = new FakeMetadataStore();
         store.addObject(us);
@@ -418,7 +417,6 @@
     private void helpTestMultipleBatches(boolean unique) throws Exception,
                                           MetaMatrixComponentException,
                                           MetaMatrixException,
-                                          TupleSourceNotFoundException,
                                           SQLException {
         // Create query  
         String sql = "SELECT * from Master.Transactions where last = 'Davis' order by CustomerID, TransactionID"; //$NON-NLS-1$ 
@@ -484,21 +482,19 @@
         // Run query 
         BufferManager bufferMgr = createCustomBufferMgr(2);
         QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-        processor.process();
+        processor.setNonBlocking(true);
+        BatchCollector collector = processor.createBatchCollector();
+        TupleBuffer id = collector.collectTuples();
 
-        TestProcessor.examineResults((List[])expected.toArray(new List[expected.size()]), bufferMgr, processor.getResultsID());
+        TestProcessor.examineResults((List[])expected.toArray(new List[expected.size()]), bufferMgr, id);
     }
 
     private BufferManager createCustomBufferMgr(int batchSize) throws MetaMatrixComponentException {
-        BufferManager bufferMgr = new BufferManagerImpl();
+        BufferManagerImpl bufferMgr = new BufferManagerImpl();
         Properties props = new Properties();
-        props.setProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE, String.valueOf(Long.MAX_VALUE)); 
-        props.setProperty(BufferManagerPropertyNames.SESSION_USE_PERCENTAGE, "100"); //$NON-NLS-1$
-        props.setProperty(BufferManagerPropertyNames.LOG_STATS_INTERVAL, "0"); //$NON-NLS-1$
-        props.setProperty(BufferManagerPropertyNames.MANAGEMENT_INTERVAL, "0"); //$NON-NLS-1$
-        props.setProperty(BufferManagerPropertyNames.PROCESSOR_BATCH_SIZE, String.valueOf(batchSize));
-        props.setProperty(BufferManagerPropertyNames.CONNECTOR_BATCH_SIZE, String.valueOf(batchSize));
-        bufferMgr.initialize("local", props); //$NON-NLS-1$
+        props.setProperty(BufferManager.PROCESSOR_BATCH_SIZE, String.valueOf(batchSize));
+        props.setProperty(BufferManager.CONNECTOR_BATCH_SIZE, String.valueOf(batchSize));
+        bufferMgr.initialize(props);
 
         // Add unmanaged memory storage manager
         bufferMgr.setStorageManager(new MemoryStorageManager());

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,30 +24,20 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.query.processor.BaseProcessorPlan;
-import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.util.CommandContext;
+import com.metamatrix.query.processor.FakeProcessorPlan;
 
 
 /** 
  * @since 4.2
  */
 public class TestBatchedUpdatePlan extends TestCase {
-    private int plansOpened = 0;
-    private int nextBatchesCalled = 0;
-    public TestBatchedUpdatePlan(String name) {
+
+	public TestBatchedUpdatePlan(String name) {
         super(name);
     }
     
@@ -58,7 +48,7 @@
             totalCommands += commandsPerPlan[i];
             plans.add(new FakeProcessorPlan(commandsPerPlan[i]));
         }
-        BatchedUpdatePlan plan = new BatchedUpdatePlan(plans, totalCommands);
+        BatchedUpdatePlan plan = new BatchedUpdatePlan(plans, totalCommands, null);
         TupleBatch batch = plan.nextBatch();
         assertEquals(totalCommands, batch.getRowCount());
         for (int i = 1; i <= totalCommands; i++) {
@@ -71,11 +61,11 @@
         for (int i = 0; i < plans.length; i++) {
             plans[i] = new FakeProcessorPlan(1);
         }
-        BatchedUpdatePlan plan = new BatchedUpdatePlan(Arrays.asList(plans), plans.length);
+        BatchedUpdatePlan plan = new BatchedUpdatePlan(Arrays.asList(plans), plans.length, null);
         plan.open();
         // First plan may or may not be opened, but all subsequent plans should not be opened.
         for (int i = 1; i < plans.length; i++) {
-            assertFalse(plans[i].opened);
+            assertFalse(plans[i].isOpened());
         }
     }
 
@@ -91,38 +81,4 @@
         helpTestNextBatch(new int[] {1, 1, 1, 1});
     }
     
-    private class FakeProcessorPlan extends BaseProcessorPlan {
-        private int counts = 0;
-        private boolean opened = false;
-        private int updateConnectorCount = 1;
-        private FakeProcessorPlan(int commands) {
-            counts = commands;
-        }       
-        public Object clone() {return null;}
-        public void close() throws MetaMatrixComponentException {}
-        public void connectTupleSource(TupleSource source, int dataRequestID) {}
-        public List getOutputElements() {return null;}
-        public int getUpdateCount() {return updateConnectorCount;}
-        public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {}
-        public TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException {
-            nextBatchesCalled++;
-            assertTrue(opened);
-            assertTrue(nextBatchesCalled == plansOpened);
-            List[] rows = new List[counts];
-            for (int i = 0; i < counts; i++) {
-                rows[i] = Arrays.asList(new Object[] {new Integer(1)});
-            }
-            TupleBatch batch = new TupleBatch(1, rows);
-            batch.setTerminationFlag(true);
-            return batch;
-        }
-        public void open() throws MetaMatrixComponentException {
-            assertFalse("ProcessorPlan.open() should not be called more than once", opened); //$NON-NLS-1$
-            opened = true;
-            plansOpened++;
-        }
-        public Map getDescriptionProperties() {return null;}
-        public Collection getChildPlans() {return Collections.EMPTY_LIST;}
-        
-    }
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -63,7 +63,7 @@
 			throws MetaMatrixProcessingException, MetaMatrixComponentException {
 		Command command = QueryParser.getQueryParser().parseCommand(sql);
 		QueryResolver.resolveCommand(command, metadata);
-		command = QueryRewriter.rewrite(command, null, metadata, commandContext);
+		command = QueryRewriter.rewrite(command, metadata, commandContext);
 		ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata,
 				idGenerator, finder, AnalysisRecord.createNonRecordingRecord(),
 				commandContext);

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,23 +22,15 @@
 
 package com.metamatrix.query.processor.dynamic;
 
-import java.io.BufferedReader;
 import java.util.Collections;
 
 import javax.xml.transform.Source;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
 
 import junit.framework.TestCase;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
+import com.metamatrix.common.types.StandardXMLTranslator;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
@@ -69,7 +61,7 @@
         CommandContext cc = TestProcessor.createCommandContext();
         cc.setQueryProcessorFactory(factory);
         
-        SqlEval sqlEval = new SqlEval(bufferMgr, null, cc, null, Collections.EMPTY_MAP);
+        SqlEval sqlEval = new SqlEval(null, cc, null, Collections.EMPTY_MAP);
         Source results =  sqlEval.executeSQL(sql);        
         String result = toXMLString(results);
         sqlEval.close();
@@ -77,55 +69,15 @@
     }
     
     String toXMLString(Source xmlSrc) throws Exception{
-        if (xmlSrc instanceof StreamSource) {
-            StreamSource input = (StreamSource)xmlSrc;
-            BufferedReader reader = new BufferedReader(input.getReader());
-            StringBuffer sb = new StringBuffer();
-            
-            int line = reader.read();
-            while(line != -1) {
-                sb.append((char)line);
-                line = reader.read();
-            }
-            reader.close();
-            return sb.toString();            
-        }
-        else if (xmlSrc instanceof SAXSource) {
-            SAXSource input = (SAXSource)xmlSrc;
-            final StringBuffer sb = new StringBuffer();
-            ContentHandler handler = new DefaultHandler() {
-
-                public void characters(char[] ch,int start,int length) throws SAXException {
-                    sb.append(ch, start, length);
-                }
-                public void endDocument() throws SAXException {
-                    super.endDocument();
-                }
-                public void endElement(String uri,String localName,String qName) throws SAXException {
-                    sb.append("</").append(qName).append(">"); //$NON-NLS-1$ //$NON-NLS-2$
-                }
-                public void error(SAXParseException e) throws SAXException {
-                    super.error(e);
-                }
-                public void startDocument() throws SAXException {
-                    super.startDocument();
-                }
-                public void startElement(String uri,String localName,String qName, Attributes attributes) throws SAXException {
-                    sb.append("<").append(qName).append(">"); //$NON-NLS-1$ //$NON-NLS-2$
-                }                
-            };
-            input.getXMLReader().setContentHandler(handler);
-            input.getXMLReader().parse(input.getInputSource());
-            return sb.toString();
-        }
-        return ""; //$NON-NLS-1$
+    	StandardXMLTranslator sxt = new StandardXMLTranslator(xmlSrc, null);
+    	return sxt.getString();
     }
       
     public void testTableResult() throws Exception { 
         // Create query 
         String sql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1"; //$NON-NLS-1$
         
-        String expected ="" + //$NON-NLS-1$ 
+        String expected ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + //$NON-NLS-1$ 
                     "<results>" + //$NON-NLS-1$
                     "<row><e1>a</e1><e2>0</e2><a>false</a><b>2.0</b></row>" + //$NON-NLS-1$
                     "<row><e1>null</e1><e2>1</e2><a>false</a><b>1.0</b></row>" +//$NON-NLS-1$
@@ -148,9 +100,8 @@
         // Create query 
         String sql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1 where e2=4"; //$NON-NLS-1$
         
-        String expected ="" + //$NON-NLS-1$ 
-                    "<results>" + //$NON-NLS-1$
-                    "</results>";//$NON-NLS-1$
+        String expected ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + //$NON-NLS-1$ 
+                    "<results/>"; //$NON-NLS-1$
                 
         // Construct data manager with data
         FakeDataManager dataMgr = new FakeDataManager();
@@ -166,7 +117,7 @@
         FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
         FakeDataManager dataMgr = TestXMLProcessor.exampleDataManager(metadata);
         String expected = 
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +  //$NON-NLS-1$
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +  //$NON-NLS-1$
             "<Catalogs xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + //$NON-NLS-1$
             "   <Catalog>\n" +  //$NON-NLS-1$
             "      <Items>\n" +  //$NON-NLS-1$

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -41,8 +41,8 @@
 import com.metamatrix.api.exception.query.QueryValidatorException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.XMLType;
 import com.metamatrix.core.MetaMatrixCoreException;
@@ -55,6 +55,7 @@
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import com.metamatrix.query.parser.QueryParser;
+import com.metamatrix.query.processor.BatchCollector;
 import com.metamatrix.query.processor.FakeDataManager;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
@@ -91,7 +92,7 @@
             ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
             throw new QueryValidatorException(firstFailure.getMessage());
         }
-        QueryRewriter.rewrite(userCommand, null, metadata, new CommandContext());
+        QueryRewriter.rewrite(userCommand, metadata, new CommandContext());
 
         AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
         try {
@@ -110,26 +111,25 @@
         }
     }
     
-    static void helpTestProcess(boolean optimistic, ProcessorPlan procPlan, int rowsUpdated, List[] expectedResults, boolean shouldFail, 
-    		ProcessorDataManager dataMgr) throws SQLException, MetaMatrixCoreException {
+    static void helpTestProcess(ProcessorPlan procPlan, int rowsUpdated, List[] expectedResults, boolean shouldFail, ProcessorDataManager dataMgr) throws SQLException, MetaMatrixCoreException {
         // Process twice, testing reset and clone method of Processor plan
         for (int i=1; i<=2; i++) {
 	        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
             CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
             context.getNextRand(0);
-            context.setOptimisticTransaction(optimistic);
             context.setProcessDebug(DEBUG);
             QueryProcessor processor = new QueryProcessor(procPlan, context, bufferMgr, dataMgr);
-            TupleSourceID tsID = processor.getResultsID();  
-	        processor.process();
+            processor.setNonBlocking(true);
+            BatchCollector collector = processor.createBatchCollector();  
+	        TupleBuffer tsID = collector.collectTuples();
 	
 	        // Create QueryResults from TupleSource
-	        TupleSource ts = bufferMgr.getTupleSource(tsID);
-	
+	        TupleSource ts = tsID.createIndexedTupleSource();
+	        int count = tsID.getRowCount();   
+            
             if(DEBUG) {
-                int count = bufferMgr.getFinalRowCount(tsID);   
-                System.out.println("\nResults:\n" + bufferMgr.getTupleSchema(tsID)); //$NON-NLS-1$
-                TupleSource ts2 = bufferMgr.getTupleSource(tsID);
+                System.out.println("\nResults:\n" + tsID.getSchema()); //$NON-NLS-1$
+                TupleSource ts2 = tsID.createIndexedTupleSource();
                 for(int j=0; j<count; j++) {
                     System.out.println("" + j + ": " + ts2.nextTuple());     //$NON-NLS-1$ //$NON-NLS-2$
                 }    
@@ -140,8 +140,6 @@
                 fail("Expected processing to fail"); //$NON-NLS-1$
             }
             
-            int count = bufferMgr.getFinalRowCount(tsID);
-                   
             if (expectedResults == null) {
                 assertEquals("Incorrect number of rows: ", 1, count);   //$NON-NLS-1$
                 List tuple = ts.nextTuple();   	
@@ -153,7 +151,7 @@
 	        
             if (expectedResults != null) {
     	        //Walk results and compare
-                ts = bufferMgr.getTupleSource(tsID);
+                ts = tsID.createIndexedTupleSource();
                 assertEquals("Incorrect number of rows: ", expectedResults.length, count);   //$NON-NLS-1$
                 for(int j=0; j<count; j++) { 
                     List record = ts.nextTuple();  
@@ -195,12 +193,12 @@
     }
     
     private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr) throws SQLException, MetaMatrixCoreException {
-        helpTestProcess(false, procPlan, expectedRows, null, false, dataMgr);
+        helpTestProcess(procPlan, expectedRows, null, false, dataMgr);
     }
     
     static void helpTestProcess(boolean optimistic, ProcessorPlan procPlan, List[] expectedResults, 
     		ProcessorDataManager dataMgr, boolean shouldFail) throws SQLException, MetaMatrixCoreException {
-        helpTestProcess(optimistic, procPlan, 0, expectedResults, shouldFail, dataMgr);
+        helpTestProcess(procPlan, 0, expectedResults, shouldFail, dataMgr);
     }
 
     // Helper to create a list of elements - used in creating sample data
@@ -1655,38 +1653,7 @@
     	
         helpTestProcessFailure(false, plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING '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'."); //$NON-NLS-1$
      }
- 
-    @Test public void testDynamicCommandInvalidModelUpdateCountEqualOne() throws Exception {
-    	//Test invalid update model count
-    	//Set update model count to 1 while actual is 2   
-        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$
-                                        + "INSERT INTO pm1.g1 (e1) VALUES (pm1.sq1.in);UPDATE pm1.g2 SET e1 = 'Next'; 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  UPDATE 1; 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(true, plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string UPDATE 1\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The actual model update count '2' is greater than the expected value of '1'.  This is potentially unsafe in OPTIMISTIC transaction mode.  Please adjust the UPDATE clause of the dynamic SQL statement."); //$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();

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/BlockingFakeRelationalNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/BlockingFakeRelationalNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/BlockingFakeRelationalNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -28,12 +28,6 @@
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.*;
 
-/**
- * @author amiller
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
 public class BlockingFakeRelationalNode extends FakeRelationalNode {
 
     private boolean blocked = false;
@@ -63,6 +57,7 @@
             blocked = true;
             throw BlockedException.INSTANCE;            
         }
+        blocked = false;
         return super.nextBatchDirect();
     }
 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/NodeTestUtil.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/NodeTestUtil.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/NodeTestUtil.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,19 +23,12 @@
 package com.metamatrix.query.processor.relational;
 
 import java.util.Properties;
-import java.util.Set;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.BufferManagerPropertyNames;
-import com.metamatrix.common.buffer.MemoryNotAvailableException;
 import com.metamatrix.common.buffer.StorageManager;
-import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManagerFactory.MemoryStorageManager;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
-import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.common.buffer.impl.MemoryStorageManager;
 
 
 /** 
@@ -47,9 +40,8 @@
 
         // Get the properties for BufferManager
         Properties bmProps = new Properties();                        
-        bmProps.setProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE, "" + bytesAvailable); //$NON-NLS-1$
-        bmProps.setProperty(BufferManagerPropertyNames.PROCESSOR_BATCH_SIZE, "" + procBatchSize); //$NON-NLS-1$
-        bmProps.setProperty(BufferManagerPropertyNames.CONNECTOR_BATCH_SIZE, "" + connectorBatchSize); //$NON-NLS-1$
+        bmProps.setProperty(BufferManager.PROCESSOR_BATCH_SIZE, "" + procBatchSize); //$NON-NLS-1$
+        bmProps.setProperty(BufferManager.CONNECTOR_BATCH_SIZE, "" + connectorBatchSize); //$NON-NLS-1$
         return createBufferManager(bmProps);
     }
     
@@ -57,19 +49,17 @@
 
         // Get the properties for BufferManager
         Properties bmProps = new Properties();                        
-        bmProps.setProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE, "" + bytesAvailable); //$NON-NLS-1$
-        bmProps.setProperty(BufferManagerPropertyNames.PROCESSOR_BATCH_SIZE, "" + procBatchSize); //$NON-NLS-1$
+        bmProps.setProperty(BufferManager.PROCESSOR_BATCH_SIZE, "" + procBatchSize); //$NON-NLS-1$
         return createBufferManager(bmProps);
     }
     
     static BufferManager createBufferManager(Properties bmProps) {
-        BufferManager bufferManager = new TestableBufferManagerImpl();
-        bmProps.setProperty(BufferManagerPropertyNames.MANAGEMENT_INTERVAL, "0"); //$NON-NLS-1$
+        BufferManagerImpl bufferManager = new BufferManagerImpl();
         try {
-            bufferManager.initialize("local", bmProps); //$NON-NLS-1$
-        } catch (MetaMatrixComponentException err) {
-            throw new MetaMatrixRuntimeException(err);
-        }
+			bufferManager.initialize(bmProps);
+		} catch (MetaMatrixComponentException e) {
+			throw new RuntimeException(e);
+		}
 
         // Add storage managers
         
@@ -82,41 +72,4 @@
         return new MemoryStorageManager();        
     } 
     
-    public static class TestableBufferManagerImpl extends BufferManagerImpl {
-        
-        private Set blockOn;
-        private int pinCount = 0;
-        private boolean wasBlocked;
-        
-        /** 
-         * @see com.metamatrix.common.buffer.impl.BufferManagerImpl#pinTupleBatch(com.metamatrix.common.buffer.TupleSourceID, int)
-         */
-        public TupleBatch pinTupleBatch(TupleSourceID tupleSourceID,
-                                        int beginRow) throws TupleSourceNotFoundException,
-                                                      MemoryNotAvailableException,
-                                                      MetaMatrixComponentException {
-            if (blockOn != null && blockOn.contains(new Integer(++pinCount))) {
-                wasBlocked = true;
-                throw new MemoryNotAvailableException();
-            }
-            
-            wasBlocked = false;
-            
-            return super.pinTupleBatch(tupleSourceID, beginRow);
-        }
-
-        
-        /** 
-         * @param blockOn The blockOn to set.
-         */
-        public void setBlockOn(Set blockOn) {
-            this.blockOn = blockOn;
-        }
-        
-        public boolean wasBlocked() {
-            return wasBlocked;
-        }
-        
-    }
-    
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -84,7 +84,12 @@
         }
         FakePDM fakePDM = new FakePDM(numExecutedCommands);
         BatchedUpdateNode node = helpOpen(commands, fakePDM);
-        TupleBatch batch = node.nextBatch();
+        TupleBatch batch = null;
+        try {
+        	batch = node.nextBatch();
+        } catch (BlockedException e) {
+        	batch = node.nextBatch();
+        }
         assertNotNull(batch);
         assertTrue(batch.getTerminationFlag());
         assertEquals(expectedResults.length, batch.getRowCount());
@@ -180,12 +185,12 @@
     }
     
     @Test public void testNextBatchSomeCommandsExecuted() throws Exception {
-        String[] commands = {"UPDATE pm1.g1 SET e2 = 50 WHERE e1 = 'criteria'", //$NON-NLS-1$
-                             "DELETE FROM pm1.g2 WHERE 1 = 0", //$NON-NLS-1$
+        String[] commands = {"DELETE FROM pm1.g2 WHERE 1 = 0", //$NON-NLS-1$
+        					 "UPDATE pm1.g1 SET e2 = 50 WHERE e1 = 'criteria'", //$NON-NLS-1$
                              "UPDATE pm1.g2 set e2 = 5, e3 = {b'false'}, e4 = 3.33 WHERE e1 = 'myrow'", //$NON-NLS-1$
                              "UPDATE pm1.g2 set e2 = 5, e3 = {b'false'}, e4 = 3.33 WHERE 1 = 0" //$NON-NLS-1$
         };
-        int[] expectedResults = {1,0,1,0};
+        int[] expectedResults = {0,1,1,0};
         helpTestNextBatch(commands, expectedResults);
     }
     
@@ -194,7 +199,7 @@
         };
         int[] expectedResults = {1};
         FakePDM fpdm = helpTestNextBatch(commands, expectedResults);
-        assertEquals("INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES (null, 1, TRUE, 1.0)", ((BatchedUpdateCommand)fpdm.actualCommands.get(0)).getContainedCommands().get(0).toString()); //$NON-NLS-1$
+        assertEquals("INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES (null, 1, TRUE, 1.0)", ((BatchedUpdateCommand)fpdm.actualCommands.get(0)).getUpdateCommands().get(0).toString()); //$NON-NLS-1$
     }
     
     private static final class FakePDM implements ProcessorDataManager {
@@ -221,13 +226,18 @@
     private static final class FakeTupleSource implements TupleSource {
         private int currentTuple = 0;
         private int numCommands;
+        private boolean first = true;
         private FakeTupleSource(int numCommands) {
             this.numCommands = numCommands;
         }
         public void closeSource() throws MetaMatrixComponentException {}
         public List getSchema() {return null;}
         public List nextTuple() throws MetaMatrixComponentException {
-            if (currentTuple < numCommands) {
+            if (first) {
+            	first = false;
+            	throw BlockedException.INSTANCE;
+            }
+        	if (currentTuple++ < numCommands) {
                 return Arrays.asList(new Object[] {new Integer(1)});
             }
             return null;

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestDuplicateFilter.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestDuplicateFilter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestDuplicateFilter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -46,7 +46,7 @@
     public void helpTestDuplicateFilter(Object[] input, Class dataType, int expected) throws MetaMatrixComponentException, MetaMatrixProcessingException {
         BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
         
-        DuplicateFilter filter = new DuplicateFilter(new Count(), mgr, "test", mgr.getProcessorBatchSize()); //$NON-NLS-1$
+        DuplicateFilter filter = new DuplicateFilter(new Count(), mgr, "test"); //$NON-NLS-1$
         filter.initialize(dataType, dataType);
         filter.reset();
         

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -64,10 +64,11 @@
 	// ################################## TEST HELPERS ################################
 
 	public static TupleSource createTupleSource1() { 
-		List symbols = new ArrayList();
+		List<ElementSymbol> symbols = new ArrayList<ElementSymbol>();
 		symbols.add(new ElementSymbol("col1")); //$NON-NLS-1$
+		symbols.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
 		symbols.add(new ElementSymbol("col2")); //$NON-NLS-1$
-		
+		symbols.get(1).setType(DataTypeManager.DefaultDataClasses.INTEGER);
 		List[] tuples = new List[] {
 			Arrays.asList(new Object[] { new Integer(5), new Integer(3) }),
 			Arrays.asList(new Object[] { new Integer(2), new Integer(1) }),
@@ -158,7 +159,7 @@
 		node.setElements(outputElements);
 		
 		List groupingElements = new ArrayList();
-		groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
+		groupingElements.add(col1); //$NON-NLS-1$
 		node.setGroupingElements(groupingElements);	  
         CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
         node.initialize(context, mgr, null);
@@ -207,7 +208,7 @@
     // Same as test2, but uses processor batch size smaller than number of groups
     public void test3() throws Exception {
         BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
-        ((BufferManagerImpl)mgr).getConfig().setProcessorBatchSize(5);
+        ((BufferManagerImpl)mgr).setProcessorBatchSize(5);
 
         GroupingNode node = getExampleGroupingNode();         
         CommandContext context = new CommandContext("pid", "test", null, null,  1);               //$NON-NLS-1$ //$NON-NLS-2$
@@ -281,7 +282,7 @@
         
         // Set grouping elements to null 
         List groupingElements = new ArrayList();
-        groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
+        groupingElements.add(col1); //$NON-NLS-1$
         node.setGroupingElements(groupingElements);         
         CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
         node.initialize(context, mgr, null);
@@ -308,7 +309,7 @@
 
     private void helpTestLookupFunctionInAggregate(int batchSize) throws Exception {
         BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
-        ((BufferManagerImpl)mgr).getConfig().setProcessorBatchSize(batchSize);
+        ((BufferManagerImpl)mgr).setProcessorBatchSize(batchSize);
 
         // Set up
         GroupingNode node = new GroupingNode(1);
@@ -330,7 +331,7 @@
         node.setElements(outputElements);
         
         List groupingElements = new ArrayList();
-        groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
+        groupingElements.add(col1); //$NON-NLS-1$
         node.setGroupingElements(groupingElements);   
         CommandContext context = new CommandContext("pid", "test", null, null, 1);    //$NON-NLS-1$ //$NON-NLS-2$
         
@@ -448,7 +449,7 @@
         node.setElements(outputElements);
         
         List groupingElements = new ArrayList();
-        groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
+        groupingElements.add(col1); //$NON-NLS-1$
         node.setGroupingElements(groupingElements);
 		return node;
 	}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestJoinNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestJoinNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestJoinNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -214,7 +214,10 @@
         
     public void helpTestJoin() throws MetaMatrixComponentException, MetaMatrixProcessingException {
     	for (int batchSize : new int[] {1, 10, leftTuples.length, 100}) {
-	        helpCreateJoin();                
+	        helpCreateJoin();        
+	        if (batchSize == 0) {
+	        	continue;
+	        }
 	        helpTestJoinDirect(expected, batchSize);
 	        List[] temp = leftTuples;
 	        leftTuples = rightTuples;

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,13 +22,10 @@
 
 package com.metamatrix.query.processor.relational;
 
-import java.util.ArrayList;
+import java.util.List;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.TupleBatch;
 
 /**
@@ -43,54 +40,12 @@
         super(arg0);
     }
     
-    public void testNoRowsFirstBatch() {
-        RelationalNode node = new RelationalNode(0) {
-            public TupleBatch nextBatchDirect() throws BlockedException, MetaMatrixComponentException {
-                TupleBatch batch = new TupleBatch(1, new ArrayList());
-                batch.setTerminationFlag(true);
-                return batch;
-            }    
-            
-            public Object clone(){
-				throw new UnsupportedOperationException();
-			}
-        };
+    public void testNoRowsFirstBatch() throws Exception {
+        RelationalNode node = new FakeRelationalNode(0, new List[0]);
         
-        try {        
-            RelationalPlan plan = new RelationalPlan(node);
-            TupleBatch batch = plan.nextBatch();
-            assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
-            
-        } catch(MetaMatrixException e) {
-            e.printStackTrace();
-            fail("Got unexpected exception: " + e.getFullMessage());     //$NON-NLS-1$
-        }
-        
-        
+        RelationalPlan plan = new RelationalPlan(node);
+        TupleBatch batch = plan.nextBatch();
+        assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
     }   
     
-    public void testNoRowsLaterBatch() {
-        RelationalNode node = new RelationalNode(0) {
-            public TupleBatch nextBatchDirect() throws BlockedException, MetaMatrixComponentException {
-                TupleBatch batch = new TupleBatch(3, new ArrayList());
-                batch.setTerminationFlag(true);
-                return batch;
-            }  
-            
-            public Object clone(){
-				throw new UnsupportedOperationException();
-			}  
-        };
-        
-        try {        
-            RelationalPlan plan = new RelationalPlan(node);
-            TupleBatch batch = plan.nextBatch();
-            assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
-            
-        } catch(MetaMatrixException e) {
-            e.printStackTrace();
-            fail("Got unexpected exception: " + e.getFullMessage());     //$NON-NLS-1$
-        }                
-    }          
-    
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSelectNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSelectNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSelectNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -39,6 +39,7 @@
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.query.function.FunctionDescriptor;
 import com.metamatrix.query.function.FunctionLibraryManager;
+import com.metamatrix.query.processor.BatchIterator;
 import com.metamatrix.query.processor.FakeDataManager;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.sql.lang.CompareCriteria;

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -26,26 +26,20 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.junit.Test;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BlockedOnMemoryException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
 import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
 import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
-import com.metamatrix.common.buffer.impl.SizeUtility;
 import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.query.processor.relational.NodeTestUtil.TestableBufferManagerImpl;
 import com.metamatrix.query.processor.relational.SortUtility.Mode;
 import com.metamatrix.query.sql.lang.OrderBy;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
@@ -54,29 +48,17 @@
 public class TestSortNode {
     
     public static final int BATCH_SIZE = 100;
-    public static final int INT_BATCH_SIZE = TestSortNode.getIntBatchSize(); //the size of 100 integers    
     
-    private void helpTestSort(long bytesInMemory, List elements, List[] data, List sortElements, List sortTypes, List[] expected, Set blockOn, Mode mode) throws MetaMatrixComponentException, MetaMatrixProcessingException {
-        BufferManager mgr = NodeTestUtil.getTestBufferManager(bytesInMemory, BATCH_SIZE, BATCH_SIZE);
-        TestableBufferManagerImpl impl = (TestableBufferManagerImpl) mgr;
-        impl.setBlockOn(blockOn);
-        impl.getConfig().setTotalAvailableMemory(bytesInMemory);
-        impl.getConfig().setGroupUsePercentage(100);
-        impl.getConfig().setManagementInterval(0);
+    private void helpTestSort(List elements, List[] data, List sortElements, List sortTypes, List[] expected, Mode mode) throws MetaMatrixComponentException, MetaMatrixProcessingException {
+        BufferManager mgr = NodeTestUtil.getTestBufferManager(100, BATCH_SIZE, BATCH_SIZE);
         CommandContext context = new CommandContext ("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
         
-        FakeRelationalNode dataNode = new FakeRelationalNode(2, data);
+        FakeRelationalNode dataNode = new BlockingFakeRelationalNode(2, data);
         dataNode.setElements(elements);
         dataNode.initialize(context, mgr, null);    
         
         SortNode sortNode = new SortNode(1);
-        if (mode == Mode.DUP_REMOVE) {
-        	sortTypes = Arrays.asList(new Boolean[elements.size()]);
-        	Collections.fill(sortTypes, OrderBy.ASC);
-            sortNode.setSortElements(elements, sortTypes);
-        } else {
-        	sortNode.setSortElements(sortElements, sortTypes);
-        }
+    	sortNode.setSortElements(sortElements, sortTypes);
         sortNode.setMode(mode);
         sortNode.setElements(elements);
         sortNode.addChild(dataNode);        
@@ -86,36 +68,24 @@
         
         int currentRow = 1;
         while(true) {
-            try {
-                TupleBatch batch = sortNode.nextBatch();
-                if (mode != Mode.DUP_REMOVE) {
+        	try {
+	            TupleBatch batch = sortNode.nextBatch();
+	            if (mode != Mode.DUP_REMOVE) {
 	                for(int row = currentRow; row <= batch.getEndRow(); row++) {
 	                    assertEquals("Rows don't match at " + row, expected[row-1], batch.getTuple(row)); //$NON-NLS-1$
 	                }
-                }
-                currentRow += batch.getRowCount();    
-                if(batch.getTerminationFlag()) {
-                    break;
-                }
-            } catch (BlockedOnMemoryException e) {
-                if (!impl.wasBlocked()) {
-                    throw new BlockedOnMemoryException();
-                }
-            }
+	            }
+	            currentRow += batch.getRowCount();    
+	            if(batch.getTerminationFlag()) {
+	                break;
+	            }
+        	} catch (BlockedException e) {
+        		
+        	}
         }
         assertEquals(expected.length, currentRow - 1);
     }
 
-    public static int getIntBatchSize() {
-        List[] expected = new List[BATCH_SIZE];
-        Arrays.fill(expected, Arrays.asList(1));
-        
-        String[] types = { "integer" };     //$NON-NLS-1$
-
-        int size = (int)SizeUtility.getBatchSize( types, expected );
-        return size;
-    }
-    
     /*
      * 1 batch all in memory
      */
@@ -146,23 +116,10 @@
         List sortTypes = new ArrayList();
         sortTypes.add(new Boolean(OrderBy.ASC));
         
-        /*
-         * the following code will do four tests.
-         * no blocking
-         * blocking during sort phase
-         * blocking during merge (for remove dups this tests defect 24736)
-         * blocking during sort node output 
-         */
-        for (int i = 0; i < 4; i++) {
-            Set blockedOn = new HashSet();
-            if (i > 0) {
-                blockedOn.add(new Integer(i));
-            }
-            helpTestSort(INT_BATCH_SIZE*2, elements, data, sortElements, sortTypes, expected, blockedOn, mode);
-        }
+        helpTestSort(elements, data, sortElements, sortTypes, expected, mode);
     }
     
-    private void helpTestBiggerSort(int batches, int inMemoryBatches) throws Exception {
+    private void helpTestAllSorts(int batches) throws Exception {
         ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
         es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
 
@@ -171,14 +128,14 @@
         
         int rows = batches * BATCH_SIZE;
         
-        List unsortedNumbers = new ArrayList();
+        List[] expected = new List[rows];
         List[] data = new List[rows];
         for(int i=0; i<rows; i++) { 
             data[i] = new ArrayList();
-            
+            expected[i] = new ArrayList();
             Integer value = new Integer((i*51) % 12321);
             data[i].add(value);
-            unsortedNumbers.add(value);
+            expected[i].add(value);
         }
         
         List sortElements = new ArrayList();
@@ -187,35 +144,25 @@
         List sortTypes = new ArrayList();
         sortTypes.add(new Boolean(OrderBy.ASC));
 
-        Collections.sort(unsortedNumbers);                
-        List[] expected = new List[rows];
-        for(int i=0; i<unsortedNumbers.size(); i++) { 
-            expected[i] = new ArrayList();
-            expected[i].add(unsortedNumbers.get(i));
+        ListNestedSortComparator comparator = new ListNestedSortComparator(new int[] {0}, OrderBy.ASC);
+        Arrays.sort(expected, comparator);
+        
+        for (Mode mode : Mode.values()) {
+            helpTestSort(elements, data, sortElements, sortTypes, expected, mode);
         }
         
+        comparator = new ListNestedSortComparator(new int[] {0}, OrderBy.DESC);
+        Arrays.sort(expected, comparator);
+        sortTypes.clear();
+        sortTypes.add(new Boolean(OrderBy.DESC));
         
         for (Mode mode : Mode.values()) {
-	        /*
-	         * the following code will do four tests, blocking in a variety of places
-	         */
-	        for (int i = 0; i < 3; i++) {
-	            Set blockedOn = new HashSet();
-	            if (i > 0) {
-	                //block on a variety of positions
-	                blockedOn.add(new Integer(i));
-	                blockedOn.add(new Integer(inMemoryBatches*i));
-	                blockedOn.add(new Integer(batches*i));
-	                blockedOn.add(new Integer(batches*(i+1)));
-	            }
-	            //5 batches in memory out of 10 total
-	            helpTestSort(INT_BATCH_SIZE * inMemoryBatches, elements, data, sortElements, sortTypes, expected, blockedOn, mode);
-	        }
+            helpTestSort(elements, data, sortElements, sortTypes, expected, mode);
         }
     }
         
     @Test public void testNoSort() throws Exception {
-        helpTestBiggerSort(0, 2);
+        helpTestAllSorts(0);
     }    
     
     @Test public void testBasicSort() throws Exception {
@@ -245,6 +192,33 @@
         helpTestBasicSort(expected, Mode.SORT);
     }
     
+    @Test public void testDupSortDesc() throws Exception {
+        List[] expected = new List[] { 
+            Arrays.asList(new Object[] { new Integer(0), "0" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(0), "3" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(1), "2" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(1), "5" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(2), "1" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(2), "4" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(3), "6" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(3), "3" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(4), "3" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(5), "2" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(5), "5" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(6), "1" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(6), "4" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(7), "3" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(7), "3" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(8), "2" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(9), "1" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(9), "5" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(10), "9" }),    //$NON-NLS-1$
+            Arrays.asList(new Object[] { new Integer(10), "4" })                //$NON-NLS-1$
+        };
+        
+        helpTestBasicSort(expected, Mode.SORT);
+    }
+    
     /**
      * Note the ordering here is not stable
      * @throws Exception
@@ -302,31 +276,22 @@
     }   
     
     @Test public void testBiggerSort() throws Exception {
-        helpTestBiggerSort(10, 5);
+        helpTestAllSorts(10);
     }
  
-    @Test(expected=BlockedOnMemoryException.class) public void testBiggerSortLowMemory() throws Exception {
-        helpTestBiggerSort(5, 1);
+    @Test public void testAllSort() throws Exception {
+        helpTestAllSorts(1);
     }       
-
-    /**
-     * Progress can be made here since 2 batches fit in memory
-     * 
-     * This is also a test of the multi-pass merge
-     */
-    @Test public void testBiggerSortLowMemory2() throws Exception {
-        helpTestBiggerSort(5, 2);
-    }
     
     @Test public void testDupRemove() throws Exception {
     	ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
         es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
         BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
-        TupleSourceID tsid = bm.createTupleSource(Arrays.asList(es1), "test", TupleSourceType.PROCESSOR); //$NON-NLS-1$
-        bm.addTupleBatch(tsid, new TupleBatch(1, new List[] {Arrays.asList(1)}));
-    	SortUtility su = new SortUtility(tsid, Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test", true); //$NON-NLS-1$
-    	TupleSourceID out = su.sort();
-    	TupleSource ts = bm.getTupleSource(out);
+        TupleBuffer tsid = bm.createTupleBuffer(Arrays.asList(es1), "test", TupleSourceType.PROCESSOR); //$NON-NLS-1$
+        tsid.addTuple(Arrays.asList(1));
+    	SortUtility su = new SortUtility(tsid.createIndexedTupleSource(), Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test"); //$NON-NLS-1$
+    	TupleBuffer out = su.sort();
+    	TupleSource ts = out.createIndexedTupleSource();
     	assertEquals(Arrays.asList(1), ts.nextTuple());
     	try {
     		ts.nextTuple();
@@ -334,7 +299,7 @@
     	} catch (BlockedException e) {
     		
     	}
-    	bm.addTupleBatch(tsid, new TupleBatch(2, new List[] {Arrays.asList(2)}));
+    	tsid.addTuple(Arrays.asList(2));
     	su.sort();
     	assertEquals(Arrays.asList(2), ts.nextTuple());
     }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestUnionAllNode.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestUnionAllNode.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/relational/TestUnionAllNode.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -205,24 +205,24 @@
     public void testMultipleSourceMultiBatchAllBlocking() throws MetaMatrixComponentException, MetaMatrixProcessingException {
         List expected[] = new List[] {
             Arrays.asList(new Object[] { new Integer(0) }),    
+            Arrays.asList(new Object[] { new Integer(1) }),    
             Arrays.asList(new Object[] { new Integer(0) }),    
+            Arrays.asList(new Object[] { new Integer(2) }),    
             Arrays.asList(new Object[] { new Integer(0) }),    
+            Arrays.asList(new Object[] { new Integer(1) }),    
+
             Arrays.asList(new Object[] { new Integer(0) }),    
             Arrays.asList(new Object[] { new Integer(0) }),    
+            Arrays.asList(new Object[] { new Integer(1) }),    
             Arrays.asList(new Object[] { new Integer(0) }),    
+            Arrays.asList(new Object[] { new Integer(2) }),    
+            Arrays.asList(new Object[] { new Integer(1) }),    
 
             Arrays.asList(new Object[] { new Integer(1) }),    
+            Arrays.asList(new Object[] { new Integer(2) }),    
             Arrays.asList(new Object[] { new Integer(1) }),    
-            Arrays.asList(new Object[] { new Integer(1) }),    
-            Arrays.asList(new Object[] { new Integer(1) }),    
-            Arrays.asList(new Object[] { new Integer(1) }),    
-            Arrays.asList(new Object[] { new Integer(1) }),    
-
             Arrays.asList(new Object[] { new Integer(2) }),    
             Arrays.asList(new Object[] { new Integer(2) }),    
-            Arrays.asList(new Object[] { new Integer(2) }),    
-            Arrays.asList(new Object[] { new Integer(2) }),    
-            Arrays.asList(new Object[] { new Integer(2) }),    
             Arrays.asList(new Object[] { new Integer(2) })          
         };
 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestInstructions.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestInstructions.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestInstructions.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -119,7 +119,7 @@
         Command command = parser.parseCommand(sql);
         
         QueryResolver.resolveCommand(command, metadata);
-        command = QueryRewriter.rewrite(command, null, metadata, null);
+        command = QueryRewriter.rewrite(command, metadata, null);
         
         return command;        
     }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,8 @@
 
 package com.metamatrix.query.processor.xml;
 
+import static org.junit.Assert.*;
+
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.util.ArrayList;
@@ -31,7 +33,8 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 
-import junit.framework.TestCase;
+import org.junit.Ignore;
+import org.junit.Test;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -39,9 +42,9 @@
 import com.metamatrix.api.exception.query.QueryPlannerException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.api.exception.query.QueryValidatorException;
-import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.BufferManagerFactory;
+import com.metamatrix.common.buffer.TupleBuffer;
 import com.metamatrix.common.buffer.TupleSource;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.XMLType;
@@ -68,6 +71,7 @@
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
 import com.metamatrix.query.optimizer.xml.TestXMLPlanner;
 import com.metamatrix.query.parser.QueryParser;
+import com.metamatrix.query.processor.BatchCollector;
 import com.metamatrix.query.processor.FakeDataManager;
 import com.metamatrix.query.processor.QueryProcessor;
 import com.metamatrix.query.resolver.QueryResolver;
@@ -86,13 +90,9 @@
  * metadata, and then that XMLPlan being processed with metadata, a 
  * ProcessorDataManager and a QueryProcessor.
  */
-public class TestXMLProcessor extends TestCase {
+public class TestXMLProcessor {
     private static final boolean DEBUG = false;
     
-    public TestXMLProcessor(String name) {
-        super(name);
-    }
-
     /**
      * Construct some fake metadata.  Basic conceptual tree is:
      * 
@@ -2929,7 +2929,7 @@
         QueryParser parser = new QueryParser();
         Command command = parser.parseCommand(sql);
         QueryResolver.resolveCommand(command, metadata);
-        command = QueryRewriter.rewrite(command, null, metadata, null);
+        command = QueryRewriter.rewrite(command, metadata, null);
         return command;
     }
 
@@ -2965,20 +2965,11 @@
                 CommandContext context = new CommandContext("pID", "TestConn", "testUser", null, 1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                 context.setProcessDebug(DEBUG);
                 QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataMgr);
-    	
-                while(true) {
-                    try {
-                        processor.process();
-                        break;
-                    } catch(BlockedException e) {
-                        // retry
-                    }
-                }
+                processor.setNonBlocking(true);
+                BatchCollector collector = processor.createBatchCollector();
+                TupleBuffer id = collector.collectTuples();
             
-                //int count = bufferMgr.getFinalRowCount(tsID);
-                //assertEquals("Incorrect number of records: ", 1, count); //$NON-NLS-1$
-                
-                TupleSource ts = bufferMgr.getTupleSource(processor.getResultsID());
+                TupleSource ts = id.createIndexedTupleSource();
                 List row = ts.nextTuple();
                 assertEquals("Incorrect number of columns: ", 1, row.size()); //$NON-NLS-1$
                
@@ -2986,7 +2977,7 @@
                 XMLType result = (XMLType)row.get(0);
                 String actualDoc = result.getString();
                 
-                bufferMgr.removeTupleSource(processor.getResultsID());
+                id.remove();
                 
                 if(DEBUG) {
                     System.out.println("expectedDoc = \n" + expectedDoc); //$NON-NLS-1$
@@ -3010,7 +3001,9 @@
             BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
             CommandContext context = new CommandContext("pID", null, null, null, 1);                                                                 //$NON-NLS-1$
             QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataMgr);
-            processor.process();
+            processor.setNonBlocking(true);
+            BatchCollector collector = processor.createBatchCollector();
+            collector.collectTuples();
         } catch (Exception e){
             if (expectedException.isInstance(e)){
                 expected = e;
@@ -3054,12 +3047,13 @@
         BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
         CommandContext context = new CommandContext("pID", null, null, null, 1);                                 //$NON-NLS-1$
         QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataMgr);
-        processor.process();
+        processor.setNonBlocking(true);
+        BatchCollector collector = processor.createBatchCollector();
+        TupleBuffer tupleBuffer = collector.collectTuples();
+        int count = tupleBuffer.getRowCount();
+        assertEquals("Incorrect number of records: ", expectedDocs.length, count); //$NON-NLS-1$
         
-       int count = bufferMgr.getFinalRowCount(processor.getResultsID());
-       assertEquals("Incorrect number of records: ", expectedDocs.length, count); //$NON-NLS-1$
-        
-        TupleSource ts = bufferMgr.getTupleSource(processor.getResultsID());
+        TupleSource ts = tupleBuffer.createIndexedTupleSource();
         for (int i=0; i<expectedDocs.length; i++){        
             List row = ts.nextTuple();
             if(row.isEmpty()){
@@ -3072,14 +3066,14 @@
             //assertEquals("XML doc result # " + i +" mismatch: ", expectedDocs[i], actualDoc); //$NON-NLS-1$ //$NON-NLS-2$
             compareDocuments(expectedDocs[i], actualDoc);
         }
-        bufferMgr.removeTupleSource(processor.getResultsID());
+        tupleBuffer.remove();
     }    
 
     // =============================================================================================
     // T E S T S 
     // =============================================================================================
 
-    public void test1() throws Exception {
+    @Test public void test1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -3106,7 +3100,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testOrderBy1() throws Exception {
+    @Test public void testOrderBy1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -3133,7 +3127,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 ORDER BY Catalogs.Catalog.Items.Item.Quantity ASC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testOrderBy1a() throws Exception {
+    @Test public void testOrderBy1a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -3160,7 +3154,7 @@
         helpTestProcess("SELECT \"xml\" FROM xmltest.doc1 ORDER BY Catalogs.Catalog.Items.Item.Quantity ASC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testOrderBy1b() throws Exception {
+    @Test public void testOrderBy1b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -3187,7 +3181,7 @@
         helpTestProcess("SELECT xmltest.doc1.xml FROM xmltest.doc1 ORDER BY Catalogs.Catalog.Items.Item.Quantity ASC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
                
-    public void testOrderBy2() throws Exception {
+    @Test public void testOrderBy2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -3214,7 +3208,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 ORDER BY Catalogs.Catalog.Items.Item.Quantity DESC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testOrderBy3() throws Exception {
+    @Test public void testOrderBy3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -3279,7 +3273,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 ORDER BY Catalogs.Catalog.Items.Item.ItemID DESC, Catalogs.Catalog.Items.Item.Suppliers.Supplier.SupplierID ASC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }   
     
-    public void testOrderBy3a() throws Exception {
+    @Test public void testOrderBy3a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -3344,7 +3338,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 ORDER BY Catalogs.Catalog.Items.Item.ItemID ASC, Catalogs.Catalog.Items.Item.Suppliers.Supplier.SupplierID DESC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }      
     
-    public void testOrderBy4() throws Exception {
+    @Test public void testOrderBy4() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -3364,7 +3358,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE ItemID='001' AND Quantity < 60 ORDER BY ItemID", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }     
      
-    public void testOrderBy5() throws Exception {
+    @Test public void testOrderBy5() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
          String expectedDoc = 
@@ -3391,7 +3385,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 ORDER BY ItemID", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     } 
     
-    public void testOrderBy6() throws Exception {
+    @Test public void testOrderBy6() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -3499,14 +3493,14 @@
     }   
    
     //order by with temp group at the root    
-    public void testOrderBy7() throws Exception {
+    @Test public void testOrderBy7() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         helpTestProcess("SELECT * FROM xmltest.doc9a ORDER BY ItemID DESC", EXPECTED_ORDERED_DOC9A, metadata, dataMgr);         //$NON-NLS-1$
     }   
            
     //order by with multiple elements and criteria with long name, short name doesn't work
-    public void testOrderBy8() throws Exception {
+    @Test public void testOrderBy8() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -3577,7 +3571,7 @@
     }   
 
     /*    
-    public void testOrderBy9() throws Exception {
+    @Test public void testOrderBy9() throws Exception {
         FakeMetadataFacade metadata = exampleMetadata();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = "";
@@ -3590,7 +3584,7 @@
     }
     */
   
-    public void testOrderBy10() throws Exception {
+    @Test public void testOrderBy10() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -3614,13 +3608,13 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE Quantity < 60 ORDER BY Name DESC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }     
     
-     public void testOrderBy11() throws Exception {
+     @Test public void testOrderBy11() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         helpTestProcess("SELECT * FROM xmltest.doc9a WHERE ItemID='001' OR ItemID='002' OR ItemID='003' ORDER BY ItemID DESC", EXPECTED_ORDERED_DOC9A, metadata, dataMgr);         //$NON-NLS-1$
     }   
 
-    public void testOrderBy13() throws Exception {
+    @Test public void testOrderBy13() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -3648,7 +3642,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 ORDER BY Name DESC, Quantity ASC ", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
         
-    public void testOrderBy14() throws Exception {
+    @Test public void testOrderBy14() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -3755,7 +3749,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 ORDER BY Catalogs.Catalog.Items.Item.Suppliers.Supplier.SupplierID ASC, OrderID DESC, Catalogs.Catalog.Items.Item.ItemID DESC", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }   
      
-    public void testOrderBy15() throws Exception {
+    @Test public void testOrderBy15() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -3784,7 +3778,7 @@
     }
 
     /** test null elements*/
-    public void testOrderBy17() throws Exception {
+    @Test public void testOrderBy17() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
         
@@ -3813,7 +3807,7 @@
     }
     
     /**  test duplicate elements*/
-    public void testOrderBy18() throws Exception {
+    @Test public void testOrderBy18() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithDuplicates(metadata);
         
@@ -3842,7 +3836,7 @@
     }
     
     /**  test more than two parallel elements*/
-    public void testOrderBy19() throws Exception {
+    @Test public void testOrderBy19() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithDuplicates1(metadata);
         
@@ -3870,7 +3864,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 ORDER BY ItemID ASC, Name ASC, Quantity DESC ", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testOrderBy20() throws Exception {
+    @Test public void testOrderBy20() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc =
@@ -3928,7 +3922,7 @@
      * Doc nodes that are not mapped to data cannot be used in the 
      * ORDER BY clause of an XML doc query
      */
-    public void testOrderBy_defect9803() throws Exception {
+    @Test public void testOrderBy_defect9803() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
                
@@ -3944,7 +3938,7 @@
     }    
         
     //defect 8130
-    public void test1CriteriaWithUnmappedElementFails() throws Exception {
+    @Test public void test1CriteriaWithUnmappedElementFails() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         
@@ -3952,14 +3946,14 @@
     }    
 
     //defect 8130
-    public void test1CriteriaWithUnmappedElementFails2() throws Exception {
+    @Test public void test1CriteriaWithUnmappedElementFails2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE Item = 'something'", null, metadata, dataMgr, false, QueryPlannerException.class, null);         //$NON-NLS-1$
     }  
     
-    public void testNested() throws Exception {
+    @Test public void testNested() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4165,7 +4159,7 @@
             "    </Catalog>\r\n" +  //$NON-NLS-1$
             "</Catalogs>\r\n\r\n"; //$NON-NLS-1$
             
-    public void testNested2() throws Exception {
+    @Test public void testNested2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2;
@@ -4176,14 +4170,14 @@
      * Tests a couple temp groups at the root - B selects from A, and a mapping class
      * selects from B
      */
-    public void testNested2aTempGroup() throws Exception {
+    @Test public void testNested2aTempGroup() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2;
         helpTestProcess("SELECT * FROM xmltest.doc9a", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }   
 
-    public void testNested2aTempGroupCriteria() throws Exception {
+    @Test public void testNested2aTempGroupCriteria() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4263,7 +4257,7 @@
     }   
 
     /** defect 13172, CSE Case 1811 */
-    public void testNested2aTempGroupCompoundCriteria() throws Exception {
+    @Test public void testNested2aTempGroupCompoundCriteria() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4344,7 +4338,7 @@
     }
 
     /** defect 13172, CSE Case 1811 */
-    public void testNested2aTempGroupCompoundCriteria1() throws Exception {
+    @Test public void testNested2aTempGroupCompoundCriteria1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4425,7 +4419,7 @@
     }
 
     /** defect 13172, CSE Case 1811 */
-    public void testNested2aTempGroupCompoundCriteria2() throws Exception {
+    @Test public void testNested2aTempGroupCompoundCriteria2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4511,7 +4505,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9a WHERE tempGroup.orders.orderNum = '1' OR tempGroup.orders.orderStatus = 'processing'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2cTempGroup() throws Exception {
+    @Test public void testNested2cTempGroup() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_3;
@@ -4529,7 +4523,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9b", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }   
 
-    public void testNested2WithCriteria() throws Exception {
+    @Test public void testNested2WithCriteria() throws Exception {
 
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -4587,7 +4581,7 @@
      * 
      * @see #testNested2WithCriteria2a
      */
-    public void testNested2WithCriteria2() throws Exception {
+    @Test public void testNested2WithCriteria2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4647,7 +4641,7 @@
      * 
      * @see #testNested2WithCriteria2a
      */
-    public void testNested2WithCriteria2_defect9802() throws Exception {
+    @Test public void testNested2WithCriteria2_defect9802() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4697,7 +4691,7 @@
      * shows a similar
      * @see #testNested2WithCriteria2
      */
-    public void testNested2WithCriteria2_function() throws Exception {
+    @Test public void testNested2WithCriteria2_function() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc =
@@ -4753,7 +4747,7 @@
      * at "Item" node) will be limited by default, instead of the one
      * the criteria is actually specified on.</p>
      */
-    public void testNested2WithCriteria2a() throws Exception {
+    @Test public void testNested2WithCriteria2a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4802,7 +4796,7 @@
     }
 
 
-    public void testNested2WithContextCriteria() throws Exception {
+    @Test public void testNested2WithContextCriteria() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4849,7 +4843,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, SupplierID)='52'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria2() throws Exception {
+    @Test public void testNested2WithContextCriteria2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4902,7 +4896,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria3() throws Exception {
+    @Test public void testNested2WithContextCriteria3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -4995,7 +4989,7 @@
             "</Catalogs>\r\n\r\n"; //$NON-NLS-1$
 
 
-    public void testNested2WithContextCriteria4() throws Exception {
+    @Test public void testNested2WithContextCriteria4() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -5003,7 +4997,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' OR context(Item, OrderID)='6'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria4a() throws Exception {
+    @Test public void testNested2WithContextCriteria4a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -5011,7 +5005,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' OR OrderID='6'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria4b() throws Exception {
+    @Test public void testNested2WithContextCriteria4b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -5097,7 +5091,7 @@
             "    </Catalog>\r\n" +  //$NON-NLS-1$
             "</Catalogs>\r\n\r\n"; //$NON-NLS-1$
 
-    public void testNested2WithContextCriteria5() throws Exception {
+    @Test public void testNested2WithContextCriteria5() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5105,7 +5099,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' OR context(Item, OrderID)='2'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria5a() throws Exception {
+    @Test public void testNested2WithContextCriteria5a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5113,7 +5107,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE OrderID='5' OR context(Item, OrderID)='2'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria5b() throws Exception {
+    @Test public void testNested2WithContextCriteria5b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5134,7 +5128,7 @@
         return baos.toString();
     }
 
-    public void testNested2WithContextCriteria5Fail() throws Exception {
+    @Test public void testNested2WithContextCriteria5Fail() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = ""; //doesn't matter //$NON-NLS-1$
@@ -5146,7 +5140,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' OR context(SupplierID, OrderID)='2'", expectedDoc, metadata, dataMgr, shouldSucceed, expectedException, shouldFailMsg);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria6() throws Exception {
+    @Test public void testNested2WithContextCriteria6() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5159,7 +5153,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' AND context(Item, OrderID)='2'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria6b() throws Exception {
+    @Test public void testNested2WithContextCriteria6b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5209,14 +5203,14 @@
             "    </Catalog>\r\n" +  //$NON-NLS-1$
             "</Catalogs>\r\n\r\n"; //$NON-NLS-1$
 
-    public void testNested2WithContextCriteria7() throws Exception {
+    @Test public void testNested2WithContextCriteria7() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE CONTEXT(SupplierID, OrderID)='5' AND context(OrderID, OrderID)='5'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNested2WithContextCriteria7b() throws Exception {
+    @Test public void testNested2WithContextCriteria7b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
@@ -5225,7 +5219,7 @@
         helpTestProcess(query, expectedDoc, metadata, dataMgr);        
     }
 
-    public void testNested2WithContextCriteria7c() throws Exception {
+    @Test public void testNested2WithContextCriteria7c() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
@@ -5237,7 +5231,7 @@
     /**
      * per defect 7333
      */
-    public void testNested2WithContextCriteria_7333() throws Exception {
+    @Test public void testNested2WithContextCriteria_7333() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5276,7 +5270,7 @@
     /**
      * per defect 7333
      */
-    public void testNested2WithContextCriteria_7333b() throws Exception {
+    @Test public void testNested2WithContextCriteria_7333b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5315,7 +5309,7 @@
     /**
      * per defect 7333
      */
-    public void testNested2WithContextCriteria_7333c() throws Exception {
+    @Test public void testNested2WithContextCriteria_7333c() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5331,7 +5325,7 @@
     /**
      * per defect 7333
      */
-    public void testNested2WithContextCriteria_7333d() throws Exception {
+    @Test public void testNested2WithContextCriteria_7333d() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5347,7 +5341,7 @@
     /**
      * Select a single item, and then limit the suppliers based on an order #
      */
-    public void testNested2WithContextCriteria8() throws Exception {
+    @Test public void testNested2WithContextCriteria8() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5383,7 +5377,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc9 WHERE ItemID='002' AND Context(Supplier,OrderID)='5'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testNestedWithChoice() throws Exception {
+    @Test public void testNestedWithChoice() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5472,7 +5466,7 @@
     /**
      * Does not use 'context' operator
      */
-    public void testNestedWithChoiceAndCriteria2_6796() throws Exception {
+    @Test public void testNestedWithChoiceAndCriteria2_6796() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5516,7 +5510,7 @@
     /**
      * Uses the 'context' operator
      */
-    public void testNestedWithChoiceAndCriteria2a_6796() throws Exception {
+    @Test public void testNestedWithChoiceAndCriteria2a_6796() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5594,7 +5588,7 @@
     /**
      * Does not use 'context' operator
      */
-    public void testNestedWithLookupChoice() throws Exception {
+    @Test public void testNestedWithLookupChoice() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -5641,7 +5635,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc10L where Catalogs.Catalog.Items.Item.Suppliers.Supplier.ProcessingOrders.OtherOrder.OrderID='5'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }    
     
-    public void test1Unformatted() throws Exception {
+    @Test public void test1Unformatted() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5671,7 +5665,7 @@
 
     // jhTODO: complete this
 
-    public void testChoice_5266a() throws Exception {
+    @Test public void testChoice_5266a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -5750,7 +5744,7 @@
     }
     
     
-    public void test1WithCriteriaShortName() throws Exception {
+    @Test public void test1WithCriteriaShortName() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5773,7 +5767,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE quantity < 50", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test1WithCriteriaLongName() throws Exception {
+    @Test public void test1WithCriteriaLongName() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5796,7 +5790,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE catalogs.catalog.items.item.quantity < 50", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test2() throws Exception {
+    @Test public void test2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5815,7 +5809,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc2", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test2a() throws Exception {
+    @Test public void test2a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5842,13 +5836,13 @@
         helpTestProcess("SELECT * FROM xmltest.doc2a", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test2b() throws Exception {
+    @Test public void test2b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         helpTestProcess("SELECT * FROM xmltest.doc2b", null, metadata, dataMgr, false, MetaMatrixComponentException.class, "Should have failed on default");         //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void test2c() throws Exception {
+    @Test public void test2c() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5871,7 +5865,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc2c", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test2d() throws Exception {
+    @Test public void test2d() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5898,7 +5892,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc2d", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void test2e() throws Exception {
+    @Test public void test2e() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -5925,7 +5919,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc2e", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testWithNillableNode() throws Exception {
+    @Test public void testWithNillableNode() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
         String expectedDoc = 
@@ -5952,7 +5946,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testWithDefault() throws Exception {
+    @Test public void testWithDefault() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
         String expectedDoc = 
@@ -5979,7 +5973,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc3", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testWithNamespaces() throws Exception {
+    @Test public void testWithNamespaces() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
         String expectedDoc = 
@@ -6012,7 +6006,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc4", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testWithNewIter3Properties() throws Exception {
+    @Test public void testWithNewIter3Properties() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerDuJour(metadata);
         String expectedDoc = 
@@ -6051,7 +6045,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc5", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testWithNewIter3PropertiesException() throws Exception {
+    @Test public void testWithNewIter3PropertiesException() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerDuJour(metadata);
         
@@ -6061,18 +6055,19 @@
         BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
         CommandContext context = new CommandContext("pID", null, null, null, 1);                                 //$NON-NLS-1$
         QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataMgr);
-
+        processor.setNonBlocking(true);
+        BatchCollector collector = processor.createBatchCollector();
         MetaMatrixComponentException failOnDefaultException = null;
         try{
-            processor.process();
+            collector.collectTuples();
         } catch (MetaMatrixComponentException e){
             failOnDefaultException = e;
         }
         
-        super.assertNotNull("Query processing should have failed on default of choice node.", failOnDefaultException); //$NON-NLS-1$
+        assertNotNull("Query processing should have failed on default of choice node.", failOnDefaultException); //$NON-NLS-1$
     }
 
-    public void testAttributeBug() throws Exception {
+    @Test public void testAttributeBug() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
 
@@ -6096,7 +6091,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc7", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testMultipleDocs() throws Exception {
+    @Test public void testMultipleDocs() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6165,7 +6160,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc11", expectedDocs, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testRecursive() throws Exception {
+    @Test public void testRecursive() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6250,7 +6245,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc12", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
     }
 
-    public void testRecursiveA() throws Exception {
+    @Test public void testRecursiveA() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6348,7 +6343,7 @@
      * See commented out section below for previous expected results. 
      * @throws Exception
      */
-    public void testRecursive2() throws Exception {
+    @Test public void testRecursive2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6410,7 +6405,7 @@
 
         helpTestProcess("SELECT * FROM xmltest.doc13", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
     }
-    public void testRecursive3() throws Exception {
+    @Test public void testRecursive3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6472,7 +6467,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc14", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
     }
 
-    public void testRecursive4Exception() throws Exception {
+    @Test public void testRecursive4Exception() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         helpTestProcess("SELECT * FROM xmltest.doc15", null, metadata, dataMgr, false, MetaMatrixComponentException.class, "Query processing should have failed on recursion limit."); //$NON-NLS-1$ //$NON-NLS-2$
@@ -6481,7 +6476,7 @@
     /**
      * Seems to be failing as a result of changes for defect 12288 
      */
-    public void testRecursive5() throws Exception {
+    @Test public void testRecursive5() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6532,7 +6527,7 @@
      * See commented out section below for previous expected results. 
      * @throws Exception
      */
-    public void testRecursiveWithStagingTable_defect15607() throws Exception {
+    @Test public void testRecursiveWithStagingTable_defect15607() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
@@ -6599,7 +6594,7 @@
      * Tests a recursive nested mapping class within a recursive mapping class, where
      * all nested "anchor" nodes are named "srcNestedRecursive".  Test of defect #5988
      */
-    public void testXQTRecursive_5988() throws Exception {
+    @Test public void testXQTRecursive_5988() throws Exception {
         FakeMetadataFacade metadata = exampleMetadata2();
         FakeDataManager dataMgr = exampleXQTDataManager(metadata);
 
@@ -6727,7 +6722,7 @@
      * Tests a non-recursive nested mapping class within a recursive mapping class, where
      * all nested "anchor" nodes are named "srcNested".  Test of defect #5988
      */
-    public void testXQTRecursive2_5988() throws Exception {
+    @Test public void testXQTRecursive2_5988() throws Exception {
         FakeMetadataFacade metadata = exampleMetadata2();
         FakeDataManager dataMgr = exampleXQTDataManager(metadata);
 
@@ -6779,7 +6774,7 @@
     /**
      * for defect 5988
      */
-    public void testXQTRecursiveSiblings_5988() throws Exception {
+    @Test public void testXQTRecursiveSiblings_5988() throws Exception {
         FakeMetadataFacade metadata = exampleMetadata2();
         FakeDataManager dataMgr = exampleXQTDataManager(metadata);
 
@@ -6915,7 +6910,7 @@
         helpTestProcess("SELECT * FROM xqttest.doc2", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
     }
 
-    public void testSelectElement1() throws Exception {
+    @Test public void testSelectElement1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -6939,7 +6934,7 @@
         helpTestProcess("SELECT Name FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
      
-    public void testSelectElement2() throws Exception {
+    @Test public void testSelectElement2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -7016,7 +7011,7 @@
     }
     
     /** select element in the reverse order of depth*/
-    public void testSelectElement3() throws Exception {
+    @Test public void testSelectElement3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -7093,7 +7088,7 @@
     }
     
     /** two select elements at the same level*/
-    public void testSelectElement4() throws Exception {
+    @Test public void testSelectElement4() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7123,7 +7118,7 @@
     }
     
     /** defect 9756 */
-    public void testSelectElement4_defect9756() throws Exception {
+    @Test public void testSelectElement4_defect9756() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7143,7 +7138,7 @@
     }    
     
     /** three select elements with two of them at the same level and there are other nodes with the same name*/
-    public void testSelectElement5() throws Exception {
+    @Test public void testSelectElement5() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -7228,7 +7223,7 @@
     }
     
     /** check element.* case */
-    public void testSelectElement6() throws Exception {
+    @Test public void testSelectElement6() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7256,7 +7251,7 @@
     }
     
     /** check element.* case without attribute in order by*/
-    public void testSelectElement6a() throws Exception {
+    @Test public void testSelectElement6a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7284,7 +7279,7 @@
             + " FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testSelectElement7() throws Exception {
+    @Test public void testSelectElement7() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7312,7 +7307,7 @@
             expectedDoc, metadata, dataMgr);        
     }
     
-    public void testSelectElement8() throws Exception {
+    @Test public void testSelectElement8() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7341,7 +7336,7 @@
     }
     
     /** SELECT clause has element.*, but the sibling elements should not be included, only subtree should */
-    public void testSelectElement9() throws Exception {
+    @Test public void testSelectElement9() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -7377,7 +7372,7 @@
           expectedDoc, metadata, dataMgr);        
     }         
     
-    public void testSelectElement9a() throws Exception {
+    @Test public void testSelectElement9a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -7410,7 +7405,7 @@
     }    
              
     /** check element.* case with criteria and order by clause */
-    public void testSelectElement10() throws Exception {
+    @Test public void testSelectElement10() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -7438,7 +7433,7 @@
             expectedDoc, metadata, dataMgr);        
     }
     
-    public void testSelectElement12() throws Exception {
+    @Test public void testSelectElement12() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -7491,7 +7486,7 @@
             expectedDoc, metadata, dataMgr);                
     }
     
-    public void testSelectElement13() throws Exception {
+    @Test public void testSelectElement13() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -7513,7 +7508,7 @@
             expectedDoc, metadata, dataMgr);                
     }
 
-    public void testSelectElement14() throws Exception {
+    @Test public void testSelectElement14() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc =
@@ -7567,7 +7562,7 @@
                 expectedDoc, metadata, dataMgr);        
     }
     
-    public void testSelectElement15() throws Exception {
+    @Test public void testSelectElement15() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc =
@@ -7620,7 +7615,7 @@
             expectedDoc, metadata, dataMgr);        
     }
 
-    public void testSelectElement16() throws Exception {
+    @Test public void testSelectElement16() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc =
@@ -7674,7 +7669,7 @@
     }         
 
     /**  CSE query 0 */
-    public void testSelectElement17() throws Exception {
+    @Test public void testSelectElement17() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
@@ -7775,7 +7770,7 @@
     }   
 
     /**  CSE query 1 */
-    public void testSelectElement18() throws Exception {
+    @Test public void testSelectElement18() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -7820,7 +7815,7 @@
     }   
 
     /**  CSE query 2 */
-    public void testSelectElement19() throws Exception {
+    @Test public void testSelectElement19() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -7866,7 +7861,7 @@
             
 
     /**  CSE query 3 */
-    public void testSelectElement20() throws Exception {
+    @Test public void testSelectElement20() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -7899,7 +7894,7 @@
     }   
 
     /**  CSE query 3a */
-    public void testSelectElement20a() throws Exception {
+    @Test public void testSelectElement20a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -7929,7 +7924,7 @@
     }   
 
     /**  CSE query 4 */
-    public void testSelectElement21() throws Exception {
+    @Test public void testSelectElement21() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8016,7 +8011,7 @@
     }  
 
     /**  CSE query 4a */
-    public void testSelectElement21a() throws Exception {
+    @Test public void testSelectElement21a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8079,7 +8074,7 @@
     }  
     
     /**  CSE query 5 */
-    public void testSelectElement22() throws Exception {
+    @Test public void testSelectElement22() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
@@ -8138,7 +8133,7 @@
     } 
     
     /**  CSE query 5a */
-    public void testSelectElement22a() throws Exception {
+    @Test public void testSelectElement22a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
@@ -8194,7 +8189,7 @@
     } 
     
     /**  CSE query 6 */
-    public void testSelectElement23() throws Exception {
+    @Test public void testSelectElement23() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
@@ -8236,7 +8231,7 @@
     } 
     
     /**  CSE query 6a */
-    public void testSelectElement23a() throws Exception {
+    @Test public void testSelectElement23a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8275,7 +8270,7 @@
     }
                      
     /** test with order by and the element in the criteria is not in the select elements*/
-    public void testSelectElement24() throws Exception {
+    @Test public void testSelectElement24() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8315,7 +8310,7 @@
     }
 
     /** test element.* with order by and the element in the criteria is not in the select elements*/
-    public void testSelectElement24a() throws Exception {
+    @Test public void testSelectElement24a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8376,7 +8371,7 @@
     }
                          
     /** test with order by with only necessary sub-mapping classes are queried*/
-    public void testSelectElement25() throws Exception {
+    @Test public void testSelectElement25() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8417,7 +8412,7 @@
     }
     
     /** test element.* with order by with only necessary sub-mapping classes are queried*/
-    public void testSelectElement25a() throws Exception {
+    @Test public void testSelectElement25a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8484,7 +8479,7 @@
     /** Test element.* with order by with only necessary sub-mapping classes are queried 
      *  and case_insensitive nodes in the mapping tree
      */
-    public void testSelectElement25b() throws Exception {
+    @Test public void testSelectElement25b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8548,7 +8543,7 @@
             expectedDoc, metadata, dataMgr);        
     }
     
-    public void testSelectElement26() throws Exception {
+    @Test public void testSelectElement26() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8615,7 +8610,7 @@
     /** test special elements: result set name, and name with format of "document.fully.qualified.element" 
      * --> refer to Defect9497, this should fail
      */
-    public void testSelectElement27() throws Exception {
+    @Test public void testSelectElement27() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8643,7 +8638,7 @@
     }
         
     /** test special element, root element */
-    public void testSelectElement28() throws Exception {
+    @Test public void testSelectElement28() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8667,7 +8662,7 @@
     }
     
     /** test special element */
-    public void testSelectElement28a() throws Exception {
+    @Test public void testSelectElement28a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc =  
@@ -8693,7 +8688,7 @@
     }
 
     /** test model.document.* */
-    public void testSelectElement28b() throws Exception {
+    @Test public void testSelectElement28b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -8724,7 +8719,7 @@
     }
         
     /** test special element, root element */
-    public void testSelectElement29() throws Exception {
+    @Test public void testSelectElement29() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8749,7 +8744,7 @@
     }
     
     /** test simple case for two elements in a mapping class */
-    public void testSelectElement30() throws Exception {
+    @Test public void testSelectElement30() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -8770,7 +8765,7 @@
     }     
                         
     /** test NullPointerException*/
-    public void testDefect_9496_1() throws Exception {
+    @Test public void testDefect_9496_1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8834,7 +8829,7 @@
             expectedDoc, metadata, dataMgr);        
     }
 
-    public void testDefect_9496_2() throws Exception {
+    @Test public void testDefect_9496_2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8891,7 +8886,7 @@
     }
     
     /** test StringIndexOutOfBoundsException */
-    public void testDefect_9496_3() throws Exception {
+    @Test public void testDefect_9496_3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -8996,7 +8991,7 @@
     }
     
     /** should fail: because there are other element other than "xml" */
-    /*public void testResolver1() throws Exception {
+    /*@Test public void testResolver1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = ""; 
@@ -9012,7 +9007,7 @@
     }*/
 
     /** should fail: partial qualified element name and "model.document.xml" */
-    /*public void testResolver2() throws Exception {
+    /*@Test public void testResolver2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = ""; 
@@ -9028,7 +9023,7 @@
     }*/
 
     /** should fail: test XMLResolver validatation for model.* */
-    /*public void testDefect_9498_1() throws Exception {
+    /*@Test public void testDefect_9498_1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = ""; 
@@ -9041,7 +9036,7 @@
     }*/
 
     /** should fail: test XMLResolver validatation for model.document.* */
-    /*public void testDefect_9498_2() throws Exception {
+    /*@Test public void testDefect_9498_2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = ""; 
@@ -9054,7 +9049,7 @@
     }*/
 
     /** should fail: test XMLResolver validatation for xml.* */
-    /*public void testDefect_9498_3() throws Exception {
+    /*@Test public void testDefect_9498_3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = ""; 
@@ -9069,7 +9064,7 @@
     /** Test element.* with order by with only necessary sub-mapping classes are queried 
      *  and case_insensitive nodes in the mapping tree
      */
-    public void testCommentNodeInDoc() throws Exception {
+    @Test public void testCommentNodeInDoc() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9118,7 +9113,7 @@
         "    <Catalog6/>\r\n" +  //$NON-NLS-1$
         "</Catalogs>\r\n\r\n"; //$NON-NLS-1$
 
-    public void testDefect8917() throws Exception {
+    @Test public void testDefect8917() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager_8917(metadata);
         
@@ -9129,7 +9124,7 @@
     /*
      * jhTODO
      */
-    public void testNillableOptional() throws Exception {
+    @Test public void testNillableOptional() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -9148,7 +9143,7 @@
     /*
      * jhTODO
      */
-    public void testNillableNonOptional() throws Exception {
+    @Test public void testNillableNonOptional() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
@@ -9170,7 +9165,7 @@
      * NON-empty whitespace string, which will NOT be treated as null
      * see also defect 15117
      */
-    public void testDefect11789() throws Exception {
+    @Test public void testDefect11789() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager_8917a(metadata);
 
@@ -9232,7 +9227,7 @@
      * Related to defect 8917 - the result should be the same as 
      * testDefect8917
      */
-    public void testDefect11789b() throws Exception {
+    @Test public void testDefect11789b() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager_8917b(metadata);
 
@@ -9240,7 +9235,7 @@
             EXPECTED_DOC_DEFECT_8917_AND_11789, metadata, dataMgr);        
     }    
     
-    public void testDefect9446() throws Exception {
+    @Test public void testDefect9446() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager_8917(metadata);
         String expectedDoc = 
@@ -9261,7 +9256,7 @@
             expectedDoc, metadata, dataMgr);        
     } 
 
-    public void testDefect9446_2() throws Exception {
+    @Test public void testDefect9446_2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager_8917(metadata);
         String expectedDoc = 
@@ -9276,7 +9271,7 @@
             expectedDoc, metadata, dataMgr);        
     } 
 
-    public void testDefect_9530() throws Exception {
+    @Test public void testDefect_9530() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9307,7 +9302,7 @@
             expectedDoc, metadata, dataMgr);        
     } 
 
-    public void testSubqueryInXMLQueryCriteria() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteria() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9334,7 +9329,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE ItemID IN (SELECT itemNum FROM stock.items WHERE itemNum = '001')", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testSubqueryInXMLQueryCriteria2() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteria2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9361,7 +9356,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE ItemID > ANY (SELECT itemNum FROM stock.items WHERE itemNum IN ('001','002') )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testSubqueryInXMLQueryCriteria3() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteria3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9415,7 +9410,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE EXISTS (SELECT itemNum FROM stock.items WHERE itemNum = '001')", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testSubqueryInXMLQueryCriteriaNestedSubquery() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedSubquery() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9442,7 +9437,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1 WHERE ItemID > ANY (SELECT itemNum FROM stock.items WHERE itemNum IN (SELECT itemNum FROM stock.items WHERE itemNum IN ('001','002') ) )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testSubqueryInXMLQueryCriteriaNestedMappingClass() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9507,7 +9502,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE ItemID > ANY (SELECT itemNum FROM stock.items WHERE itemNum IN ('001','002') )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }  
 
-    public void testSubqueryInXMLQueryCriteriaNestedMappingClass2() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass2() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9572,7 +9567,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE SupplierID > ANY (SELECT supplierNum FROM stock.suppliers WHERE supplierNum IN ('53','54') )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     } 
 
-    public void testSubqueryInXMLQueryCriteriaNestedMappingClass3() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass3() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9637,7 +9632,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE SupplierID < ALL (SELECT supplierNum FROM stock.suppliers WHERE supplierNum IN ('52','54') )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testSubqueryInXMLQueryCriteriaNestedMappingClass3a() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass3a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9703,7 +9698,7 @@
     }
 
 
-    public void testSubqueryInXMLQueryCriteriaNestedMappingClass4() throws Exception {
+    @Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass4() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9770,7 +9765,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE context(SupplierID, SupplierID) < SOME (SELECT supplierNum FROM stock.suppliers WHERE supplierNum IN ('52','54') )", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testCritNestedMappingClass() throws Exception {
+    @Test public void testCritNestedMappingClass() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9835,7 +9830,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE SupplierID = '52'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testDefect_9893() throws Exception{
+    @Test public void testDefect_9893() throws Exception{
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9850,7 +9845,7 @@
             expectedDoc, metadata, dataMgr); 
     }
 
-    public void testDefect_9893_2() throws Exception{
+    @Test public void testDefect_9893_2() throws Exception{
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9865,7 +9860,7 @@
             expectedDoc, metadata, dataMgr); 
     }
 
-    public void testDefect_9893_3() throws Exception{
+    @Test public void testDefect_9893_3() throws Exception{
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 
@@ -9880,7 +9875,7 @@
             expectedDoc, metadata, dataMgr); 
     }
 
-    public void testDefect_9893_4() throws Exception{
+    @Test public void testDefect_9893_4() throws Exception{
         FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
         String expectedDoc = 
@@ -9900,7 +9895,7 @@
             expectedDoc, metadata, dataMgr, SHOULD_SUCCEED, null, null);       
     }
 
-    public void testNestedWithStoredQueryInMappingClass() throws Exception {
+    @Test public void testNestedWithStoredQueryInMappingClass() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -9966,7 +9961,7 @@
     }
 
     /** homegenous, simple array elements */
-    public void testWithSOAPEncoding1() throws Exception {
+    @Test public void testWithSOAPEncoding1() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataSoap1();
         FakeDataManager dataMgr = exampleDataManagerForSoap1(metadata, false);
          
@@ -10000,7 +9995,7 @@
      * (e.g. ORG:ArrayOfTaxID) and the schema allows it, eliminate the 
      * whole fragment
      */        
-    public void testWithSOAPEncodingNoRows() throws Exception {
+    @Test public void testWithSOAPEncodingNoRows() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataSoap1();
         FakeDataManager dataMgr = exampleDataManagerForSoap1(metadata, true);
          
@@ -10026,7 +10021,7 @@
         helpTestProcess("SELECT * FROM xmltest.docSoap", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }  
     
-    public void testDefect12260() throws Exception{
+    @Test public void testDefect12260() throws Exception{
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = 
@@ -10065,7 +10060,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc12260", expectedDoc, metadata, dataMgr, true, MetaMatrixComponentException.class, null, capFinder); //$NON-NLS-1$
     }
     
-    public void testDefect8373() throws Exception{
+    @Test public void testDefect8373() throws Exception{
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
@@ -10106,7 +10101,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8373", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testDefect8373a() throws Exception{
+    @Test public void testDefect8373a() throws Exception{
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
@@ -10147,7 +10142,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8373a", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testDefect8373b() throws Exception{
+    @Test public void testDefect8373b() throws Exception{
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
@@ -10188,7 +10183,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8373b", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }    
 
-    public void testDefect13617() throws Exception {
+    @Test public void testDefect13617() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager13617(metadata);
         String expectedDoc = 
@@ -10212,7 +10207,7 @@
         helpTestProcess("SELECT Item.Name FROM xmltest.doc13617", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }       
 
-    public void testDefect13617a() throws Exception {
+    @Test public void testDefect13617a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager13617(metadata);
         String expectedDoc = 
@@ -10243,7 +10238,7 @@
      * @throws Exception
      * @since 4.2
      */
-    public void testDefect14905() throws Exception {
+    @Test public void testDefect14905() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager14905(metadata);
         String expectedDoc = 
@@ -10270,7 +10265,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }    
 
-    public void testTextUnnormalizedDefect15117() throws Exception {
+    @Test public void testTextUnnormalizedDefect15117() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager15117(metadata);
         String expectedDoc = 
@@ -10297,7 +10292,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
 
-    public void testTextUnnormalizedDefect15117a() throws Exception {
+    @Test public void testTextUnnormalizedDefect15117a() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager15117a(metadata);
         String expectedDoc = 
@@ -10324,7 +10319,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }      
     
-    public void testRecursiveGroupDoc() throws Exception {
+    @Test public void testRecursiveGroupDoc() throws Exception {
 
         FakeMetadataFacade metadata = exampleMetadata2();
         FakeDataManager dataMgr = exampleXQTDataManager(metadata);
@@ -10358,7 +10353,7 @@
         helpTestProcess("SELECT * FROM xqttest.groupDoc WHERE pseudoID = 2", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testCase2951MaxRows() throws Exception {
+    @Test public void testCase2951MaxRows() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10425,7 +10420,7 @@
     }
     
     /** test rowlimitexception() doesn't throw exception is rowlimit isn't passed */
-    public void testDefect19173RowLimitException() throws Exception {
+    @Test public void testDefect19173RowLimitException() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10492,7 +10487,7 @@
     }    
 
     /** test criteria can be written backwards */
-    public void testDefect19173RowLimitExceptionBackwardsCriteria() throws Exception {
+    @Test public void testDefect19173RowLimitExceptionBackwardsCriteria() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10558,7 +10553,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE 4 = rowlimitexception(supplier)", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }    
     
-    public void testCase2951MaxRows2() throws Exception {
+    @Test public void testCase2951MaxRows2() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10613,7 +10608,7 @@
     }    
 
     /** test processing exception is thrown if row limit is passed */
-    public void testDefect19173RowLimitException2() throws Exception {
+    @Test public void testDefect19173RowLimitException2() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10622,7 +10617,7 @@
     }      
     
     /** Two row limits on the same mapping class should be harmless as long as the row limits are identical. */
-    public void testCase2951MaxRows2a() throws Exception {
+    @Test public void testCase2951MaxRows2a() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10677,7 +10672,7 @@
     }    
 
     /** test processing exception is thrown if row limit is passed */
-    public void testDefect19173RowLimitException2a() throws Exception {
+    @Test public void testDefect19173RowLimitException2a() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10686,7 +10681,7 @@
     }      
     
     /** compound criteria */
-    public void testCase2951MaxRows3() throws Exception {
+    @Test public void testCase2951MaxRows3() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10717,7 +10712,7 @@
     }    
 
     /** compound criteria */
-    public void testDefect19173RowLimitException3() throws Exception {
+    @Test public void testDefect19173RowLimitException3() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10725,7 +10720,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE ItemID='002' AND rowlimitexception(supplier) = 2", null, metadata, dataMgr, false, MetaMatrixProcessingException.class, "");         //$NON-NLS-1$ //$NON-NLS-2$
     }     
     
-    public void testCase2951MaxRows4() throws Exception {
+    @Test public void testCase2951MaxRows4() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10769,7 +10764,7 @@
         helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimit(supplier) = 2 AND rowlimit(item) = 2", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }     
 
-    public void testCase2951AndDefect19173MixTwoFunctions() throws Exception {
+    @Test public void testCase2951AndDefect19173MixTwoFunctions() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10824,7 +10819,7 @@
     }     
     
     /** arg to rowlimit function isn't in the scope of any mapping class */
-    public void testCase2951MaxRowsFails() throws Exception {
+    @Test public void testCase2951MaxRowsFails() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10833,7 +10828,7 @@
     }     
 
     /** two conflicting row limits on the same mapping class */
-    public void testCase2951MaxRowsFails2() throws Exception {
+    @Test public void testCase2951MaxRowsFails2() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10842,7 +10837,7 @@
     }
     
     /** arg to rowlimitexception function isn't in the scope of any mapping class */
-    public void testDefect19173RowLimitExceptionFails() throws Exception {
+    @Test public void testDefect19173RowLimitExceptionFails() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10851,7 +10846,7 @@
     }     
 
     /** two conflicting rowlimitexceptions on the same mapping class */
-    public void testDefect19173RowLimitExceptionFails2() throws Exception {
+    @Test public void testDefect19173RowLimitExceptionFails2() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10860,7 +10855,7 @@
     }    
     
     /** two conflicting rowlimit and rowlimitexceptions on the same mapping class fails planning */
-    public void testDefect19173RowLimitAndRowLimitExceptionMixFails2() throws Exception {
+    @Test public void testDefect19173RowLimitAndRowLimitExceptionMixFails2() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10869,7 +10864,7 @@
     }    
 
     /** try rowlimit criteria written the reverse way */
-    public void testCase2951MaxRows5() throws Exception {
+    @Test public void testCase2951MaxRows5() throws Exception {
         
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
@@ -10924,7 +10919,7 @@
     } 
     
     
-    public void testNormalizationCollapse() throws Exception {
+    @Test public void testNormalizationCollapse() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNormalization(metadata);
         String expectedDoc = 
@@ -10963,7 +10958,7 @@
         helpTestProcess("SELECT * FROM xmltest.normDoc1", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
     
-    public void testNormalizationReplace() throws Exception {
+    @Test public void testNormalizationReplace() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNormalization(metadata);
         String expectedDoc = 
@@ -11001,7 +10996,7 @@
  
         helpTestProcess("SELECT * FROM xmltest.normDoc2", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
     }
-    public void testNormalizationPreserve() throws Exception {
+    @Test public void testNormalizationPreserve() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNormalization2(metadata);
         String expectedDoc = 
@@ -11268,7 +11263,7 @@
      * Test of doc model w/o criteria, just as a baseline 
      * @throws Exception
      */
-    public void testCase3225() throws Exception {
+    @Test public void testCase3225() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
         String expectedDoc = 
@@ -11586,7 +11581,7 @@
      * the combined criteria should limit returned items to item 001.
      * @throws Exception
      */
-    public void testCase3225WithCriteria() throws Exception {
+    @Test public void testCase3225WithCriteria() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
         helpTestProcess("select * from xmltest.itemsdoc where employee. at supervisorID='1004' and order.orderquantity > 1", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
@@ -11608,7 +11603,7 @@
      * the combined criteria should limit returned items to item 001.
      * @throws Exception
      */
-    public void testCase3225WithCriteriaReversed() throws Exception {
+    @Test public void testCase3225WithCriteriaReversed() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
         helpTestProcess("select * from xmltest.itemsdoc where order.orderquantity > 1 and employee. at supervisorID='1004'", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
@@ -11620,7 +11615,7 @@
      * to make sure all of the criteria is processed correctly. 
      * @throws Exception
      */
-    public void testCase3225WithEmptyDocCriteria() throws Exception {
+    @Test public void testCase3225WithEmptyDocCriteria() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
         String expectedDoc = 
@@ -11639,7 +11634,7 @@
      * @throws Exception
      * @since 4.3
      */
-    public void testBaseballPlayersDoc() throws Exception {
+    @Test public void testBaseballPlayersDoc() throws Exception {
         
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
@@ -11731,7 +11726,7 @@
      * @throws Exception
      * @since 4.3
      */
-    public void testBaseballPlayersDocCriteria() throws Exception {
+    @Test public void testBaseballPlayersDocCriteria() throws Exception {
         
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
@@ -11786,7 +11781,7 @@
      * @throws Exception
      * @since 4.3
      */
-    public void testBaseballPlayersDocContextCriteria() throws Exception {
+    @Test public void testBaseballPlayersDocContextCriteria() throws Exception {
         
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
         FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
@@ -11847,7 +11842,8 @@
         
     }    
     
-    public void testProcedureAndXML() throws Exception {
+    @Ignore("stored procedure wrapper removal has been disabled")
+    @Test public void testProcedureAndXML() throws Exception {
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
         String expectedDoc = 

Copied: branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestProcedureResolving.java (from rev 1724, trunk/engine/src/test/java/com/metamatrix/query/resolver/TestProcedureResolving.java)
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestProcedureResolving.java	                        (rev 0)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestProcedureResolving.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -0,0 +1,1639 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.query.resolver;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.api.exception.query.QueryParserException;
+import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.dqp.message.ParameterInfo;
+import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.mapping.relational.QueryNode;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.metadata.TempMetadataAdapter;
+import com.metamatrix.query.metadata.TempMetadataID;
+import com.metamatrix.query.metadata.TempMetadataStore;
+import com.metamatrix.query.parser.QueryParser;
+import com.metamatrix.query.resolver.util.ResolverUtil;
+import com.metamatrix.query.sql.ProcedureReservedWords;
+import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.lang.Insert;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
+import com.metamatrix.query.sql.proc.AssignmentStatement;
+import com.metamatrix.query.sql.proc.Block;
+import com.metamatrix.query.sql.proc.CommandStatement;
+import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
+import com.metamatrix.query.sql.proc.LoopStatement;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.query.sql.symbol.Expression;
+import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.visitor.ElementCollectorVisitor;
+import com.metamatrix.query.unittest.FakeMetadataFacade;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
+import com.metamatrix.query.unittest.FakeMetadataObject;
+
+public class TestProcedureResolving {
+
+ 	private QueryMetadataInterface exampleStoredProcedure(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.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", procedure); //$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);
+        
+        return metadata;
+	}
+ 	
+    private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType) {
+        helpFailUpdateProcedure(procedure, userUpdateStr, procedureType, null);
+    }
+    
+	private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType, String msg) {
+        // resolve
+        try {
+    		helpResolveUpdateProcedure(procedure, userUpdateStr, procedureType);
+            fail("Expected a QueryResolverException but got none."); //$NON-NLS-1$
+        } catch(QueryResolverException ex) {
+        	if (msg != null) {
+                assertEquals(msg, ex.getMessage());
+            }
+        } catch (MetaMatrixComponentException e) {
+        	throw new RuntimeException(e);
+		} catch (QueryParserException e) {
+			throw new RuntimeException(e);
+		} 
+	}	
+	
+    public static Map getProcedureExternalMetadata(GroupSymbol virtualGroup, QueryMetadataInterface metadata)
+    throws QueryMetadataException, MetaMatrixComponentException {
+        Map externalMetadata = new HashMap();
+
+        // Look up elements for the virtual group
+        List elements = ResolverUtil.resolveElementsInGroup(virtualGroup, metadata);
+        // virtual group metadata info
+        externalMetadata.put(virtualGroup, elements);
+
+        // INPUT group metadata info
+        GroupSymbol inputGroup = new GroupSymbol(ProcedureReservedWords.INPUT);
+        List inputElments = new ArrayList(elements.size());
+        List elementIds = new ArrayList();
+        for(int i=0; i<elements.size(); i++) {
+            ElementSymbol virtualElmnt = (ElementSymbol)elements.get(i);
+            ElementSymbol inputElement = (ElementSymbol)virtualElmnt.clone();
+            inputElments.add(inputElement);
+            elementIds.add(new TempMetadataID(ProcedureReservedWords.INPUT + ElementSymbol.SEPARATOR + virtualElmnt.getShortName(), virtualElmnt.getType()));
+        }
+        inputGroup.setMetadataID(new TempMetadataID(ProcedureReservedWords.INPUT, elementIds));
+        externalMetadata.put(inputGroup, inputElments);
+
+        // CHANGING group metadata info
+        // Switch type to be boolean for all CHANGING variables
+        GroupSymbol changeGroup = new GroupSymbol(ProcedureReservedWords.CHANGING);
+        List changingElments = new ArrayList(elements.size());
+        elementIds = new ArrayList();
+        for(int i=0; i<elements.size(); i++) {
+            ElementSymbol changeElement = (ElementSymbol)((ElementSymbol)elements.get(i)).clone();
+            changeElement.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
+            changingElments.add(changeElement);
+            elementIds.add(new TempMetadataID(ProcedureReservedWords.INPUT + ElementSymbol.SEPARATOR + changeElement.getShortName(), changeElement.getType()));
+        }
+        changeGroup.setMetadataID(new TempMetadataID(ProcedureReservedWords.CHANGING, elementIds));
+        externalMetadata.put(changeGroup, changingElments);
+
+        return externalMetadata;
+    }
+	
+    @Test public void testDefect13029_CorrectlySetUpdateProcedureTempGroupIDs() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$
+            .append("\nBEGIN") //$NON-NLS-1$
+            .append("\nDECLARE string var1;") //$NON-NLS-1$
+            .append("\nvar1 = '';") //$NON-NLS-1$
+            .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
+            .append("\n  BEGIN") //$NON-NLS-1$
+            .append("\n    LOOP ON (SELECT pm1.g2.e1 FROM pm1.g2 WHERE loopCursor.e1 = pm1.g2.e1) AS loopCursor2") //$NON-NLS-1$
+            .append("\n    BEGIN") //$NON-NLS-1$
+            .append("\n      var1 = CONCAT(var1, CONCAT(' ', loopCursor2.e1));") //$NON-NLS-1$
+            .append("\n    END") //$NON-NLS-1$
+            .append("\n  END") //$NON-NLS-1$
+            .append("\nEND"); //$NON-NLS-1$
+            
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        Command command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+        Map tempIDs = command.getTemporaryMetadata();
+        assertNotNull(tempIDs);
+        assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
+        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
+        
+        Command subCommand = command.getSubCommands().get(0);
+        tempIDs = subCommand.getTemporaryMetadata();
+        assertNotNull(tempIDs);
+        assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
+        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
+
+        subCommand = command.getSubCommands().get(1);
+        tempIDs = subCommand.getTemporaryMetadata();
+        assertNotNull(tempIDs);
+        assertNotNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
+        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
+    }
+    
+	private CreateUpdateProcedureCommand helpResolveUpdateProcedure(String procedure, String userUpdateStr, String procedureType) throws QueryParserException, QueryResolverException, MetaMatrixComponentException {
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+		return resolveProcedure(userUpdateStr, metadata);
+	}
+
+	private CreateUpdateProcedureCommand resolveProcedure(String userUpdateStr,
+			QueryMetadataInterface metadata) throws QueryParserException,
+			QueryResolverException, MetaMatrixComponentException,
+			QueryMetadataException {
+		ProcedureContainer userCommand = (ProcedureContainer)QueryParser.getQueryParser().parseCommand(userUpdateStr); 
+        QueryResolver.resolveCommand(userCommand, metadata);
+        metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(userCommand.getTemporaryMetadata()));
+        return (CreateUpdateProcedureCommand)QueryResolver.expandCommand(userCommand, metadata, null);
+	}
+
+	private void helpResolveException(String userUpdateStr, QueryMetadataInterface metadata, String msg) throws QueryParserException, MetaMatrixComponentException {
+		try {
+			helpResolve(userUpdateStr, metadata);
+		} catch (QueryResolverException e) {
+			assertEquals(msg, e.getMessage());
+		}
+	}
+
+	private CreateUpdateProcedureCommand helpResolve(String userUpdateStr, QueryMetadataInterface metadata) throws QueryParserException, QueryResolverException, MetaMatrixComponentException {
+		return resolveProcedure(userUpdateStr, metadata);
+	}
+    
+    /**
+     *  Constants will now auto resolve if they are consistently representable in the target type
+     */
+    @Test public void testDefect23257() throws Exception{
+    	CreateUpdateProcedureCommand command = helpResolve("EXEC pm5.vsp59()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+        
+        CommandStatement cs = (CommandStatement)command.getBlock().getStatements().get(1);
+        
+        Insert insert = (Insert)cs.getCommand();
+        
+        assertEquals(DataTypeManager.DefaultDataClasses.SHORT, ((Expression)insert.getValues().get(1)).getType());
+    } 
+    
+    @Test public void testProcedureScoping() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        //note that this declare takes presedense over the proc INPUT.e1 and CHANGING.e1 variables
+        .append("\n  declare integer e1 = 1;") //$NON-NLS-1$
+        .append("\n  e1 = e1;") //$NON-NLS-1$
+        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
+        .append("\n  BEGIN") //$NON-NLS-1$
+        //inside the scope of the loop, an unqualified e1 should resolve to the loop variable group
+        .append("\n    variables.e1 = convert(e1, integer);") //$NON-NLS-1$
+        .append("\n  END") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        CreateUpdateProcedureCommand command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
+        
+        Block block = command.getBlock();
+        
+        AssignmentStatement assStmt = (AssignmentStatement)block.getStatements().get(1);
+        assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getCanonicalName());
+        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getValue()).getGroupSymbol().getCanonicalName());
+        
+        Block inner = ((LoopStatement)block.getStatements().get(2)).getBlock();
+        
+        assStmt = (AssignmentStatement)inner.getStatements().get(0);
+        
+        ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getValue(), false).iterator().next();
+        
+        assertEquals("LOOPCURSOR", value.getGroupSymbol().getCanonicalName()); //$NON-NLS-1$
+    }
+    
+	// variable resolution, variable used in if statement, variable compared against
+	// different datatype element
+    @Test public void testCreateUpdateProcedure4() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "if(var1 =1);\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = 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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// variable resolution, variable used in if statement, invalid operation on variable
+    @Test public void testCreateUpdateProcedure5() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = var1 + var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 whwre var1 = var1+var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }    
+    
+	// variable resolution, variables declared in different blocks local variables
+	// should not override
+    @Test public void testCreateUpdateProcedure6() {
+        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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e3;\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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable var1 was previously declared."); //$NON-NLS-1$
+    }
+    
+	// variable resolution, variables declared in different blocks local variables
+	// inner block using outer block variables
+    @Test public void testCreateUpdateProcedure7() 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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var2;\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e1;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// variable resolution, variables declared in different blocks local variables
+	// outer block cannot use inner block variables
+    @Test public void testCreateUpdateProcedure8() {
+        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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n";         //$NON-NLS-1$
+        procedure = procedure + "var2 = 1\n";                 //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }     
+    
+	// variable resolution, variables declared in different blocks local variables
+	// should override, outer block variables still valid afetr inner block is declared
+    @Test public void testCreateUpdateProcedure9() {
+        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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e3;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = var1 +1;\n";                 //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }    
+    
+	// special variable ROWS_UPDATED resolution
+    @Test public void testCreateUpdateProcedure10() 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;\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 + "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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable ROWS_UPDATED used with declared variable
+    @Test public void testCreateUpdateProcedure11() 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;\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 + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable INPUT used with declared variable
+    @Test public void testCreateUpdateProcedure12() 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 + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable CHANGING used with declared variable
+    @Test public void testCreateUpdateProcedure14() 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(CHANGING.e1 = 'true')\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable CHANGING and INPUT used in compound criteria
+    @Test public void testCreateUpdateProcedure15() 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(CHANGING.e1='false' and INPUT.e1=1)\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable CHANGING and INPUT used in compound criteria, with declared variables
+    @Test public void testCreateUpdateProcedure16() 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(CHANGING.e4 ='true' and INPUT.e2=1 or var1 < 30)\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// special variable CHANGING compared against integer no implicit conversion available
+    @Test public void testCreateUpdateProcedure17() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "if(CHANGING.e4 = {d'2000-01-01'})\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0027 Message:The expressions in this criteria are being compared but are of differing types (boolean and date) and no implicit conversion is available:  CHANGING.e4 = {d'2000-01-01'}"); //$NON-NLS-1$
+    }       
+    
+	// virtual group elements used in procedure(HAS CRITERIA)
+    @Test public void testCreateUpdateProcedure18() 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 HAS CRITERIA ON (vm1.g1.e1, vm1.g1.e1);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// virtual group elements used in procedure in if statement(HAS CRITERIA)
+    @Test public void testCreateUpdateProcedure19() 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.g1.e1, vm1.g1.e1))\n";                 //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where HAS CRITERIA ON (vm1.g1.e1, vm1.g1.e1);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }    
+    
+	// virtual group elements used in procedure(TRANSLATE CRITERIA)
+    @Test public void testCreateUpdateProcedure20() 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 Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// virtual group elements used in procedure(TRANSLATE CRITERIA)
+    @Test public void testCreateUpdateProcedure21() 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 Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using undefined variable should fail
+    @Test public void testCreateUpdateProcedure22() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+//        procedure = procedure + "DECLARE integer var1;\n";
+        procedure = procedure + "var3 = var2+var1;\n";         //$NON-NLS-1$
+        procedure = procedure + "var2 = Select pm1.g1.e2 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using undefined variable declared is of invalid datatype
+    @Test public void testCreateUpdateProcedure23() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE struct var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using declare variable that has parts
+    @Test public void testCreateUpdateProcedure24() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer var2.var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using declare variable is qualified
+    @Test public void testCreateUpdateProcedure26() throws Exception {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer VARIABLES.var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using declare variable is qualified but has more parts
+    @Test public void testCreateUpdateProcedure27() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer VARIABLES.var1.var2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using a variable that has not been declared in an assignment stmt
+    @Test public void testCreateUpdateProcedure28() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = 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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using a variable that has not been declared in an assignment stmt
+    @Test public void testCreateUpdateProcedure29() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = 1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using invalid function in assignment expr
+    @Test public void testCreateUpdateProcedure30() {
+        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 = 'x' + ROWS_UPDATED;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }    
+    
+	// using invalid function in assignment expr
+    @Test public void testCreateUpdateProcedure31() {
+        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 = 'x' + ROWS_UPDATED;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// using a variable being used inside a subcomand
+    @Test public void testCreateUpdateProcedure32() 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 + "Select var1 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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// variable resolution, variables declared in different blocks local variables
+	// should override, outer block variables still valid afetr inner block is declared
+	// fails as variable being compared against incorrect type
+    @Test public void testCreateUpdateProcedure33() {
+        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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE timestamp var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = var1 +1;\n";                 //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// physical elements used on criteria of the if statement
+    @Test public void testCreateUpdateProcedure34() {
+        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol pm1.g1.e2 is specified with an unknown group context"); //$NON-NLS-1$
+    }
+    
+	// virtual elements used on criteria of the if statement
+    @Test public void testCreateUpdateProcedure35() 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.g1.e1) and var1=1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// physical elements used on criteria of the if statement
+    @Test public void testCreateUpdateProcedure36() {
+        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }          
+    
+	// TranslateCriteria on criteria of the if statement
+    @Test public void testCreateUpdateProcedure37() 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(TRANSLATE CRITERIA ON (vm1.g1.e1) WITH (vm1.g1.e1 = 1))\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// validating Translate CRITERIA, elements on it should be virtual group elements
+	// but can use variables
+    @Test public void testCreateUpdateProcedure38() {
+        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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (pm1.g1.e2 = var1);\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// physical elements used on criteria of the if statement
+    @Test public void testCreateUpdateProcedure39() {
+        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// TranslateCriteria on criteria of the if statement
+    @Test public void testCreateUpdateProcedure40() 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(TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1))\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// TranslateCriteria on criteria of the if statement
+    @Test public void testCreateUpdateProcedure41() 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 (e1))\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// TranslateCriteria on criteria of the if statement
+    @Test public void testCreateUpdateProcedure42() 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 (e1))\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// TranslateCriteria on criteria of the if statement
+    @Test public void testCreateUpdateProcedure43() 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 + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\n";         //$NON-NLS-1$
+//        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n";
+//        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\n";
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+
+        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
+		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
+		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
+		Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
+        QueryResolver.resolveCommand(procCommand, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
+    }
+    
+	// special variable CHANGING compared against integer no implicit conversion available
+    @Test public void testCreateUpdateProcedure44() throws Exception {
+        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n";         //$NON-NLS-1$
+
+        String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.INSERT_PROCEDURE);
+    }
+    
+	// special variable CHANGING compared against integer no implicit conversion available
+    @Test public void testCreateUpdateProcedure45() throws Exception {
+        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n";         //$NON-NLS-1$
+
+        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.INSERT_PROCEDURE, procedure);        
+        
+		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
+		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
+		
+    	Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
+        QueryResolver.resolveCommand(procCommand, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
+    }
+    
+	// special variable CHANGING compared against integer no implicit conversion available
+    @Test public void testCreateUpdateProcedure46() throws Exception {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n";         //$NON-NLS-1$
+
+        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
+        
+        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);        
+        
+		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
+		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
+
+		Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
+        QueryResolver.resolveCommand(procCommand, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
+    }
+
+	// TranslateCriteria on criteria of the if statement
+	@Test public void testCreateUpdateProcedure47() 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 (e1))\n"; //$NON-NLS-1$
+		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+		procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (vm1.g1.e1 = pm1.g1.e1);\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// validating Translate CRITERIA, elements(left elements on  on it should be virtual group elements
+	@Test public void testCreateUpdateProcedure48() {
+		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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, INPUT.e2 = 2);\n";         //$NON-NLS-1$
+		procedure = procedure + "END\n"; //$NON-NLS-1$
+
+		String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// resolving Translate CRITERIA, right element should be present on the command
+	@Test public void testCreateUpdateProcedure49() {
+		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+		procedure = procedure + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = pm1.g2.e1);\n";         //$NON-NLS-1$
+		procedure = procedure + "END\n"; //$NON-NLS-1$
+
+		String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// resolving criteria selector(on HAS CRITERIA), elements on it should be virtual group elements
+	@Test public void testCreateUpdateProcedure50() {
+		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.g1.E1, vm1.g1.e1, INPUT.e1))\n";                 //$NON-NLS-1$
+		procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+		procedure = procedure + "END\n"; //$NON-NLS-1$
+		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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// resolving Translate CRITERIA, right side expression in the translate criteria should be elements on the command
+	@Test public void testCreateUpdateProcedure51() {
+		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=1;\n"; //$NON-NLS-1$
+		procedure = procedure + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e2 = var1+vm1.g1.e2, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+		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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// validating Translate CRITERIA, elements on it should be virtual group elements
+	// but can use variables, gut left exprs should always be virtual elements
+	@Test public void testCreateUpdateProcedure52() {
+		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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (var1 = vm1.g1.e2, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
+		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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// resolving AssignmentStatement, variable type and assigned type 
+	// do not match and no implicit conversion available
+	@Test public void testCreateUpdateProcedure53() {
+		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 = INPUT.e4;"; //$NON-NLS-1$
+		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$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+	
+	// resolving AssignmentStatement, variable type and assigned type 
+	// do not match, but implicit conversion available
+	@Test public void testCreateUpdateProcedure54() throws Exception {
+		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+		procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
+		procedure = procedure + "var1 = 1+1;"; //$NON-NLS-1$
+		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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}
+    
+	// resolving AssignmentStatement, variable type and assigned type 
+	// do not match, but implicit conversion available
+	@Test public void testCreateUpdateProcedure55() throws Exception {
+		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+		procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
+		procedure = procedure + "var1 = 1+ROWS_UPDATED;"; //$NON-NLS-1$
+		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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+	}	
+
+    // no user command provided - should throw resolver exception
+    @Test public void testCreateUpdateProcedure56() throws Exception {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = 1+ROWS_UPDATED;"; //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        TestResolver.helpResolveException(procedure, FakeMetadataFactory.example1Cached(), "Error Code:ERR.015.008.0012 Message:Unable to resolve update procedure as the virtual group context is ambiguous."); //$NON-NLS-1$
+    }
+    
+    @Test public void testDefect14912_CreateUpdateProcedure57_FunctionWithElementParamInAssignmentStatement() {
+        // Tests that the function params are resolved before the function for assignment statements
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = badFunction(badElement);"; //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+        helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"badElement\" is not defined by any relevant group."); //$NON-NLS-1$
+    }
+    
+	// addresses Cases 4624.  Before change to UpdateProcedureResolver,
+    // this case failed with assertion exception.
+    @Test public void testCase4624() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "VARIABLES.ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "var1 = {b'false'};\n"; //$NON-NLS-1$
+        procedure = procedure + "IF(var1 = {b 'true'})\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "SELECT Rack_ID, RACK_MDT_TYPE INTO #racks FROM Bert_MAP.BERT3.RACK;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+        helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: Bert_MAP.BERT3.RACK"); //$NON-NLS-1$
+    }
+
+	// addresses Cases 5474.  
+    @Test public void testCase5474() throws Exception {
+        String procedure = "CREATE VIRTUAL PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer VARIABLES.NLEVELS;\n"; //$NON-NLS-1$
+        procedure = procedure + "VARIABLES.NLEVELS = SELECT COUNT(*) FROM (SELECT oi.e1 AS Col1, oi.e2 AS Col2, oi.e3 FROM pm1.g2 AS oi) AS TOBJ, pm2.g2 AS TModel WHERE TModel.e3 = TOBJ.e3;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        TestResolver.helpResolve(procedure, FakeMetadataFactory.example1Cached(), null);
+    }
+    
+    @Test public void testIssue174102() throws Exception {
+        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE string crit = 'WHERE pm1.sq2.in = \"test\"';\n"; //$NON-NLS-1$
+        procedure = procedure + "CREATE LOCAL TEMPORARY TABLE #TTable (e1 string);"; //$NON-NLS-1$
+        procedure = procedure + "EXECUTE STRING ('SELECT e1 FROM pm1.sq2 ' || crit ) AS e1 string INTO #TTable;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        TestResolver.helpResolve(procedure, FakeMetadataFactory.example1Cached(), null);
+    }
+    
+    // Address Issue 174519.
+    // Expected result is resolver failure, but with different error.
+    @Test public void testIssue174519() throws Exception {
+        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE string VARIABLES.l_in = pm1.sq1.in;\n"; //$NON-NLS-1$
+        procedure = procedure + "INSERT INTO #temp \n"; //$NON-NLS-1$
+        procedure = procedure + "SELECT pm1.sq3.e1 FROM pm1.sq3 WHERE pm1.sq3.in = VARIABLES.l_in;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = exampleStoredProcedure(procedure);
+        helpResolveException("EXEC pm1.sq1(1)", metadata, "Error Code:ERR.015.008.0010 Message:INSERT statement must have the same number of elements and values specified.  This statement has 0 elements and 0 values."); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+	/*@Test public void testCommandUpdatingCountFromLastStatement() throws Exception {
+        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "declare integer x = convert(pm1.sq1.in, integer) + 5;\n"; //$NON-NLS-1$
+        procedure = procedure + "insert into pm1.g1 values (null, null, null, null);"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        
+        QueryMetadataInterface metadata = exampleStoredProcedure(procedure);
+        Command command = helpResolve(helpParse("exec pm1.sq1(1)"), metadata, null); //$NON-NLS-1$
+        
+        assertEquals(1, command.updatingModelCount(new TempMetadataAdapter(metadata, new TempMetadataStore())));
+	}*/
+
+    //baseline test to ensure that a declare assignment cannot contain the declared variable
+    @Test public void testDeclareStatement() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer VARIABLES.var1 = VARIABLES.var1;\n"; //$NON-NLS-1$
+        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$
+
+        helpFailUpdateProcedure(procedure, userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+    @Test public void testDynamicIntoInProc() throws Exception {
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                .append("BEGIN\n") //$NON-NLS-1$
+                                .append("execute string 'SELECT e1, e2, e3, e4 FROM pm1.g2' as e1 string, e2 string, e3 string, e4 string INTO #myTempTable;\n") //$NON-NLS-1$
+                                .append("select e1 from #myTempTable;\n") //$NON-NLS-1$
+                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                .append("END\n"); //$NON-NLS-1$
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+    @Test public void testDynamicStatement() throws Exception {
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                .append("BEGIN\n") //$NON-NLS-1$
+                                .append("execute string 'SELECT e1, e2, e3, e4 FROM pm1.g2';\n") //$NON-NLS-1$
+                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                .append("END\n"); //$NON-NLS-1$
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+    @Test public void testDynamicStatementType() {
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                .append("BEGIN\n") //$NON-NLS-1$
+                                .append("DECLARE object VARIABLES.X = null;\n") //$NON-NLS-1$
+                                .append("execute string VARIABLES.X;\n") //$NON-NLS-1$
+                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                .append("END\n"); //$NON-NLS-1$
+        helpFailUpdateProcedure(procedure.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+
+	// variable resolution
+    @Test public void testCreateUpdateProcedure1() 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;\n"; //$NON-NLS-1$
+        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+	// variable resolution, variable used in if statement
+    @Test public void testCreateUpdateProcedure3() 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(var1 =1)\n"; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\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$
+        
+		helpResolveUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+
+    @Test public void testSelectIntoInProc() throws Exception {
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                            .append("BEGIN\n") //$NON-NLS-1$
+                                            .append("SELECT e1, e2, e3, e4 INTO pm1.g1 FROM pm1.g2;\n") //$NON-NLS-1$
+                                            .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                            .append("END\n"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
+        
+        procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                .append("BEGIN\n") //$NON-NLS-1$
+                                .append("SELECT e1, e2, e3, e4 INTO #myTempTable FROM pm1.g2;\n") //$NON-NLS-1$
+                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                .append("END\n"); //$NON-NLS-1$
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+
+    @Test public void testSelectIntoInProcNoFrom() throws Exception {
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                            .append("BEGIN\n") //$NON-NLS-1$
+                                            .append("SELECT 'a', 19, {b'true'}, 13.999 INTO pm1.g1;\n") //$NON-NLS-1$
+                                            .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                            .append("END\n"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
+        
+        procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+                                .append("BEGIN\n") //$NON-NLS-1$
+                                .append("SELECT 'a', 19, {b'true'}, 13.999 INTO #myTempTable;\n") //$NON-NLS-1$
+                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
+                                .append("END\n"); //$NON-NLS-1$
+        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+    /*@Test public void testCommandUpdating3() throws Exception{
+        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
+        .append("BEGIN\n") //$NON-NLS-1$
+        .append("INSERT INTO pm1.g1 (e1) VALUES (input.e1);\n") //$NON-NLS-1$
+        .append("ROWS_UPDATED = INSERT INTO pm1.g2 (e1) VALUES (input.e1);\n") //$NON-NLS-1$
+        .append("END\n"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        Command command = helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
+                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
+        assertEquals(2, command.updatingModelCount(metadata));
+    }*/
+
+    /*@Test public void testCommandUpdatingCount6() throws Exception{
+        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
+        procedure = procedure + "INSERT INTO pm1.g1 (e2) VALUES (Input.e2);\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n";         //$NON-NLS-1$
+
+        String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
+        
+        Command command = helpResolveUpdateProcedure(procedure, userUpdateStr,
+                                     FakeMetadataObject.Props.INSERT_PROCEDURE);
+        assertEquals(2, command.updatingModelCount(metadata));
+    }*/
+    
+    // variable declared is of special type ROWS_RETURNED
+    @Test public void testDeclareRowsUpdated() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer rows_updated;\n"; //$NON-NLS-1$
+        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$
+        
+        helpFailUpdateProcedure(procedure, userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable rows_updated was previously declared."); //$NON-NLS-1$
+    }
+    
+    // validating INPUT element assigned
+    @Test public void testAssignInput() {
+        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 + "INPUT.e1 = Select pm1.g1.e1 from pm1.g1;\n"; //$NON-NLS-1$
+        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$
+        
+        helpFailUpdateProcedure(procedure, userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element symbol \"INPUT.e1\" cannot be assigned a value.  Only declared VARIABLES can be assigned values."); //$NON-NLS-1$
+    }
+    
+    // validating CHANGING element assigned
+    @Test public void testAssignChanging() {
+        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 + "CHANGING.e1 = Select pm1.g1.e1 from pm1.g1;\n"; //$NON-NLS-1$
+        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$
+        
+        helpFailUpdateProcedure(procedure, userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element symbol \"CHANGING.e1\" cannot be assigned a value.  Only declared VARIABLES can be assigned values."); //$NON-NLS-1$
+    }
+    
+    // variables cannot be used among insert elements
+    @Test public void testVariableInInsert() {
+        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 + "Insert into pm1.g1 (pm1.g1.e2, var1) values (1, 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
+
+        helpFailUpdateProcedure(procedure, userQuery, 
+                FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'var1': Element \"var1\" is not defined by any relevant group.]"); //$NON-NLS-1$
+    }
+    
+    // variables cannot be used among insert elements
+    @Test public void testVariableInInsert2() {
+        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 + "Insert into pm1.g1 (pm1.g1.e2, INPUT.x) values (1, 2);\n"; //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
+
+        helpFailUpdateProcedure(procedure, userQuery, 
+                FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'INPUT.x': Symbol INPUT.x is specified with an unknown group context]"); //$NON-NLS-1$
+    }
+    
+    //should resolve first to the table's column
+    @Test public void testVariableInInsert3() throws Exception {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "DECLARE integer e2;\n"; //$NON-NLS-1$
+        procedure = procedure + "Insert into pm1.g1 (e2) values (1);\n"; //$NON-NLS-1$
+        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
+
+        helpResolveUpdateProcedure(procedure, userQuery, 
+                FakeMetadataObject.Props.UPDATE_PROCEDURE); 
+    }
+    
+    @Test public void testAmbigousInput() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+        procedure = procedure + "select e1;\n"; //$NON-NLS-1$
+        procedure = procedure + "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(procedure, userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"e1\" is ambiguous, it exists in two or more groups."); //$NON-NLS-1$
+    }
+    
+    @Test public void testLoopRedefinition() {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  declare string var1;") //$NON-NLS-1$
+        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
+        .append("\n  BEGIN") //$NON-NLS-1$
+        .append("\n    LOOP ON (SELECT pm1.g2.e1 FROM pm1.g2 WHERE loopCursor.e1 = pm1.g2.e1) AS loopCursor") //$NON-NLS-1$
+        .append("\n    BEGIN") //$NON-NLS-1$
+        .append("\n      var1 = CONCAT(var1, CONCAT(' ', loopCursor.e1));") //$NON-NLS-1$
+        .append("\n    END") //$NON-NLS-1$
+        .append("\n  END") //$NON-NLS-1$
+        .append("\n  END"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$
+    }
+    
+    @Test public void testTempGroupElementShouldNotBeResolable() {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  select 1 as a into #temp;") //$NON-NLS-1$
+        .append("\n  select #temp.a from pm1.g1;") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
+    }
+    
+    @Test public void testTempGroupElementShouldNotBeResolable1() {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  select 1 as a into #temp;") //$NON-NLS-1$
+        .append("\n  insert into #temp (a) values (#temp.a);") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
+                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
+    }
+    
+    @Test public void testProcedureCreate() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
+        .append("\n  select e1 from t1;") //$NON-NLS-1$
+        .append("\n  create local temporary table t1 (e1 string, e2 integer);") //$NON-NLS-1$
+        .append("\n  select e2 from t1;") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
+    }
+    
+    /**
+     * it is not ok to redefine the loopCursor 
+     */
+    @Test public void testProcedureCreate1() {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
+        .append("\n  BEGIN") //$NON-NLS-1$
+        .append("\n  create local temporary table loopCursor (e1 string);") //$NON-NLS-1$
+        .append("\nEND") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Cannot create temporary table \"loopCursor\". A table with the same name already exists."); //$NON-NLS-1$
+    }
+    
+    @Test public void testProcedureCreateDrop() {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n drop table t1;") //$NON-NLS-1$
+        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: t1"); //$NON-NLS-1$
+    }
+    
+    @Test public void testProcedureCreateDrop1() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
+        .append("\n  drop table t1;") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+    }
+    
+    @Test public void testCreateAfterImplicitTempTable() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  select e1 into #temp from pm1.g1;") //$NON-NLS-1$
+        .append("\n  create local temporary table #temp (e1 string);") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
+    }
+    
+    @Test public void testInsertAfterCreate() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$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("\nEND"); //$NON-NLS-1$
+        
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
+    }
+    
+	/**
+	 * delete procedures should not reference input or changing vars.
+	 */
+	@Test public void testDefect16451() {
+		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure += "BEGIN\n"; //$NON-NLS-1$
+        procedure += "Select pm1.g1.e2 from pm1.g1 where e1 = input.e1;\n"; //$NON-NLS-1$
+        procedure += "ROWS_UPDATED = 0;"; //$NON-NLS-1$
+        procedure += "END\n"; //$NON-NLS-1$
+        
+        String userUpdateStr = "delete from vm1.g1 where e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+									 FakeMetadataObject.Props.DELETE_PROCEDURE, "Symbol input.e1 is specified with an unknown group context"); //$NON-NLS-1$
+	}
+	
+    @Test public void testInvalidVirtualProcedure3() throws Exception {
+    	helpResolveException("EXEC pm1.vsp18()", FakeMetadataFactory.example1Cached(), "Group does not exist: temptable"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    // variable resolution, variable compared against
+    // different datatype element for which there is no implicit transformation)
+    @Test public void testCreateUpdateProcedure2() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure += "BEGIN\n"; //$NON-NLS-1$
+        procedure += "DECLARE boolean var1;\n"; //$NON-NLS-1$
+        procedure += "ROWS_UPDATED = UPDATE pm1.g1 SET pm1.g1.e4 = convert(var1, string), pm1.g1.e1 = var1;\n"; //$NON-NLS-1$
+        procedure += "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+				 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e4' with expected type double to expression 'convert(var1, string)'"); //$NON-NLS-1$
+    }
+    
+    // special variable INPUT compared against invalid type
+    @Test public void testInvalidInputInUpdate() {
+        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
+        procedure += "BEGIN\n"; //$NON-NLS-1$
+        procedure += "DECLARE integer var1;\n"; //$NON-NLS-1$
+        procedure += "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
+        procedure += "ROWS_UPDATED = UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e1;\n"; //$NON-NLS-1$
+        procedure += "END\n"; //$NON-NLS-1$
+
+        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
+        
+		helpFailUpdateProcedure(procedure, userUpdateStr,
+				 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e2' with expected type integer to expression 'INPUT.e1'"); //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedure() throws Exception {
+        helpResolve("EXEC pm1.vsp1()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedure2() throws Exception {
+        helpResolve("EXEC pm1.vsp14()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedurePartialParameterReference() throws Exception {
+        helpResolve("EXEC pm1.vsp58(5)", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+    }
+    
+    //cursor starts with "#" Defect14924
+    @Test public void testVirtualProcedureInvalid1() throws Exception {
+    	helpResolveException("EXEC pm1.vsp32()",FakeMetadataFactory.example1Cached(), "Cursor names cannot begin with \"#\" as that indicates the name of a temporary table: #mycursor.");   //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    @Test public void testVirtualProcedureWithOrderBy() throws Exception {
+        helpResolve("EXEC pm1.vsp29()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedureWithTempTableAndOrderBy() throws Exception {
+        helpResolve("EXEC pm1.vsp33()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedureWithConstAndOrderBy() throws Exception {
+        helpResolve("EXEC pm1.vsp34()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testVirtualProcedureWithNoFromAndOrderBy() throws Exception {
+        helpResolve("EXEC pm1.vsp28()", FakeMetadataFactory.example1Cached());   //$NON-NLS-1$
+    }
+    
+    @Test public void testInvalidVirtualProcedure2() throws Exception {
+        helpResolveException("EXEC pm1.vsp12()", FakeMetadataFactory.example1Cached(), "Symbol mycursor.e2 is specified with an unknown group context"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    @Test public void testLoopRedefinition2() throws Exception {
+        helpResolveException("EXEC pm1.vsp11()", FakeMetadataFactory.example1Cached(), "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+        
+    @Test public void testVariableResolutionWithIntervening() throws Exception {
+        StringBuffer proc = new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$
+        .append("\nBEGIN") //$NON-NLS-1$
+        .append("\n  declare string x;") //$NON-NLS-1$
+        .append("\n  x = '1';") //$NON-NLS-1$
+        .append("\n  declare string y;") //$NON-NLS-1$
+        .append("\n  y = '1';") //$NON-NLS-1$
+        .append("\nEND"); //$NON-NLS-1$
+        
+        TestResolver.helpResolve(proc.toString(), FakeMetadataFactory.example1Cached(), null); 
+    }
+    
+}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,8 @@
 
 package com.metamatrix.query.resolver;
 
+import static org.junit.Assert.*;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Date;
@@ -38,17 +40,13 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.api.exception.query.QueryResolverException;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.dqp.message.ParameterInfo;
 import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.analysis.QueryAnnotation;
 import com.metamatrix.query.function.FunctionDescriptor;
 import com.metamatrix.query.function.FunctionLibrary;
 import com.metamatrix.query.function.FunctionLibraryManager;
@@ -59,7 +57,6 @@
 import com.metamatrix.query.metadata.TempMetadataStore;
 import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.resolver.util.BindVariableVisitor;
-import com.metamatrix.query.resolver.util.ResolverUtil;
 import com.metamatrix.query.sql.LanguageObject;
 import com.metamatrix.query.sql.ProcedureReservedWords;
 import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
@@ -69,7 +66,6 @@
 import com.metamatrix.query.sql.lang.From;
 import com.metamatrix.query.sql.lang.Insert;
 import com.metamatrix.query.sql.lang.OrderBy;
-import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.SPParameter;
 import com.metamatrix.query.sql.lang.Select;
@@ -80,11 +76,8 @@
 import com.metamatrix.query.sql.lang.SubquerySetCriteria;
 import com.metamatrix.query.sql.lang.Update;
 import com.metamatrix.query.sql.navigator.DeepPreOrderNavigator;
-import com.metamatrix.query.sql.proc.AssignmentStatement;
-import com.metamatrix.query.sql.proc.Block;
 import com.metamatrix.query.sql.proc.CommandStatement;
 import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
-import com.metamatrix.query.sql.proc.LoopStatement;
 import com.metamatrix.query.sql.symbol.Constant;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.Expression;
@@ -120,46 +113,7 @@
             throw new RuntimeException(e);
         }
 	}
-    
-    public static Map getProcedureExternalMetadata(GroupSymbol virtualGroup, QueryMetadataInterface metadata)
-    throws QueryMetadataException, MetaMatrixComponentException {
-        Map externalMetadata = new HashMap();
-
-        // Look up elements for the virtual group
-        List elements = ResolverUtil.resolveElementsInGroup(virtualGroup, metadata);
-        // virtual group metadata info
-        externalMetadata.put(virtualGroup, elements);
-
-        // INPUT group metadata info
-        GroupSymbol inputGroup = new GroupSymbol(ProcedureReservedWords.INPUT);
-        List inputElments = new ArrayList(elements.size());
-        List elementIds = new ArrayList();
-        for(int i=0; i<elements.size(); i++) {
-            ElementSymbol virtualElmnt = (ElementSymbol)elements.get(i);
-            ElementSymbol inputElement = (ElementSymbol)virtualElmnt.clone();
-            inputElments.add(inputElement);
-            elementIds.add(new TempMetadataID(ProcedureReservedWords.INPUT + ElementSymbol.SEPARATOR + virtualElmnt.getShortName(), virtualElmnt.getType()));
-        }
-        inputGroup.setMetadataID(new TempMetadataID(ProcedureReservedWords.INPUT, elementIds));
-        externalMetadata.put(inputGroup, inputElments);
-
-        // CHANGING group metadata info
-        // Switch type to be boolean for all CHANGING variables
-        GroupSymbol changeGroup = new GroupSymbol(ProcedureReservedWords.CHANGING);
-        List changingElments = new ArrayList(elements.size());
-        elementIds = new ArrayList();
-        for(int i=0; i<elements.size(); i++) {
-            ElementSymbol changeElement = (ElementSymbol)((ElementSymbol)elements.get(i)).clone();
-            changeElement.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
-            changingElments.add(changeElement);
-            elementIds.add(new TempMetadataID(ProcedureReservedWords.INPUT + ElementSymbol.SEPARATOR + changeElement.getShortName(), changeElement.getType()));
-        }
-        changeGroup.setMetadataID(new TempMetadataID(ProcedureReservedWords.CHANGING, elementIds));
-        externalMetadata.put(changeGroup, changingElments);
-
-        return externalMetadata;
-    }
-	
+    	
     /**
      * Helps resolve command, then check that the actual resolved Elements variables are the same as
      * the expected variable names.  The variableNames param will be empty unless the subquery
@@ -209,39 +163,6 @@
 		return helpResolve(helpParse(sql));
 	}
 	
-	private Command helpResolveUpdateProcedure(String procedure, String userUpdateStr, String procedureType) {
-        metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
-
-        return helpResolve(userUpdateStr, metadata, AnalysisRecord.createNonRecordingRecord());
-    }
-	
-    private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType) {
-        helpFailUpdateProcedure(procedure, userUpdateStr, procedureType, null);
-    }
-    
-	private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType, String msg) {
-        metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
-
-        Command userCommand;
-		try {
-			userCommand = QueryParser.getQueryParser().parseCommand(userUpdateStr);
-		} catch (QueryParserException e) {
-			throw new RuntimeException(e);
-		}
-
-        // resolve
-        try {
-            QueryResolver.resolveCommand(userCommand, metadata);
-            fail("Expected a QueryResolverException but got none."); //$NON-NLS-1$
-        } catch(QueryResolverException ex) {
-        	if (msg != null) {
-                assertEquals(msg, ex.getMessage());
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new RuntimeException(e);
-		} 
-	}	
-
     private Command helpResolve(Command command) {    
         return helpResolve(command, this.metadata, AnalysisRecord.createNonRecordingRecord());  
     }	
@@ -1052,7 +973,7 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
         
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         // Verify results        
         helpCheckFrom((Query)command, new String[] { "pm1.g1" });         //$NON-NLS-1$
@@ -1072,7 +993,7 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
                     
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         // Verify results        
         helpCheckFrom((Query)command, new String[] { "pm1.g1" });         //$NON-NLS-1$
@@ -1092,7 +1013,7 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
 
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         // Verify results
         Collection vars = getVariables(command);
@@ -1113,7 +1034,7 @@
             Map externalMetadata = new HashMap();
             externalMetadata.put(sqGroup, sqParams);
 
-            QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+            QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
             
             fail("Expected exception on invalid variable pm1.sq2.in"); //$NON-NLS-1$
         } catch(QueryResolverException e) {
@@ -1134,6 +1055,10 @@
         Object[] expectedParameterExpressions = new Object[] {new Constant("xyz")};//$NON-NLS-1$
         helpResolveExec("EXEC pm1.sq2(\"in\" = 'xyz')", expectedParameterExpressions);//$NON-NLS-1$
     }
+    
+    @Test public void testExecNamedParamDup() {
+        helpResolveException("EXEC pm1.sq2(\"in\" = 'xyz', \"in\" = 'xyz1')");//$NON-NLS-1$
+    }
 
     /** Should get exception because param name is wrong. */
     @Test public void testExecWrongParamName() {
@@ -1416,949 +1341,7 @@
 
         helpResolve(sql);
 	}	
-
-	// variable resolution
-    @Test public void testCreateUpdateProcedure1() {
-        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;\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 1, pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
     
-	// variable resolution, variable used in if statement
-    @Test public void testCreateUpdateProcedure3() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// variable resolution, variable used in if statement, variable comapred against
-	// differrent datatype element
-    @Test public void testCreateUpdateProcedure4() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "if(var1 =1);\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = 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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// variable resolution, variable used in if statement, invalid operation on variable
-    @Test public void testCreateUpdateProcedure5() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = var1 + var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 whwre var1 = var1+var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }    
-    
-	// variable resolution, variables declared in different blocks local variables
-	// should not override
-    @Test public void testCreateUpdateProcedure6() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e3;\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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable var1 was previously declared."); //$NON-NLS-1$
-    }
-    
-	// variable resolution, variables declared in different blocks local variables
-	// inner block using outer block variables
-    @Test public void testCreateUpdateProcedure7() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var2;\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e1;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// variable resolution, variables declared in differrent blocks local variables
-	// outer block cannot use inner block variables
-    @Test public void testCreateUpdateProcedure8() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n";         //$NON-NLS-1$
-        procedure = procedure + "var2 = 1\n";                 //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }     
-    
-	// variable resolution, variables declared in differrent blocks local variables
-	// should override, outer block variables still valid afetr inner block is declared
-    @Test public void testCreateUpdateProcedure9() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e3;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = var1 +1;\n";                 //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }    
-    
-	// special variable ROWS_UPDATED resolution
-    @Test public void testCreateUpdateProcedure10() {
-        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;\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 + "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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable ROWS_UPDATED used with declared variable
-    @Test public void testCreateUpdateProcedure11() {
-        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;\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 + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable INPUT used with declared variable
-    @Test public void testCreateUpdateProcedure12() {
-        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 + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable CHANGING used with declared variable
-    @Test public void testCreateUpdateProcedure14() {
-        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(CHANGING.e1 = 'true')\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable CHANGING and INPUT used in conpound criteria
-    @Test public void testCreateUpdateProcedure15() {
-        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(CHANGING.e1='false' and INPUT.e1=1)\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable CHANGING and INPUT used in conpound criteria, with declared variables
-    @Test public void testCreateUpdateProcedure16() {
-        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(CHANGING.e4 ='true' and INPUT.e2=1 or var1 < 30)\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// special variable CHANGING compared against integer no implicit conversion available
-    @Test public void testCreateUpdateProcedure17() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "if(CHANGING.e4 = {d'2000-01-01'})\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0027 Message:The expressions in this criteria are being compared but are of differing types (boolean and date) and no implicit conversion is available:  CHANGING.e4 = {d'2000-01-01'}"); //$NON-NLS-1$
-    }       
-    
-	// virtual group elements used in procedure(HAS CRITERIA)
-    @Test public void testCreateUpdateProcedure18() {
-        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 HAS CRITERIA ON (vm1.g1.e1, vm1.g1.e1);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// virtual group elements used in procedure in if statement(HAS CRITERIA)
-    @Test public void testCreateUpdateProcedure19() {
-        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.g1.e1, vm1.g1.e1))\n";                 //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED = Select pm1.g1.e2 from pm1.g1 where HAS CRITERIA ON (vm1.g1.e1, vm1.g1.e1);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }    
-    
-	// virtual group elements used in procedure(TRANSLATE CRITERIA)
-    @Test public void testCreateUpdateProcedure20() {
-        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 Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// virtual group elements used in procedure(TRANSLATE CRITERIA)
-    @Test public void testCreateUpdateProcedure21() {
-        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 Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using undefined variable should fail
-    @Test public void testCreateUpdateProcedure22() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-//        procedure = procedure + "DECLARE integer var1;\n";
-        procedure = procedure + "var3 = var2+var1;\n";         //$NON-NLS-1$
-        procedure = procedure + "var2 = Select pm1.g1.e2 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using undefined variable declared is of invalid datatype
-    @Test public void testCreateUpdateProcedure23() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE struct var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = Select pm1.g1.e2 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = 'x', pm1.g1.e2 = INPUT.e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using declare variable that has parts
-    @Test public void testCreateUpdateProcedure24() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer var2.var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using declare variable is qualified
-    @Test public void testCreateUpdateProcedure26() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer VARIABLES.var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using declare variable is qualified but has more parts
-    @Test public void testCreateUpdateProcedure27() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer VARIABLES.var1.var2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using a variable that has not been declared in an assignment stmt
-    @Test public void testCreateUpdateProcedure28() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = 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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using a variable that has not been declared in an assignment stmt
-    @Test public void testCreateUpdateProcedure29() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = 1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using invalid function in assignment expr
-    @Test public void testCreateUpdateProcedure30() {
-        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 = 'x' + ROWS_UPDATED;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }    
-    
-	// using invalid function in assignment expr
-    @Test public void testCreateUpdateProcedure31() {
-        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 = 'x' + ROWS_UPDATED;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// using a variable being used inside a subcomand
-    @Test public void testCreateUpdateProcedure32() {
-        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 + "Select var1 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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// variable resolution, variables declared in differrent blocks local variables
-	// should override, outer block variables still valid afetr inner block is declared
-	// fails as variable being compared against incorrect type
-    @Test public void testCreateUpdateProcedure33() {
-        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(var1 =1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE timestamp var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where var1 = pm1.g1.e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = var1 +1;\n";                 //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// physical elements used on criteria of the if statement
-    @Test public void testCreateUpdateProcedure34() {
-        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol pm1.g1.e2 is specified with an unknown group context"); //$NON-NLS-1$
-    }
-    
-	// virtual elements used on criteria of the if statement
-    @Test public void testCreateUpdateProcedure35() {
-        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.g1.e1) and var1=1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// physical elements used on criteria of the if statement
-    @Test public void testCreateUpdateProcedure36() {
-        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }          
-    
-	// TranslateCriteria on criteria of the if statement
-    @Test public void testCreateUpdateProcedure37() {
-        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(TRANSLATE CRITERIA ON (vm1.g1.e1) WITH (vm1.g1.e1 = 1))\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// validating Translate CRITERIA, elements on it should be virtual group elements
-	// but can use variables
-    @Test public void testCreateUpdateProcedure38() {
-        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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (pm1.g1.e2 = var1);\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// physical elements used on criteria of the if statement
-    @Test public void testCreateUpdateProcedure39() {
-        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(pm1.g1.e2 =1 and var1=1)\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// TranslateCriteria on criteria of the if statement
-    @Test public void testCreateUpdateProcedure40() {
-        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(TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1))\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1;\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// TranslateCriteria on criteria of the if statement
-    @Test public void testCreateUpdateProcedure41() {
-        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 (e1))\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// TranslateCriteria on criteria of the if statement
-    @Test public void testCreateUpdateProcedure42() {
-        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 (e1))\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-	// TranslateCriteria on criteria of the if statement
-    @Test public void testCreateUpdateProcedure43() 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 + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (g1.e1 = 1);\n";         //$NON-NLS-1$
-//        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n";
-//        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e2;\n";
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        
-        metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
-
-        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
-		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
-		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
-		Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
-        QueryResolver.resolveCommand(procCommand, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
-    }
-    
-	// special variable CHANGING compared against integer no implicit conversion available
-    @Test public void testCreateUpdateProcedure44() {
-        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n";         //$NON-NLS-1$
-
-        String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.INSERT_PROCEDURE);
-    }
-    
-	// special variable CHANGING compared against integer no implicit conversion available
-    @Test public void testCreateUpdateProcedure45() throws Exception {
-        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n";         //$NON-NLS-1$
-
-        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
-        
-        metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.INSERT_PROCEDURE, procedure);        
-        
-		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
-		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
-		
-    	Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
-        QueryResolver.resolveCommand(procCommand, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
-    }
-    
-	// special variable CHANGING compared against integer no implicit conversion available
-    @Test public void testCreateUpdateProcedure46() throws Exception {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n";         //$NON-NLS-1$
-
-        Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
-        
-        metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);        
-        
-		GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
-		virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
-
-		Map externalMetadata = getProcedureExternalMetadata(virtualGroup, metadata);        	
-        QueryResolver.resolveCommand(procCommand, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
-    }
-
-	// TranslateCriteria on criteria of the if statement
-	@Test public void testCreateUpdateProcedure47() {
-		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 (e1))\n"; //$NON-NLS-1$
-		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-		procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE CRITERIA ON (e1) WITH (vm1.g1.e1 = pm1.g1.e1);\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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// validating Translate CRITERIA, elements(left elements on  on it should be virtual group elements
-	@Test public void testCreateUpdateProcedure48() {
-		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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = 1, INPUT.e2 = 2);\n";         //$NON-NLS-1$
-		procedure = procedure + "END\n"; //$NON-NLS-1$
-
-		String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// resolving Translate CRITERIA, right element should be present on the command
-	@Test public void testCreateUpdateProcedure49() {
-		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-		procedure = procedure + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e1 = pm1.g2.e1);\n";         //$NON-NLS-1$
-		procedure = procedure + "END\n"; //$NON-NLS-1$
-
-		String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// resolving criteria selector(on HAS CRITERIA), elements on it should be virtual group elements
-	@Test public void testCreateUpdateProcedure50() {
-		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.g1.E1, vm1.g1.e1, INPUT.e1))\n";                 //$NON-NLS-1$
-		procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-		procedure = procedure + "END\n"; //$NON-NLS-1$
-		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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// resolving Translate CRITERIA, right side expression in the translate criteria should be elements on the command
-	@Test public void testCreateUpdateProcedure51() {
-		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=1;\n"; //$NON-NLS-1$
-		procedure = procedure + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (vm1.g1.e2 = var1+vm1.g1.e2, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-		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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// validating Translate CRITERIA, elements on it should be virtual group elements
-	// but can use variables, gut left exprs should always be virtual elements
-	@Test public void testCreateUpdateProcedure52() {
-		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 + "Select pm1.g1.e1 from pm1.g1 where Translate CRITERIA WITH (var1 = vm1.g1.e2, vm1.g1.e1 = 2);\n"; //$NON-NLS-1$
-		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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// resolving AssignmentStatement, variable type and assigned type 
-	// do not match and no implicit conversion available
-	@Test public void testCreateUpdateProcedure53() {
-		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 = INPUT.e4;"; //$NON-NLS-1$
-		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$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-	
-	// resolving AssignmentStatement, variable type and assigned type 
-	// do not match, but implicit conversion available
-	@Test public void testCreateUpdateProcedure54() {
-		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-		procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
-		procedure = procedure + "var1 = 1+1;"; //$NON-NLS-1$
-		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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}
-    
-	// resolving AssignmentStatement, variable type and assigned type 
-	// do not match, but implicit conversion available
-	@Test public void testCreateUpdateProcedure55() {
-		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-		procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
-		procedure = procedure + "var1 = 1+ROWS_UPDATED;"; //$NON-NLS-1$
-		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$
-        
-		helpResolveUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.UPDATE_PROCEDURE);
-	}	
-
-    // no user command provided - should throw resolver exception
-    @Test public void testCreateUpdateProcedure56() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = 1+ROWS_UPDATED;"; //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        helpResolveException(procedure, FakeMetadataFactory.example1Cached(), "Error Code:ERR.015.008.0012 Message:Unable to resolve update procedure as the virtual group context is ambiguous."); //$NON-NLS-1$
-    }
-    
-    @Test public void testDefect14912_CreateUpdateProcedure57_FunctionWithElementParamInAssignmentStatement() {
-        // Tests that the function params are resolved before the function for assignment statements
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = badFunction(badElement);"; //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-        helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"badElement\" is not defined by any relevant group."); //$NON-NLS-1$
-    }
-    
-	// addresses Cases 4624.  Before change to UpdateProcedureResolver,
-    // this case failed with assertion exception.
-    @Test public void testCase4624() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "VARIABLES.ROWS_UPDATED = 0;\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure = procedure + "var1 = {b'false'};\n"; //$NON-NLS-1$
-        procedure = procedure + "IF(var1 = {b 'true'})\n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "SELECT Rack_ID, RACK_MDT_TYPE INTO #racks FROM Bert_MAP.BERT3.RACK;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-        helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: Bert_MAP.BERT3.RACK"); //$NON-NLS-1$
-    }
-
-	// addresses Cases 5474.  
-    @Test public void testCase5474() {
-        String procedure = "CREATE VIRTUAL PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer VARIABLES.NLEVELS;\n"; //$NON-NLS-1$
-        procedure = procedure + "VARIABLES.NLEVELS = SELECT COUNT(*) FROM (SELECT oi.e1 AS Col1, oi.e2 AS Col2, oi.e3 FROM pm1.g2 AS oi) AS TOBJ, pm2.g2 AS TModel WHERE TModel.e3 = TOBJ.e3;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        helpResolve(procedure, FakeMetadataFactory.example1Cached(), null);
-    }
-    
-    @Test public void testIssue174102() throws Exception {
-        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE string crit = 'WHERE pm1.sq2.in = \"test\"';\n"; //$NON-NLS-1$
-        procedure = procedure + "CREATE LOCAL TEMPORARY TABLE #TTable (e1 string);"; //$NON-NLS-1$
-        procedure = procedure + "EXECUTE STRING ('SELECT e1 FROM pm1.sq2 ' || crit ) AS e1 string INTO #TTable;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        helpResolve(procedure, FakeMetadataFactory.example1Cached(), null);
-    }
-    
-    // Address Issue 174519.
-    // Expected result is resolver failure, but with different error.
-    @Test public void testIssue174519() {
-        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE string VARIABLES.l_in = pm1.sq1.in;\n"; //$NON-NLS-1$
-        procedure = procedure + "INSERT INTO #temp \n"; //$NON-NLS-1$
-        procedure = procedure + "SELECT pm1.sq3.e1 FROM pm1.sq3 WHERE pm1.sq3.in = VARIABLES.l_in;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = exampleStoredProcedure(procedure);
-        helpResolveException("EXEC pm1.sq1(1)", metadata, "Error Code:ERR.015.008.0010 Message:INSERT statement must have the same number of elements and values specified.  This statement has 0 elements and 0 values."); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
- 	private QueryMetadataInterface exampleStoredProcedure(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.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", procedure); //$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);
-        
-        return metadata;
-	}
-    
     @Test public void testIsXMLQuery1() throws Exception {
         helpTestIsXMLQuery("SELECT * FROM pm1.g1", false);     //$NON-NLS-1$
     }
@@ -2508,7 +1491,7 @@
         e1.setType(DataTypeManager.DefaultDataClasses.TIMESTAMP);
                
         // Expected right expression
-        Constant e2 = new Constant(new TimestampUtil().createDate(96, 0, 31), DataTypeManager.DefaultDataClasses.DATE);
+        Constant e2 = new Constant(TimestampUtil.createDate(96, 0, 31), DataTypeManager.DefaultDataClasses.DATE);
         Function f1 = new Function("convert", new Expression[] { e2, new Constant(DataTypeManager.DefaultDataTypes.TIMESTAMP)}); //$NON-NLS-1$
         f1.makeImplicit();
                
@@ -2526,20 +1509,7 @@
         
     @Test public void testFailedConversion_defect9725() throws Exception{
     	helpResolveException("select * from pm3.g1 where pm3.g1.e4 > {b 'true'}", "Error Code:ERR.015.008.0027 Message:The expressions in this criteria are being compared but are of differing types (timestamp and boolean) and no implicit conversion is available:  pm3.g1.e4 > TRUE"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    /**
-     *  Constants will now auto resolve if they are consistently representable in the target type
-     */
-    @Test public void testDefect23257() throws Exception{
-    	StoredProcedure command = (StoredProcedure)helpResolve("EXEC pm5.vsp59()"); //$NON-NLS-1$
-        
-        CommandStatement cs = (CommandStatement)((CreateUpdateProcedureCommand)command.getSubCommand()).getBlock().getStatements().get(1);
-        
-        Insert insert = (Insert)cs.getCommand();
-        
-        assertEquals(DataTypeManager.DefaultDataClasses.SHORT, ((Expression)insert.getValues().get(1)).getType());
-    }  
+    } 
             
     @Test public void testLookupFunction() {     
         String sql = "SELECT lookup('pm1.g1', 'e1', 'e2', e2) AS x, lookup('pm1.g1', 'e4', 'e3', e3) AS y FROM pm1.g1"; //$NON-NLS-1$
@@ -2627,39 +1597,6 @@
         assertEquals("Did not match expected criteria", expected, actual); //$NON-NLS-1$
     }    
     
-    @Test public void testVirtualProcedure(){
-        helpResolve("EXEC pm1.vsp1()");   //$NON-NLS-1$
-    }
-    
-    @Test public void testVirtualProcedure2(){
-        helpResolve("EXEC pm1.vsp14()");   //$NON-NLS-1$
-    }
-    
-    @Test public void testVirtualProcedurePartialParameterReference() {
-        helpResolve("EXEC pm1.vsp58(5)"); //$NON-NLS-1$
-    }
-    
-    //cursor starts with "#" Defect14924
-    @Test public void testVirtualProcedureInvalid1(){
-    	helpResolveException("EXEC pm1.vsp32()","Cursor names cannot begin with \"#\" as that indicates the name of a temporary table: #mycursor.");   //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    @Test public void testVirtualProcedureWithOrderBy() {
-        helpResolve("EXEC pm1.vsp29()");   //$NON-NLS-1$
-    }
-    
-    @Test public void testVirtualProcedureWithTempTableAndOrderBy() {
-        helpResolve("EXEC pm1.vsp33()");   //$NON-NLS-1$
-    }
-    
-    @Test public void testVirtualProcedureWithConstAndOrderBy() {
-        helpResolve("EXEC pm1.vsp34()");   //$NON-NLS-1$
-    }
-    
-    @Test public void testVirtualProcedureWithNoFromAndOrderBy() {
-        helpResolve("EXEC pm1.vsp28()");   //$NON-NLS-1$
-    }
-
     /** select e1 from pm1.g1 where e2 BETWEEN 1000 AND 2000 */
     @Test public void testBetween1(){
         String sql = "select e1 from pm1.g1 where e2 BETWEEN 1000 AND 2000"; //$NON-NLS-1$
@@ -3107,53 +2044,7 @@
             example_12968(), AnalysisRecord.createNonRecordingRecord());
     }
 
-    @Test public void testDefect13029_CorrectlySetUpdateProcedureTempGroupIDs() {
-        StringBuffer proc = new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$
-            .append("\nBEGIN") //$NON-NLS-1$
-            .append("\nDECLARE string var1;") //$NON-NLS-1$
-            .append("\nvar1 = '';") //$NON-NLS-1$
-            .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
-            .append("\n  BEGIN") //$NON-NLS-1$
-            .append("\n    LOOP ON (SELECT pm1.g2.e1 FROM pm1.g2 WHERE loopCursor.e1 = pm1.g2.e1) AS loopCursor2") //$NON-NLS-1$
-            .append("\n    BEGIN") //$NON-NLS-1$
-            .append("\n      var1 = CONCAT(var1, CONCAT(' ', loopCursor2.e1));") //$NON-NLS-1$
-            .append("\n    END") //$NON-NLS-1$
-            .append("\n  END") //$NON-NLS-1$
-            .append("\nEND"); //$NON-NLS-1$
-            
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, proc.toString());
 
-        // parse
-        Command userCommand = helpParse(userUpdateStr);
-
-        // resolve
-        try {
-            QueryResolver.resolveCommand(userCommand, metadata);
-        } catch(MetaMatrixException e) {
-            fail("Exception during resolution (" + e.getClass().getName() + "): " + e.getMessage());     //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        
-        Command command = ((ProcedureContainer)userCommand).getSubCommand();
-        Map tempIDs = command.getTemporaryMetadata();
-        assertNotNull(tempIDs);
-        assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
-        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
-        
-        Command subCommand = (Command)command.getSubCommands().get(0);
-        tempIDs = subCommand.getTemporaryMetadata();
-        assertNotNull(tempIDs);
-        assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
-        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
-
-        subCommand = (Command)command.getSubCommands().get(1);
-        tempIDs = subCommand.getTemporaryMetadata();
-        assertNotNull(tempIDs);
-        assertNotNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
-        assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
-
-    }
-
     @Test public void testUnionQueryWithNull() throws Exception{
     	helpResolve("SELECT NULL, e2 FROM pm1.g2 UNION ALL SELECT e1, e2 FROM pm1.g3"); //$NON-NLS-1$
     	helpResolve("SELECT e1, e2 FROM pm1.g1 UNION ALL SELECT NULL, e2 FROM pm1.g2 UNION ALL SELECT e1, e2 FROM pm1.g3"); //$NON-NLS-1$
@@ -3200,99 +2091,7 @@
         helpResolve("SELECT 'a', 19, {b'true'}, 13.999 INTO #myTempTable"); //$NON-NLS-1$
         helpResolve("SELECT e1, e2, e3, e4 INTO #myTempTable FROM pm1.g1"); //$NON-NLS-1$
     }
-    
-    @Test public void testSelectIntoInProcNoFrom() {
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                            .append("BEGIN\n") //$NON-NLS-1$
-                                            .append("SELECT 'a', 19, {b'true'}, 13.999 INTO pm1.g1;\n") //$NON-NLS-1$
-                                            .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                            .append("END\n"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
-        
-        procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                .append("BEGIN\n") //$NON-NLS-1$
-                                .append("SELECT 'a', 19, {b'true'}, 13.999 INTO #myTempTable;\n") //$NON-NLS-1$
-                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                .append("END\n"); //$NON-NLS-1$
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-    @Test public void testSelectIntoInProc() {
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                            .append("BEGIN\n") //$NON-NLS-1$
-                                            .append("SELECT e1, e2, e3, e4 INTO pm1.g1 FROM pm1.g2;\n") //$NON-NLS-1$
-                                            .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                            .append("END\n"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
-        
-        procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                .append("BEGIN\n") //$NON-NLS-1$
-                                .append("SELECT e1, e2, e3, e4 INTO #myTempTable FROM pm1.g2;\n") //$NON-NLS-1$
-                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                .append("END\n"); //$NON-NLS-1$
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-    //baseline test to ensure that a declare assignment cannot contain the declared variable
-    @Test public void testDeclareStatement() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer VARIABLES.var1 = VARIABLES.var1;\n"; //$NON-NLS-1$
-        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$
-
-        helpFailUpdateProcedure(procedure, userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-    @Test public void testDynamicIntoInProc() {
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                .append("BEGIN\n") //$NON-NLS-1$
-                                .append("execute string 'SELECT e1, e2, e3, e4 FROM pm1.g2' as e1 string, e2 string, e3 string, e4 string INTO #myTempTable;\n") //$NON-NLS-1$
-                                .append("select e1 from #myTempTable;\n") //$NON-NLS-1$
-                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                .append("END\n"); //$NON-NLS-1$
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-    @Test public void testDynamicStatement() {
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                .append("BEGIN\n") //$NON-NLS-1$
-                                .append("execute string 'SELECT e1, e2, e3, e4 FROM pm1.g2';\n") //$NON-NLS-1$
-                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                .append("END\n"); //$NON-NLS-1$
-        helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
-    @Test public void testDynamicStatementType() {
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-                                .append("BEGIN\n") //$NON-NLS-1$
-                                .append("DECLARE object VARIABLES.X = null;\n") //$NON-NLS-1$
-                                .append("execute string VARIABLES.X;\n") //$NON-NLS-1$
-                                .append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
-                                .append("END\n"); //$NON-NLS-1$
-        helpFailUpdateProcedure(procedure.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
+                
     //procedural relational mapping
     @Test public void testProcInVirtualGroup1(){
         String sql = "select e1 from pm1.vsp26 where param1=1 and param2='a'"; //$NON-NLS-1$
@@ -3334,122 +2133,6 @@
         helpResolve(sql);
     }
         
-    @Test public void testMaterializedTransformation() {
-        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
-        AnalysisRecord analysis = new AnalysisRecord(false, true, false);
-        
-        Command command = helpResolve(userSql, metadata, analysis);
-
-        assertEquals("Command different than user sql", "SELECT MATVIEW.E1 FROM MATVIEW", command.toString().toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("Command contains no subcommands", 1 == command.getSubCommands().size()); //$NON-NLS-1$
-        
-        String expectedTransformationSql = "SELECT * FROM MatTable.MatTable"; //$NON-NLS-1$
-        Command transCommand = (Command) command.getSubCommands().get(0);
-
-        assertEquals("Commands don't match", expectedTransformationSql, transCommand.toString()); //$NON-NLS-1$
-        
-        assertEquals("Wrong number of projected symbols", 1, transCommand.getProjectedSymbols().size()); //$NON-NLS-1$
-        assertEquals("wrong projected symbol", "MatTable.MatTable.e1", transCommand.getProjectedSymbols().get(0).toString()); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        Collection annotations = analysis.getAnnotations();
-        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
-        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
-        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
-
-        //System.out.println(annotations);
-
-    }
-
-    @Test public void testMaterializedTransformationLoading() {
-        String userSql = "SELECT MATVIEW.E1 INTO MatTable.MatStage FROM MATVIEW"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
-        AnalysisRecord analysis = new AnalysisRecord(false, true, false);
-        
-        Command command = helpResolve(userSql, metadata, analysis);
-        assertEquals("Command different than user sql", "SELECT MATVIEW.E1 INTO MATTABLE.MATSTAGE FROM MATVIEW", command.toString().toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("Command contains no subcommands", 1 == command.getSubCommands().size()); //$NON-NLS-1$
-        
-        String expectedTransformationSql = "SELECT x FROM MatSrc.MatSrc"; //$NON-NLS-1$
-        Command transCommand = (Command) command.getSubCommands().get(0);
-        assertEquals("Commands don't match", expectedTransformationSql, transCommand.toString()); //$NON-NLS-1$
-        
-        assertEquals("Wrong number of projected symbols", 1, transCommand.getProjectedSymbols().size()); //$NON-NLS-1$
-        assertEquals("wrong projected symbol", "x", transCommand.getProjectedSymbols().get(0).toString()); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        Collection annotations = analysis.getAnnotations();
-        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
-        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
-        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
-        
-        //System.out.println(annotations);
-        
-    }    
-    
-    @Test public void testMaterializedTransformationNoCache() {
-        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE MatView.MatView"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
-        AnalysisRecord analysis = new AnalysisRecord(false, true, false);
-        
-        Command command = helpResolve(userSql, metadata, analysis);
-        assertEquals("Command different than user sql", "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE MATVIEW.MATVIEW", command.toString().toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("Command contains no subcommands", 1 == command.getSubCommands().size()); //$NON-NLS-1$
-        
-        String expectedTransformationSql = "SELECT x FROM MatSrc.MatSrc OPTION NOCACHE"; //$NON-NLS-1$
-        Command transCommand = (Command) command.getSubCommands().get(0);
-        assertEquals("Commands don't match", expectedTransformationSql, transCommand.toString()); //$NON-NLS-1$
-        
-        assertEquals("Wrong number of projected symbols", 1, transCommand.getProjectedSymbols().size()); //$NON-NLS-1$
-        assertEquals("wrong projected symbol", "x", transCommand.getProjectedSymbols().get(0).toString()); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        Collection annotations = analysis.getAnnotations();
-        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
-        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
-        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
-    }
-    
-    //related to defect 14423
-    @Test public void testMaterializedTransformationNoCache2() {
-        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
-        AnalysisRecord analysis = new AnalysisRecord(false, true, false);
-        
-        Command command = helpResolve(userSql, metadata, analysis);
-        assertEquals("Command different than user sql", "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE", command.toString().toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("Command contains no subcommands", 1 == command.getSubCommands().size()); //$NON-NLS-1$
-        
-        String expectedTransformationSql = "SELECT x FROM MatSrc.MatSrc OPTION NOCACHE"; //$NON-NLS-1$
-        Command transCommand = (Command) command.getSubCommands().get(0);
-        assertEquals("Commands don't match", expectedTransformationSql, transCommand.toString()); //$NON-NLS-1$
-        
-        assertEquals("Wrong number of projected symbols", 1, transCommand.getProjectedSymbols().size()); //$NON-NLS-1$
-        assertEquals("wrong projected symbol", "x", transCommand.getProjectedSymbols().get(0).toString()); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        Collection annotations = analysis.getAnnotations();
-        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
-        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
-        assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
-    }
-    
-    @Test public void testNoCacheInTransformation(){
-        String userSql = "SELECT VGROUP.E1 FROM VGROUP"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
-        AnalysisRecord analysis = new AnalysisRecord(false, true, false);
-        
-        Command command = helpResolve(userSql, metadata, analysis);
-        assertEquals("Command different than user sql", "SELECT VGROUP.E1 FROM VGROUP", command.toString().toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("Command contains no subcommands", 1 == ((Command)command.getSubCommands().get(0)).getSubCommands().size()); //$NON-NLS-1$
-        
-        String expectedTransformationSql = "SELECT x FROM MatSrc.MatSrc OPTION NOCACHE"; //$NON-NLS-1$
-        Command transCommand = (Command)((Command) command.getSubCommands().get(0)).getSubCommands().get(0);
-        assertEquals("Commands don't match", expectedTransformationSql, transCommand.toString()); //$NON-NLS-1$
-    }
-	
     @Test public void testProcParamComparison_defect13653() {
         String userSql = "SELECT * FROM (EXEC mmspTest1.MMSP5('a')) AS a, (EXEC mmsptest1.mmsp6('b')) AS b"; //$NON-NLS-1$
         
@@ -3518,7 +2201,7 @@
     	inputSetElements.add(inputSetElement);
     	externalMetadata.put(inputSet, inputSetElements);
         Query command = (Query)helpParse(sql);
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
         Collection groups = GroupCollectorVisitor.getGroups(command, false);
         assertFalse(groups.contains(inputSet));
     }
@@ -3536,7 +2219,7 @@
     	param.setType(String.class);
     	procPrarms.add(param);
     	externalMetadata.put(procGroup, procPrarms);
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
         CreateUpdateProcedureCommand proc = (CreateUpdateProcedureCommand)command;
         Query query = (Query)proc.getSubCommands().get(0);
         ElementSymbol inElement = (ElementSymbol)((CompareCriteria)query.getCriteria()).getLeftExpression();
@@ -3606,40 +2289,10 @@
         assertEquals(0, command.updatingModelCount(metadata));
     }
     
-    @Test public void testCommandUpdating3() throws Exception{
-        StringBuffer procedure = new StringBuffer("CREATE PROCEDURE  ") //$NON-NLS-1$
-        .append("BEGIN\n") //$NON-NLS-1$
-        .append("INSERT INTO pm1.g1 (e1) VALUES (input.e1);\n") //$NON-NLS-1$
-        .append("ROWS_UPDATED = INSERT INTO pm1.g2 (e1) VALUES (input.e1);\n") //$NON-NLS-1$
-        .append("END\n"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        Command command = helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
-                                   FakeMetadataObject.Props.UPDATE_PROCEDURE);
-        assertEquals(2, command.updatingModelCount(metadata));
-    }
-    
     @Test public void testCommandUpdatingCount5() throws Exception{
         Command command = helpResolve("SELECT pm1.g1.e1 FROM pm1.g1 UNION SELECT pm1.g2.e1 FROM pm1.g2 ORDER BY e1"); //$NON-NLS-1$
         assertEquals(0, command.updatingModelCount(metadata));
     }
-
-    @Test public void testCommandUpdatingCount6() throws Exception{
-        String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "if(INPUT.e1 = 10)\n";         //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
-        procedure = procedure + "INSERT INTO pm1.g1 (e2) VALUES (Input.e2);\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n";         //$NON-NLS-1$
-
-        String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
-        
-        Command command = helpResolveUpdateProcedure(procedure, userUpdateStr,
-                                     FakeMetadataObject.Props.INSERT_PROCEDURE);
-        assertEquals(2, command.updatingModelCount(metadata));
-    }
     
     /** case 3955 */
     @Test public void testCommandUpdatingCountPhysicalInsert() throws Exception{
@@ -3688,20 +2341,7 @@
         
         assertEquals(2, command.updatingModelCount(new TempMetadataAdapter(metadata, new TempMetadataStore())));
     }
-	
-	@Test public void testCommandUpdatingCountFromLastStatement() throws Exception {
-        String procedure = "CREATE VIRTUAL PROCEDURE  \n"; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "declare integer x = convert(pm1.sq1.in, integer) + 5;\n"; //$NON-NLS-1$
-        procedure = procedure + "insert into pm1.g1 values (null, null, null, null);"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-        
-        QueryMetadataInterface metadata = exampleStoredProcedure(procedure);
-        Command command = helpResolve(helpParse("exec pm1.sq1(1)"), metadata, null); //$NON-NLS-1$
-        
-        assertEquals(1, command.updatingModelCount(new TempMetadataAdapter(metadata, new TempMetadataStore())));
-	}
-		    
+			    
     @Test public void testCommandUpdatingCountFromMetadata() throws Exception {
         FakeMetadataFacade metadata = FakeMetadataFactory.example1();
         FakeMetadataObject proc = metadata.getStore().findObject("pm1.sp1", FakeMetadataObject.PROCEDURE); //$NON-NLS-1$
@@ -3903,205 +2543,6 @@
         helpResolveException(sql, "Group does not exist: temp_table"); //$NON-NLS-1$ 
     }
     
-    @Test public void testInvalidVirtualProcedure2(){
-        helpResolveException("EXEC pm1.vsp12()", FakeMetadataFactory.example1Cached(), "Symbol mycursor.e2 is specified with an unknown group context"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    // variable declared is of special type ROWS_RETURNED
-    @Test public void testDeclareRowsUpdated() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer rows_updated;\n"; //$NON-NLS-1$
-        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$
-        
-        helpFailUpdateProcedure(procedure, userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable rows_updated was previously declared."); //$NON-NLS-1$
-    }
-    
-    // validating INPUT element assigned
-    @Test public void testAssignInput() {
-        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 + "INPUT.e1 = Select pm1.g1.e1 from pm1.g1;\n"; //$NON-NLS-1$
-        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$
-        
-        helpFailUpdateProcedure(procedure, userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element symbol \"INPUT.e1\" cannot be assigned a value.  Only declared VARIABLES can be assigned values."); //$NON-NLS-1$
-    }
-    
-    // validating CHANGING element assigned
-    @Test public void testAssignChanging() {
-        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 + "CHANGING.e1 = Select pm1.g1.e1 from pm1.g1;\n"; //$NON-NLS-1$
-        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$
-        
-        helpFailUpdateProcedure(procedure, userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element symbol \"CHANGING.e1\" cannot be assigned a value.  Only declared VARIABLES can be assigned values."); //$NON-NLS-1$
-    }
-    
-    // variables cannot be used among insert elements
-    @Test public void testVariableInInsert() {
-        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 + "Insert into pm1.g1 (pm1.g1.e2, var1) values (1, 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
-
-        helpFailUpdateProcedure(procedure, userQuery, 
-                FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'var1': Element \"var1\" is not defined by any relevant group.]"); //$NON-NLS-1$
-    }
-    
-    // variables cannot be used among insert elements
-    @Test public void testVariableInInsert2() {
-        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 + "Insert into pm1.g1 (pm1.g1.e2, INPUT.x) values (1, 2);\n"; //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
-
-        helpFailUpdateProcedure(procedure, userQuery, 
-                FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'INPUT.x': Symbol INPUT.x is specified with an unknown group context]"); //$NON-NLS-1$
-    }
-    
-    //should resolve first to the table's column
-    @Test public void testVariableInInsert3() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "DECLARE integer e2;\n"; //$NON-NLS-1$
-        procedure = procedure + "Insert into pm1.g1 (e2) values (1);\n"; //$NON-NLS-1$
-        procedure = procedure + "ROWS_UPDATED =0;\n";         //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
-
-        helpResolveUpdateProcedure(procedure, userQuery, 
-                FakeMetadataObject.Props.UPDATE_PROCEDURE); 
-    }
-    
-    @Test public void testAmbigousInput() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
-        procedure = procedure + "select e1;\n"; //$NON-NLS-1$
-        procedure = procedure + "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(procedure, userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"e1\" is ambiguous, it exists in two or more groups."); //$NON-NLS-1$
-    }
-    
-    @Test public void testLoopRedefinition() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  declare string var1;") //$NON-NLS-1$
-        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
-        .append("\n  BEGIN") //$NON-NLS-1$
-        .append("\n    LOOP ON (SELECT pm1.g2.e1 FROM pm1.g2 WHERE loopCursor.e1 = pm1.g2.e1) AS loopCursor") //$NON-NLS-1$
-        .append("\n    BEGIN") //$NON-NLS-1$
-        .append("\n      var1 = CONCAT(var1, CONCAT(' ', loopCursor.e1));") //$NON-NLS-1$
-        .append("\n    END") //$NON-NLS-1$
-        .append("\n  END") //$NON-NLS-1$
-        .append("\n  END"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$
-    }
-    
-    @Test public void testLoopRedefinition2(){
-        helpResolveException("EXEC pm1.vsp11()", FakeMetadataFactory.example1Cached(), "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    @Test public void testTempGroupElementShouldNotBeResolable() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  select 1 as a into #temp;") //$NON-NLS-1$
-        .append("\n  select #temp.a from pm1.g1;") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
-    }
-    
-    @Test public void testTempGroupElementShouldNotBeResolable1() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  select 1 as a into #temp;") //$NON-NLS-1$
-        .append("\n  insert into #temp (a) values (#temp.a);") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(proc.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
-    }
-    
-    @Test public void testVariableResolutionWithIntervening() {
-        StringBuffer proc = new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  declare string x;") //$NON-NLS-1$
-        .append("\n  x = '1';") //$NON-NLS-1$
-        .append("\n  declare string y;") //$NON-NLS-1$
-        .append("\n  y = '1';") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        helpResolve(proc.toString()); 
-    }
-    
-    @Test public void testProcedureScoping() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        //note that this declare takes presedense over the proc INPUT.e1 and CHANGING.e1 variables
-        .append("\n  declare integer e1 = 1;") //$NON-NLS-1$
-        .append("\n  e1 = e1;") //$NON-NLS-1$
-        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
-        .append("\n  BEGIN") //$NON-NLS-1$
-        //inside the scope of the loop, an unqualified e1 should resolve to the loop variable group
-        .append("\n    variables.e1 = convert(e1, integer);") //$NON-NLS-1$
-        .append("\n  END") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        Update command = (Update)helpResolveUpdateProcedure(proc.toString(), userUpdateStr,
-                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
-        
-        Block block = ((CreateUpdateProcedureCommand)command.getSubCommand()).getBlock();
-        
-        AssignmentStatement assStmt = (AssignmentStatement)block.getStatements().get(1);
-        assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getCanonicalName());
-        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getValue()).getGroupSymbol().getCanonicalName());
-        
-        Block inner = ((LoopStatement)block.getStatements().get(2)).getBlock();
-        
-        assStmt = (AssignmentStatement)inner.getStatements().get(0);
-        
-        ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getValue(), false).iterator().next();
-        
-        assertEquals("LOOPCURSOR", value.getGroupSymbol().getCanonicalName()); //$NON-NLS-1$
-    }
-    
     @Test public void testResolveUnqualifiedCriteria() throws Exception{
         Criteria criteria = QueryParser.getQueryParser().parseCriteria("e1 = 1"); //$NON-NLS-1$
            
@@ -4136,64 +2577,9 @@
         param.setType(DataTypeManager.DefaultDataClasses.STRING);
         procPrarms.add(param);
         externalMetadata.put(proc, procPrarms);
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
     }
-    
-    @Test public void testProcedureCreate() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
-        .append("\n  select e1 from t1;") //$NON-NLS-1$
-        .append("\n  create local temporary table t1 (e1 string, e2 integer);") //$NON-NLS-1$
-        .append("\n  select e2 from t1;") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
         
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
-    }
-    
-    /**
-     * it is not ok to redefine the loopCursor 
-     */
-    @Test public void testProcedureCreate1() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  LOOP ON (SELECT pm1.g1.e1 FROM pm1.g1) AS loopCursor") //$NON-NLS-1$
-        .append("\n  BEGIN") //$NON-NLS-1$
-        .append("\n  create local temporary table loopCursor (e1 string);") //$NON-NLS-1$
-        .append("\nEND") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Cannot create temporary table \"loopCursor\". A table with the same name already exists."); //$NON-NLS-1$
-    }
-    
-    @Test public void testProcedureCreateDrop() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n drop table t1;") //$NON-NLS-1$
-        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: t1"); //$NON-NLS-1$
-    }
-    
-    @Test public void testProcedureCreateDrop1() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  create local temporary table t1 (e1 string);") //$NON-NLS-1$
-        .append("\n  drop table t1;") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
-    }
-    
     @Test public void testBatchedUpdateResolver() throws Exception {
         String update1 = "update pm1.g1 set e1 =1"; //$NON-NLS-1$
         String update2 = "update pm2.g1 set e1 =1"; //$NON-NLS-1$
@@ -4259,31 +2645,7 @@
         
         helpResolveException(sql);
     }
-            
-    @Test public void testCreateAfterImplicitTempTable() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$NON-NLS-1$
-        .append("\n  select e1 into #temp from pm1.g1;") //$NON-NLS-1$
-        .append("\n  create local temporary table #temp (e1 string);") //$NON-NLS-1$
-        .append("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
-    }
-    
-    @Test public void testInsertAfterCreate() {
-        StringBuffer proc = new StringBuffer("CREATE PROCEDURE") //$NON-NLS-1$
-        .append("\nBEGIN") //$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("\nEND"); //$NON-NLS-1$
-        
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-        helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE); 
-    }
-    
+                
     @Test public void testUpdateError() {
         String userUpdateStr = "UPDATE vm1.g2 SET e1='x'"; //$NON-NLS-1$
         
@@ -4313,7 +2675,7 @@
     }
     
     @Test public void testXMLJoinFail() {
-        String query = "select * from xmltest.doc1, xmltest.doc1"; //$NON-NLS-1$
+        String query = "select * from xmltest.doc1, xmltest.doc2"; //$NON-NLS-1$
          
         helpResolveException(query, "Error Code:ERR.015.008.0003 Message:Only one XML document may be specified in the FROM clause of a query."); //$NON-NLS-1$
     }
@@ -4497,57 +2859,7 @@
 		
 		TestResolver.helpResolveException(sql, FakeMetadataFactory.exampleBQTCached(), "Error Code:ERR.015.008.0007 Message:Incorrect number of parameters specified on the stored procedure pm4.spTest9 - expected 1 but got 2"); //$NON-NLS-1$
 	}	
-	
-	/**
-	 * delete procedures should not reference input or changing vars.
-	 */
-	@Test public void testDefect16451() {
-		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure += "BEGIN\n"; //$NON-NLS-1$
-        procedure += "Select pm1.g1.e2 from pm1.g1 where e1 = input.e1;\n"; //$NON-NLS-1$
-        procedure += "ROWS_UPDATED = 0;"; //$NON-NLS-1$
-        procedure += "END\n"; //$NON-NLS-1$
-        
-        String userUpdateStr = "delete from vm1.g1 where e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-									 FakeMetadataObject.Props.DELETE_PROCEDURE, "Symbol input.e1 is specified with an unknown group context"); //$NON-NLS-1$
-	}
-	
-    @Test public void testInvalidVirtualProcedure3() throws Exception {
-    	helpResolveException("EXEC pm1.vsp18()", "Group does not exist: temptable"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    // variable resolution, variable comapred against
-    // differrent datatype element for which there is no implicit transformation)
-    @Test public void testCreateUpdateProcedure2() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure += "BEGIN\n"; //$NON-NLS-1$
-        procedure += "DECLARE boolean var1;\n"; //$NON-NLS-1$
-        procedure += "ROWS_UPDATED = UPDATE pm1.g1 SET pm1.g1.e4 = convert(var1, string), pm1.g1.e1 = var1;\n"; //$NON-NLS-1$
-        procedure += "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-				 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e4' with expected type double to expression 'convert(var1, string)'"); //$NON-NLS-1$
-    }
-    
-    // special variable INPUT compared against invalid type
-    @Test public void testInvalidInputInUpdate() {
-        String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
-        procedure += "BEGIN\n"; //$NON-NLS-1$
-        procedure += "DECLARE integer var1;\n"; //$NON-NLS-1$
-        procedure += "Select pm1.g1.e2, Input.e2 from pm1.g1;\n"; //$NON-NLS-1$
-        procedure += "ROWS_UPDATED = UPDATE pm1.g1 SET pm1.g1.e1 = INPUT.e1, pm1.g1.e2 = INPUT.e1;\n"; //$NON-NLS-1$
-        procedure += "END\n"; //$NON-NLS-1$
-
-        String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
-        
-		helpFailUpdateProcedure(procedure, userUpdateStr,
-				 FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e2' with expected type integer to expression 'INPUT.e1'"); //$NON-NLS-1$
-    }
-    
+	    
     @Test public void testUpdateSetClauseReferenceType() {
     	String sql = "UPDATE pm1.g1 SET pm1.g1.e1 = 1, pm1.g1.e2 = ?;"; //$NON-NLS-1$
     	

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -398,7 +398,7 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
         
-        QueryResolver.resolveCommand(command, externalMetadata, false, FakeMetadataFactory.example1Cached(), AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, FakeMetadataFactory.example1Cached(), AnalysisRecord.createNonRecordingRecord());
     
         // Verify results        
         Collection vars = TestResolver.getVariables(command);

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -58,7 +58,7 @@
         
         QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
         
-        return QueryRewriter.rewrite(command, null, FakeMetadataFactory.example1Cached(), null);
+        return QueryRewriter.rewrite(command, FakeMetadataFactory.example1Cached(), null);
     }
 
     private void helpCheckElements(OrderBy langObj,

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -52,13 +52,14 @@
 import com.metamatrix.query.sql.lang.CompoundCriteria;
 import com.metamatrix.query.sql.lang.Criteria;
 import com.metamatrix.query.sql.lang.MatchCriteria;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.Query;
 import com.metamatrix.query.sql.lang.QueryCommand;
 import com.metamatrix.query.sql.lang.SPParameter;
 import com.metamatrix.query.sql.lang.SetCriteria;
 import com.metamatrix.query.sql.lang.SetQuery;
 import com.metamatrix.query.sql.lang.StoredProcedure;
-import com.metamatrix.query.sql.lang.Update;
+import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
 import com.metamatrix.query.sql.symbol.Constant;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.ExpressionSymbol;
@@ -125,42 +126,24 @@
         return actual;
     }    
     
-	private String getReWrittenProcedure(String procedure, String userUpdateStr, String procedureType) {
+	private String getRewritenProcedure(String procedure, String userUpdateStr, String procedureType) throws QueryParserException, QueryResolverException, MetaMatrixComponentException, QueryValidatorException {
         QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
 
-        try {
-            Command userCommand = QueryParser.getQueryParser().parseCommand(userUpdateStr);       
-            QueryResolver.resolveCommand(userCommand, metadata);
-    		QueryRewriter.rewrite(userCommand, null, metadata, null);
-    		return userCommand.getSubCommands().get(0).toString();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
+        return getRewritenProcedure(userUpdateStr, metadata);
+	}
+
+	private String getRewritenProcedure(String userUpdateStr,
+			QueryMetadataInterface metadata) throws QueryParserException,
+			QueryResolverException, MetaMatrixComponentException,
+			QueryMetadataException, QueryValidatorException {
+		ProcedureContainer userCommand = (ProcedureContainer)QueryParser.getQueryParser().parseCommand(userUpdateStr); 
+        QueryResolver.resolveCommand(userCommand, metadata);
+        CreateUpdateProcedureCommand proc = (CreateUpdateProcedureCommand)QueryResolver.expandCommand(userCommand, metadata, null);
+		QueryRewriter.rewrite(userCommand, metadata, null);
+		Command result = QueryRewriter.rewrite(proc, metadata, null);
+		return result.toString();
 	}
 	
-	private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType) {
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
-
-        Command userCommand = null;       
-        try {
-            QueryParser parser = new QueryParser();
-            userCommand = parser.parseCommand(userUpdateStr);
-            QueryResolver.resolveCommand(userCommand, metadata);            
-        } catch(MetaMatrixException e) {
-            e.printStackTrace();
-			fail("Exception during parsing/resolution (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-
-		QueryValidatorException exception = null;
-        try {		
-			QueryRewriter.rewrite(userCommand, null, metadata, null);
-        } catch(QueryValidatorException e) {
-        	exception = e;
-        }
-
-		assertNotNull("Expected a QueryValidatorException but got none.", exception); //$NON-NLS-1$
-	}
-
     static Command helpTestRewriteCommand(String original, String expected) { 
         try {
             return helpTestRewriteCommand(original, expected, FakeMetadataFactory.example1Cached());
@@ -172,7 +155,7 @@
     static Command helpTestRewriteCommand(String original, String expected, QueryMetadataInterface metadata) throws MetaMatrixException { 
         Command command = QueryParser.getQueryParser().parseCommand(original);            
         QueryResolver.resolveCommand(command, metadata);
-        Command rewriteCommand = QueryRewriter.rewrite(command, null, metadata, null);
+        Command rewriteCommand = QueryRewriter.rewrite(command, metadata, null);
         assertEquals("Rewritten command was not expected", expected, rewriteCommand.toString()); //$NON-NLS-1$
         return rewriteCommand;
     }
@@ -823,7 +806,7 @@
     }
     
     // HAS Criteria
-    @Test public void testRewriteProcedure1() {
+    @Test public void testRewriteProcedure1() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -839,14 +822,14 @@
 		rewritProc = rewritProc + "BEGIN\n";		 //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 				
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
     // HAS Criteria
-    @Test public void testRewriteProcedure2() {
+    @Test public void testRewriteProcedure2() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -867,14 +850,14 @@
 		rewritProc = rewritProc + "SELECT vm1.g1.e1 FROM vm1.g1 WHERE "+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 				
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
     // HAS Criteria
-    @Test public void testRewriteProcedure3() {
+    @Test public void testRewriteProcedure3() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -895,13 +878,13 @@
 		rewritProc = rewritProc + "SELECT vm1.g1.e1 FROM vm1.g1 WHERE "+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 				
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
-    @Test public void testRewriteProcedure4() {
+    @Test public void testRewriteProcedure4() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -918,14 +901,14 @@
 		rewritProc = rewritProc + "SELECT vm1.g1.e1 FROM vm1.g1 WHERE "+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 				
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }    
     
     // CHANGING
-    @Test public void testRewriteProcedure5() {
+    @Test public void testRewriteProcedure5() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -941,14 +924,14 @@
 		rewritProc = rewritProc + "BEGIN\n";		 //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
     // CHANGING
-    @Test public void testRewriteProcedure6() {
+    @Test public void testRewriteProcedure6() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -963,14 +946,14 @@
 		rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }     
     
     // TRANSLATE CRITERIA
-    @Test public void testRewriteProcedure7() {
+    @Test public void testRewriteProcedure7() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -987,14 +970,14 @@
 		rewritProc = rewritProc + "SELECT e2 FROM pm1.g1 WHERE pm1.g1.e2 = 10;\n";				 //$NON-NLS-1$
 		rewritProc = rewritProc + "END";		 //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
     // TRANSLATE CRITERIA
-    @Test public void testRewriteProcedure8() {
+    @Test public void testRewriteProcedure8() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -1011,14 +994,14 @@
 		rewritProc = rewritProc + "SELECT e2 FROM pm1.g1 WHERE convert(sqrt(pm1.g1.e2), integer) = 10;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
     // rewrite input/ changing variables
-    @Test public void testRewriteProcedure9() {
+    @Test public void testRewriteProcedure9() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "Declare String var1;\n"; //$NON-NLS-1$
@@ -1039,14 +1022,14 @@
 		rewritProc = rewritProc + "END\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    @Test public void testRewriteProcedure10() {
+    @Test public void testRewriteProcedure10() 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$
@@ -1061,14 +1044,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1, pm1.g2 WHERE (pm1.g1.e2 + 20) = ((pm1.g1.e2 + 20) + 50);\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
 	// virtual group elements used in procedure in if statement(HAS CRITERIA)
-    @Test public void testRewriteProcedure11() {
+    @Test public void testRewriteProcedure11() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
@@ -1083,7 +1066,7 @@
 		rewritProc = rewritProc + "var1 = '40';\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1091,7 +1074,7 @@
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// with complex query transform
-    @Test public void testRewriteProcedure12() {
+    @Test public void testRewriteProcedure12() 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$
@@ -1106,7 +1089,7 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE CONCAT(e1, 'z') = CONCAT(CONCAT(e1, 'z'), 'y');\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1114,7 +1097,7 @@
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// with complex query transform
-    @Test public void testRewriteProcedure13() {
+    @Test public void testRewriteProcedure13() 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$
@@ -1129,14 +1112,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE (CONCAT(e1, 'z') = CONCAT(CONCAT(e1, 'z'), 'y')) AND (convert(CONCAT(e1, 'k'), integer) = 1);\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    @Test public void testRewriteProcedure14() {
+    @Test public void testRewriteProcedure14() 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$
@@ -1151,14 +1134,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE sqrt(e4) = 1.0;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    @Test public void testRewriteProcedure15() {
+    @Test public void testRewriteProcedure15() 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$
@@ -1173,14 +1156,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE e2 = 0;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    @Test public void testRewriteProcedure16() {
+    @Test public void testRewriteProcedure16() 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$
@@ -1195,14 +1178,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE e4 = 0.02;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    @Test public void testRewriteProcedure17() {
+    @Test public void testRewriteProcedure17() 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$
@@ -1217,14 +1200,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE "+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// Bug 8212 elements in INPUT and CHANGING special groups are cese sensitive
-    @Test public void testRewriteProcedure18() {
+    @Test public void testRewriteProcedure18() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "Select Input.E1, Input.e2, CHANGING.e2, CHANGING.E1 from pm1.g1;\n"; //$NON-NLS-1$
@@ -1237,7 +1220,7 @@
 		rewritProc = rewritProc + "SELECT 'x', 1, TRUE, TRUE FROM pm1.g1;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1245,7 +1228,7 @@
 	
 	// elements being set in updates are dropped if INPUT var is not available, unless a default is available
     // Note that this test is a little odd in that it is an update inside of an insert
-    @Test public void testRewriteProcedure19() {
+    @Test public void testRewriteProcedure19() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e1=Input.E1, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1258,7 +1241,7 @@
         rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = 'xyz', e2 = 1, e3 = TRUE;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1267,7 +1250,7 @@
 	// elements being set in updates are dropped if INPUT var is not available, unless a default is supplied
     
     //this test fails because the default for E1 'xyz' cannot be converted into a integer
-    @Test public void testRewriteProcedure21() {
+    @Test(expected=QueryValidatorException.class) public void testRewriteProcedure21() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1280,10 +1263,10 @@
         rewritProc = rewritProc + "UPDATE pm1.g1 SET e3 = TRUE;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		this.helpFailUpdateProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
+		this.getRewritenProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
 	}
     
-    @Test public void testRewriteProcedure21a() {
+    @Test public void testRewriteProcedure21a() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1296,15 +1279,14 @@
         rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = null, e2 = null, e3 = TRUE;\n"; //$NON-NLS-1$
         rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-        String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+        String procReturned = this.getRewritenProcedure(procedure, userQuery, 
                                                         FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
 
-	
 	// none of input variables on update statement changing
-    @Test public void testRewriteProcedure22() {
+    @Test public void testRewriteProcedure22() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2;\n"; //$NON-NLS-1$
@@ -1316,14 +1298,14 @@
 		rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// none of input variables on update statement changing
-    @Test public void testRewriteProcedure23() {
+    @Test public void testRewriteProcedure23() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1335,14 +1317,14 @@
 		rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
     
     //with an insert, defaults are used
-    @Test public void testRewriteProcedure23a() {
+    @Test public void testRewriteProcedure23a() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "update pm1.g1 set e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1355,14 +1337,14 @@
         rewritProc = rewritProc + "UPDATE pm1.g1 SET e2 = null, e3 = TRUE;\n"; //$NON-NLS-1$
         rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-        String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+        String procReturned = this.getRewritenProcedure(procedure, userQuery, 
                 FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
     
 	// elements being set in updates are dropped if INPUT var is not available
-    @Test public void testRewriteProcedure24() {
+    @Test public void testRewriteProcedure24() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "UPDATE pm1.g1 SET e2=Input.e2 WHERE TRANSLATE LIKE CRITERIA ON (e1) WITH (e1=concat(pm1.g1.e1, '%'));\n"; //$NON-NLS-1$
@@ -1375,14 +1357,14 @@
         rewritProc = rewritProc + "UPDATE pm1.g1 SET e2 = 1 WHERE concat(pm1.g1.e1, '%') LIKE 'mnopxyz_';\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 
 	// INPUT vars in insert statements replaced by default variable when user's inser ignores values
-    @Test public void testRewriteProcedure25() {
+    @Test public void testRewriteProcedure25() throws Exception {
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "INSERT into pm1.g1 (e1,e2,e3,e4) values (Input.e1, Input.e2, Input.e3, Input.e4);"; //$NON-NLS-1$
@@ -1395,14 +1377,14 @@
         rewritProc = rewritProc + "INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES ('xyz', 1, TRUE, 123.456);\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.INSERT_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-	@Test public void testRewriteProcedure26() {
+	@Test public void testRewriteProcedure26() 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$
@@ -1417,14 +1399,14 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e2 = (pm1.g1.e2 + 50);\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
 		assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-	@Test public void testRewriteProcedure27() {
+	@Test public void testRewriteProcedure27() 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$
@@ -1439,7 +1421,7 @@
 		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1, pm1.g2 WHERE "+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
 		assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1455,7 +1437,7 @@
      * descriptor couldn't be found for the "minus" operation for the two types 
      * integer and MetaMatrix's null type.
      */
-    @Test public void testRewriteProcedure_9380() {
+    @Test public void testRewriteProcedure_9380() throws Exception {
         
         String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1475,7 +1457,7 @@
         rewritProc = rewritProc + "DECLARE integer var2;\n"; //$NON-NLS-1$
         rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
-        String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+        String procReturned = this.getRewritenProcedure(procedure, userQuery, 
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1513,7 +1495,7 @@
         QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
         
         // rewrite
-        Command rewriteCommand = QueryRewriter.rewrite(command, null, null, null);
+        Command rewriteCommand = QueryRewriter.rewrite(command, null, null);
         
         List<SPParameter> parameters = ((StoredProcedure)rewriteCommand).getParameters();
 
@@ -1524,14 +1506,6 @@
         }  
     }
     
-    @Test public void testRewriteRecursive() {
-        Command c = helpTestRewriteCommand("SELECT e2 FROM vm1.g33", "SELECT e2 FROM vm1.g33"); //$NON-NLS-1$ //$NON-NLS-2$
-        Command innerCommand = c.getSubCommands().get(0);
-        
-        assertEquals("Inner command not rewritten", "SELECT e2 FROM pm1.g1 WHERE e2 = 2", innerCommand.toString()); //$NON-NLS-1$ //$NON-NLS-2$
-        
-    }
-    
     @Test public void testRewriteFunctionThrowsEvaluationError() {
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached(); 
         Criteria origCrit = parseCriteria("5 / 0 = 5", metadata); //$NON-NLS-1$
@@ -1559,7 +1533,7 @@
         }       
     }
     
-    @Test public void testDefect13458() {
+    @Test public void testDefect13458() throws Exception {
     	
 		String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";		 //$NON-NLS-1$
@@ -1576,7 +1550,7 @@
 		rewritProc = rewritProc + "SELECT vm1.g1.e1 FROM vm1.g1;\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 		
-		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+		String procReturned = this.getRewritenProcedure(procedure, userQuery, 
 				FakeMetadataObject.Props.DELETE_PROCEDURE);				
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
     }
@@ -1761,9 +1735,9 @@
         Properties props = new Properties();
         props.setProperty(ContextProperties.SESSION_ID, "1"); //$NON-NLS-1$
         context.setEnvironmentProperties(props);
-        Command rewriteCommand = QueryRewriter.rewrite(command, null, null, context);
+        Command rewriteCommand = QueryRewriter.rewrite(command, null, context);
         
-        assertEquals("SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'", rewriteCommand.toString()); //$NON-NLS-1$
+        assertEquals("EXEC pm1.sq2('1')", rewriteCommand.toString()); //$NON-NLS-1$
     }
 
     @Ignore(value="It's not generally possible to invert a narrowing conversion")
@@ -1796,22 +1770,15 @@
         
         String userQuery = "Insert into vm1.g1 (e1, e2) values ('String', 1)"; //$NON-NLS-1$
 
-        QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.INSERT_PROCEDURE, procedure);
-        
-        QueryParser parser = new QueryParser();
-        Command userCommand = parser.parseCommand(userQuery);
-        QueryResolver.resolveCommand(userCommand, metadata);
-        
         try {       
-            QueryRewriter.rewrite(userCommand, null, metadata, null);
+            getRewritenProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
             fail("exception expected"); //$NON-NLS-1$
         } catch (QueryValidatorException e) {
             assertEquals("Infinite loop detected, procedure will not be executed.", e.getMessage()); //$NON-NLS-1$
         }
-                
     }
     
-    @Test public void testRewriteWhile1() {
+    @Test public void testRewriteWhile1() throws Exception {
         
         String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n";       //$NON-NLS-1$
@@ -1827,7 +1794,7 @@
         rewritProc = rewritProc + "BEGIN\n";         //$NON-NLS-1$
         rewritProc = rewritProc + "END"; //$NON-NLS-1$
         
-        String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+        String procReturned = this.getRewritenProcedure(procedure, userQuery, 
                 FakeMetadataObject.Props.INSERT_PROCEDURE);
                 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1836,7 +1803,7 @@
     /**
      * Tests that VariableSubstitutionVisitor does not cause an NPE on count(*)
      */
-    @Test public void testRewriteProcedureWithCount() {
+    @Test public void testRewriteProcedureWithCount() throws Exception {
         
         String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
@@ -1850,7 +1817,7 @@
         rewritProc = rewritProc + "SELECT COUNT(*) FROM pm1.g1;\n";         //$NON-NLS-1$
         rewritProc = rewritProc + "END"; //$NON-NLS-1$
         
-        String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
+        String procReturned = this.getRewritenProcedure(procedure, userQuery, 
                 FakeMetadataObject.Props.INSERT_PROCEDURE);
                 
         assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
@@ -1878,12 +1845,12 @@
         String userUpdateStr = "UPDATE vm1.g1 SET e1 = 'x' WHERE e2 = 5"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+        
+        String rewriten = getRewritenProcedure(userUpdateStr, metadata);
         
-        Update command = (Update)helpTestRewriteCommand(userUpdateStr, userUpdateStr, metadata);
-                     
         String expected = "CREATE PROCEDURE\nBEGIN\nDECLARE string var1 = 'x';\nROWS_UPDATED = UPDATE vm1.g2 SET e1 = var1;\nEND"; //$NON-NLS-1$
         
-        assertEquals(expected, command.getSubCommand().toString());
+        assertEquals(expected, rewriten);
     }
     
     @Test public void testRemoveEmptyLoop() {
@@ -1989,7 +1956,7 @@
         SetQuery union = (SetQuery)QueryParser.getQueryParser().parseCommand(unionQuery);
         QueryResolver.resolveCommand(union, FakeMetadataFactory.example1Cached());
         
-        union = (SetQuery)QueryRewriter.rewrite(union, null, FakeMetadataFactory.example1Cached(), null);
+        union = (SetQuery)QueryRewriter.rewrite(union, FakeMetadataFactory.example1Cached(), null);
         
         for (QueryCommand query : union.getQueryCommands()) {
             List<SingleElementSymbol> projSymbols = query.getProjectedSymbols();
@@ -2083,16 +2050,6 @@
     }
     
     /**
-     * Should fail since null is not allowed as an input
-     * @throws Exception
-     */
-    @Test(expected=QueryValidatorException.class) public void testProcWithNull() throws Exception {
-        String sql = "exec pm1.vsp26(1, null)"; //$NON-NLS-1$
-        
-    	helpTestRewriteCommand(sql, "", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
-    }
-
-    /**
      * Test <code>QueryRewriter</code>'s ability to rewrite a query that 
      * contains an aggregate function which uses a <code>CASE</code> 
      * expression which contains <code>BETWEEN</code> criteria as its value.

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestBlock.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestBlock.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestBlock.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -60,13 +60,13 @@
 	
 	public void testGetStatements1() {
 		Block b1 = sample1();
-		List stmts = b1.getStatements();
+		List<Statement> stmts = b1.getStatements();
         assertTrue("Incorrect number of statements in the Block", (stmts.size() == 4)); //$NON-NLS-1$
 	}
 	
 	public void testGetStatements2() {
 		Block b1 = sample1();
-		Statement stmt = (Statement) b1.getStatements().get(1);
+		Statement stmt = b1.getStatements().get(1);
         assertTrue("Incorrect statement in the Block", stmt.equals(TestCommandStatement.sample1())); //$NON-NLS-1$
 	}
 	
@@ -79,7 +79,7 @@
 	public void testaddStatement2() {
 		Block b1 = (Block) sample2().clone();
 		b1.addStatement(TestCommandStatement.sample2());
-		Statement stmt = (Statement) b1.getStatements().get(4);
+		Statement stmt = b1.getStatements().get(4);
         assertTrue("Incorrect statement in the Block", stmt.equals(TestCommandStatement.sample2())); //$NON-NLS-1$
 	}
 
@@ -102,5 +102,12 @@
 		int equals = -1;
 		UnitTestUtil.helpTestEquivalence(equals, b1, b2);
 	}
+	
+	public void testClone() {
+		Block b1 = sample1();
+		Block b2 = (Block)b1.clone();
+		UnitTestUtil.helpTestEquivalence(0, b1, b2);
+		assertNotSame(b1.getStatements().get(0), b2.getStatements().get(0));
+	}
 
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestCreateUpdateProcedureCommand.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestCreateUpdateProcedureCommand.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/sql/proc/TestCreateUpdateProcedureCommand.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -182,9 +182,6 @@
         field = clazz.getDeclaredField("projectedSymbols"); //$NON-NLS-1$
         field.setAccessible( true );
         assertNotNull(field.get(cloned));
-        field = clazz.getDeclaredField("resultsCommand"); //$NON-NLS-1$
-        field.setAccessible( true );
-        assertNotNull(field.get(cloned));
     }
     
     /**

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/sql/util/TestElementSymbolOptimizer.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/sql/util/TestElementSymbolOptimizer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/sql/util/TestElementSymbolOptimizer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -55,7 +55,7 @@
         Command command = QueryParser.getQueryParser().parseCommand(sql);
 
         final boolean USE_METADATA_COMMANDS = true;
-        QueryResolver.resolveCommand(command, externalMetadata, USE_METADATA_COMMANDS, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
         
         return command;      
     }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -288,7 +288,7 @@
 		QueryNode vm1g1n1 = new QueryNode("vm1.g1", "SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
 		FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
 
-		QueryNode vm2g1n1 = new QueryNode("vm2.g1", "SELECT * FROM pm1.g1, pm1.g2 where pm1.g1.e2 = pm1.g2.e2"); //$NON-NLS-1$ //$NON-NLS-2$
+		QueryNode vm2g1n1 = new QueryNode("vm2.g1", "SELECT pm1.g1.* FROM pm1.g1, pm1.g2 where pm1.g1.e2 = pm1.g2.e2"); //$NON-NLS-1$ //$NON-NLS-2$
 		FakeMetadataObject vm2g1 = FakeMetadataFactory.createUpdatableVirtualGroup("vm2.g1", vm2, vm2g1n1); //$NON-NLS-1$		
 		
         QueryNode vm1g1n1_defect10711 = new QueryNode("vm1.g1a", "SELECT * FROM vm1.g1 as X"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -456,8 +456,8 @@
             new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
         List vm1g11e = createElements(vm1g11,
-            new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+            new String[] { "e1", "e2", "e3", "e4", "e5", "e6"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
         List vm1g12e = createElements(vm1g12,
             new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
@@ -531,8 +531,8 @@
              new String[] { "ve1", "ve2" }, //$NON-NLS-1$ //$NON-NLS-2$
              new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
         List vm1g37e = createElements(vm1g37,
-              new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-              new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
+              new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+              new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
         List vm1g38e = createElements(vm1g38,
               new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
               new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
@@ -938,8 +938,10 @@
         QueryNode vspqn41 = new QueryNode("vsp41", "CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 where e2=15; END"); //$NON-NLS-1$ //$NON-NLS-2$
         FakeMetadataObject vsp41 = createVirtualProcedure("pm1.vsp41", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn41); //$NON-NLS-1$
 
-        vm1g1.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm1.g1(e2) values(INPUT.e2); END"); //$NON-NLS-1$
-        vm1g1.putProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = UPDATE pm1.g1 SET e2 = INPUT.e2; END"); //$NON-NLS-1$       
+        vm1g1.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm1.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
+        vm1g1.putProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = UPDATE pm1.g1 SET e1 = INPUT.e1, e2 = INPUT.e2, e3 = INPUT.e3, e4=INPUT.e4 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$       
+        vm1g1.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm1.g1 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$       
+
         vm1g37.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm4.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
         vm1g37.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm4.g1 where translate criteria; END"); //$NON-NLS-1$
         QueryNode vspqn37 = new QueryNode("vsp37", "CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; VARIABLES.x=5; INSERT INTO vm1.g1(e2) values(VARIABLES.x); END"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1059,7 +1061,7 @@
         FakeMetadataObject vgvp6e4 = FakeMetadataFactory.createElement("vm1.vgvp6.ve4", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER, 3); //$NON-NLS-1$
 
         //virtual group with two elements. One selectable, one not.
-        QueryNode vm1g35n1 = new QueryNode("vm1.g35", "SELECT e2 FROM pm1.g1");         //$NON-NLS-1$ //$NON-NLS-2$
+        QueryNode vm1g35n1 = new QueryNode("vm1.g35", "SELECT e1, e2 FROM pm1.g1");         //$NON-NLS-1$ //$NON-NLS-2$
 		FakeMetadataObject vm1g35 = createVirtualGroup("vm1.g35", vm1, vm1g35n1); //$NON-NLS-1$
         FakeMetadataObject vm1g35e1 = FakeMetadataFactory.createElement("vm1.g35.e1", vm1g35, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
         vm1g35e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
@@ -2058,7 +2060,7 @@
         QueryNode vm1g1n1 = new QueryNode("vm1.g1", "SELECT * FROM vm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
         FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
 
-        QueryNode vm1g2n1 = new QueryNode("vm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+        QueryNode vm1g2n1 = new QueryNode("vm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
         FakeMetadataObject vm1g2 = createUpdatableVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
 
         // Create virtual elements
@@ -2067,9 +2069,9 @@
             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
             new Object[] { "xyz", Integer.getInteger("123"), Boolean.valueOf("true"), Double.valueOf("123.456")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         List vm1g2e = createElementsWithDefaults(vm1g2, 
-            new String[] { "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN },
-            new Object[] { "abc", Integer.getInteger("456"), Boolean.valueOf("false")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
+            new Object[] { "abc", Integer.getInteger("456"), Boolean.valueOf("false"), null}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         vm1g1.putProperty(procedureType, procedure1);
         vm1g2.putProperty(procedureType, procedure2);
@@ -3370,12 +3372,22 @@
                                       new String[] { "e1" }, //$NON-NLS-1$
                                       new String[] { DataTypeManager.DefaultDataTypes.STRING});
         
+        FakeMetadataObject physGroup1 = createPhysicalGroup("MatTable.MatTable1", physModel); //$NON-NLS-1$
+        List physElements1 = createElements(physGroup,
+                                      new String[] { "e1" }, //$NON-NLS-1$
+                                      new String[] { DataTypeManager.DefaultDataTypes.STRING});
+        
+        FakeMetadataObject physGroupStage1 = createPhysicalGroup("MatTable.MatStage1", physModel); //$NON-NLS-1$
+        List physStageElements1 = createElements(physGroupStage,
+                                      new String[] { "e1" }, //$NON-NLS-1$
+                                      new String[] { DataTypeManager.DefaultDataTypes.STRING});
+        
         FakeMetadataObject physGroup_virtSrc = createPhysicalGroup("MatSrc.MatSrc", physModel_virtSrc); //$NON-NLS-1$
         List physElements_virtSrc = createElements(physGroup_virtSrc,
                                       new String[] { "X" }, //$NON-NLS-1$
                                       new String[] { DataTypeManager.DefaultDataTypes.STRING});
         
-        QueryNode virtTrans = new QueryNode("MatView.MatView", "SELECT x FROM MatSrc.MatSrc");         //$NON-NLS-1$ //$NON-NLS-2$
+        QueryNode virtTrans = new QueryNode("MatView.MatView", "SELECT x as e1 FROM MatSrc.MatSrc");         //$NON-NLS-1$ //$NON-NLS-2$
         FakeMetadataObject virtGroup = createVirtualGroup("MatView.MatView", virtModel, virtTrans); //$NON-NLS-1$
         List virtElements = createElements(virtGroup,
                                       new String[] { "e1" }, //$NON-NLS-1$
@@ -3391,6 +3403,15 @@
                                       new String[] { "e1" }, //$NON-NLS-1$
                                       new String[] { DataTypeManager.DefaultDataTypes.STRING});
         
+        QueryNode virtTrans1 = new QueryNode("MatView.MatView1", "SELECT e1 FROM MatView.MatView where e1 = 1");         //$NON-NLS-1$ //$NON-NLS-2$
+        FakeMetadataObject virtGroup1 = createVirtualGroup("MatView.MatView1", virtModel, virtTrans1); //$NON-NLS-1$
+        List virtElements1 = createElements(virtGroup1,
+                                      new String[] { "e1" }, //$NON-NLS-1$
+                                      new String[] { DataTypeManager.DefaultDataTypes.STRING});
+        
+        virtGroup1.putProperty(FakeMetadataObject.Props.MAT_GROUP, physGroup1);
+        virtGroup1.putProperty(FakeMetadataObject.Props.MAT_STAGE, physGroupStage1);
+
         FakeMetadataStore store = new FakeMetadataStore();
         store.addObject(virtModel);
         store.addObject(physModel);
@@ -3399,13 +3420,18 @@
         store.addObjects(physElements);
         store.addObject(physGroupStage);
         store.addObjects(physStageElements);
+        store.addObject(physGroup1);
+        store.addObjects(physElements1);
+        store.addObject(physGroupStage1);
+        store.addObjects(physStageElements1);
         store.addObject(physGroup_virtSrc);
         store.addObjects(physElements_virtSrc);
         store.addObject(virtGroup);
         store.addObjects(virtElements);
         store.addObject(vGroup);
         store.addObjects(vElements);
-        
+        store.addObject(virtGroup1);
+        store.addObjects(virtElements1);
         return new FakeMetadataFacade(store);
     }
     

Deleted: branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/QueryMetadataInterfaceBuilder.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/QueryMetadataInterfaceBuilder.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/QueryMetadataInterfaceBuilder.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,270 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.unittest;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
-
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.message.ParameterInfo;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-
-public class QueryMetadataInterfaceBuilder {
-
-    private FakeMetadataObject physicalModel;
-    private FakeMetadataObject group;
-    private FakeMetadataObject procedure;
-    private FakeMetadataObject resultSet;
-
-    private List elementNames;
-    private List elementTypes;
-    private List inParamNames;
-    private List inParamTypes;
-    private List resultElementNames;
-    private List resultElementTypes;
-    private String resultSetName;
-
-    private FakeMetadataStore store = new FakeMetadataStore();
-    private boolean storePopulated = false;
-
-    public QueryMetadataInterfaceBuilder() {
-        initElements();
-    }
-    
-    public void addPhysicalModel(String name) {
-        physicalModel = createPhysicalModel(name);
-    }
-
-    public void addGroup(String name) {
-        addGroup(name, name);
-    }
-
-    public void addProcedure(String name) {
-        addProcedure(name, name);
-    }
-
-    public void addGroup(String name, String nameInSource) {
-        if (group != null) {
-            addGroup();
-        }
-        group = createPhysicalGroup(name, nameInSource, physicalModel);
-    }
-
-    public void addProcedure(String name, String nameInSource) {
-        procedure = createPhysicalProcedure(name, nameInSource, physicalModel);
-        addProcedure();
-    }
-
-    private void addGroup(){
-        store.addObject(group);
-        store.addObjects(getElements());
-        initElements();
-    }
-    
-    private void addProcedure(){
-        store.addObject(procedure);
-        if(this.resultSet != null) {
-            store.addObject(this.resultSet);
-        }
-    }
-
-    private void initElements() {
-        elementNames = new ArrayList();
-        elementTypes = new ArrayList();
-    }
-
-    private void initInputParameters() {
-        if(this.inParamNames == null || this.inParamTypes == null) {        
-            inParamNames = new ArrayList();
-            inParamTypes = new ArrayList();
-        }
-    }
-
-    private void initResultSetColumns() {
-        if(this.resultElementNames == null) {
-            resultElementNames = new ArrayList();
-        }
-
-        if(this.resultElementTypes == null) {            
-            resultElementTypes = new ArrayList();
-        }
-    }    
-
-    public void addElement(String name, Class dataType) {
-        elementNames.add(name);
-        elementTypes.add(DataTypeManager.getDataTypeName(dataType));
-    }
-    
-    public void addInputParameter(String name, Class dataType) {
-        initInputParameters();
-        inParamNames.add(name);
-        inParamTypes.add(DataTypeManager.getDataTypeName(dataType));
-    }
-    
-    public void addResultSet(String resultSetName, String[] names, Class[] dataTypes) {
-        initResultSetColumns();
-        for(int i=0; i < names.length; i++) {
-	        resultElementNames.add(names[i]);
-	        resultElementTypes.add(DataTypeManager.getDataTypeName(dataTypes[i]));
-        }
-        this.resultSetName = resultSetName;
-    }
-
-    private List getElements(){
-        return createElements(group, (String[]) elementNames.toArray(new String[0]),
-            (String[]) elementTypes.toArray(new String[0]));
-    }
-
-    private List getParameters() {
-        List inParameters = createInParameters(this.inParamNames, this.inParamTypes);
-        if ( (resultElementNames == null || resultElementNames.size() ==0) || (resultElementTypes == null || resultElementTypes.size() == 0)) {
-            return inParameters;
-        }
-        this.resultSet = createResultSetParameter(this.physicalModel, resultSetName, (String[]) resultElementNames.toArray(new String[resultElementNames.size()]),
-                                                  (String[]) resultElementTypes.toArray(new String[resultElementTypes.size()]));
-        inParameters.add(this.resultSet);
-        return inParameters;
-    }
-
-    private void populateStoreIfNeeded(){
-        if (!storePopulated) {
-            if(this.group != null) {
-	            store.addObject(physicalModel);
-	            addGroup();
-            } else if(this.procedure != null) {
-	            store.addObject(physicalModel);
-	            addProcedure();                
-            }
-            storePopulated = true;
-        }
-    }
-    
-    public QueryMetadataInterface getQueryMetadata() {
-        populateStoreIfNeeded();
-        return new FakeMetadataFacade(store);
-    }
-    
-    public RuntimeMetadata getRuntimeMetadata(){
-        return new RuntimeMetadataImpl(getQueryMetadata());
-    }
-    
-    private FakeMetadataObject createPhysicalModel(String name) {
-        return FakeMetadataFactory.createPhysicalModel(name);
-    }
-
-    private static FakeMetadataObject createPhysicalGroup(String name, String nameInSource, FakeMetadataObject model) {
-        FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
-        obj.putProperty(FakeMetadataObject.Props.MODEL, model);
-        obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
-        obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE); 
-        obj.putProperty(FakeMetadataObject.Props.TEMP, Boolean.FALSE);
-        obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, nameInSource); 
-        return obj; 
-    }
-
-    private FakeMetadataObject createPhysicalProcedure(String name, String nameInSource, FakeMetadataObject model) {
-        FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.PROCEDURE);
-        obj.putProperty(FakeMetadataObject.Props.MODEL, model);
-        obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
-        obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, nameInSource);
-        obj.putProperty(FakeMetadataObject.Props.PARAMS, getParameters());
-        if(this.resultSet != null) {
-            obj.putProperty(FakeMetadataObject.Props.RESULT_SET, this.resultSet);
-        }
-        return obj; 
-    }
-
-    private List createElements(FakeMetadataObject group, String[] names, String[] types) {
-        return FakeMetadataFactory.createElements(group, names, types);
-    }
-
-    private List createInParameters(List names, List types) {
-        List params = new ArrayList();
-        if (names == null || types == null) {
-            return params;
-        }
-        final Iterator iter1 = names.iterator();
-        final Iterator iter2 = types.iterator();        
-        
-        int i=0;
-        while(iter1.hasNext() && iter2.hasNext()) {
-            String name = (String) iter1.next();
-            String className = (String) iter2.next();
-            params.add(FakeMetadataFactory.createParameter(name, i, ParameterInfo.IN, className, null));
-            i++;
-        }
-        return params;
-    }    
-
-    private FakeMetadataObject createResultSetParameter(FakeMetadataObject model, String name, String[] colNames, String[] colTypes) {
-        if (colNames == null || colTypes == null) {
-            return null;
-        }
-        FakeMetadataObject resultSet = FakeMetadataFactory.createResultSet(name, model, colNames, colTypes);
-        int s = (this.inParamNames == null ? 0 : this.inParamNames.size());
-        resultSet.putProperty(FakeMetadataObject.Props.INDEX, new Integer(s));
-        resultSet.putProperty(FakeMetadataObject.Props.DIRECTION, new Integer(ParameterInfo.RESULT_SET));
-        resultSet.putProperty(FakeMetadataObject.Props.RESULT_SET, resultSet);
-        return resultSet;
-    }
-
-    public void addMetadataForType(String tableName, String tableNameInSource, Class type, String tableDefiningMethodName) {
-        addPhysicalModel("model"); //$NON-NLS-1$
-        addGroup(tableName, tableNameInSource);
-        Method[] methods = type.getMethods();
-        for (int i = 0; i < methods.length; i++) {
-            if (methods[i].getParameterTypes().length == 0) {
-                Class returnType = methods[i].getReturnType();
-                if (returnType != null) {
-                    if (returnType.isPrimitive()) {
-                        if (returnType.equals(Integer.TYPE)) {
-                            returnType = Integer.class;
-                        }
-                    }
-                    String methodName = methods[i].getName();
-                    if (methodName.equals(tableDefiningMethodName)) {
-                        if (returnType.isArray()) {
-                            returnType = returnType.getComponentType();
-                        } else if (Collection.class.isAssignableFrom(returnType)) {
-                            returnType = String.class;
-                        }
-                    }
-                    if (DataTypeManager.getDataTypeName(returnType) == null) {
-                        if (methodName.equals(tableDefiningMethodName)) {
-                            throw new MetaMatrixRuntimeException("Data type not supported " + returnType.getName()); //$NON-NLS-1$
-                        }
-                    } else {
-                        addElement(methodName, returnType);
-                    }
-                }
-            }
-        }
-    }      
-}

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,6 +22,8 @@
 
 package com.metamatrix.query.validator;
 
+import static org.junit.Assert.*;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -33,7 +35,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
@@ -52,7 +54,9 @@
 import com.metamatrix.query.resolver.QueryResolver;
 import com.metamatrix.query.sql.LanguageObject;
 import com.metamatrix.query.sql.lang.Command;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
 import com.metamatrix.query.sql.lang.SPParameter;
+import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.GroupSymbol;
 import com.metamatrix.query.sql.visitor.SQLStringVisitor;
@@ -61,14 +65,8 @@
 import com.metamatrix.query.unittest.FakeMetadataObject;
 import com.metamatrix.query.unittest.FakeMetadataStore;
 
-public class TestValidator extends TestCase {
+public class TestValidator {
 
-	// ################################## FRAMEWORK ################################
-	
-	public TestValidator(String name) { 
-		super(name);
-	}	
-    
     public static Map getStoredProcedureExternalMetadata(GroupSymbol virtualProc, QueryMetadataInterface metadata)
     throws QueryMetadataException, MetaMatrixComponentException {
 
@@ -325,16 +323,9 @@
 	public static Command helpResolve(String sql, QueryMetadataInterface metadata, Map externalMetadata) { 
 		Command command = null;
 		
-		// parse
 		try { 
 			command = QueryParser.getQueryParser().parseCommand(sql);
-		} catch(Exception e) { 
-            throw new MetaMatrixRuntimeException(e);
-		}	
-		
-		// resolve
-		try { 
-			QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+			QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 		} catch(Exception e) {
             throw new MetaMatrixRuntimeException(e);
 		} 
@@ -406,10 +397,9 @@
 
         try {
         	
-	        Command command = helpResolve(userUpdateStr, metadata);
-        	
-            ValidatorReport report = Validator.validate(command, metadata); 
-            //System.out.println("\nReport = \n" + report);
+	        ProcedureContainer command = (ProcedureContainer)helpResolve(userUpdateStr, metadata);
+        	CreateUpdateProcedureCommand cmd = (CreateUpdateProcedureCommand)QueryResolver.expandCommand(command, metadata, null);
+            ValidatorReport report = Validator.validate(cmd, metadata); 
         
             // Get invalid objects from report
             Collection actualObjs = new ArrayList();
@@ -423,178 +413,178 @@
 	// ################################## ACTUAL TESTS ################################
 	
 	
-    public void testSelectStarWhereNoElementsAreNotSelectable() {
+    @Test public void testSelectStarWhereNoElementsAreNotSelectable() {
         helpValidate("SELECT * FROM pm1.g5", new String[] {"SELECT * FROM pm1.g5"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-	public void testValidateSelect1() {        
+	@Test public void testValidateSelect1() {        
         helpValidate("SELECT e1, e2 FROM test.group", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testValidateSelect2() {        
+	@Test public void testValidateSelect2() {        
         helpValidate("SELECT e2 FROM test.group", new String[] {}, exampleMetadata()); //$NON-NLS-1$
 	}
  
-	public void testValidateCompare1() {        
+	@Test public void testValidateCompare1() {        
         helpValidate("SELECT e2 FROM vTest.vMap WHERE e2 = 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
 	}
 
-    public void testValidateCompare4() {        
+    @Test public void testValidateCompare4() {        
         helpValidate("SELECT e3 FROM vTest.vMap WHERE e3 LIKE 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
-    public void testValidateCompare6() {        
+    @Test public void testValidateCompare6() {        
         helpValidate("SELECT e0 FROM vTest.vMap WHERE e0 BETWEEN 1000 AND 2000", new String[] {}, exampleMetadata()); //$NON-NLS-1$
     }
 
-	public void testValidateCompareInHaving2() {        
+	@Test public void testValidateCompareInHaving2() {        
         helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IS NULL", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
 	}
 
-	public void testValidateCompareInHaving3() {        
+	@Test public void testValidateCompareInHaving3() {        
         helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IN ('a')", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
 	}
 
-    public void testValidateCompareInHaving4() {        
+    @Test public void testValidateCompareInHaving4() {        
         helpValidate("SELECT e3 FROM vTest.vMap GROUP BY e3 HAVING e3 LIKE 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
-    public void testValidateCompareInHaving5() {        
+    @Test public void testValidateCompareInHaving5() {        
         helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 BETWEEN 1000 AND 2000", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
-	public void testInvalidAggregate1() {        
+	@Test public void testInvalidAggregate1() {        
         helpValidate("SELECT SUM(e3) FROM test.group GROUP BY e2", new String[] {"SUM(e3)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testInvalidAggregate2() {        
+	@Test public void testInvalidAggregate2() {        
         helpValidate("SELECT e3 FROM test.group GROUP BY e2", new String[] {"e3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testInvalidAggregate3() {        
+	@Test public void testInvalidAggregate3() {        
         helpValidate("SELECT SUM(e2) FROM test.group GROUP BY e2", new String[] {"SUM(e2)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testInvalidAggregate4() {        
+	@Test public void testInvalidAggregate4() {        
         helpValidate("SELECT AVG(e2) FROM test.group GROUP BY e2", new String[] {"AVG(e2)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
     
-    public void testInvalidAggregate5() {
+    @Test public void testInvalidAggregate5() {
         helpValidate("SELECT e1 || 'x' frOM pm1.g1 GROUP BY e2 + 1", new String[] {"e1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testInvalidAggregate6() {
+    @Test public void testInvalidAggregate6() {
         helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1 HAVING e1 || 'x' > 0", new String[] {"e1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testInvalidAggregate7() {
+    @Test public void testInvalidAggregate7() {
         helpValidate("SELECT StringKey, SUM(length(StringKey || 'x')) + 1 AS x FROM BQT1.SmallA GROUP BY StringKey || 'x' HAVING space(MAX(length((StringKey || 'x') || 'y'))) = '   '", //$NON-NLS-1$
                      new String[] {"StringKey"}, FakeMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
     }
     
-    public void testInvalidAggregate8() {
+    @Test public void testInvalidAggregate8() {
         helpValidate("SELECT max(ObjectValue) FROM BQT1.SmallA GROUP BY StringKey", //$NON-NLS-1$
                      new String[] {"MAX(ObjectValue)"}, FakeMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
     }
     
-    public void testInvalidAggregateIssue190644() {
+    @Test public void testInvalidAggregateIssue190644() {
         helpValidate("SELECT e3 + 1 from pm1.g1 GROUP BY e2 + 1 HAVING e2 + 1 = 5", new String[] {"e3"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidAggregate1() {
+    @Test public void testValidAggregate1() {
         helpValidate("SELECT (e2 + 1) * 2 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ 
     }
 
-    public void testValidAggregate2() {
+    @Test public void testValidAggregate2() {
         helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ 
     }
 
-    public void testValidAggregate3() {
+    @Test public void testValidAggregate3() {
         helpValidate("SELECT sum (IntKey), case when IntKey>=5000 then '5000 +' else '0-999' end " + //$NON-NLS-1$
             "FROM BQT1.SmallA GROUP BY case when IntKey>=5000 then '5000 +' else '0-999' end", //$NON-NLS-1$
             new String[] {}, FakeMetadataFactory.exampleBQTCached());
     }
-	public void testInvalidHaving1() {        
+	@Test public void testInvalidHaving1() {        
         helpValidate("SELECT e3 FROM test.group HAVING e3 > 0", new String[] {"e3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testInvalidHaving2() {        
+	@Test public void testInvalidHaving2() {        
         helpValidate("SELECT e3 FROM test.group HAVING concat(e3,'a') > 0", new String[] {"e3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
  
-	public void testNestedAggregateInHaving() {        
+	@Test public void testNestedAggregateInHaving() {        
         helpValidate("SELECT e0 FROM test.group GROUP BY e0 HAVING SUM(COUNT(e0)) > 0", new String[] {"COUNT(e0)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-    public void testNestedAggregateInSelect() {        
+    @Test public void testNestedAggregateInSelect() {        
         helpValidate("SELECT SUM(COUNT(e0)) FROM test.group GROUP BY e0", new String[] {"COUNT(e0)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidateCaseInGroupBy() {        
+    @Test public void testValidateCaseInGroupBy() {        
         helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY CASE e2 WHEN 0 THEN 1 ELSE 2 END", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ 
     }
     
-    public void testValidateFunctionInGroupBy() {        
+    @Test public void testValidateFunctionInGroupBy() {        
         helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY (e2 + 1)", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ 
     }
 
-    public void testInvalidScalarSubqueryInGroupBy() {        
+    @Test public void testInvalidScalarSubqueryInGroupBy() {        
         helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY (SELECT 1)", new String[] { "(SELECT 1)" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testInvalidConstantInGroupBy() {        
+    @Test public void testInvalidConstantInGroupBy() {        
         helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY 1", new String[] { "1" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testInvalidReferenceInGroupBy() {        
+    @Test public void testInvalidReferenceInGroupBy() {        
         helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY ?", new String[] { "?" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateObjectType1() {
+    @Test public void testValidateObjectType1() {
         helpValidate("SELECT DISTINCT * FROM test.group", new String[] {"test.\"group\".e2", "test.\"group\".e3", "test.\"group\".e4", "test.\"group\".e5"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
     }
 
-    public void testValidateObjectType2() {
+    @Test public void testValidateObjectType2() {
         helpValidate("SELECT * FROM test.group ORDER BY e1, e2", new String[] {"e2"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateObjectType3() {
+    @Test public void testValidateObjectType3() {
         helpValidate("SELECT e2 AS x FROM test.group ORDER BY x", new String[] {"x"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidateNonComparableType() {
+    @Test public void testValidateNonComparableType() {
         helpValidate("SELECT e3 FROM test.group ORDER BY e3", new String[] {"e3"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
  
-    public void testValidateNonComparableType1() {
+    @Test public void testValidateNonComparableType1() {
         helpValidate("SELECT e3 FROM test.group union SELECT e3 FROM test.group", new String[] {"e3"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateNonComparableType2() {
+    @Test public void testValidateNonComparableType2() {
         helpValidate("SELECT e3 FROM test.group GROUP BY e3", new String[] {"e3"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidateNonComparableType3() {
+    @Test public void testValidateNonComparableType3() {
         helpValidate("SELECT e3 FROM test.group intersect SELECT e3 FROM test.group", new String[] {"e3"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateNonComparableType4() {
+    @Test public void testValidateNonComparableType4() {
         helpValidate("SELECT e3 FROM test.group except SELECT e3 FROM test.group", new String[] {"e3"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidateIntersectAll() {
+    @Test public void testValidateIntersectAll() {
         helpValidate("SELECT e3 FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidateSetSelectInto() {
+    @Test public void testValidateSetSelectInto() {
         helpValidate("SELECT e3 into #temp FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 INTO #temp FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testInsert1() {
+    @Test public void testInsert1() {
         helpValidate("INSERT INTO test.group (e0) VALUES (null)", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testInsert2() throws Exception {
+    @Test public void testInsert2() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group (e0) VALUES (p1)"); //$NON-NLS-1$
@@ -608,12 +598,12 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
 
-        QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         helpRunValidator(command, new String[] {}, metadata);
     }
 
-    public void testInsert3() throws Exception {
+    @Test public void testInsert3() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group (e0) VALUES (p1+2)"); //$NON-NLS-1$
@@ -627,13 +617,13 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
 
-        QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         helpRunValidator(command, new String[] {}, metadata);
     }
     
 	// non-null, no-default elements not left
-    public void testInsert4() throws Exception {
+    @Test public void testInsert4() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata1();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group (e0) VALUES (2)"); //$NON-NLS-1$
@@ -644,7 +634,7 @@
     }
     
 	// non-null, no-default elements left
-    public void testInsert5() throws Exception {
+    @Test public void testInsert5() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata1();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group (e1, e2) VALUES ('x', 'y')"); //$NON-NLS-1$
@@ -653,7 +643,7 @@
         helpRunValidator(command, new String[] {"test.\"group\".e0"}, metadata); //$NON-NLS-1$
     }    
 
-    public void testValidateInsertElements1() throws Exception {
+    @Test public void testValidateInsertElements1() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group2 (e0, e1, e2) VALUES (5, 'x', 'y')"); //$NON-NLS-1$
@@ -662,7 +652,7 @@
         helpRunValidator(command, new String[] {"e2", "e0"}, metadata); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateInsertElements2() throws Exception {
+    @Test public void testValidateInsertElements2() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group2 (e1) VALUES ('y')"); //$NON-NLS-1$
@@ -672,19 +662,19 @@
         helpRunValidator(command, new String[] {}, metadata);
     }
 
-    public void testValidateInsertElements3_autoIncNotRequired() throws Exception {
+    @Test public void testValidateInsertElements3_autoIncNotRequired() throws Exception {
     	helpValidate("INSERT INTO test.group (e0) VALUES (1)", new String[] {}, exampleMetadata3()); //$NON-NLS-1$
     }
 
-    public void testUpdate1() {
+    @Test public void testUpdate1() {
         helpValidate("UPDATE test.group SET e0=null", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
         
-    public void testUpdate2() {
+    @Test public void testUpdate2() {
         helpValidate("UPDATE test.group SET e0=1, e0=2", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    public void testUpdate3() throws Exception {
+    @Test public void testUpdate3() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
         
         Command command = QueryParser.getQueryParser().parseCommand("UPDATE test.group SET p1=1"); //$NON-NLS-1$
@@ -698,12 +688,12 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
         
-        QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
                 
         helpRunValidator(command, new String[] {"p1"}, metadata); //$NON-NLS-1$
     }
 
-    public void testUpdate4() throws Exception {
+    @Test public void testUpdate4() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("UPDATE test.group SET e0=p1"); //$NON-NLS-1$
@@ -717,12 +707,12 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
 
-        QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
 
         helpRunValidator(command, new String[] {}, metadata);
     }
 
-    public void testUpdate5() throws Exception {
+    @Test public void testUpdate5() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("UPDATE test.group SET e0=p1+2"); //$NON-NLS-1$
@@ -736,11 +726,11 @@
         Map externalMetadata = new HashMap();
         externalMetadata.put(sqGroup, sqParams);
 
-        QueryResolver.resolveCommand(command, externalMetadata, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
         helpRunValidator(command, new String[] {}, metadata);
     }
 
-    public void testValidateUpdateElements1() throws Exception {
+    @Test public void testValidateUpdateElements1() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("UPDATE test.group2 SET e0 = 5, e1 = 'x', e2 = 'y'"); //$NON-NLS-1$
@@ -749,7 +739,7 @@
         helpRunValidator(command, new String[] {"e2", "e0"}, metadata); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateUpdateElements2() throws Exception {
+    @Test public void testValidateUpdateElements2() throws Exception {
         QueryMetadataInterface metadata = exampleMetadata();
 
         Command command = QueryParser.getQueryParser().parseCommand("UPDATE test.group2 SET e1 = 'x'"); //$NON-NLS-1$
@@ -757,93 +747,93 @@
 
         helpRunValidator(command, new String[] {}, metadata);
     }
-    public void testXMLQuery1() {
+    @Test public void testXMLQuery1() {
     	helpValidate("SELECT * FROM vm1.doc1", new String[] {}, exampleMetadata()); //$NON-NLS-1$
     }
 
-    public void testXMLQuery2() {
+    @Test public void testXMLQuery2() {
     	helpValidate("SELECT * FROM vm1.doc1 where a2='x'", new String[] {}, exampleMetadata()); //$NON-NLS-1$
     }
 
-    public void testXMLQuery3() {
+    @Test public void testXMLQuery3() {
     	helpValidate("SELECT * FROM vm1.doc1 order by a2", new String[] {}, exampleMetadata()); //$NON-NLS-1$
     }
 
-    public void testXMLQuery6() {
+    @Test public void testXMLQuery6() {
     	helpValidate("SELECT * FROM vm1.doc1 UNION SELECT * FROM vm1.doc1", new String[] {"\"xml\"", "SELECT * FROM vm1.doc1 UNION SELECT * FROM vm1.doc1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
     
-    public void testXMLQueryWithLimit() {
+    @Test public void testXMLQueryWithLimit() {
     	helpValidate("SELECT * FROM vm1.doc1 limit 1", new String[] {"SELECT * FROM vm1.doc1 LIMIT 1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** test rowlimit function is valid */
-    public void testXMLQueryRowLimit() {
+    @Test public void testXMLQueryRowLimit() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = RowLimit(a2)", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
     
     /** rowlimit function operand must be nonnegative integer */
-    public void testXMLQueryRowLimit1() {
+    @Test public void testXMLQueryRowLimit1() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimit(a2)=-1", new String[] {"RowLimit(a2) = -1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimit function operand must be nonnegative integer */
-    public void testXMLQueryRowLimit2() {
+    @Test public void testXMLQueryRowLimit2() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimit(a2)='x'", new String[] {"RowLimit(a2) = 'x'"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimit function cannot be nested within another function (this test inserts an implicit type conversion) */
-    public void testXMLQueryRowLimitNested() {
+    @Test public void testXMLQueryRowLimitNested() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimit(a2)=a2", new String[] {"RowLimit(a2) = a2"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimit function cannot be nested within another function */
-    public void testXMLQueryRowLimitNested2() {
+    @Test public void testXMLQueryRowLimitNested2() {
         helpValidate("SELECT * FROM vm1.doc1 where convert(RowLimit(a2), string)=a2", new String[] {"convert(RowLimit(a2), string) = a2"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimit function operand must be nonnegative integer */
-    public void testXMLQueryRowLimit3a() {
+    @Test public void testXMLQueryRowLimit3a() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimit(a2) = convert(a2, integer)", new String[] {"RowLimit(a2) = convert(a2, integer)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimit function operand must be nonnegative integer */
-    public void testXMLQueryRowLimit3b() {
+    @Test public void testXMLQueryRowLimit3b() {
         helpValidate("SELECT * FROM vm1.doc1 where convert(a2, integer) = RowLimit(a2)", new String[] {"convert(a2, integer) = RowLimit(a2)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
     /** rowlimit function arg must be an element symbol */
-    public void testXMLQueryRowLimit4() {
+    @Test public void testXMLQueryRowLimit4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit('x') = 3", new String[] {"rowlimit('x')"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimit function arg must be an element symbol */
-    public void testXMLQueryRowLimit5() {
+    @Test public void testXMLQueryRowLimit5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(concat(a2, 'x')) = 3", new String[] {"rowlimit(concat(a2, 'x'))"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimit function arg must be a single conjunct */
-    public void testXMLQueryRowLimitConjunct() {
+    @Test public void testXMLQueryRowLimitConjunct() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 OR a2 = 'x'", new String[] {"(rowlimit(a2) = 3) OR (a2 = 'x')"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimit function arg must be a single conjunct */
-    public void testXMLQueryRowLimitCompound() {
+    @Test public void testXMLQueryRowLimitCompound() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 AND a2 = 'x'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
     /** rowlimit function arg must be a single conjunct */
-    public void testXMLQueryRowLimitCompound2() {
+    @Test public void testXMLQueryRowLimitCompound2() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 AND concat(a2, 'y') = 'xy'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
     /** rowlimit function arg must be a single conjunct */
-    public void testXMLQueryRowLimitCompound3() {
+    @Test public void testXMLQueryRowLimitCompound3() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 AND (concat(a2, 'y') = 'xy' OR concat(a2, 'y') = 'zy')", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
     /** each rowlimit function arg must be a single conjunct */
-    public void testXMLQueryRowLimitCompound4() {
+    @Test public void testXMLQueryRowLimitCompound4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 AND rowlimit(c2) = 4", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
@@ -852,118 +842,118 @@
      * invalidated here (could be two different elements but in the same 
      * mapping class - needs to be caught in XMLPlanner)
      */
-    public void testXMLQueryRowLimitCompound5() {
+    @Test public void testXMLQueryRowLimitCompound5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = 3 AND rowlimit(a2) = 4", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria() {
         helpValidate("SELECT * FROM vm1.doc1 where not(rowlimit(a2) = 3)", new String[] {"NOT (rowlimit(a2) = 3)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria2() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria2() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) IN (3)", new String[] {"rowlimit(a2) IN (3)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    public void testXMLQueryRowLimitInvalidCriteria3() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria3() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) LIKE 'x'", new String[] {"rowlimit(a2) LIKE 'x'"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria4() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) IS NULL", new String[] {"rowlimit(a2) IS NULL"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria5() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) IN (SELECT e0 FROM vTest.vMap)", new String[] {"rowlimit(a2) IN (SELECT e0 FROM vTest.vMap)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria6() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria6() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = CASE WHEN rowlimit(a2) = 2 THEN 2 END", new String[] {"2 = CASE WHEN rowlimit(a2) = 2 THEN 2 END"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria6a() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria6a() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = CASE rowlimit(a2) WHEN 2 THEN 2 END", new String[] {"2 = CASE rowlimit(a2) WHEN 2 THEN 2 END"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    public void testXMLQueryRowLimitInvalidCriteria7() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria7() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) BETWEEN 2 AND 3", new String[] {"rowlimit(a2) BETWEEN 2 AND 3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitInvalidCriteria8() {
+    @Test public void testXMLQueryRowLimitInvalidCriteria8() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimit(a2) = ANY (SELECT e0 FROM vTest.vMap)", new String[] {"rowlimit(a2) = ANY (SELECT e0 FROM vTest.vMap)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
     /** using rowlimit pseudo-function in non-XML query is invalid */
-    public void testNonXMLQueryRowLimit() {        
+    @Test public void testNonXMLQueryRowLimit() {        
         helpValidate("SELECT e2 FROM vTest.vMap WHERE rowlimit(e1) = 2", new String[] {"rowlimit(e1)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
     /** test rowlimitexception function is valid */
-    public void testXMLQueryRowLimitException() {
+    @Test public void testXMLQueryRowLimitException() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = RowLimitException(a2)", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
     
     /** rowlimitexception function operand must be nonnegative integer */
-    public void testXMLQueryRowLimitException1() {
+    @Test public void testXMLQueryRowLimitException1() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimitException(a2)=-1", new String[] {"RowLimitException(a2) = -1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimitexception function operand must be nonnegative integer */
-    public void testXMLQueryRowLimitException2() {
+    @Test public void testXMLQueryRowLimitException2() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimitException(a2)='x'", new String[] {"RowLimitException(a2) = 'x'"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimitexception function cannot be nested within another function (this test inserts an implicit type conversion) */
-    public void testXMLQueryRowLimitExceptionNested() {
+    @Test public void testXMLQueryRowLimitExceptionNested() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimitException(a2)=a2", new String[] {"RowLimitException(a2) = a2"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimitexception function cannot be nested within another function */
-    public void testXMLQueryRowLimitExceptionNested2() {
+    @Test public void testXMLQueryRowLimitExceptionNested2() {
         helpValidate("SELECT * FROM vm1.doc1 where convert(RowLimitException(a2), string)=a2", new String[] {"convert(RowLimitException(a2), string) = a2"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimitexception function operand must be nonnegative integer */
-    public void testXMLQueryRowLimitException3a() {
+    @Test public void testXMLQueryRowLimitException3a() {
         helpValidate("SELECT * FROM vm1.doc1 where RowLimitException(a2) = convert(a2, integer)", new String[] {"RowLimitException(a2) = convert(a2, integer)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimitexception function operand must be nonnegative integer */
-    public void testXMLQueryRowLimitException3b() {
+    @Test public void testXMLQueryRowLimitException3b() {
         helpValidate("SELECT * FROM vm1.doc1 where convert(a2, integer) = RowLimitException(a2)", new String[] {"convert(a2, integer) = RowLimitException(a2)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
     /** rowlimitexception function arg must be an element symbol */
-    public void testXMLQueryRowLimitException4() {
+    @Test public void testXMLQueryRowLimitException4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception('x') = 3", new String[] {"rowlimitexception('x')"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimitexception function arg must be an element symbol */
-    public void testXMLQueryRowLimitException5() {
+    @Test public void testXMLQueryRowLimitException5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(concat(a2, 'x')) = 3", new String[] {"rowlimitexception(concat(a2, 'x'))"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** rowlimitexception function arg must be a single conjunct */
-    public void testXMLQueryRowLimitExceptionConjunct() {
+    @Test public void testXMLQueryRowLimitExceptionConjunct() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 OR a2 = 'x'", new String[] {"(rowlimitexception(a2) = 3) OR (a2 = 'x')"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /** rowlimitexception function arg must be a single conjunct */
-    public void testXMLQueryRowLimitExceptionCompound() {
+    @Test public void testXMLQueryRowLimitExceptionCompound() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 AND a2 = 'x'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
     /** rowlimitexception function arg must be a single conjunct */
-    public void testXMLQueryRowLimitExceptionCompound2() {
+    @Test public void testXMLQueryRowLimitExceptionCompound2() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 AND concat(a2, 'y') = 'xy'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
     /** rowlimitexception function arg must be a single conjunct */
-    public void testXMLQueryRowLimitExceptionCompound3() {
+    @Test public void testXMLQueryRowLimitExceptionCompound3() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 AND (concat(a2, 'y') = 'xy' OR concat(a2, 'y') = 'zy')", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
     /** each rowlimitexception function arg must be a single conjunct */
-    public void testXMLQueryRowLimitExceptionCompound4() {
+    @Test public void testXMLQueryRowLimitExceptionCompound4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 AND rowlimitexception(c2) = 4", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
@@ -972,106 +962,106 @@
      * invalidated here (could be two different elements but in the same 
      * mapping class - needs to be caught in XMLPlanner)
      */
-    public void testXMLQueryRowLimitExceptionCompound5() {
+    @Test public void testXMLQueryRowLimitExceptionCompound5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = 3 AND rowlimitexception(a2) = 4", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria() {
         helpValidate("SELECT * FROM vm1.doc1 where not(rowlimitexception(a2) = 3)", new String[] {"NOT (rowlimitexception(a2) = 3)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria2() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria2() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) IN (3)", new String[] {"rowlimitexception(a2) IN (3)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    public void testXMLQueryRowLimitExceptionInvalidCriteria3() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria3() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) LIKE 'x'", new String[] {"rowlimitexception(a2) LIKE 'x'"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria4() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria4() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) IS NULL", new String[] {"rowlimitexception(a2) IS NULL"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria5() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria5() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) IN (SELECT e0 FROM vTest.vMap)", new String[] {"rowlimitexception(a2) IN (SELECT e0 FROM vTest.vMap)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria6() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria6() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = CASE WHEN rowlimitexception(a2) = 2 THEN 2 END", new String[] {"2 = CASE WHEN rowlimitexception(a2) = 2 THEN 2 END"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria6a() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria6a() {
         helpValidate("SELECT * FROM vm1.doc1 where 2 = CASE rowlimitexception(a2) WHEN 2 THEN 2 END", new String[] {"2 = CASE rowlimitexception(a2) WHEN 2 THEN 2 END"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
-    public void testXMLQueryRowLimitExceptionInvalidCriteria7() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria7() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) BETWEEN 2 AND 3", new String[] {"rowlimitexception(a2) BETWEEN 2 AND 3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
-    public void testXMLQueryRowLimitExceptionInvalidCriteria8() {
+    @Test public void testXMLQueryRowLimitExceptionInvalidCriteria8() {
         helpValidate("SELECT * FROM vm1.doc1 where rowlimitexception(a2) = ANY (SELECT e0 FROM vTest.vMap)", new String[] {"rowlimitexception(a2) = ANY (SELECT e0 FROM vTest.vMap)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
     
     /** using rowlimit pseudo-function in non-XML query is invalid */
-    public void testNonXMLQueryRowLimitException() {        
+    @Test public void testNonXMLQueryRowLimitException() {        
         helpValidate("SELECT e2 FROM vTest.vMap WHERE rowlimitexception(e1) = 2", new String[] {"rowlimitexception(e1)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
     /** using context pseudo-function in non-XML query is invalid */
-    public void testNonXMLQueryContextOperator() {        
+    @Test public void testNonXMLQueryContextOperator() {        
         helpValidate("SELECT e2 FROM vTest.vMap WHERE context(e1, e1) = 2", new String[] {"context(e1, e1)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }      
     
-    public void testValidateSubquery1() {        
+    @Test public void testValidateSubquery1() {        
         helpValidate("SELECT e2 FROM (SELECT e2 FROM vTest.vMap WHERE e2 = 'a') AS x", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
-    public void testValidateSubquery2() {        
+    @Test public void testValidateSubquery2() {        
         helpValidate("SELECT e2 FROM (SELECT e3 FROM vTest.vMap) AS x, vTest.vMap WHERE e2 = 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
     
-    public void testValidateSubquery3() {        
+    @Test public void testValidateSubquery3() {        
         helpValidate("SELECT * FROM pm1.g1, (EXEC pm1.sq1( )) AS alias", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
     }
 
-    public void testValidateUnionWithSubquery() {        
+    @Test public void testValidateUnionWithSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 union all SELECT e3 FROM test.group union all select * from (SELECT e1 FROM test.group) as subquery1", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateExistsSubquery() {        
+    @Test public void testValidateExistsSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE EXISTS (SELECT e2 FROM vTest.vMap WHERE e2 = 'a')", new String[] {}, exampleMetadata()); //$NON-NLS-1$ 
     }
 
-    public void testValidateScalarSubquery() {        
+    @Test public void testValidateScalarSubquery() {        
         helpValidate("SELECT e2, (SELECT e1 FROM vTest.vMap WHERE e2 = '3') FROM test.group2", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$ 
     }
 
-    public void testValidateAnyCompareSubquery() {        
+    @Test public void testValidateAnyCompareSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE e1 < ANY (SELECT e1 FROM test.group)", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateAllCompareSubquery() {        
+    @Test public void testValidateAllCompareSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE e1 = ALL (SELECT e1 FROM test.group)", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateSomeCompareSubquery() {        
+    @Test public void testValidateSomeCompareSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE e1 <= SOME (SELECT e1 FROM test.group)", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateCompareSubquery() {        
+    @Test public void testValidateCompareSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE e1 >= (SELECT e1 FROM test.group WHERE e1 = 1)", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateInClauseSubquery() {        
+    @Test public void testValidateInClauseSubquery() {        
         helpValidate("SELECT e2 FROM test.group2 WHERE e1 IN (SELECT e1 FROM test.group)", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testValidateExec1() {
+    @Test public void testValidateExec1() {
         helpValidate("EXEC pm1.sq1()", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
     }
     
 	// variable declared is of special type INPUT
-    public void testCreateUpdateProcedure1() {
+    @Test public void testCreateUpdateProcedure1() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer INPUT;\n"; //$NON-NLS-1$
@@ -1085,7 +1075,7 @@
     }
     
 	// variable declared is of special type CHANGING
-    public void testCreateUpdateProcedure3() {
+    @Test public void testCreateUpdateProcedure3() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer CHANGING;\n"; //$NON-NLS-1$
@@ -1099,7 +1089,7 @@
     }
 
 	// valid variable declared
-    public void testCreateUpdateProcedure4() {
+    @Test public void testCreateUpdateProcedure4() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1113,7 +1103,7 @@
     }
     
 	// validating criteria selector(on HAS CRITERIA), elements on it should be virtual group elements
-    public void testCreateUpdateProcedure5() {
+    @Test public void testCreateUpdateProcedure5() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1130,7 +1120,7 @@
     }
     
 	// validating Translate CRITERIA, elements on it should be virtual group elements
-    public void testCreateUpdateProcedure7() {
+    @Test public void testCreateUpdateProcedure7() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1145,7 +1135,7 @@
     }
     
 	// ROWS_UPDATED not assigned
-    public void testCreateUpdateProcedure8() {
+    @Test public void testCreateUpdateProcedure8() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1159,7 +1149,7 @@
     }
 
 	// validating AssignmentStatement, ROWS_UPDATED element assigned
-    public void testCreateUpdateProcedure9() {
+    @Test public void testCreateUpdateProcedure9() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1175,7 +1165,7 @@
     
 	// validating AssignmentStatement, variable type and assigned type 
 	// do not match
-    public void testCreateUpdateProcedure10() {
+    @Test public void testCreateUpdateProcedure10() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1191,7 +1181,7 @@
 
 	// validating AssignmentStatement, more than one project symbol on the
 	// command
-    public void testCreateUpdateProcedure11() {
+    @Test public void testCreateUpdateProcedure11() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1207,7 +1197,7 @@
     
 	// validating AssignmentStatement, more than one project symbol on the
 	// command
-    public void testCreateUpdateProcedure12() {
+    @Test public void testCreateUpdateProcedure12() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1222,7 +1212,7 @@
     }
     
 	// TranslateCriteria on criteria of the if statement
-    public void testCreateUpdateProcedure13() {
+    @Test public void testCreateUpdateProcedure13() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1240,7 +1230,7 @@
     }
     
 	// INPUT ised in command
-    public void testCreateUpdateProcedure16() {
+    @Test public void testCreateUpdateProcedure16() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1256,7 +1246,7 @@
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// elements on with should be on ON
-    public void testCreateUpdateProcedure17() {
+    @Test public void testCreateUpdateProcedure17() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1272,7 +1262,7 @@
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// failure, aggregate function in query transform
-    public void testCreateUpdateProcedure18() {
+    @Test public void testCreateUpdateProcedure18() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1288,7 +1278,7 @@
     
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// failure, aggregate function in query transform
-    public void testCreateUpdateProcedure18a() {
+    @Test public void testCreateUpdateProcedure18a() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1305,7 +1295,7 @@
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
 	// failure, translated criteria elements not present on groups of command
-    public void testCreateUpdateProcedure19() {
+    @Test public void testCreateUpdateProcedure19() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1320,7 +1310,7 @@
 	}
 	
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    public void testCreateUpdateProcedure20() {
+    @Test public void testCreateUpdateProcedure20() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1335,7 +1325,7 @@
 	}
 
 	// variables cannot be used among insert elements
-    public void testCreateUpdateProcedure23() {
+    @Test public void testCreateUpdateProcedure23() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1350,7 +1340,7 @@
 	}
 	
 	// variables cannot be used among insert elements
-    public void testCreateUpdateProcedure24() {
+    @Test public void testCreateUpdateProcedure24() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1365,7 +1355,7 @@
 	}
 
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    public void testCreateUpdateProcedure25() {
+    @Test public void testCreateUpdateProcedure25() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1380,7 +1370,7 @@
 	}
 
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    public void testCreateUpdateProcedure26() {
+    @Test public void testCreateUpdateProcedure26() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1395,7 +1385,7 @@
 	}
 
 	// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
-    public void testCreateUpdateProcedure27() {
+    @Test public void testCreateUpdateProcedure27() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1409,7 +1399,7 @@
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 	}
     
-    public void testCreateUpdateProcedure28() {
+    @Test public void testCreateUpdateProcedure28() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1424,7 +1414,7 @@
 	}
 
     // using aggregate function within a procedure - defect #8394
-    public void testCreateUpdateProcedure31() {
+    @Test public void testCreateUpdateProcedure31() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE string MaxTran;\n"; //$NON-NLS-1$
@@ -1439,7 +1429,7 @@
     }
     
 	// assigning null values to known datatype variable
-	public void testCreateUpdateProcedure32() {
+	@Test public void testCreateUpdateProcedure32() {
 		String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
 		procedure = procedure + "DECLARE string var;\n"; //$NON-NLS-1$
@@ -1453,7 +1443,7 @@
 				FakeMetadataObject.Props.UPDATE_PROCEDURE);
 	}
     
-    public void testDefect13643() {
+    @Test public void testDefect13643() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1470,7 +1460,7 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testValidHaving() {
+    @Test public void testValidHaving() {
         helpValidate(
             "SELECT DISTINCT ProdHier.prod_num " + //$NON-NLS-1$
             "FROM Sales, ProdHier, Cust " + //$NON-NLS-1$
@@ -1480,7 +1470,7 @@
             new String[] { }, FakeMetadataFactory.exampleSymphony());
     } 
     
-    public void testValidHaving2() {
+    @Test public void testValidHaving2() {
         String sql =  "SELECT intkey FROM bqt1.smalla WHERE intkey = 1 " + //$NON-NLS-1$
             "GROUP BY intkey HAVING intkey = 1";         //$NON-NLS-1$
         QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();        
@@ -1495,15 +1485,15 @@
         }        
     } 
     
-    public void testVirtualProcedure(){
+    @Test public void testVirtualProcedure(){
           helpValidate("EXEC pm1.vsp1()", new String[] { }, FakeMetadataFactory.example1Cached());  //$NON-NLS-1$
     }
         
-    public void testSelectWithNoFrom() {        
+    @Test public void testSelectWithNoFrom() {        
         helpValidate("SELECT 5", new String[] {}, exampleMetadata()); //$NON-NLS-1$
     }
     
-    public void testSelectIntoTempGroup() {
+    @Test public void testSelectIntoTempGroup() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "SELECT e1, e2, e3, e4 INTO #myTempTable FROM pm1.g2;\n";         //$NON-NLS-1$
@@ -1519,7 +1509,7 @@
     /**
      * Defect 24346
      */
-    public void testInvalidSelectIntoTempGroup() {
+    @Test public void testInvalidSelectIntoTempGroup() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "SELECT e1, e2, e3, e4 INTO #myTempTable FROM pm1.g2;\n";         //$NON-NLS-1$
@@ -1536,7 +1526,7 @@
     /**
      * Defect 24346 with type mismatch
      */
-    public void testInvalidSelectIntoTempGroup1() {
+    @Test public void testInvalidSelectIntoTempGroup1() {
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
         procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
         procedure = procedure + "create local temporary table #myTempTable (e1 integer);\n";         //$NON-NLS-1$
@@ -1551,7 +1541,7 @@
     }
 
     
-    public void testSelectIntoPhysicalGroup() {
+    @Test public void testSelectIntoPhysicalGroup() {
         helpValidate("SELECT e1, e2, e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] { }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1566,15 +1556,15 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testSelectIntoPhysicalGroupNotUpdateable_Defect16857() {
+    @Test public void testSelectIntoPhysicalGroupNotUpdateable_Defect16857() {
         helpValidate("SELECT e0, e1, e2 INTO test.group3 FROM test.group2", new String[] {"test.group3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testSelectIntoElementsNotUpdateable() {
+    @Test public void testSelectIntoElementsNotUpdateable() {
     	helpValidate("SELECT e0, e1, e2 INTO test.group2 FROM test.group3", new String[] {"test.group2"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testInvalidSelectIntoTooManyElements() {
+    @Test public void testInvalidSelectIntoTooManyElements() {
     	helpValidate("SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1589,7 +1579,7 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testInvalidSelectIntoTooFewElements() {
+    @Test public void testInvalidSelectIntoTooFewElements() {
     	helpValidate("SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1604,7 +1594,7 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testInvalidSelectIntoIncorrectTypes() {
+    @Test public void testInvalidSelectIntoIncorrectTypes() {
         helpValidate("SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1619,11 +1609,11 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testSelectIntoWithStar() {
+    @Test public void testSelectIntoWithStar() {
         helpResolve("SELECT * INTO pm1.g1 FROM pm1.g2", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
     }
     
-    public void testInvalidSelectIntoWithStar() {
+    @Test public void testInvalidSelectIntoWithStar() {
         helpValidate("SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1", new String[] {"SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1638,7 +1628,7 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testSelectIntoVirtualGroup() {
+    @Test public void testSelectIntoVirtualGroup() {
         helpValidate("SELECT e1, e2, e3, e4 INTO vm1.g1 FROM pm1.g2", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
         
         String procedure = "CREATE PROCEDURE  "; //$NON-NLS-1$
@@ -1653,26 +1643,26 @@
                 FakeMetadataObject.Props.UPDATE_PROCEDURE);
     }
     
-    public void testVirtualProcedure2(){
+    @Test public void testVirtualProcedure2(){
           helpValidate("EXEC pm1.vsp13()", new String[] { }, FakeMetadataFactory.example1Cached());  //$NON-NLS-1$
     }
 
     //procedure that has another procedure in the transformation
-    public void testVirtualProcedure3(){
+    @Test public void testVirtualProcedure3(){
         helpValidate("EXEC pm1.vsp27()", new String[] { }, FakeMetadataFactory.example1Cached());  //$NON-NLS-1$
     }
     
-    public void testNonEmbeddedSubcommand_defect11000() {        
+    @Test public void testNonEmbeddedSubcommand_defect11000() {        
         helpValidate("SELECT e0 FROM vTest.vGroup", new String[0], exampleMetadata()); //$NON-NLS-1$ 
     }
     
-    public void testValidateObjectInComparison() throws Exception {
+    @Test public void testValidateObjectInComparison() throws Exception {
         String sql = "SELECT IntKey FROM BQT1.SmallA WHERE ObjectValue = 5";   //$NON-NLS-1$
         ValidatorReport report = helpValidate(sql, new String[] {"ObjectValue = 5"}, FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
         assertEquals("Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in comparison: ObjectValue = 5.", report.toString()); //$NON-NLS-1$
     }
 
-    public void testValidateAssignmentWithFunctionOnParameter_InServer() throws Exception{
+    @Test public void testValidateAssignmentWithFunctionOnParameter_InServer() throws Exception{
         String sql = "EXEC pm1.vsp36(5)";  //$NON-NLS-1$
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         
@@ -1684,7 +1674,7 @@
         assertEquals(0, report.getItems().size());                      
     }
 
-    public void testDefect9917() throws Exception{
+    @Test public void testDefect9917() throws Exception{
     	QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         String sql = "SELECT lookup('pm1.g1', 'e1a', 'e2', e2) AS x, lookup('pm1.g1', 'e4', 'e3', e3) AS y FROM pm1.g1"; //$NON-NLS-1$
         Command command = new QueryParser().parseCommand(sql);
@@ -1705,7 +1695,7 @@
         }
     }
     
-    public void testLookupKeyElementComparable() throws Exception {
+    @Test public void testLookupKeyElementComparable() throws Exception {
     	QueryMetadataInterface metadata = exampleMetadata2();
         String sql = "SELECT lookup('test.group', 'e2', 'e3', convert(e2, blob)) AS x FROM test.group"; //$NON-NLS-1$
         Command command = QueryParser.getQueryParser().parseCommand(sql);
@@ -1715,7 +1705,7 @@
         assertEquals("Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used as LOOKUP key columns: test.\"group\".e3.", report.toString()); //$NON-NLS-1$
     }
     
-    public void testDefect12107() throws Exception{
+    @Test public void testDefect12107() throws Exception{
     	QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         String sql = "SELECT SUM(DISTINCT lookup('pm1.g1', 'e2', 'e2', e2)) FROM pm1.g1"; //$NON-NLS-1$
         Command command = helpResolve(sql, metadata);
@@ -1730,13 +1720,13 @@
         
         GroupSymbol group = new GroupSymbol(procName);
         Map externalMetadata = getStoredProcedureExternalMetadata(group, metadata);
-        QueryResolver.resolveCommand(command, externalMetadata, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, externalMetadata, metadata, AnalysisRecord.createNonRecordingRecord());
         
         // Validate
         return Validator.validate(command, metadata);         
     }
 
-    public void testValidateDynamicCommandWithNonTempGroup_InModeler() throws Exception{
+    @Test public void testValidateDynamicCommandWithNonTempGroup_InModeler() throws Exception{
         // SQL is same as pm1.vsp36() in example1 
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN execute string 'select ' || '1' as X integer into pm1.g3; END";  //$NON-NLS-1$        
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
@@ -1747,7 +1737,7 @@
         assertEquals("Wrong number of elements being SELECTed INTO the target table. Expected 4 elements, but was 1.", report.toString()); //$NON-NLS-1$
     }
     
-    public void testDynamicDupUsing() throws Exception {
+    @Test public void testDynamicDupUsing() throws Exception {
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN execute string 'select ' || '1' as X integer into #temp using id=1, id=2; END";  //$NON-NLS-1$        
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         
@@ -1757,7 +1747,7 @@
         assertEquals("Elements cannot appear more than once in a SET or USING clause.  The following elements are duplicated: [\"USING\".id]", report.toString()); //$NON-NLS-1$
     }    
     
-    public void testValidateAssignmentWithFunctionOnParameter_InModeler() throws Exception{
+    @Test public void testValidateAssignmentWithFunctionOnParameter_InModeler() throws Exception{
         // SQL is same as pm1.vsp36() in example1 
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x = pm1.vsp36.param1 * 2; SELECT x; END";  //$NON-NLS-1$        
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
@@ -1767,7 +1757,7 @@
         assertEquals(0, report.getItems().size());                      
     }
     
-    public void testDefect12533() {
+    @Test public void testDefect12533() {
         String sql = "SELECT BQT1.SmallA.DateValue, BQT2.SmallB.ObjectValue FROM BQT1.SmallA, BQT2.SmallB " +  //$NON-NLS-1$
             "WHERE BQT1.SmallA.DateValue = BQT2.SmallB.DateValue AND BQT1.SmallA.ObjectValue = BQT2.SmallB.ObjectValue " + //$NON-NLS-1$
             "AND BQT1.SmallA.IntKey < 30 AND BQT2.SmallB.IntKey < 30 ORDER BY BQT1.SmallA.DateValue"; //$NON-NLS-1$
@@ -1777,7 +1767,7 @@
         helpValidate(sql, new String[] {"BQT1.SmallA.ObjectValue = BQT2.SmallB.ObjectValue"}, metadata);  //$NON-NLS-1$ 
     }
 
-    public void testDefect16772() throws Exception{
+    @Test public void testDefect16772() throws Exception{
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp42.param1 > 0) SELECT 1 AS x; ELSE SELECT 0 AS x; END"; //$NON-NLS-1$
         
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
@@ -1787,12 +1777,12 @@
         assertEquals("Expected report to have no validation failures", false, report.hasItems()); //$NON-NLS-1$
     }
 	
-	public void testDefect14886() throws Exception{        
+	@Test public void testDefect14886() throws Exception{        
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN END";  //$NON-NLS-1$        
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         
         Command command = new QueryParser().parseCommand(sql);
-        QueryResolver.resolveCommand(command, new HashMap(), false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, new HashMap(), metadata, AnalysisRecord.createNonRecordingRecord());
         
         // Validate
         ValidatorReport report = Validator.validate(command, metadata); 
@@ -1800,14 +1790,14 @@
         assertEquals(1, report.getItems().size());  	
     }
 	
-    public void testDefect21389() throws Exception{        
+    @Test public void testDefect21389() throws Exception{        
         String sql = "CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; INSERT INTO #temptable (e1) VALUES ('a'); END"; //$NON-NLS-1$      
         FakeMetadataFacade metadata = FakeMetadataFactory.example1();
         FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
         e1.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
         
         Command command = new QueryParser().parseCommand(sql);
-        QueryResolver.resolveCommand(command, new HashMap(), false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, new HashMap(), metadata, AnalysisRecord.createNonRecordingRecord());
         
         // Validate
         ValidatorReport report = Validator.validate(command, metadata); 
@@ -1815,18 +1805,18 @@
         assertEquals(0, report.getItems().size());      
     }
     
-    public void testMakeNotDep() {
+    @Test public void testMakeNotDep() {
         helpValidate("select group2.e1, group3.e2 from group2, group3 WHERE group2.e0 = group3.e0 OPTION MAKENOTDEP group2, group3", new String[0], exampleMetadata()); //$NON-NLS-1$
     }
-    public void testInvalidMakeNotDep() {
+    @Test public void testInvalidMakeNotDep() {
     	helpValidate("select group2.e1, group3.e2 from group2, group3 WHERE group2.e0 = group3.e0 OPTION MAKEDEP group2 MAKENOTDEP group2, group3", new String[] {"OPTION MAKEDEP group2 MAKENOTDEP group2, group3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testInvalidLimit() {
+    @Test public void testInvalidLimit() {
         helpValidate("SELECT * FROM pm1.g1 LIMIT -5", new String[] {"LIMIT -5"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    public void testInvalidLimit_Offset() {
+    @Test public void testInvalidLimit_Offset() {
     	helpValidate("SELECT * FROM pm1.g1 LIMIT -1, 100", new String[] {"LIMIT -1, 100"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
@@ -1838,7 +1828,7 @@
      * 
      * This virtual procedure calls a physical stored procedure directly.  
      */
-    public void testCase4237() {
+    @Test public void testCase4237() {
 
         FakeMetadataFacade metadata = helpCreateCase4237VirtualProcedureMetadata();
         Map externalMetadata = helpCreateCase4237ExternalMetadata(metadata);
@@ -1852,7 +1842,7 @@
      * This test was already working before the case was logged, due for some reason
      * to the exec() statement being inside an inline view.  This is a control test. 
      */
-    public void testCase4237InlineView() {
+    @Test public void testCase4237InlineView() {
 
         FakeMetadataFacade metadata = helpCreateCase4237VirtualProcedureMetadata();
         Map externalMetadata = helpCreateCase4237ExternalMetadata(metadata);
@@ -1917,32 +1907,32 @@
         return new FakeMetadataFacade(store);
     }       
     
-    public void testSelectIntoWithNull() {
+    @Test public void testSelectIntoWithNull() {
         helpValidate("SELECT null, null, null, null INTO pm1.g1 FROM pm1.g2", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
     }
         
-    public void testDropNonTemporary() {
+    @Test public void testDropNonTemporary() {
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         Command command = helpResolve("drop table pm1.g1", metadata); //$NON-NLS-1$
         helpRunValidator(command, new String[] {command.toString()}, FakeMetadataFactory.example1Cached()); 
     }
     
-    public void testNestedContexts() {
+    @Test public void testNestedContexts() {
         helpValidate("SELECT * FROM vm1.doc1 where context(a0, context(a0, a2))='x'", new String[] {"context(a0, context(a0, a2))"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testValidContextElement() {
+    @Test public void testValidContextElement() {
         helpValidate("SELECT * FROM vm1.doc1 where context(1, a2)='x'", new String[] {"context(1, a2)"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    public void testInsertIntoVirtualWithQuery() throws Exception {
+    @Test public void testInsertIntoVirtualWithQuery() throws Exception {
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         Command command = helpResolve("insert into vm1.g1 select 1, 2, true, 3", metadata); //$NON-NLS-1$
         ValidatorReport report = Validator.validate(command, metadata);
         assertTrue(report.getItems().isEmpty());
     }
     
-    public void testDynamicIntoDeclaredTemp() throws Exception {
+    @Test public void testDynamicIntoDeclaredTemp() throws Exception {
         StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE  ") //$NON-NLS-1$
                                 .append("BEGIN\n") //$NON-NLS-1$
                                 .append("CREATE LOCAL TEMPORARY TABLE x (column1 string);") //$NON-NLS-1$
@@ -1957,7 +1947,7 @@
         assertEquals(report.toString(), 0, report.getItems().size());
     }
     
-    public void testVariablesGroupSelect() {
+    @Test public void testVariablesGroupSelect() {
         String procedure = "CREATE VIRTUAL PROCEDURE "; //$NON-NLS-1$
         procedure += "BEGIN\n"; //$NON-NLS-1$
         procedure += "DECLARE integer VARIABLES.var1 = 1;\n"; //$NON-NLS-1$
@@ -1970,34 +1960,34 @@
         helpRunValidator(command, new String[] {"variables"}, metadata); //$NON-NLS-1$
     }
     
-    public void testClobEquals() {
+    @Test public void testClobEquals() {
         TestValidator.helpValidate("SELECT * FROM test.group where e4 = '1'", new String[] {"e4 = '1'"}, TestValidator.exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$ 
     }
     
     /**
      *  Should not fail since the update changing set is not really criteria
      */
-    public void testUpdateWithClob() {
+    @Test public void testUpdateWithClob() {
         TestValidator.helpValidate("update test.group set e4 = ?", new String[] {}, TestValidator.exampleMetadata2()); //$NON-NLS-1$ 
     }
 
-    public void testBlobLessThan() {
+    @Test public void testBlobLessThan() {
         TestValidator.helpValidate("SELECT * FROM test.group where e3 < ?", new String[] {"e3 < ?"}, TestValidator.exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$ 
     }
     
-	public void testValidateCompare2() {        
+	@Test public void testValidateCompare2() {        
         helpValidate("SELECT e2 FROM test.group WHERE e4 IS NULL", new String[] {}, exampleMetadata2()); //$NON-NLS-1$ 
 	}
 
-	public void testValidateCompare3() {        
+	@Test public void testValidateCompare3() {        
         helpValidate("SELECT e2 FROM test.group WHERE e4 IN ('a')", new String[] {"e4 IN ('a')"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-    public void testValidateCompare5() {        
+    @Test public void testValidateCompare5() {        
         helpValidate("SELECT e2 FROM test.group WHERE e4 BETWEEN '1' AND '2'", new String[] {"e4 BETWEEN '1' AND '2'"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-	public void testValidateCompareInHaving1() {        
+	@Test public void testValidateCompareInHaving1() {        
         helpValidate("SELECT e1 FROM test.group GROUP BY e1 HAVING convert(e1, clob) = 'a'", new String[] {"convert(e1, clob) = 'a'"}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/xquery/TestXQueryEngine.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/xquery/TestXQueryEngine.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/xquery/TestXQueryEngine.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -23,6 +23,9 @@
 package com.metamatrix.query.xquery;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.sql.SQLXML;
 import java.util.HashMap;
@@ -35,6 +38,7 @@
 
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.common.types.SQLXMLImpl;
+import com.metamatrix.common.types.XMLTranslator;
 import com.metamatrix.core.util.FileUtil;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.query.xquery.saxon.SaxonXQueryExpression;
@@ -61,8 +65,9 @@
     
     private void helpTestEngine(XQueryExpression expr, String xQuery, SQLXML expected, XQuerySQLEvaluator sqlEval) throws Exception{
         expr.compileXQuery(xQuery);        
-        SQLXML actualResults = expr.evaluateXQuery(sqlEval);
-        assertEquals(expected.getString(), actualResults.getString());        
+        XMLTranslator actualResults = expr.evaluateXQuery(sqlEval);
+        String result = actualResults.getString();
+        assertEquals(expected.getString(), result);        
     }
 
     private void helpTestEngineFails(String xQuery, Class<?> expectedFailure, XQuerySQLEvaluator sqlEval) throws Exception{
@@ -154,7 +159,7 @@
         
         XQueryExpression expr = new SaxonXQueryExpression();
         expr.compileXQuery(xquery);
-        SQLXML actualResults = expr.evaluateXQuery(new HardcodedSqlEval(null));
+        XMLTranslator actualResults = expr.evaluateXQuery(new HardcodedSqlEval(null));
         
         assertEquals(expectedStr, actualResults.getString().replaceAll("[ \t\r\n]", "")); //$NON-NLS-1$ //$NON-NLS-2$
     }

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestCacheID.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestCacheID.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestCacheID.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -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.dqp.internal.cache;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.dqp.internal.cache.CacheID;
-
-import junit.framework.TestCase;
-
-public class TestCacheID extends TestCase{
-    public TestCacheID(final String name) {
-        super(name);
-    }
-    
-    public void testIDEquals1(){
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheID id2 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	assertEquals(id1, id2);
-    }
-    
-    public void testIDEquals2(){
-    	List variables1 = new ArrayList();
-    	variables1.add(new Integer(6));
-    	variables1.add("aaa"); //$NON-NLS-1$
-    	CacheID id1 = new CacheID("12345", "select * from table1",variables1);  //$NON-NLS-1$//$NON-NLS-2$
-    	List variables2 = new ArrayList();
-    	variables2.add(new Integer(6));
-    	variables2.add("aaa"); //$NON-NLS-1$
-    	CacheID id2 = new CacheID("12345", "select * from table1",variables2);  //$NON-NLS-1$//$NON-NLS-2$
-    	assertEquals(id1, id2);
-    }
-    
-    public void testIDEquals3(){
-    	CacheID id1 = new CacheID("12345", "select * from table1", null);  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheID id2 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	assertEquals(id1, id2);
-    }
-    
-    public void testIDNotEquals1(){
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheID id2 = new CacheID("2345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	assertTrue(!id1.equals(id2));
-    }
-    
-    public void testIDNotEquals2(){
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheID id2 = new CacheID("12345", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-    	assertTrue(!id1.equals(id2));
-    }
-    
-    public void testIDNotEquals3(){
-    	List variables1 = new ArrayList();
-    	variables1.add(new Integer(6));
-    	variables1.add("aba"); //$NON-NLS-1$
-    	CacheID id1 = new CacheID("12345", "select * from table1",variables1);  //$NON-NLS-1$//$NON-NLS-2$
-    	List variables2 = new ArrayList();
-    	variables2.add(new Integer(6));
-    	variables2.add("aaa"); //$NON-NLS-1$
-    	CacheID id2 = new CacheID("12345", "select * from table1",variables2);  //$NON-NLS-1$//$NON-NLS-2$
-    	assertTrue(!id1.equals(id2));
-    }
-    
-    public void testIDNotEquals4(){
-    	List variables1 = null;
-    	CacheID id1 = new CacheID("12345", "select * from table1",variables1);  //$NON-NLS-1$//$NON-NLS-2$
-    	List variables2 = new ArrayList();
-    	variables2.add(new Integer(6));
-    	variables2.add("aaa"); //$NON-NLS-1$
-    	CacheID id2 = new CacheID("12345", "select * from table1",variables2);  //$NON-NLS-1$//$NON-NLS-2$
-    	assertTrue(!id1.equals(id2));
-    }
-    
-    public void testIDNotEquals5(){
-    	List variables1 = new ArrayList();
-    	variables1.add(new Integer(6));
-    	variables1.add("aaa"); //$NON-NLS-1$
-    	variables1.add("aaa"); //$NON-NLS-1$
-    	CacheID id1 = new CacheID("12345", "select * from table1",variables1);  //$NON-NLS-1$//$NON-NLS-2$
-    	List variables2 = new ArrayList();
-    	variables2.add(new Integer(6));
-    	variables2.add("aaa"); //$NON-NLS-1$
-    	CacheID id2 = new CacheID("12345", "select * from table1",variables2);  //$NON-NLS-1$//$NON-NLS-2$
-    	assertTrue(!id1.equals(id2));
-    }
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestResultSetCache.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestResultSetCache.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/cache/TestResultSetCache.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,240 +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.cache;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import com.metamatrix.cache.FakeCache.FakeCacheFactory;
-import com.metamatrix.common.buffer.impl.SizeUtility;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-
-public class TestResultSetCache {
-    
-    @Test public void testSetAndGetResultsForSession() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result1 = new List[]{new ArrayList()};
-    	cache.setResults(id1, new CacheResults(result1, 1, true ), "req1");  //$NON-NLS-1$
-    	CacheID id2 = new CacheID("12346", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result2 = new List[]{new ArrayList()};
-    	cache.setResults(id2, new CacheResults(result2, 1, true), "req2" );  //$NON-NLS-1$
-    	assertEquals(result1, cache.getResults(id1, new int[]{1, 500}).getResults()); 
-    	assertEquals(result2, cache.getResults(id2, new int[]{1, 500}).getResults()); 
-    }
-    
-    @Test public void testSetAndGetResultsForVDB() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result1 = new List[]{new ArrayList()};
-    	cache.setResults(id1, new CacheResults(result1, 1, true) , "req1");  //$NON-NLS-1$
-    	CacheID id2 = new CacheID("vdb2", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result2 = new List[]{new ArrayList()};
-    	cache.setResults(id2, new CacheResults(result2, 1, true ), "req2");  //$NON-NLS-1$
-    	assertEquals(cache.getResults(id1, new int[]{1, 500}).getResults(), result1); 
-    	assertEquals(cache.getResults(id2, new int[]{1, 500}).getResults(), result2); 
-    }
-    
-//    @Test public void testRemoveConnection() throws Exception{
-//    	Properties props = new Properties();
-//    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-//    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-//    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-//    	ResultSetCache cache = new ResultSetCache(props);
-//    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-//    	List[] result1 = new List[]{new ArrayList()};
-//    	cache.setResults(id1, new CacheResults(result1, 0, true ));  //$NON-NLS-1$//$NON-NLS-2$
-//    	CacheID id2 = new CacheID("12346",  "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-//    	List[] result2 = new List[]{new ArrayList()};
-//    	cache.setResults(id2, new CacheResults(result2, 0, true) );  //$NON-NLS-1$//$NON-NLS-2$
-//    	cache.removeConnection(id1.getScopeID());
-//    	assertNull(cache.getResults(id1, new int[]{0, 500})); //$NON-NLS-1$
-//    }
-//    
-//    @Test public void testRemoveVDB() throws Exception{
-//    	Properties props = new Properties();
-//    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-//    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-//    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB);
-//    	ResultSetCache cache = new ResultSetCache(props);
-//    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-//    	List[] result1 = new List[]{new ArrayList()};
-//    	cache.setResults(id1, new CacheResults(result1, 0, true ));  //$NON-NLS-1$//$NON-NLS-2$
-//    	CacheID id2 = new CacheID("vdb2", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-//    	List[] result2 = new List[]{new ArrayList()};
-//    	cache.setResults(id2, new CacheResults(result2, 0, true ));  //$NON-NLS-1$//$NON-NLS-2$
-//    	cache.removeVDB(id1.getScopeID());
-//    	assertNull(cache.getResults(id1, new int[]{0, 500})); //$NON-NLS-1$
-//    }
-    
-    @Test public void testClearAllCache() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result1 = new List[]{new ArrayList()};
-    	cache.setResults(id1, new CacheResults(result1, 1, true), "req1" );  //$NON-NLS-1$
-    	CacheID id2 = new CacheID("vdb2", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-    	List[] result2 = new List[]{new ArrayList()};
-    	cache.setResults(id2, new CacheResults(result2, 1, true ), "req2");  //$NON-NLS-1$
-    	cache.clear();
-    	assertNull(cache.getResults(id1, new int[]{1, 500})); 
-    }
-    
-    @Test public void testSetAndGetResultsForSession1() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	List row1 = new ArrayList();
-    	row1.add("1"); //$NON-NLS-1$
-    	List row2 = new ArrayList();
-    	row2.add("2"); //$NON-NLS-1$
-    	List row3 = new ArrayList();
-    	row3.add("3"); //$NON-NLS-1$
-    	List row4 = new ArrayList();
-    	row4.add("4"); //$NON-NLS-1$
-    	List[] result1 = new List[]{row1, row2, row3, row4};
-    	cache.setResults(id1, new CacheResults(result1, 1, true ), "req1");   //$NON-NLS-1$
-    	assertEquals(cache.getResults(id1, new int[]{1, 500}).getResults(), result1); 
-    	assertEquals(cache.getResults(id1, new int[]{1, 2}).getResults()[0], row1);
-    }
-    
-    @Test public void testSetAndGetResultsForSession2() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("12345", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	List row1 = new ArrayList();
-    	row1.add("1"); //$NON-NLS-1$
-    	List row2 = new ArrayList();
-    	row2.add("2"); //$NON-NLS-1$
-    	List row3 = new ArrayList();
-    	row3.add("3"); //$NON-NLS-1$
-    	List row4 = new ArrayList();
-    	row4.add("4"); //$NON-NLS-1$
-    	List[] result1 = new List[]{row1, row2, row3, row4};
-    	cache.setResults(id1, new CacheResults(result1, 1, false) , "req1");   //$NON-NLS-1$
-    	List row5 = new ArrayList();
-    	row5.add("5"); //$NON-NLS-1$
-    	List[] result2 = new List[]{row5};
-    	cache.setResults(id1, new CacheResults(result2, 5, true), "req1" );  //$NON-NLS-1$
-    	assertEquals(cache.getResults(id1, new int[]{1, 500}).getResults()[4], row5); 
-    	assertEquals(cache.getResults(id1, new int[]{1, 2}).getResults()[0], row1);
-    }
-    
-    @Test public void testMaxSize() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "1"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheResults result1 = createResults(500000, 1, 1, true);
-    	CacheID id2 = new CacheID("vdb2", "select * from table2");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheResults result2 = createResults(500000, 1, 1, true);
-    	CacheID id3 = new CacheID("vdb1", "select * from table3");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheResults result3 = createResults(500000, 1, 1, true);
-    	//add two results
-    	cache.setResults(id1, result1, "req1" );   //$NON-NLS-1$
-    	cache.setResults(id2, result2, "req2" );   //$NON-NLS-1$
-    	//use the first one
-    	assertNotNull(cache.getResults(id1, new int[]{1, 500}));
-    	//add one more result. Because the max size is 1mb, the
-    	//third one can not be added
-       	cache.setResults(id3, result3, "req3" );  //$NON-NLS-1$
-       	assertNull(cache.getResults(id3, new int[]{1, 500})); 
-    	//reduced the size and try again. The second one should
-    	//be removed
-       	result3 = createResults(1000, 1, 1, true);
-       	cache.setResults(id3, result3, "req4" );  //$NON-NLS-1$
-       	assertNotNull(cache.getResults(id3, new int[]{1, 500})); 
-    }
-    
-    private CacheResults createResults(int size, int firstRow, int rowCnt, boolean isFinal){
-    	List[] results = new List[rowCnt];
-    	for(int i=0; i<rowCnt; i++){
-    		results[i] = new ArrayList();
-    	}
-    	CacheResults cr = new CacheResults(results, firstRow, isFinal);
-    	cr.setSize(size);
-    	return cr;
-    }
-    
-    
-    @Test public void testComputeSize() throws Exception{
-    	int cnt = 1000000;
-    	List[] results = new List[cnt];
-		List row = new ArrayList();
-		row.add("ajwuiotbn0w49yunq9 tjfvwioprkpo23bltplql;galkg"); //$NON-NLS-1$
-		row.add(new Long(1242534776));
-		row.add(new Double(24235.5476884));
-    	for(int i=0; i<cnt; i++){
-    		results[i] = row;
-    	} 	
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheResults result = new CacheResults(results, 1, true);
-    	cache.setResults(id1, result, "req1" );  //$NON-NLS-1$
-    	
-        int size = (SizeUtility.IS_64BIT ? 296000000 : 256000000);
-    	assertEquals(size, result.getSize());
-    }
-    
-    @Test(expected=MetaMatrixRuntimeException.class) public void testBatchNotContiguous() throws Exception{
-    	Properties props = new Properties();
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "0"); //$NON-NLS-1$
-    	props.setProperty(ResultSetCache.RS_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_CONN);
-    	ResultSetCache cache = new ResultSetCache(props, new FakeCacheFactory());
-    	CacheID id1 = new CacheID("vdb1", "select * from table1");  //$NON-NLS-1$//$NON-NLS-2$
-    	CacheResults result1 = createResults(1000, 1, 100, false);
-    	CacheResults result3 = createResults(2000, 102, 200, true);
-    	cache.setResults(id1, result1 , "req1");  //$NON-NLS-1$
-   		cache.setResults(id1, result3, "req1" );  //$NON-NLS-1$
-    }
-    
-}

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -36,12 +36,10 @@
 import org.mockito.Mockito;
 import org.teiid.connector.api.Connector;
 import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.datamgr.impl.TestConnectorWorkItem.QueueResultsReceiver;
 
-import com.metamatrix.cache.FakeCache;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
-import com.metamatrix.dqp.message.AtomicResultsMessage;
 
 /**
  * JUnit test for TestConnectorManagerImpl
@@ -81,46 +79,6 @@
     }
     
     
-    @Test public void testCaching() throws Exception {
-    	ConnectorManager cm = getConnectorManager(helpGetAppProps());
-		Properties rsCacheProps = new Properties();
-    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "20"); 
-    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "3600000"); 
-    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, "vdb"); 
-
-    	cm.rsCache = new ResultSetCache(rsCacheProps, new FakeCache.FakeCacheFactory());
-    	//cm.start(Mockito.mock(ApplicationEnvironment.class));
-    	cm.workItemFactory = new ConnectorWorkItemFactory(cm, cm.rsCache, true);
-    	FakeWorkManager wm = new FakeWorkManager();
-    	FakeConnector fc = (FakeConnector)cm.getConnector();
-        assertEquals(0, fc.getConnectionCount());
-        assertEquals(0, fc.getExecutionCount());
-        AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
-        request.setUseResultSetCache(true);
-        QueueResultsReceiver receiver = new QueueResultsReceiver();
-        cm.executeRequest(wm,receiver, request);
-        AtomicResultsMessage arm = receiver.getResults().poll(1000, TimeUnit.MILLISECONDS);
-        assertEquals(-1, arm.getFinalRow());
-        //get the last batch - it will be 0 sized
-        cm.requstMore(request.getAtomicRequestID());
-        assertNotNull(receiver.getResults().poll(1000, TimeUnit.MILLISECONDS));
-        cm.closeRequest(request.getAtomicRequestID());
-        assertEquals(1, fc.getConnectionCount());
-        assertEquals(1, fc.getExecutionCount());
-
-        //this request should hit the cache
-        AtomicRequestMessage request1 = TestConnectorWorkItem.createNewAtomicRequestMessage(2, 1);
-        request1.setUseResultSetCache(true);
-        QueueResultsReceiver receiver1 = new QueueResultsReceiver();
-        cm.executeRequest(wm,receiver1, request1);
-        arm = receiver1.getResults().poll(1000, TimeUnit.MILLISECONDS);
-        assertEquals(5, arm.getFinalRow());
-        assertEquals(1, fc.getConnectionCount());
-        assertEquals(1, fc.getExecutionCount());
-        
-        cm.stop();
-    }
-    
     @Test public void testDefect19049() throws Exception {
         ConnectorManager cm = getConnectorManager(helpGetAppProps());
         AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -62,7 +62,7 @@
         super.setUp();
         request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
         csm = TestConnectorManagerImpl.getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
-        csm.workItemFactory = new ConnectorWorkItemFactory(csm, null, true);
+        csm.workItemFactory = new ConnectorWorkItemFactory(csm, true);
     }
 
     void helpAssureOneState() throws Exception {

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -196,7 +196,7 @@
     
 	public void helpTestVisibilityFails(String sql) throws Exception {
         RequestMessage reqMsg = exampleRequestMessage(sql); 
-        reqMsg.setTxnAutoWrapMode(ExecutionProperties.AUTO_WRAP_OFF);
+        reqMsg.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_OFF);
         Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
         ResultsMessage results = message.get(50000, TimeUnit.MILLISECONDS);
         assertEquals("[QueryValidatorException]Group does not exist: BQT3.SmallA", results.getException().toString()); //$NON-NLS-1$
@@ -222,7 +222,7 @@
         RequestMessage reqMsg = exampleRequestMessage(sql);
         DQPWorkContext.getWorkContext().setSessionToken(new SessionToken(sessionid, userName));
         if (txnAutoWrap) {
-        	reqMsg.setTxnAutoWrapMode(ExecutionProperties.AUTO_WRAP_ON);
+        	reqMsg.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_ON);
         }
 
         Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -117,8 +117,7 @@
         rm.setTransactionService(new FakeTransactionService());
         RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$
         RequestID requestID = new RequestID(SESSION_STRING, 1);
-        RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);  
-        assertTrue(workItem.resultsCursor.resultsRequested);
+        addRequest(rm, r0, requestID, null, null);  
     }
     
     public void testWarnings1() {

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,11 +22,7 @@
 
 package org.teiid.dqp.internal.process;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import javax.resource.spi.work.WorkManager;
 
@@ -39,11 +35,7 @@
 import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
 import org.teiid.dqp.internal.datamgr.impl.FakeWorkManager;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -55,8 +47,6 @@
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 import com.metamatrix.query.parser.QueryParser;
-import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.dynamic.SimpleQueryProcessorFactory;
 import com.metamatrix.query.resolver.QueryResolver;
 import com.metamatrix.query.sql.lang.Command;
@@ -307,25 +297,6 @@
         }
     }
     
-    private static class FakeProcessorPlan implements ProcessorPlan {
-        public Object clone() {return this;}
-        public void close() throws MetaMatrixComponentException {}
-        public List getAndClearWarnings() {return null;}
-        public CommandContext getContext() {return null;}
-        public List getOutputElements() {return Collections.EMPTY_LIST;}
-        public void initialize(CommandContext context,ProcessorDataManager dataMgr,BufferManager bufferMgr) {}
-        public TupleBatch nextBatch() throws BlockedException,MetaMatrixComponentException {
-        	ArrayList one = new ArrayList(); one.add("1");
-        	ArrayList two = new ArrayList(); two.add("2");
-        	List[] results = {one, two};
-        	return new TupleBatch(1, results);
-        }
-        public void open() throws MetaMatrixComponentException {}
-        public void reset() {}
-        public Map getDescriptionProperties() {return null;}
-        public Collection getChildPlans() { return Collections.EMPTY_LIST; }
-    }
-
     private static class FakeConnectorManager extends ConnectorManager {
         private int failOnCall = 10000;
         private int calls = 0;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -55,7 +55,7 @@
     public Map[] helpGetMetadata(String sql, QueryMetadataInterface metadata, VDBMetaData vdb) throws Exception {
         // Prepare sql 
         Command command = QueryParser.getQueryParser().parseCommand(sql);
-        QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, false, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, metadata, AnalysisRecord.createNonRecordingRecord());
         
         // Create components
         PreparedPlanCache prepPlanCache = new PreparedPlanCache();
@@ -69,7 +69,7 @@
         RequestMessage requestMsg = new RequestMessage(sql);
         TestDQPCoreRequestHandling.addRequest(requestMgr, requestMsg, requestID, command, null); 
         
-        MetaDataProcessor mdProc = new MetaDataProcessor(requestMgr, prepPlanCache);
+        MetaDataProcessor mdProc = new MetaDataProcessor(requestMgr, prepPlanCache, "MyVDB", 1);
                      
         return mdProc.processMessage(requestID, workContext, null, true).getColumnMetadata();    
     }
@@ -118,7 +118,7 @@
         PreparedPlanCache prepPlanCache = new PreparedPlanCache();
         
         // Initialize components
-        MetaDataProcessor mdProc = new MetaDataProcessor(new DQPCore(), prepPlanCache);
+        MetaDataProcessor mdProc = new MetaDataProcessor(new DQPCore(), prepPlanCache, "MyVDB", 1);
                      
         DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
         return mdProc.processMessage(workContext.getRequestID(1), workContext, sql, true);    
@@ -159,8 +159,8 @@
         while(iter.hasNext()) {
             String type = (String) iter.next();
             Class typeClass = DataTypeManager.getDataTypeClass(type);
-            MetaDataProcessor processor = new MetaDataProcessor(null, null);
-            Map columnMetadata = processor.getDefaultColumn("vdb", 1, "t", "c", typeClass); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+            MetaDataProcessor processor = new MetaDataProcessor(null, null, "vdb", 1);
+            Map columnMetadata = processor.getDefaultColumn("t", "c", typeClass); //$NON-NLS-1$ //$NON-NLS-2$
             verifyColumn(columnMetadata, type);            
         }               
     }

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,16 +22,16 @@
 
 package org.teiid.dqp.internal.process;
 
+import static org.junit.Assert.*;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.*;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.teiid.dqp.internal.process.PreparedPlanCache;
 import org.teiid.dqp.internal.process.PreparedPlanCache.CacheID;
+import org.teiid.dqp.internal.process.PreparedPlanCache.PreparedPlan;
 
 import com.metamatrix.api.exception.query.QueryParserException;
 import com.metamatrix.query.analysis.AnalysisRecord;
@@ -59,12 +59,12 @@
     @Test public void testPutPreparedPlan(){
     	PreparedPlanCache cache = new PreparedPlanCache();
     	
-    	CacheID id = new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 1);
+    	CacheID id = new CacheID(token, pi, EXAMPLE_QUERY + 1);
     	
     	//No PreparedPlan at the begining
     	assertNull(cache.getPreparedPlan(id));
     	//create one
-    	cache.putPreparedPlan(id, true, new PreparedPlanCache.PreparedPlan());
+    	cache.putPreparedPlan(id, true, new PreparedPlan());
     	//should have one now
     	assertNotNull("Unable to get prepared plan from cache", cache.getPreparedPlan(id)); //$NON-NLS-1$
     }
@@ -75,7 +75,7 @@
     	helpPutPreparedPlans(cache, token2, 0, 15);
     	
     	//read an entry for session2 (token2)
-    	PreparedPlanCache.PreparedPlan pPlan = cache.getPreparedPlan(new PreparedPlanCache.CacheID(token2, pi, EXAMPLE_QUERY + 12));
+    	PreparedPlan pPlan = cache.getPreparedPlan(new CacheID(token2, pi, EXAMPLE_QUERY + 12));
     	assertNotNull("Unable to get prepared plan from cache", pPlan); //$NON-NLS-1$
     	assertEquals("Error getting plan from cache", new RelationalPlan(new ProjectNode(12)).toString(), pPlan.getPlan().toString()); //$NON-NLS-1$
     	assertEquals("Error getting command from cache", EXAMPLE_QUERY + 12, pPlan.getCommand().toString()); //$NON-NLS-1$
@@ -90,24 +90,24 @@
     	helpPutPreparedPlans(cache, token, 1, 1);
     	helpPutPreparedPlans(cache, token2, 1, 1);
     	//should have one
-    	assertNotNull("Unable to get prepared plan from cache for token", cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$
+    	assertNotNull("Unable to get prepared plan from cache for token", cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$
     	cache.clearAll();
     	//should not exist for token
-    	assertNull("Failed remove from cache", cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ 
+    	assertNull("Failed remove from cache", cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ 
     	//should not exist for token2
-    	assertNull("Unable to get prepared plan from cache for token2", cache.getPreparedPlan(new PreparedPlanCache.CacheID(token2, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ 
+    	assertNull("Unable to get prepared plan from cache for token2", cache.getPreparedPlan(new CacheID(token2, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ 
     }
     
     @Test public void testMaxSize(){
         PreparedPlanCache cache = new PreparedPlanCache(100);
         helpPutPreparedPlans(cache, token, 0, 101);
         //the first one should be gone because the max size is 100
-        assertNull(cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 0))); 
+        assertNull(cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 0))); 
         
-        assertNotNull(cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 12))); 
+        assertNotNull(cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 12))); 
         helpPutPreparedPlans(cache, token, 102, 50);
         //"sql12" should still be there based on lru  policy
-        assertNotNull(cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 12))); 
+        assertNotNull(cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 12))); 
         
         helpPutPreparedPlans(cache, token2, 0, 121);
         helpPutPreparedPlans(cache, token, 0, 50);
@@ -121,12 +121,12 @@
         
         // Add 1 plan and verify it is not in the cache
         helpPutPreparedPlans(cache, token, 0, 1);
-        assertNull(cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 0))); 
+        assertNull(cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 0))); 
         assertEquals(0, cache.getSpaceUsed());
         
         // Add another plan and verify it is not in the cache
         helpPutPreparedPlans(cache, token, 1, 1);
-        assertNull(cache.getPreparedPlan(new PreparedPlanCache.CacheID(token, pi, EXAMPLE_QUERY + 1))); 
+        assertNull(cache.getPreparedPlan(new CacheID(token, pi, EXAMPLE_QUERY + 1))); 
         assertEquals(0, cache.getSpaceUsed());        
     }
     
@@ -148,9 +148,9 @@
 			} catch (QueryParserException e) {
 				throw new RuntimeException(e);
 			}
-	    	CacheID id = new PreparedPlanCache.CacheID(session, pi, dummy.toString());
+	    	CacheID id = new CacheID(session, pi, dummy.toString());
 
-	    	PreparedPlanCache.PreparedPlan pPlan = new PreparedPlanCache.PreparedPlan();
+	    	PreparedPlan pPlan = new PreparedPlan();
     		cache.putPreparedPlan(id, true, pPlan);
     		pPlan.setCommand(dummy); 
     		pPlan.setPlan(new RelationalPlan(new ProjectNode(i)));

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -92,21 +92,19 @@
     }
     
     static public void helpTestProcessing(String preparedSql, List values, List[] expected, ProcessorDataManager dataManager, CapabilitiesFinder capFinder, QueryMetadataInterface metadata, TestablePreparedPlanCache prepPlanCache, boolean callableStatement, boolean isSessionSpecific, boolean isAlreadyCached, VDBMetaData vdb) throws Exception { 
-        TestablePreparedPlanCache pPlanCache = null;
-        CapabilitiesFinder cFinder = null;
-        ProcessorDataManager dManager = null;
-        
         if ( dataManager == null ) {
             // Construct data manager with data
-            dManager = new FakeDataManager();
-            TestProcessor.sampleData1((FakeDataManager)dManager);    
-        } else dManager = dataManager;
+        	dataManager = new FakeDataManager();
+            TestProcessor.sampleData1((FakeDataManager)dataManager);    
+        }
         
-        if ( capFinder == null ) cFinder = new DefaultCapabilitiesFinder();
-        else cFinder = capFinder;
+        if ( capFinder == null ) {
+        	capFinder = new DefaultCapabilitiesFinder();
+        }
         
-        if ( prepPlanCache == null ) pPlanCache = new TestablePreparedPlanCache();
-        else pPlanCache = prepPlanCache;
+        if ( prepPlanCache == null ) {
+        	prepPlanCache = new TestablePreparedPlanCache();
+        }
         
 		// expected cache hit count
         int exHitCount = -1;
@@ -117,28 +115,41 @@
 		 * get the plan twice.  Otherwise, we want it to be 1.
 		 */
         if ( isAlreadyCached ) {
-        	exHitCount = pPlanCache.hitCount + 2;
+        	exHitCount = prepPlanCache.hitCount + 2;
         } else {
-        	exHitCount = pPlanCache.hitCount + 1;
+        	exHitCount = prepPlanCache.hitCount + 1;
         }
         
         //Create plan or used cache plan if isPlanCached
-        PreparedStatementRequest plan = TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, cFinder, metadata, pPlanCache, SESSION_ID, callableStatement, false, vdb);
+        PreparedStatementRequest plan = TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, capFinder, metadata, prepPlanCache, SESSION_ID, callableStatement, false, vdb);
 
         // Run query
         TestProcessor.doProcess(plan.processPlan, dataManager, expected, plan.context);
         
         //test cached plan
-    	plan = TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, cFinder, metadata, pPlanCache, SESSION_ID, callableStatement, false,vdb);
+    	plan = TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, capFinder, metadata, prepPlanCache, SESSION_ID, callableStatement, false,vdb);
     	
         //make sure the plan is only created once
-        assertEquals("should reuse the plan", exHitCount, pPlanCache.hitCount); //$NON-NLS-1$
+        assertEquals("should reuse the plan", exHitCount, prepPlanCache.hitCount); //$NON-NLS-1$
                 
+        // If we are using FakeDataManager, stop command recording to prevent
+        // duplicate commands
+        boolean dmir = false;
+        if (dataManager instanceof FakeDataManager && ((FakeDataManager) dataManager).isRecordingCommands()) {
+        	dmir = true;
+        	((FakeDataManager) dataManager).setRecordingCommands(false);
+        }
         // Run query again
         TestProcessor.doProcess(plan.processPlan, dataManager, expected, plan.context);
         
+        // If we are using FakeDataManager and we stopped it from recording, 
+        // start it back up again
+        if (dmir == true) {
+        	((FakeDataManager) dataManager).setRecordingCommands(true);
+        }
+        
         //get the plan again with a new connection
-        assertNotNull(TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, cFinder, metadata, pPlanCache, 7, callableStatement, false, vdb));
+        assertNotNull(TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, capFinder, metadata, prepPlanCache, 7, callableStatement, false, vdb));
 
         /*
          * If the command is not specific to a session we expect
@@ -147,7 +158,7 @@
          * created and the hit count will be unchanged.
          */
         if ( !isSessionSpecific ) exHitCount++;
-        assertEquals(exHitCount, pPlanCache.hitCount); 
+        assertEquals(exHitCount, prepPlanCache.hitCount); 
 	}
     	    
     @Test public void testWhere() throws Exception { 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -48,19 +48,53 @@
  */
 public class TestPreparedStatementBatchedUpdate {
 
+    @Test public void testBatchedUpdatePushdown() throws Exception {
+        // Create query 
+		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
+        
+		// Create a testable prepared plan cache
+		TestablePreparedPlanCache prepPlanCache = new TestablePreparedPlanCache();
+		
+		// Construct data manager with data
+        HardcodedDataManager dataManager = new HardcodedDataManager();
+		dataManager.addData("UPDATE pm1.g1 SET e1 = ?, e3 = ? WHERE pm1.g1.e2 = ?", new List[] {Arrays.asList(4)}); //$NON-NLS-1$
+		// Source capabilities must support batched updates
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+        
+        // batch with two commands
+		ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a",  Boolean.FALSE, new Integer(0) })));  //$NON-NLS-1$
+    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
+    	
+    	List<?>[] expected = new List[] { 
+                Arrays.asList(4)
+        };
+    	
+    	// Create the plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false,FakeMetadataFactory.example1VDB());
+    	Update update = (Update)dataManager.getCommandHistory().iterator().next();
+    	assertTrue(((Constant)update.getChangeList().getClauses().get(0).getValue()).isMultiValued());
+    }
+    
     /**
      * Test prepared statements that use batched updates using the same prepared
-     * command with varying number of commands in the batch.
+     * command with same number of commands in the batch.
      * <p>
-     * The test verifies that no errors occur when planning the same batched 
-     * command SQL with varying number of batched command parameter value sets.
-     * For example, if the first executeBatch() call were to occur with three 
-     * batched commands a repeated call with only two batched commands should 
-     * not result in an error.
+     * The test verifies that no errors occur when planning and executing the 
+     * same batched command SQL with the same number of batched command parameter 
+     * value sets.  For example, if the first executeBatch() call were to occur 
+     * with two batched commands a repeated call with two batched commands  
+     * should not result in an error during planning or execution and the value 
+     * used in the second batched command should be used instead of any values 
+     * from the first batched command.
      * <p>
-     * The test also verifies that a cached version of the PreparedStatement plan 
-     * is used on each subsequent execution of the same SQL command even though 
-     * the number of batched commands may vary. 
+     * The test also verifies that the correct SQL is pushed to the data manager 
+     * to verify that the parameter substitution occurred and is correct and the
+     * correct number of statements made it to the data manager for the respective 
+     * batch command.
      * <p>
      * The batched command "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"
      * will appear as:
@@ -69,51 +103,169 @@
      * UPDATE pm1.g1 SET pm1.g1.e1=null, pm1.g1.e3=false WHERE pm1.g1.e2=1
      * <p>
      * UPDATE pm1.g1 SET pm1.g1.e1='a', pm1.g1.e3=false WHERE pm1.g1.e2=0
-     * <p>
-     * UPDATE pm1.g1 SET pm1.g1.e1='a', pm1.g1.e3=false WHERE pm1.g1.e2=0
-     * UPDATE pm1.g1 SET pm1.g1.e1=null, pm1.g1.e3=false WHERE pm1.g1.e2=1
-     * UPDATE pm1.g1 SET pm1.g1.e1='c', pm1.g1.e3=true WHERE pm1.g1.e2=4
      * UPDATE pm1.g1 SET pm1.g1.e1='b', pm1.g1.e3=true WHERE pm1.g1.e2=5
      * <p>
-     * The result should be that only one command is in the plan cache and 
-     * no plan creation or validation errors will occur.
+     * The result should be that one command is in the plan cache and 
+     * no plan creation, validation, or execution errors will occur and 
+     * a predetermined set of queries were executed in the data manager.
      * 
      * @throws Exception
      */
-    @Test public void testPlanCache_VarNumCmds() throws Exception {
+    @Test public void testUpdateSameNumCmds() throws Exception {
         // Create query 
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
+		// Create a testable prepared plan cache
+		TestablePreparedPlanCache prepPlanCache = new TestablePreparedPlanCache();
+		
+		// Construct data manager with data
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);    
+		
+		// Source capabilities must support batched updates
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
+        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
-		// Create PrepareedPlanCache
-		PreparedPlanCache prepPlanCache = new PreparedPlanCache();
+        // Something to hold our final query list
+        List<String> finalQueryList = new ArrayList<String>(13);
+        
+		// Create expected results
+        // first command should result in 2 rows affected
+        // second command should result in 2 rows affected  
+        List<?>[] expected = new List[] { 
+            Arrays.asList(new Object[] { new Integer(2) }),
+            Arrays.asList(new Object[] { new Integer(2) })
+        };    
+
+        // batch with two commands
+		List<List<Object>> values = new ArrayList<List<Object>>(2);
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a",  Boolean.FALSE, new Integer(0) })));  //$NON-NLS-1$
+    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
+    	
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
+    	
+    	// Create the plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false,FakeMetadataFactory.example1VDB());
+
+    	// Repeat with different number of commands in batch
+    	// Create expected results
+        // first command should result in 2 rows affected
+        expected = new List[] { 
+                Arrays.asList(new Object[] { new Integer(2) }),
+                Arrays.asList(new Object[] { new Integer(0) })
+        };    
+
+        // batch with two commands
+		values = new ArrayList<List<Object>>(1);
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a",  Boolean.FALSE, new Integer(0) })));  //$NON-NLS-1$
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "b",  Boolean.TRUE, new Integer(5) })));  //$NON-NLS-1$
+    	
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5")); //$NON-NLS-1$
+    	
+    	// Use the cached plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
+
+    	// Verify all the queries that were run
+    	assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
+    }
+    
+    /**
+     * Test prepared statements that use batched updates using the same prepared
+     * command with same number of commands in the batch.  Update is performed 
+     * against a view model instead of a source model.
+     * <p>
+     * The test verifies that no errors occur when planning and executing the 
+     * same batched command SQL with the same number of batched command parameter 
+     * value sets.  For example, if the first executeBatch() call were to occur 
+     * with two batched commands a repeated call with two batched commands  
+     * should not result in an error during planning or execution and the value 
+     * used in the second batched command should be used instead of any values 
+     * from the first batched command.
+     * <p>
+     * The test also verifies that the correct SQL is pushed to the data manager 
+     * to verify that the parameter substitution occurred and is correct and the
+     * correct number of statements made it to the data manager for the respective 
+     * batch command.
+     * <p>
+     * The batched command "UPDATE vm1.g1 SET vm1.g1.e2=? WHERE vm1.g1.e1=?"
+     * will appear as:
+     * <p>
+     * UPDATE pm1.g1 SET e2=0 WHERE pm1.g1.e1='a'
+     * UPDATE pm1.g1 SET e2=1 WHERE pm1.g1.e1='b'
+     * <p>
+     * UPDATE pm1.g1 SET e2=2 WHERE pm1.g1.e1='c'
+     * UPDATE pm1.g1 SET e2=3 WHERE pm1.g1.e1='d'
+     * <p>
+     * The result should be that one command is in the plan cache and 
+     * no plan creation, validation, or execution errors will occur and 
+     * a predetermined set of queries were executed in the data manager.
+     * 
+     * @throws Exception
+     */
+    @Test public void testUpdateSameNumCmds_Virtual() throws Exception {
+        // Create query 
+		String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e2=? WHERE vm1.g1.e1=?"; //$NON-NLS-1$
+		// Create a testable prepared plan cache
+		TestablePreparedPlanCache prepPlanCache = new TestablePreparedPlanCache();
 		
+		// Construct data manager with data
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);    
+		
+		// Source capabilities must support batched updates
+        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        BasicSourceCapabilities caps = new BasicSourceCapabilities();
+        caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
+        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+        
+        // Something to hold our final query list
+        List<String> finalQueryList = new ArrayList<String>();
+        
+		// Create expected results
+        List<?>[] expected = new List[] { 
+            Arrays.asList(3),
+            Arrays.asList(1)
+        };    
+
         // batch with two commands
 		ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
-		values.add( new ArrayList<Object>( Arrays.asList( new Object[] { "a",  Boolean.FALSE, new Integer(0) } ) ) );  //$NON-NLS-1$
-    	values.add( new ArrayList<Object>( Arrays.asList( new Object[] { null, Boolean.FALSE, new Integer(1) } ) ) );
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(0), "a" })));  //$NON-NLS-1$
+    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(1), "b" })));  //$NON-NLS-1$
     	
-        //Create plan
-    	TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, prepPlanCache);
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 0 WHERE pm1.g1.e1 = 'a'")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 1 WHERE pm1.g1.e1 = 'b'")); //$NON-NLS-1$
+    	
+    	// Create the plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
 
-        // batch with one command
+    	// Repeat
+        expected = new List[] { 
+    		Arrays.asList(1),
+            Arrays.asList(0)
+        };    
+
+        // batch with two commands
 		values = new ArrayList<ArrayList<Object>>(1);
-		values.add( new ArrayList<Object>( Arrays.asList( new Object[] { "a",  Boolean.FALSE, new Integer(0) } ) ) );  //$NON-NLS-1$
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(2), "c" })));  //$NON-NLS-1$
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(3), "d" })));  //$NON-NLS-1$
     	
-        //Create plan
-		TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, prepPlanCache);
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 2 WHERE pm1.g1.e1 = 'c'")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e1 = 'd'")); //$NON-NLS-1$
+    	
+    	// Use the cached plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
 
-        // batch with four commands
-		values = new ArrayList<ArrayList<Object>>(4);
-		values.add( new ArrayList<Object>( Arrays.asList( new Object[] { "a",  Boolean.FALSE, new Integer(0) } ) ) );  //$NON-NLS-1$
-    	values.add( new ArrayList<Object>( Arrays.asList( new Object[] { null, Boolean.FALSE, new Integer(1) } ) ) );
-		values.add( new ArrayList<Object>( Arrays.asList( new Object[] { "c",  Boolean.TRUE, new Integer(4) } ) ) );  //$NON-NLS-1$
-		values.add( new ArrayList<Object>( Arrays.asList( new Object[] { "b",  Boolean.TRUE, new Integer(5) } ) ) );  //$NON-NLS-1$
-    	
-        //Create plan
-		TestPreparedStatement.helpGetProcessorPlan(preparedSql, values, prepPlanCache);
-		assertEquals("PreparedPlanCache size is invalid - ", 1, prepPlanCache.getSpaceUsed() ); //$NON-NLS-1$
+    	// Verify all the queries that were run
+    	assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
     }
-
+    
     /**
      * Test prepared statements that use batched updates using the same prepared
      * command with varying number of commands in the batch.
@@ -124,14 +276,10 @@
      * with two batched commands a repeated call with only one batched command 
      * should not result in an error during planning or execution.
      * <p>
-     * The test also verifies that a cached version of the PreparedStatement plan 
-     * is used on each subsequent execution of the same SQL command even though 
-     * the number of batched commands may vary. 
-     * <p>
      * The test also verifies that the correct SQL is pushed to the data manager 
      * to verify that the parameter substitution occurred and is correct and the
      * correct number of statements made it to the data manager for the respective 
-     * batch.
+     * batch command.
      * <p>
      * The batched command "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"
      * will appear as:
@@ -146,16 +294,15 @@
      * UPDATE pm1.g1 SET pm1.g1.e1='c', pm1.g1.e3=true WHERE pm1.g1.e2=4
      * UPDATE pm1.g1 SET pm1.g1.e1='b', pm1.g1.e3=true WHERE pm1.g1.e2=5
      * <p>
-     * The result should be that only one command is in the plan cache and 
+     * The result should be that three commands are in the plan cache and 
      * no plan creation, validation, or execution errors will occur and 
      * a predetermined set of queries were executed in the data manager.
      * 
      * @throws Exception
      */
-    @Test public void testProcessor_VarNumCmds() throws Exception {
+    @Test public void testUpdateVarNumCmds() throws Exception {
         // Create query 
 		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
-        int executionsPerTest = 2;
 		// Create a testable prepared plan cache
 		TestablePreparedPlanCache prepPlanCache = new TestablePreparedPlanCache();
 		
@@ -186,10 +333,8 @@
     	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
     	
     	// Add our expected queries to the final query list
-    	for ( int i = 0; i < executionsPerTest; i++ ) {
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
-    	}
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
     	
     	// Create the plan and process the query
     	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
@@ -206,9 +351,7 @@
 		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a",  Boolean.FALSE, new Integer(0) })));  //$NON-NLS-1$
     	
     	// Add our expected queries to the final query list
-    	for (int i = 0; i < executionsPerTest; i++) {
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
-    	}
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
     	
     	// Use the cached plan and process the query
     	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
@@ -234,12 +377,10 @@
 		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "b",  Boolean.TRUE, new Integer(5)} )));  //$NON-NLS-1$
 
     	// Add our expected queries to the final query list
-    	for (int i = 0; i < executionsPerTest; i++) {
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = TRUE WHERE pm1.g1.e2 = 4")); //$NON-NLS-1$
-    		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5")); //$NON-NLS-1$
-    	}
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = TRUE WHERE pm1.g1.e2 = 4")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5")); //$NON-NLS-1$
     	
     	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
 
@@ -247,35 +388,118 @@
     	assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
     }
     
-    @Test public void testBatchedUpdatePushdown() throws Exception {
+    /**
+     * Test prepared statements that use batched updates using the same prepared
+     * command with varying number of commands in the batch.  Update is 
+     * performed against a view model instead of a source model.
+     * <p>
+     * The test verifies that no errors occur when planning and executing the 
+     * same batched command SQL with varying number of batched command parameter 
+     * value sets.  For example, if the first executeBatch() call were to occur 
+     * with two batched commands a repeated call with only one batched command 
+     * should not result in an error during planning or execution.
+     * <p>
+     * The test also verifies that the correct SQL is pushed to the data manager 
+     * to verify that the parameter substitution occurred and is correct and the
+     * correct number of statements made it to the data manager for the respective 
+     * batch command.
+     * <p>
+     * The batched command "UPDATE vm1.g1 SET vm1.g1.e1=?, vm1.g1.e3=? WHERE vm1.g1.e2=?"
+     * will appear as:
+     * <p>
+     * UPDATE pm1.g1 SET e1='a', e3=false WHERE pm1.g1.e2=0
+     * UPDATE pm1.g1 SET e1='b', e3=true WHERE pm1.g1.e2=1
+     * <p>
+     * UPDATE pm1.g1 SET e1='c', e3=false WHERE pm1.g1.e2=1
+     * <p>
+     * UPDATE pm1.g1 SET e1='d', e3=false WHERE pm1.g1.e2=1
+     * UPDATE pm1.g1 SET e1='e', e3=false WHERE pm1.g1.e2=0
+     * UPDATE pm1.g1 SET e1='f', e3=true WHERE pm1.g1.e2=2
+     * UPDATE pm1.g1 SET e1='g', e3=true WHERE pm1.g1.e2=3
+     * <p>
+     * The result should be that three commands are in the plan cache and 
+     * no plan creation, validation, or execution errors will occur and 
+     * a predetermined set of queries were executed in the data manager.
+     * 
+     * @throws Exception
+     */
+    @Test public void testUpdateVarNumCmds_Virtual() throws Exception {
         // Create query 
-		String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"; //$NON-NLS-1$
-        
+		String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e1=?, vm1.g1.e3=? WHERE vm1.g1.e2=?"; //$NON-NLS-1$
 		// Create a testable prepared plan cache
 		TestablePreparedPlanCache prepPlanCache = new TestablePreparedPlanCache();
 		
 		// Construct data manager with data
-        HardcodedDataManager dataManager = new HardcodedDataManager();
-		dataManager.addData("UPDATE pm1.g1 SET e1 = ?, e3 = ? WHERE pm1.g1.e2 = ?", new List[] {Arrays.asList(4)}); //$NON-NLS-1$
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);    
+		
 		// Source capabilities must support batched updates
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
-        caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+        caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
+        // Something to hold our final query list
+        List<String> finalQueryList = new ArrayList<String>(13);
+        
+		// Create expected results
+        List<?>[] expected = new List[] { 
+                Arrays.asList(2),
+                Arrays.asList(2)
+        };    
+
         // batch with two commands
 		ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
 		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a",  Boolean.FALSE, new Integer(0) })));  //$NON-NLS-1$
-    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
+    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "b", Boolean.TRUE, new Integer(1) })));  //$NON-NLS-1$
     	
-    	List<?>[] expected = new List[] { 
-                Arrays.asList(4)
-        };
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
     	
     	// Create the plan and process the query
     	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
-    	Update update = (Update)dataManager.getCommandHistory().iterator().next();
-    	assertTrue(((Constant)update.getChangeList().getClauses().get(0).getValue()).isMultiValued());
+
+    	// Repeat with different number of commands in batch
+        expected = new List[] { 
+            Arrays.asList(new Object[] { new Integer(2) })
+        };    
+
+        // batch with one command
+		values = new ArrayList<ArrayList<Object>>(1);
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "c",  Boolean.FALSE, new Integer(1) })));  //$NON-NLS-1$
+    	
+    	// Add our expected queries to the final query list
+   		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
+    	
+    	// Use the cached plan and process the query
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
+
+    	// Repeat with different number of commands in batch
+        expected = new List[] { 
+                Arrays.asList(2),
+                Arrays.asList(2),
+                Arrays.asList(1),
+                Arrays.asList(1)
+        };    
+
+        // batch with four commands
+		values = new ArrayList<ArrayList<Object>>(4);
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "d",  Boolean.FALSE, new Integer(1)} )));  //$NON-NLS-1$
+    	values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "e", Boolean.FALSE, new Integer(0)} )));  //$NON-NLS-1$ 
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "f",  Boolean.TRUE, new Integer(2)} )));  //$NON-NLS-1$
+		values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "g",  Boolean.TRUE, new Integer(3)} )));  //$NON-NLS-1$
+
+    	// Add our expected queries to the final query list
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'd', e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'e', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'f', e3 = TRUE WHERE pm1.g1.e2 = 2")); //$NON-NLS-1$
+		finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'g', e3 = TRUE WHERE pm1.g1.e2 = 3")); //$NON-NLS-1$
+    	
+    	TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
+
+    	// Verify all the queries that were run
+    	assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
     }
-    
+
 }

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -98,7 +98,7 @@
         
         Request request = new Request();
         Command command = QueryParser.getQueryParser().parseCommand(QUERY);
-        QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, true, metadata, AnalysisRecord.createNonRecordingRecord());
+        QueryResolver.resolveCommand(command, Collections.EMPTY_MAP, metadata, AnalysisRecord.createNonRecordingRecord());
         
         ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
         Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService());

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -111,7 +111,7 @@
         Command command = TestResolver.helpResolve(userSql, wrapper, analysis);               
                 
         // Plan
-        command = QueryRewriter.rewrite(command, null, wrapper, null);
+        command = QueryRewriter.rewrite(command, wrapper, null);
         FakeCapabilitiesFinder fakeFinder = new FakeCapabilitiesFinder();
         fakeFinder.addCapabilities(multiModel, TestOptimizer.getTypicalCapabilities()); 
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -131,7 +131,7 @@
         DQPWorkContext.setWorkContext(context);
         
         AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(svc); //$NON-NLS-1$ //$NON-NLS-2$
-        ValidatorReport report = Validator.validate(command, metadata, visitor, true);
+        ValidatorReport report = Validator.validate(command, metadata, visitor);
         if(report.hasItems()) {
             ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
             
@@ -256,7 +256,7 @@
 		
 		String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
 		Command command = QueryParser.getQueryParser().parseCommand(sql);
-		Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command, true);
+		Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command);
 	}
 	
 	public void testLookupVisibility() throws Exception {

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -101,7 +101,7 @@
             server.start(THREAD2, XID1, XAResource.TMNOFLAGS, 100,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("Global transaction MMXid global:1 branch:null format:0 already exists.", ex.getMessage()); //$NON-NLS-1$
+            assertEquals("Global transaction Teiid-Xid global:1 branch:null format:0 already exists.", ex.getMessage()); //$NON-NLS-1$
         }
     }
 
@@ -220,7 +220,7 @@
             server.start(THREAD1, XID1, XAResource.TMJOIN, 100,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("Concurrent enlistment in global transaction MMXid global:1 branch:null format:0 is not supported.", //$NON-NLS-1$
+            assertEquals("Concurrent enlistment in global transaction Teiid-Xid global:1 branch:null format:0 is not supported.", //$NON-NLS-1$
                          ex.getMessage());
         }
     }
@@ -233,7 +233,7 @@
             server.end(THREAD1, XID1, XAResource.TMSUSPEND,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("Client is not currently enlisted in transaction MMXid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
+            assertEquals("Client is not currently enlisted in transaction Teiid-Xid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
         }
     }
     
@@ -247,7 +247,7 @@
             server.start(THREAD2, XID1, XAResource.TMRESUME, 100,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("Cannot resume, transaction MMXid global:1 branch:null format:0 was not suspended by client 2.", ex.getMessage()); //$NON-NLS-1$
+            assertEquals("Cannot resume, transaction Teiid-Xid global:1 branch:null format:0 was not suspended by client 2.", ex.getMessage()); //$NON-NLS-1$
         }
     }
 
@@ -265,7 +265,7 @@
             server.end(THREAD1, XID1, XAResource.TMSUCCESS,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("No global transaction found for MMXid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
+            assertEquals("No global transaction found for Teiid-Xid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
         }
     }
     
@@ -277,7 +277,7 @@
             server.prepare(THREAD1, XID1,false);
             fail("exception expected"); //$NON-NLS-1$
         } catch (XATransactionException ex) {
-            assertEquals("Suspended work still exists on transaction MMXid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
+            assertEquals("Suspended work still exists on transaction Teiid-Xid global:1 branch:null format:0.", ex.getMessage()); //$NON-NLS-1$
         }
     }
     

Modified: branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
===================================================================
--- branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -25,7 +25,7 @@
 			ds.setServerName("localhost");
 			ds.setPortNumber(31000);
 			ds.setDatabaseName(vdbName);
-			ds.setTxnAutoWrap("PESSIMISTIC");
+			ds.setAutoCommitTxn("AUTO");
 			return ds.getConnection();
 		}
 	}

Modified: branches/JCA/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java
===================================================================
--- branches/JCA/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -83,30 +83,12 @@
 		}
     }	
 	
-//	public static QueryMetadataInterface getVDBMetadata(String[] vdbFile) {
-//		
-//        List<MetadataStore> selectors = new ArrayList<MetadataStore>();
-//        MetadataSource source = null;
-//        for (int i = 0; i < vdbFile.length; i++){
-//        	try {
-//	        	MetadataSource tempSource = new VDBArchive(new File(vdbFile[i]));
-//	        	if (i == 0) {
-//	        		source = tempSource;
-//	        	}
-//				selectors.add(new IndexMetadataFactory(tempSource).getMetadataStore());
-//			} catch (IOException e) {
-//				throw new MetaMatrixRuntimeException(e);
-//			}        
-//        }
-//        
-//        return new TransformationMetadata(new CompositeMetadataStore(selectors, source));
-//    }	
-	
+
 	private static class VDBContext extends ZipEntryContext{
 		private static final long serialVersionUID = -6504988258841073415L;
 
 		protected VDBContext(URL url) throws IOException, URISyntaxException {
 			super(url,false);
 		}
-	}	
+	}
 }

Modified: branches/JCA/metadata/src/test/java/com/metamatrix/internal/core/index/TestGammaCompressedIndexBlock.java
===================================================================
--- branches/JCA/metadata/src/test/java/com/metamatrix/internal/core/index/TestGammaCompressedIndexBlock.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/metadata/src/test/java/com/metamatrix/internal/core/index/TestGammaCompressedIndexBlock.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -22,26 +22,18 @@
 
 package com.metamatrix.internal.core.index;
 
+import junit.framework.TestCase;
+
 import org.teiid.internal.core.index.GammaCompressedIndexBlock;
 import org.teiid.internal.core.index.IIndexConstants;
 import org.teiid.internal.core.index.IndexBlock;
 import org.teiid.internal.core.index.WordEntry;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 public class TestGammaCompressedIndexBlock extends TestCase {
     public TestGammaCompressedIndexBlock(String name) {
         super(name);
     }
 
-    public static Test suite() {
-        TestSuite suite = new TestSuite("TestGammaCompressedIndexBlock"); //$NON-NLS-1$
-        suite.addTestSuite(TestGammaCompressedIndexBlock.class);
-        return suite;
-    }
-
     public void testAddAndRetrieveEntry() {
         IndexBlock indexBlock = new GammaCompressedIndexBlock(IIndexConstants.BLOCK_SIZE);
         WordEntry entry = new WordEntry();

Deleted: branches/JCA/metadata/src/test/java/com/metamatrix/metadata/runtime/FakeQueryMetadata.java
===================================================================
--- branches/JCA/metadata/src/test/java/com/metamatrix/metadata/runtime/FakeQueryMetadata.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/metadata/src/test/java/com/metamatrix/metadata/runtime/FakeQueryMetadata.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.metadata.runtime;
-
-import org.teiid.metadata.index.IndexConstants;
-
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.unittest.QueryMetadataInterfaceBuilder;
-
-public class FakeQueryMetadata {
-	private static QueryMetadataInterface metadata;
-	
-    public static QueryMetadataInterface getQueryMetadata() {
-        if (metadata == null) {
-            QueryMetadataInterfaceBuilder builder = new QueryMetadataInterfaceBuilder();
-            builder.addPhysicalModel("system"); //$NON-NLS-1$
-            
-            builder.addGroup("tables", IndexConstants.INDEX_NAME.TABLES_INDEX + "#B"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("FullName", String.class); //$NON-NLS-1$
-            builder.addElement("Path", String.class); //$NON-NLS-1$
-            //builder.addElement("UUID", String.class);
-            builder.addElement("Cardinality", Integer.class);      //$NON-NLS-1$
-            builder.addElement("supportsUpdate", Boolean.class);      //$NON-NLS-1$
-            
-            builder.addGroup("columns", IndexConstants.INDEX_NAME.COLUMNS_INDEX + "#G"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("FullName", String.class); //$NON-NLS-1$
-            
-            builder.addGroup("models", IndexConstants.INDEX_NAME.MODELS_INDEX + "#A"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("FullName", String.class); //$NON-NLS-1$
-            builder.addElement("MaxSetSize", Integer.class); //$NON-NLS-1$
-            
-            builder.addGroup("foreignKeys", IndexConstants.INDEX_NAME.KEYS_INDEX + "#J"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("FullName", String.class); //$NON-NLS-1$
-            
-            builder.addGroup("primaryKeys", IndexConstants.INDEX_NAME.KEYS_INDEX + "#K"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("FullName", String.class); //$NON-NLS-1$
-            
-            builder.addGroup("procs", IndexConstants.INDEX_NAME.PROCEDURES_INDEX + "#E"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("Name", String.class); //$NON-NLS-1$
-            
-            builder.addGroup("junk", "junk"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("UUID", String.class); //$NON-NLS-1$
-            builder.addElement("toString", String.class); //$NON-NLS-1$
-            
-            builder.addGroup("fake1Properties", "DatatypeTypeEnumeration.properties"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.addElement("Key", Integer.class); //$NON-NLS-1$
-            builder.addElement("Value", String.class); //$NON-NLS-1$
-            
-            metadata = builder.getQueryMetadata();
-        }
-        return metadata;
-    }
-}

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -32,10 +32,10 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.cache.CacheFactory;
 import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.BufferManagerPropertyNames;
 import com.metamatrix.common.buffer.StorageManager;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
-import com.metamatrix.common.buffer.storage.file.FileStorageManager;
+import com.metamatrix.common.buffer.impl.FileStorageManager;
+import com.metamatrix.common.buffer.impl.MemoryStorageManager;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.service.BufferService;
@@ -48,16 +48,8 @@
  */
 public class EmbeddedBufferService implements BufferService, Serializable {
 
-	private static final long serialVersionUID = -8681597264608558472L;
-	
-	// Constants
-    private static final String DEFAULT_MANAGEMENT_INTERVAL = "500"; //$NON-NLS-1$
-    private static final String DEFAULT_LOG_STATS_INTERVAL = "60000"; //$NON-NLS-1$ // every minute
-    private static final String DEFAULT_SESSION_USE_PERCENTAGE = "100"; //$NON-NLS-1$
-    private static final String DEFAULT_MAX_OPEN_FILES = "10"; //$NON-NLS-1$
-    
     // Instance
-    private BufferManager bufferMgr;
+    private BufferManagerImpl bufferMgr;
 	private File bufferDir;
 	private boolean useDisk = true;
 	private int memorySize = 64;
@@ -84,37 +76,31 @@
 
     public void start(){
     	try {
-                            
             // Set up buffer configuration properties
             Properties bufferProps = new Properties();                                  
-            bufferProps.setProperty(BufferManagerPropertyNames.SESSION_USE_PERCENTAGE, DEFAULT_SESSION_USE_PERCENTAGE); 
-            bufferProps.setProperty(BufferManagerPropertyNames.LOG_STATS_INTERVAL, DEFAULT_LOG_STATS_INTERVAL); 
-            bufferProps.setProperty(BufferManagerPropertyNames.MANAGEMENT_INTERVAL, DEFAULT_MANAGEMENT_INTERVAL); 
-            bufferProps.setProperty(BufferManagerPropertyNames.MEMORY_AVAILABLE, String.valueOf(memorySize));
-            bufferProps.setProperty(BufferManagerPropertyNames.BUFFER_STORAGE_DIRECTORY, bufferDir.getCanonicalPath());
-            bufferProps.setProperty(BufferManagerPropertyNames.PROCESSOR_BATCH_SIZE, String.valueOf(processorBatchSize)); 
-            bufferProps.setProperty(BufferManagerPropertyNames.CONNECTOR_BATCH_SIZE, String.valueOf(connectorBatchSize)); 
-            // These are not set yet..
-            //CONNECTOR_BATCH_SIZE
-            //PROCESSOR_BATCH_SIZE
+
+            bufferProps.setProperty(BufferManager.BUFFER_STORAGE_DIRECTORY, bufferDir.getCanonicalPath());
+            bufferProps.setProperty(BufferManager.PROCESSOR_BATCH_SIZE, String.valueOf(processorBatchSize)); 
+            bufferProps.setProperty(BufferManager.CONNECTOR_BATCH_SIZE, String.valueOf(connectorBatchSize)); 
             
             // Construct and initialize the buffer manager
             this.bufferMgr = new BufferManagerImpl();
-            this.bufferMgr.initialize("local", bufferProps); //$NON-NLS-1$
+            this.bufferMgr.initialize(bufferProps);
             
             // If necessary, add disk storage manager
             if(useDisk) {
                 // Get the properties for FileStorageManager and create.
                 Properties fsmProps = new Properties();
-                fsmProps.setProperty(BufferManagerPropertyNames.BUFFER_STORAGE_DIRECTORY, bufferDir.getCanonicalPath());
-                fsmProps.setProperty(BufferManagerPropertyNames.MAX_OPEN_FILES, DEFAULT_MAX_OPEN_FILES);
+                fsmProps.setProperty(BufferManager.BUFFER_STORAGE_DIRECTORY, bufferDir.getCanonicalPath());
                 StorageManager fsm = new FileStorageManager();
                 fsm.initialize(fsmProps);        
                 this.bufferMgr.setStorageManager(fsm);
                 
-                // start the file storrage manager in clean state
+                // start the file storage manager in clean state
                 // wise FileStorageManager is smart enough to clen up after itself
                 cleanDirectory(bufferDir);
+            } else {
+            	this.bufferMgr.setStorageManager(new MemoryStorageManager());
             }
             
         } catch(MetaMatrixComponentException e) { 
@@ -125,7 +111,7 @@
     }
    
     public void stop() {
-        bufferMgr.stop();
+        bufferMgr.shutdown();
 
         // Delete the buffer directory
         if (bufferDir != null) {

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedMetadataService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedMetadataService.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedMetadataService.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -63,15 +63,6 @@
         return new TransformationMetadata(composite);
     }
     
-    public void updateCostMetadata(String vdbName, String vdbVersion, String modelName) throws MetaMatrixComponentException {
-    	CompositeMetadataStore store = getMetadataObjectSource(vdbName, vdbVersion);
-    	//...
-    }
-    
-    public void updateCostMetadata(String vdbName, String vdbVersion, String objectName, String propertyName, String value) {
-    	
-    }
-    
 	private void saveMetadataStore(final MetadataSource runtimeSelector,
 			MetadataStore connectorMetadata, String savedMetadata)
 			throws IOException {
@@ -99,8 +90,8 @@
 			try {
 				ois = new ObjectInputStream(new FileInputStream(f));
 				return (MetadataStore)ois.readObject();
-			} catch (Exception e) {
-				
+			} catch (Throwable e) {
+				LogManager.logDetail(LogConstants.CTX_DQP, e, "invalid metadata in file", savedMetadata);  //$NON-NLS-1$
 			} finally {
 				if (ois != null) {
 					ois.close();
@@ -110,5 +101,4 @@
 		return null;
 	}
 	*/
-
 }

Modified: branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -15,12 +15,13 @@
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
 
+import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.xml.XMLReaderWriter;
 import com.metamatrix.common.xml.XMLReaderWriterImpl;
 
 public class DefParser {
     
-	public static VDBMetaData load(InputStream defStream) throws IOException {
+	public static VDBMetaData load(InputStream defStream) throws IOException, MetaMatrixComponentException {
     	VDBMetaData vdb = new VDBMetaData();
     	try {
         	XMLReaderWriter reader = new XMLReaderWriterImpl();
@@ -34,7 +35,7 @@
             loadModelsSection(vdb, root);
             
         } catch (JDOMException e) {
-            throw new IOException(e);//$NON-NLS-1$
+            throw new MetaMatrixComponentException(e);//$NON-NLS-1$
         } 
         return vdb;
     }

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -24,8 +24,8 @@
 
 import junit.framework.TestCase;
 
-import com.metamatrix.common.buffer.impl.BufferConfig;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
+import com.metamatrix.common.buffer.impl.FileStorageManager;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.dqp.embedded.services.EmbeddedBufferService;
 
@@ -60,12 +60,7 @@
         assertTrue(svc.isUseDisk());
         
         BufferManagerImpl mgr = (BufferManagerImpl) svc.getBufferManager();
-        BufferConfig config = mgr.getConfig();
-        assertEquals("Did not get expected memory level", 96000000L, config.getTotalAvailableMemory()); //$NON-NLS-1$
-        assertTrue(config.getBufferStorageDirectory().endsWith(svc.getBufferDirectory().getName()));
-        
-        svc.stop();
-        
+        assertTrue(((FileStorageManager)mgr.getStorageManager()).getDirectory().endsWith(svc.getBufferDirectory().getName()));
     }
 
     public void testCheckMemPropertyGotSet2() throws Exception {
@@ -77,10 +72,6 @@
         
         // all the properties are set
         assertFalse(svc.isUseDisk());
-        
-        BufferManagerImpl mgr = (BufferManagerImpl) svc.getBufferManager();
-        BufferConfig config = mgr.getConfig();
-        assertEquals("Did not get expected memory level", 96000000L, config.getTotalAvailableMemory()); //$NON-NLS-1$
     }
     
 }

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -92,9 +92,8 @@
         //add doc to test against
         char[] result = AuthorizationPolicyFactory.exportPolicies(policies);
         String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath()+File.separator+"permissions.xml")); //$NON-NLS-1$
-        String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertEquals(expected, actual); 
+        //String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+        assertEquals(expected.replaceAll("[\r]", ""), new String(result).replaceAll("[\r]", "")); 
     }
     
     public void testImport() throws Exception {
@@ -122,8 +121,8 @@
 
         char[] result = AuthorizationPolicyFactory.exportPolicies(roles);
         String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath() + "/permissions2.xml")); //$NON-NLS-1$
-        String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals(expected, actual); 
+        //String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+        assertEquals(expected.replaceAll("[\r]", ""), new String(result).replaceAll("[\r]", "")); 
     }
     
     public void testParsingFails() throws Exception {

Modified: branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -42,9 +42,9 @@
     }
 
     public StaticMetadataProvider exampleProvider() throws Exception {
-        MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null);
-        Map col1 = processor.getDefaultColumn("vdb", "1", "table", "col1", String.class); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-        Map col2 = processor.getDefaultColumn("vdb", "1", "table", "col2", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+        MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null, "vdb", "1"); //$NON-NLS-1$ //$NON-NLS-2$ 
+        Map col1 = processor.getDefaultColumn("table", "col1", String.class); //$NON-NLS-1$ //$NON-NLS-2$ 
+        Map col2 = processor.getDefaultColumn("table", "col2", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$ 
         
         Map[] columnMetadata = new Map[] {
             col1, col2

Modified: branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -44,10 +44,10 @@
     }
 
     private StaticMetadataProvider example1() throws Exception {
-        MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null);
+    	MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null, "vdb", "1"); //$NON-NLS-1$ //$NON-NLS-2$
         Map[] columnMetadata = new Map[] { 
-            processor.getDefaultColumn("vdb", "1", "table", "c1", String.class), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-            processor.getDefaultColumn("vdb", "1", "table", "c2", Integer.class) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+            processor.getDefaultColumn("table", "c1", String.class), //$NON-NLS-1$ //$NON-NLS-2$ 
+            processor.getDefaultColumn("table", "c2", Integer.class) //$NON-NLS-1$ //$NON-NLS-2$ 
         };               
         
         return StaticMetadataProvider.createWithData(columnMetadata, 0);
@@ -81,7 +81,7 @@
 
     public void testGetIntValue() throws Exception {
         Integer property = ResultsMetadataConstants.VIRTUAL_DATABASE_NAME;
-        Integer value = new Integer(10); //$NON-NLS-1$
+        Integer value = new Integer(10); 
         
         Map columnMetadata = new HashMap();
         columnMetadata.put(property, value); 
@@ -94,7 +94,7 @@
 
     public void testGetBooleanValue() throws Exception {
         Integer property = ResultsMetadataConstants.VIRTUAL_DATABASE_NAME;
-        Boolean value = Boolean.TRUE; //$NON-NLS-1$
+        Boolean value = Boolean.TRUE; 
         
         Map columnMetadata = new HashMap();
         columnMetadata.put(property, value); 

Modified: branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -21,18 +21,13 @@
  */
 package com.metamatrix.server.integration;
 
-import java.sql.SQLXML;
 import java.util.List;
 import java.util.Properties;
 
-import org.teiid.metadata.index.VDBMetadataFactory;
-
 import junit.framework.TestCase;
 
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.BufferManagerFactory;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceID;
+import org.teiid.metadata.index.VDBMetadataFactory;
+
 import com.metamatrix.query.analysis.AnalysisRecord;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.QueryOptimizer;
@@ -40,7 +35,7 @@
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.processor.ProcessorDataManager;
 import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.processor.QueryProcessor;
+import com.metamatrix.query.processor.TestProcessor;
 import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.util.CommandContext;
 
@@ -61,9 +56,10 @@
     public static QueryMetadataInterface createMetadata(String vdbFile, String systemVDBFile) {        
     	return VDBMetadataFactory.getVDBMetadata(new String[] {vdbFile, systemVDBFile});
     }
-        
-    public ProcessorPlan createPlan(QueryMetadataInterface metadata, String sql, CapabilitiesFinder capFinder, boolean debug) throws Exception {
-        
+            
+    protected void doProcess(QueryMetadataInterface metadata, String sql, CapabilitiesFinder capFinder, ProcessorDataManager dataManager, List[] expectedResults, boolean debug) throws Exception {
+    	CommandContext context = createCommandContext();
+    	context.setProcessDebug(debug);
         Command command = TestOptimizer.helpGetCommand(sql, metadata, null);
 
         // plan
@@ -76,80 +72,10 @@
                 System.out.println(analysisRecord.getDebugLog());
             }
         }
-        
-        return plan;
-    }
-    
-    protected void doProcess(ProcessorPlan plan, ProcessorDataManager dataManager, List[] expectedResults, boolean debug) throws Exception {
-        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
-        CommandContext context = createCommandContext();
-        context.setProcessDebug(debug);
-        QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-        TupleSourceID tsID = processor.getResultsID();
-        processor.process();
 
-        // Create QueryResults from TupleSource
-        TupleSource ts = bufferMgr.getTupleSource(tsID);
-        int count = bufferMgr.getFinalRowCount(tsID);   
-
-        if(debug) {
-            System.out.println("\nResults:\n" + bufferMgr.getTupleSchema(tsID)); //$NON-NLS-1$
-            TupleSource ts2 = bufferMgr.getTupleSource(tsID);
-            for(int j=0; j<count; j++) {
-                System.out.println("" + j + ": " + ts2.nextTuple());     //$NON-NLS-1$ //$NON-NLS-2$
-            }    
-            ts2.closeSource();
-        }
-        
-        // Compare actual to expected row count
-        assertEquals("Did not get expected row count: ", expectedResults.length, count); //$NON-NLS-1$
-     
-        // Walk results and compare
-        for(int i=0; i<count; i++) { 
-            List record = ts.nextTuple();
-            
-            Object value = record.get(0);
-            if(value instanceof SQLXML) {
-                record.set(0, ((SQLXML)value).getString());
-            }            
-            assertEquals(expectedResults[i].get(0), record.get(0));                
-        }
-        ts.closeSource();        
-        
-        bufferMgr.removeTupleSource(tsID);
+    	TestProcessor.doProcess(plan, dataManager, expectedResults, context);
     }
 
-    protected void doProcessNoResultsCheck(ProcessorPlan plan, ProcessorDataManager dataManager, int expectedRowCount, boolean debug) throws Exception {
-        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
-        CommandContext context = createCommandContext();
-        QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
-        TupleSourceID tsID = processor.getResultsID();
-        processor.process();
-
-        // Create QueryResults from TupleSource
-        TupleSource ts = bufferMgr.getTupleSource(tsID);
-        int count = bufferMgr.getFinalRowCount(tsID);   
-
-        if(debug) {
-            System.out.println("\nResults:\n" + bufferMgr.getTupleSchema(tsID)); //$NON-NLS-1$
-            TupleSource ts2 = bufferMgr.getTupleSource(tsID);
-            for(int j=0; j<count; j++) {
-                System.out.println("" + j + ": " + ts2.nextTuple());     //$NON-NLS-1$ //$NON-NLS-2$
-            }    
-            ts2.closeSource();
-        }
-        
-        // Compare actual to expected row count
-        assertEquals("Did not get expected row count: ", expectedRowCount, count); //$NON-NLS-1$
-     
-        // Walk results 
-        for(int i=0; i<count; i++) { 
-            ts.nextTuple();
-        }
-        ts.closeSource();        
-        bufferMgr.removeTupleSource(tsID);
-    }
-    
     protected CommandContext createCommandContext() {
         Properties props = new Properties();
         //props.setProperty(ContextProperties.SOAP_HOST, "my.host.com"); //$NON-NLS-1$
@@ -158,8 +84,4 @@
         return context;
     }       
     
-    public void verifyQueryPlan(String[] expectedAtomic, ProcessorPlan plan, QueryMetadataInterface md, CapabilitiesFinder capFinder) throws Exception {
-        TestOptimizer.checkAtomicQueries(expectedAtomic, plan, md, capFinder);
-    }
-    
 }

Modified: branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestTPCR.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestTPCR.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestTPCR.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -59,16 +59,6 @@
         FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
         finder.addCapabilities("TPCR_Oracle_9i", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
         
-        ProcessorPlan plan = createPlan(METADATA,  
-                 "select l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, o_orderdate, o_shippriority " + //$NON-NLS-1$
-                 "from customer, orders, lineitem " +  //$NON-NLS-1$
-                 "where c_mktsegment = 'BUILDING' and c_custkey = o_custkey and l_orderkey = o_orderkey " +  //$NON-NLS-1$
-                 "and o_orderdate < {ts'1995-03-15 00:00:00'} " +  //$NON-NLS-1$
-                 "and l_shipdate > {ts'1995-03-15 00:00:00'} " +  //$NON-NLS-1$
-                 "group by l_orderkey, o_orderdate, o_shippriority " + //$NON-NLS-1$
-                 "order by revenue desc, o_orderdate", //$NON-NLS-1$
-                 finder, DEBUG);
-
         HardcodedDataManager dataMgr = new HardcodedDataManager();
     
         List[] expected =
@@ -79,7 +69,15 @@
         dataMgr.addData("SELECT g_2.l_orderkey AS c_0, SUM((g_2.l_extendedprice * (1 - g_2.l_discount))) AS c_1, g_1.o_orderdate AS c_2, g_1.o_shippriority AS c_3 FROM TPCR_Oracle_9i.CUSTOMER AS g_0, TPCR_Oracle_9i.ORDERS AS g_1, TPCR_Oracle_9i.LINEITEM AS g_2 WHERE (g_0.c_custkey = g_1.o_custkey) AND (g_2.l_orderkey = g_1.o_orderkey) AND (g_0.c_mktsegment = 'BUILDING') AND (g_1.o_orderdate < {d'1995-03-15'}) AND (g_2.l_shipdate > {ts'1995-03-15 00:00:00.0'}) GROUP BY g_2.l_orderkey, g_1.o_orderdate, g_1.o_shippriority ORDER BY c_1 DESC, c_2", //$NON-NLS-1$
                         expected);
 
-        doProcess(plan, dataMgr, expected, DEBUG);
+        doProcess(METADATA,  
+                "select l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, o_orderdate, o_shippriority " + //$NON-NLS-1$
+                "from customer, orders, lineitem " +  //$NON-NLS-1$
+                "where c_mktsegment = 'BUILDING' and c_custkey = o_custkey and l_orderkey = o_orderkey " +  //$NON-NLS-1$
+                "and o_orderdate < {ts'1995-03-15 00:00:00'} " +  //$NON-NLS-1$
+                "and l_shipdate > {ts'1995-03-15 00:00:00'} " +  //$NON-NLS-1$
+                "group by l_orderkey, o_orderdate, o_shippriority " + //$NON-NLS-1$
+                "order by revenue desc, o_orderdate", //$NON-NLS-1$
+                finder, dataMgr, expected, DEBUG);
         
     }
     
@@ -87,13 +85,6 @@
         FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
         finder.addCapabilities("TPCR_Ora", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
         
-        ProcessorPlan plan = createPlan(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
-                 "SELECT count (*)  " + //$NON-NLS-1$
-                 "FROM TPCR_Ora.CUSTOMER LEFT OUTER JOIN TPCR_Ora.ORDERS ON C_CUSTKEY = O_CUSTKEY " +  //$NON-NLS-1$
-                 "WHERE (O_ORDERKEY IS NULL) OR O_ORDERDATE < '1992-01-02 00:00:00' " +  //$NON-NLS-1$
-                 "AND C_ACCTBAL > 0", //$NON-NLS-1$
-                 finder, DEBUG);
-
         HardcodedDataManager dataMgr = new HardcodedDataManager();
         List[] expected =
             new List[] { Arrays.asList(new Object[] { new Integer(5) } ) };
@@ -101,7 +92,12 @@
         dataMgr.addData("SELECT COUNT(*) FROM TPCR_Ora.CUSTOMER AS g_0 LEFT OUTER JOIN TPCR_Ora.ORDERS AS g_1 ON g_0.C_CUSTKEY = g_1.O_CUSTKEY WHERE (g_1.O_ORDERKEY IS NULL) OR ((g_1.O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AND (g_0.C_ACCTBAL > 0))", //$NON-NLS-1$
                        expected);
         
-        doProcess(plan, dataMgr, expected, DEBUG);
+        doProcess(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
+                "SELECT count (*)  " + //$NON-NLS-1$
+                "FROM TPCR_Ora.CUSTOMER LEFT OUTER JOIN TPCR_Ora.ORDERS ON C_CUSTKEY = O_CUSTKEY " +  //$NON-NLS-1$
+                "WHERE (O_ORDERKEY IS NULL) OR O_ORDERDATE < '1992-01-02 00:00:00' " +  //$NON-NLS-1$
+                "AND C_ACCTBAL > 0", //$NON-NLS-1$
+                finder, dataMgr, expected, DEBUG);
         
     }
     
@@ -122,13 +118,6 @@
         finder.addCapabilities("TPCR_Ora", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
         finder.addCapabilities("TPCR_SQLS", CapabilitiesConverter.convertCapabilities(new SqlServerCapabilities())); //$NON-NLS-1$
         
-        ProcessorPlan plan = createPlan(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
-                 "SELECT C_CUSTKEY, C_NAME, C_ADDRESS, C_PHONE, C_ACCTBAL, O_ORDERKEY FROM TPCR_Ora.CUSTOMER " + //$NON-NLS-1$
-                 "LEFT OUTER JOIN TPCR_SQLS.ORDERS ON C_CUSTKEY = O_CUSTKEY " + //$NON-NLS-1$
-                 "AND O_ORDERDATE < {ts'1992-01-02 00:00:00.0'} " + //$NON-NLS-1$
-                 "WHERE (C_ACCTBAL > 50)", //$NON-NLS-1$
-                 finder, DEBUG);
-
         HardcodedDataManager dataMgr = new HardcodedDataManager();
                 
         List[] oracleExpected =
@@ -149,7 +138,12 @@
                          Arrays.asList(new Object[] { new Long(5), "Bill", "101 Fake St.", "392839283", "21.12", new Integer(13) } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                          Arrays.asList(new Object[] { new Long(6), "Stu", "102 Fake St.", "385729385", "51.50", null } )}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 
-        doProcess(plan, dataMgr, expected, DEBUG);
+        doProcess(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
+                "SELECT C_CUSTKEY, C_NAME, C_ADDRESS, C_PHONE, C_ACCTBAL, O_ORDERKEY FROM TPCR_Ora.CUSTOMER " + //$NON-NLS-1$
+                "LEFT OUTER JOIN TPCR_SQLS.ORDERS ON C_CUSTKEY = O_CUSTKEY " + //$NON-NLS-1$
+                "AND O_ORDERDATE < {ts'1992-01-02 00:00:00.0'} " + //$NON-NLS-1$
+                "WHERE (C_ACCTBAL > 50)", //$NON-NLS-1$
+                finder, dataMgr, expected, DEBUG);
         
     }     
 
@@ -164,14 +158,6 @@
         finder.addCapabilities("TPCR_Ora", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
         finder.addCapabilities("TPCR_SQLS", CapabilitiesConverter.convertCapabilities(new SqlServerCapabilities())); //$NON-NLS-1$
         
-        ProcessorPlan plan = createPlan(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
-                 "SELECT C_CUSTKEY, C_NAME, C_ADDRESS, C_PHONE, C_ACCTBAL, O_ORDERKEY FROM TPCR_Ora.CUSTOMER " + //$NON-NLS-1$
-                 "LEFT OUTER JOIN " + //$NON-NLS-1$
-                 "(SELECT O_CUSTKEY, O_ORDERKEY FROM TPCR_SQLS.ORDERS WHERE O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AS X " + //$NON-NLS-1$
-                 "ON C_CUSTKEY = O_CUSTKEY " + //$NON-NLS-1$
-                 "WHERE (C_ACCTBAL > 50)", //$NON-NLS-1$
-                 finder, DEBUG);
-
         HardcodedDataManager dataMgr = new HardcodedDataManager();
                 
         List[] oracleExpected =
@@ -192,7 +178,13 @@
                          Arrays.asList(new Object[] { new Long(5), "Bill", "101 Fake St.", "392839283", "51.12", new Integer(13) } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                          Arrays.asList(new Object[] { new Long(6), "Stu", "102 Fake St.", "385729385", "51.50", null } )}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 
-        doProcess(plan, dataMgr, expected, DEBUG);
+        doProcess(BaseQueryTest.createMetadata(UnitTestUtil.getTestDataPath()+"/tpcr/TPCR_3.vdb"),  //$NON-NLS-1$
+                "SELECT C_CUSTKEY, C_NAME, C_ADDRESS, C_PHONE, C_ACCTBAL, O_ORDERKEY FROM TPCR_Ora.CUSTOMER " + //$NON-NLS-1$
+                "LEFT OUTER JOIN " + //$NON-NLS-1$
+                "(SELECT O_CUSTKEY, O_ORDERKEY FROM TPCR_SQLS.ORDERS WHERE O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AS X " + //$NON-NLS-1$
+                "ON C_CUSTKEY = O_CUSTKEY " + //$NON-NLS-1$
+                "WHERE (C_ACCTBAL > 50)", //$NON-NLS-1$
+                finder, dataMgr, expected, DEBUG);
         
     }    
     

Modified: branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java	2010-01-09 12:55:15 UTC (rev 1726)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java	2010-01-10 00:19:53 UTC (rev 1727)
@@ -35,7 +35,6 @@
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
 import com.metamatrix.query.processor.HardcodedDataManager;
-import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 public class TestXMLTypeTranslations extends BaseQueryTest {
@@ -55,11 +54,6 @@
         
         String sql = "select * from testdocument.testDocument";  //$NON-NLS-1$
 
-        
-        ProcessorPlan plan = createPlan(metadata,  
-                 sql, 
-                 finder, DEBUG);
-
         HardcodedDataManager dataMgr = new HardcodedDataManager();
         
         Set models = new HashSet();
@@ -82,7 +76,9 @@
         
         
         List[] expected = new List[] { Arrays.asList(new Object[] {"<?xml version=\"1.0\" encoding=\"UTF-8\"?><XSDTypesNS:test xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:XSDTypesNS=\"http://www.metamatrix.com/XMLSchema/DataSets/XSDTypes\"><book><datetime>1903-04-04T05:06:10.0000002</datetime><double>-INF</double><float>INF</float><gday>---100</gday><gmonth>--100</gmonth><gmonthday>--04-04</gmonthday><gyear>0100</gyear><gyearmonth>1903-04</gyearmonth><string>1</string></book></XSDTypesNS:test>" })};                     //$NON-NLS-1$
-        doProcess(plan, dataMgr , expected, DEBUG);
+        doProcess(metadata,  
+                sql, 
+                finder, dataMgr , expected, DEBUG);
         
     }
     



More information about the teiid-commits mailing list